This commit is contained in:
caishi 2021-02-02 14:20:31 +08:00
parent cae10cec2a
commit 34ba476011
3 changed files with 72 additions and 97 deletions

View File

@ -13,14 +13,15 @@ export default ((props) => {
const { current_user } = props;
useEffect(() => {
getMember()
}, [page])
if(groupId && OIdentifier){
getMember();
}
}, [OIdentifier,groupId,page])
function getMember() {
setIsSpin(true)
const url = `/organizations/${OIdentifier}/teams/${groupId}/team_users.json`;
axios
.get(url, {
axios.get(url, {
params: {
page,
limit
@ -37,9 +38,10 @@ export default ((props) => {
return (
<Spin spinning={isSpin}>
{ data && data.length > 0 ?
<div className="MemberBoxThree">
{
data && data.length > 0 ? data.map((item, key) => {
data.map((item, key) => {
return (
<Cards
img={item.user.image_url}
@ -51,10 +53,9 @@ export default ((props) => {
/>
)
})
:
<Empty image={Empty.PRESENTED_IMAGE_SIMPLE} />
}
</div>
</div>:""
}
{
total > limit ?
<div className="edu-txt-center mt30 mb20">

View File

@ -18,48 +18,24 @@ const Leave = styled.a`{
}`
export default ((props) => {
const [nav, setNav] = useState('0');
const [isSpin, setIsSpin] = useState(false);
const [userSpin, setUserSpin] = useState(false);
const [page, setPage] = useState(1);
const [limit, setLimit] = useState(15);
const [total, setTotal] = useState(0);
const [group, setGroup] = useState(undefined);
const { OIdentifier, groupId } = props.match.params;
const { current_user } = props;
useEffect(() => {
setIsSpin(true)
const url = `/organizations/${OIdentifier}/teams/${groupId}.json`;
axios.get(url)
.then((result) => {
if (result && result.data) {
setGroup(result.data)
}
}).catch((error) => { });
setIsSpin(false)
}, [])
const { current_user , group } = props;
//
function removeUser(username) {
setIsSpin(true)
const url = `/organizations/${OIdentifier}/teams/${groupId}/team_users/${username}.json`;
if (username) {
axios.delete(url)
.then((result) => {
axios.delete(url).then((result) => {
if (result && result.data) {
setPage(1)
this.getMember();
}
})
.catch((error) => { });
}).catch((error) => { });
}
setIsSpin(false)
}
return (
<Box className="GroupSubLevel">
<Short className="g-sub-left">
<Spin spinning={isSpin}>
{
group ?
<div>
@ -87,15 +63,13 @@ export default ((props) => {
:
<Empty image={Empty.PRESENTED_IMAGE_SIMPLE} />
}
</Spin>
</Short>
<Long>
<Gap>
<WhiteBack>
<Tabs nav={['团队成员', '团队项目']} index={nav} onChange={setNav}>
{
nav === "0" ?
<Memberlist {...props} /> : <Grouplist {...props}/>
nav === "0" ? <Memberlist {...props} /> : <Grouplist {...props}/>
}
</Tabs>
</WhiteBack>

View File

@ -95,7 +95,7 @@ export default ((props)=>{
<Route
path="/organize/:OIdentifier/group/:groupId"
render={(p) => {
return <GroupDetails {...props} {...p}/>
return <GroupDetails {...props} {...p} group={detail}/>
}}
></Route>
</Switch>