From 34ba476011088a0f62ecf1a0fedc4321a11b055d Mon Sep 17 00:00:00 2001 From: caishi <1149225589@qq.com> Date: Tue, 2 Feb 2021 14:20:31 +0800 Subject: [PATCH] bug --- src/forge/Team/Group/GroupDetailMember.jsx | 75 +++++++++--------- src/forge/Team/Group/GroupDetails.jsx | 92 ++++++++-------------- src/forge/Team/Sub/SubDetail.jsx | 2 +- 3 files changed, 72 insertions(+), 97 deletions(-) diff --git a/src/forge/Team/Group/GroupDetailMember.jsx b/src/forge/Team/Group/GroupDetailMember.jsx index b7fafaff..22be1e61 100644 --- a/src/forge/Team/Group/GroupDetailMember.jsx +++ b/src/forge/Team/Group/GroupDetailMember.jsx @@ -13,54 +13,55 @@ 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, { - params: { - page, - limit - }, - }) - .then((result) => { - if (result && result.data) { - setMembers(result.data.team_users) - setTotal(result.data.total_count) - } - }).catch((error) => { }); + axios.get(url, { + params: { + page, + limit + }, + }) + .then((result) => { + if (result && result.data) { + setMembers(result.data.team_users) + setTotal(result.data.total_count) + } + }).catch((error) => { }); setIsSpin(false) }; return ( -
- { - data && data.length > 0 ? data.map((item, key) => { - return ( - - ) - }) - : - - } -
+ { data && data.length > 0 ? +
+ { + data.map((item, key) => { + return ( + + ) + }) + } +
:"" + } { total > limit ? -
- -
- : "" +
+ +
+ : "" }
diff --git a/src/forge/Team/Group/GroupDetails.jsx b/src/forge/Team/Group/GroupDetails.jsx index 2d8a462b..c9709b6b 100644 --- a/src/forge/Team/Group/GroupDetails.jsx +++ b/src/forge/Team/Group/GroupDetails.jsx @@ -18,84 +18,58 @@ 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) => { - if (result && result.data) { - setPage(1) - this.getMember(); - } - }) - .catch((error) => { }); + axios.delete(url).then((result) => { + if (result && result.data) { + + } + }).catch((error) => { }); } - setIsSpin(false) } return ( - - { - group ? -
- - {group.name} - {group.is_member ? - removeUser(current_user.login)} - okText="确认" - cancelText="取消" - > - 离开团队 - - : "" - } - -
{group.description ? group.description : "暂无描述"}
-
-

管理员团队对 所有仓库 具有操作权限,且对组织具有 管理员权限

-

此外,该团队拥有了 创建仓库 的权限:成员可以在组织中创建新的仓库。

- {group.is_admin ? : ""} -
+ { + group ? +
+ + {group.name} + {group.is_member ? + removeUser(current_user.login)} + okText="确认" + cancelText="取消" + > + 离开团队 + + : "" + } + +
{group.description ? group.description : "暂无描述"}
+
+

管理员团队对 所有仓库 具有操作权限,且对组织具有 管理员权限

+

此外,该团队拥有了 创建仓库 的权限:成员可以在组织中创建新的仓库。

+ {group.is_admin ? : ""}
- : - - } - +
+ : + + } { - nav === "0" ? - : + nav === "0" ? : } diff --git a/src/forge/Team/Sub/SubDetail.jsx b/src/forge/Team/Sub/SubDetail.jsx index e1f368cf..001a1479 100644 --- a/src/forge/Team/Sub/SubDetail.jsx +++ b/src/forge/Team/Sub/SubDetail.jsx @@ -95,7 +95,7 @@ export default ((props)=>{ { - return + return }} >