This commit is contained in:
caishi 2021-02-02 09:31:15 +08:00
parent fcf03f2631
commit 3b85567a1a
10 changed files with 102 additions and 99 deletions

View File

@ -3,6 +3,7 @@ import './Component.scss';
import { Button } from 'antd';
import styled from 'styled-components';
import FocusButton from "../UsersList/focus_button";
import { getImageUrl } from 'educoder';
const Img = styled.img`{
border-radius:50%;
@ -61,7 +62,7 @@ const Div = styled.div`{
export default (({ img, name, time, focusStatus, is_current_user, login }) => {
return (
<Div>
<Img src={img} />
<Img src={getImageUrl(`images/${img}`)} />
<div className="m-infos">
<Name>{name}</Name>
<Time><I className="iconfont icon-shijian"></I>加入时间:{time}</Time>

View File

@ -1,12 +1,12 @@
import React from 'react';
import { Link } from 'react-router-dom';
export default (({ name , count , bottom , children })=>{
export default (({ name , count , bottom , children , url })=>{
return(
<div className="box">
<div className="head">
<span>{name}</span>
<span>{count}<i className="iconfont icon-youjiantou font-12 ml3"></i></span>
<span className="font-16">{name}</span>
<Link to={url}>{count}<i className="iconfont icon-youjiantou font-12 ml3"></i></Link>
</div>
<div className="content">
{children}

View File

@ -42,7 +42,7 @@ export default ((props) => {
data && data.length > 0 ? data.map((item, key) => {
return (
<Cards
img={getImageUrl(`images/${item.user.image_url}`)}
img={item.user.image_url}
name={item.user.name}
time={item.created_at}
focusStatus={item.user.watched}

View File

@ -22,31 +22,11 @@ const Imgs = styled.img`{
margin-right:12px;
border-radius:50%;
}`
const faker_projects = [
{
id: 2,
project: {
owner_name: "ceshi_org_1",
name: "jajaj0",
identifier: "ssjsksjsk"
}
},
{
id: 3,
project: {
owner_name: "sylor_test",
name: "sylor_test",
identifier: "sylor_test"
}
}
]
const limit = 15;
export default ((props) => {
const [isSpin, setIsSpin] = useState(false);
const [projects, setProjects] = useState(undefined);
const [page, setPage] = useState(1);
const [limit, setLimit] = useState(15);
const [total, setTotal] = useState(0);
const { OIdentifier, groupId } = props.match.params;
@ -57,21 +37,17 @@ export default ((props) => {
function get_project() {
setIsSpin(true)
const url = `/organizations/${OIdentifier}/teams/${groupId}/team_projects.json`;
axios
.get(url, {
params: {
page,
limit
},
})
.then((result) => {
if (result && result.data && result.data.team_projects.length > 0) {
setProjects(result.data.team_projects)
setTotal(result.data.total_count)
} else {
setProjects(faker_projects)
}
}).catch((error) => { });
axios.get(url, {
params: {
page,
limit
},
}).then((result) => {
if (result && result.data && result.data.team_projects.length > 0) {
setProjects(result.data.team_projects)
setTotal(result.data.total_count)
}
}).catch((error) => { });
setIsSpin(false)
}
@ -81,15 +57,13 @@ export default ((props) => {
<Spin spinning={isSpin}>
{
projects && projects.length > 0 ? projects.map((item, key) => {
return (
<Div>
<Imgs src={item.project.image_url ? getImageUrl(`images/${item.project.image_url}`) : "https://dss3.bdstatic.com/70cFv8Sh_Q1YnxGkpoWK1HF6hhy/it/u=3025493530,1989042357&fm=26&gp=0.jpg"}/>
<Link to={`/projects/${item.project.owner_name}/${item.project.name}`}>{item.project.name}</Link>
</Div>
)
})
:
<Empty image={Empty.PRESENTED_IMAGE_SIMPLE} />
return (
<Div>
<Imgs src={item.project && getImageUrl(`images/${item.project.owner_image_url}`)}/>
<Link to={`/projects/${item.project.owner_name}/${item.project.name}`}>{item.project.name}</Link>
</Div>
)
}):<Empty image={Empty.PRESENTED_IMAGE_SIMPLE} />
}
</Spin>

View File

@ -48,8 +48,6 @@ export default ((props) => {
.then((result) => {
if (result && result.data) {
setPage(1)
setQuery(undefined)
setIdentify(undefined)
this.getMember();
}
})
@ -83,7 +81,7 @@ export default ((props) => {
<div className="g-tip">
<p>管理员团队对 <span>所有仓库</span> 具有操作权限且对组织具有 <span>管理员权限</span> </p>
<p>此外该团队拥有了 <span>创建仓库</span> 的权限成员可以在组织中创建新的仓库 </p>
{group.is_admin ? <Button type="primary" href={`/organize/${OIdentifier}/group/${groupId}/setting`}><span className="color-white">团队设置</span></Button> : ""}
{group.is_admin ? <Button type="primary" onClick={()=>props.history.push(`/organize/${OIdentifier}/group/${groupId}/setting`)}><span className="color-white">团队设置</span></Button> : ""}
</div>
</div>
:

View File

@ -30,7 +30,7 @@ export default withRouter(CNotificationHOC()(SnackbarHOC()(TPMIndexHOC(
<Switch>
{/* 组织团队 */}
<Route
path="/organize/:OIdentifier/group/:groupId"
path="/organize/:OIdentifier/group"
render={(p) => {
return <SubDetail {...props} {...p}/>
}}

View File

@ -103,7 +103,7 @@ function List(props){
</div>
}
</div>
<Right OIdentifier={OIdentifier}/>
<Right OIdentifier={OIdentifier} history={props.history}/>
</div>
)
}

View File

@ -4,6 +4,7 @@ import styled from 'styled-components';
import Box from './Box';
import axios from 'axios';
import { getImageUrl } from 'educoder';
import { Link } from 'react-router-dom';
const Span = styled.span`{
color:#888;
@ -34,7 +35,7 @@ const Img = styled.img`{
height:45px;
margin-right:12px;
}`
function RightBox({ OIdentifier }) {
function RightBox({ OIdentifier , history }) {
const [ memberData, setMemberData ] = useState(undefined);
const [ groupData, setGroupData ] = useState(undefined);
@ -65,7 +66,7 @@ function RightBox({ OIdentifier }) {
<div className="list-r">
{
memberData && memberData.organization_users && memberData.organization_users.length>0 ?
<Box name="组织成员" count={memberData && memberData.total_count}>
<Box name="组织成员" count={memberData && memberData.total_count} url={`/organize/${OIdentifier}/member`}>
{
memberData.organization_users.map((item,key)=>{
return(
@ -87,14 +88,15 @@ function RightBox({ OIdentifier }) {
<Box
name="组织团队"
count={groupData && groupData.total_count}
bottom={<Button type={'primary'} to={``}>新建团队</Button>}
bottom={<Button type={'primary'} onClick={()=>history.push(`/organize/${OIdentifier}/group/new`)}>新建团队</Button>}
url={`/organize/${OIdentifier}/group`}
>
{
groupData.teams.map((item,key)=>{
return(
<div className="teammembers" key={key}>
<div>
<ColorListName>{item.name}</ColorListName>
<Link to={`/organize/${OIdentifier}/group/${item.id}`}><ColorListName>{item.name}</ColorListName></Link>
<Align>
<Span>{item.num_users}名成员</Span>
<Span>{item.num_projects}个仓库</Span>

View File

@ -71,8 +71,8 @@ export default ((props)=>{
title={detail.name}
rightBtn={
flag && <span className="subNavs">
<Link to={``} className="active"><span>组织成员</span>{detail.num_users && <lable>{detail.num_users}</lable>}</Link>
<Link to={``}><span>组织团队</span>{detail.num_teams &&<lable>{detail.num_teams}</lable>}</Link>
<Link to={`/organize/${OIdentifier}/member`} className={pathname ===`/organize/${OIdentifier}/member` ? "active":""}><span>组织成员</span>{detail.num_users && <lable>{detail.num_users}</lable>}</Link>
<Link to={`/organize/${OIdentifier}/group`} className={pathname ===`/organize/${OIdentifier}/group` ? "active":""}><span>组织团队</span>{detail.num_teams &&<lable>{detail.num_teams}</lable>}</Link>
</span>
}
img={detail.avatar_url}
@ -83,36 +83,36 @@ export default ((props)=>{
{/* 组织团队-设置 */}
<Route
path="/organize/:OIdentifier/group/:groupId/setting"
render={(props) => {
return <GroupSetting {...props} />
}}
></Route>
{/* 组织团队-成员 */}
<Route
path="/organize/:OIdentifier/group/:groupId/member"
render={(props) => {
return <GroupDetails {...props} />
}}
></Route>
{/* 组织成员 */}
<Route
path="/organize/:OIdentifier/member"
render={(props) => {
return <Member {...props} />
render={(p) => {
return <GroupSetting {...props} {...p}/>
}}
></Route>
{/* 组织-新建团队 */}
<Route
path="/organize/:OIdentifier/group/new"
render={(props) => {
return <GroupNew {...props} />
render={(p) => {
return <GroupNew {...props} {...p}/>
}}
></Route>
{/* 组织团队-成员 */}
<Route
path="/organize/:OIdentifier/group/:groupId"
render={(p) => {
return <GroupDetails {...props} {...p}/>
}}
></Route>
{/* 组织成员 */}
<Route
path="/organize/:OIdentifier/member"
render={(p) => {
return <Member {...props} {...p} organizeDetail={detail}/>
}}
></Route>
{/* 组织团队 */}
<Route
path="/organize/:OIdentifier/group"
render={(props) => {
return <Group {...props} />
render={(p) => {
return <Group {...props} {...p}/>
}}
></Route>
</Switch>

View File

@ -1,25 +1,53 @@
import React from 'react';
import React ,{ useEffect , useState } from 'react';
import { Banner } from '../Component/layout';
import Cards from '../Component/MemberCards';
import axios from 'axios';
import Nodata from '../Nodata';
const limit = 15;
function TeamMember({organizeDetail,current_user}){
const [ page , setPage ] = useState(1);
const [ total , setTotal ] = useState(0);
const [ list , setList ] = useState(undefined);
useEffect(()=>{
if(organizeDetail){
getData();
}
},[organizeDetail]);
function getData(){
const url = `/organizations/${organizeDetail.id}/organization_users.json`;
axios.get(url).then(result=>{
if(result && result.data){
setList(result.data.organization_users);
setTotal(result.data.total_count);
}
})
}
export default (()=>{
return(
<div>
<Banner>组织成员</Banner>
<div className="memberBox">
<Cards
img="https://dss2.bdstatic.com/70cFvnSh_Q1YnxGkpoWK1HF6hhy/it/u=3331079987,1190181307&fm=111&gp=0.jpg"
name="陈教授"
time="2020-04-29"
focusStatus={true}
/>
<Cards
img="https://dss2.bdstatic.com/70cFvnSh_Q1YnxGkpoWK1HF6hhy/it/u=3331079987,1190181307&fm=111&gp=0.jpg"
name="陈教授"
time="2020-04-29"
focusStatus={false}
/>
</div>
{
list && list.length > 0 ?
<div className="memberBox">
{
list.map((item,key)=>{
console.log(current_user);
return(
item.user && <Cards
img={item.user.image_url}
name={item.user.name}
time={item.created_at}
focusStatus={item.user.watched}
is_current_user={current_user && current_user.login === item.user.login}
/>
)
})
}
</div>
:<Nodata _html="暂无数据"/>
}
</div>
)
})
}export default TeamMember