forked from Gitlink/forgeplus-react
同上-修改细节
This commit is contained in:
parent
1432afebfd
commit
4b6592dfb3
|
@ -1,7 +1,6 @@
|
||||||
import React, { useEffect, useState } from 'react';
|
import React, { useEffect, useState } from 'react';
|
||||||
import { AlignAJBottom , AlignCenter } from '../../Component/layout';
|
import { AlignAJBottom , AlignCenter } from '../../Component/layout';
|
||||||
import { Link } from 'react-router-dom';
|
import { Link } from 'react-router-dom';
|
||||||
import { Spin } from 'antd';
|
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
|
|
||||||
import Box from './ConcentrateBox';
|
import Box from './ConcentrateBox';
|
||||||
|
@ -9,11 +8,9 @@ import Box from './ConcentrateBox';
|
||||||
function ConcentrateProject({userLogin,current}) {
|
function ConcentrateProject({userLogin,current}) {
|
||||||
const [ list , setList ] = useState(undefined);
|
const [ list , setList ] = useState(undefined);
|
||||||
const [ visible , setVisible ] = useState(false);
|
const [ visible , setVisible ] = useState(false);
|
||||||
const [ isSpin , setIsSpin ] = useState(false);
|
|
||||||
const [ value , setValue ] = useState([]);
|
const [ value , setValue ] = useState([]);
|
||||||
|
|
||||||
useEffect(()=>{
|
useEffect(()=>{
|
||||||
setIsSpin(true);
|
|
||||||
getList();
|
getList();
|
||||||
},[])
|
},[])
|
||||||
|
|
||||||
|
@ -23,7 +20,6 @@ function ConcentrateProject({userLogin,current}) {
|
||||||
if(result && result.data){
|
if(result && result.data){
|
||||||
let p = result.data.projects;
|
let p = result.data.projects;
|
||||||
setList(p);
|
setList(p);
|
||||||
setIsSpin(false);
|
|
||||||
if(p && p.length > 0){
|
if(p && p.length > 0){
|
||||||
let array = p.map(i=>{
|
let array = p.map(i=>{
|
||||||
return i.id
|
return i.id
|
||||||
|
@ -41,13 +37,12 @@ function ConcentrateProject({userLogin,current}) {
|
||||||
}).then(result=>{
|
}).then(result=>{
|
||||||
if(result && result.data){
|
if(result && result.data){
|
||||||
setVisible(false);
|
setVisible(false);
|
||||||
setIsSpin(true);
|
|
||||||
getList();
|
getList();
|
||||||
}
|
}
|
||||||
}).catch(error=>{})
|
}).catch(error=>{})
|
||||||
}
|
}
|
||||||
return(
|
return(
|
||||||
<Spin spinning={isSpin}>
|
<React.Fragment>
|
||||||
<Box visible={visible} onCancel={()=>setVisible(false)} onSure={onSure} username={userLogin} choosed={value}/>
|
<Box visible={visible} onCancel={()=>setVisible(false)} onSure={onSure} username={userLogin} choosed={value}/>
|
||||||
{
|
{
|
||||||
list && list.length>0 &&
|
list && list.length>0 &&
|
||||||
|
@ -80,7 +75,7 @@ function ConcentrateProject({userLogin,current}) {
|
||||||
{
|
{
|
||||||
list && list.length === 0 && current && <div className="ConcentrateTip"><i className="iconfont icon-tishi2"></i>你还没有设置精选项目,<a onClick={()=>setVisible(true)}>点击设置</a></div>
|
list && list.length === 0 && current && <div className="ConcentrateTip"><i className="iconfont icon-tishi2"></i>你还没有设置精选项目,<a onClick={()=>setVisible(true)}>点击设置</a></div>
|
||||||
}
|
}
|
||||||
</Spin>
|
</React.Fragment>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
export default ConcentrateProject;
|
export default ConcentrateProject;
|
Loading…
Reference in New Issue