修改组织和首页的路由
This commit is contained in:
parent
fb872f3a3d
commit
e606147d03
75
src/App.js
75
src/App.js
|
@ -100,6 +100,27 @@ class App extends Component {
|
|||
mydisplay: false,
|
||||
occupation: 0,
|
||||
mygetHelmetapi: null,
|
||||
pathType: null,
|
||||
}
|
||||
}
|
||||
|
||||
UNSAFE_componentWillMount() {
|
||||
initAxiosInterceptors(this.props);
|
||||
let pathname = window.location.pathname ? window.location.pathname.split('/')[1] : '';
|
||||
pathname && this.getPathnameType(pathname);
|
||||
}
|
||||
|
||||
getPathnameType = (pathname) => {
|
||||
let keyWord = ["Gitlink", "Trustie", "explore", "settings", "setting", "CCF", "mulan", "wiki", "issues", "setting", "trending", "code", "projects", "pulls", "mine", "login", "register", "email",];
|
||||
if (!keyWord.includes('pathname')) {
|
||||
let url = `/owners/${pathname}.json`;
|
||||
axios.get(url).then((response) => {
|
||||
if (response && response.status === 200) {
|
||||
this.setState({
|
||||
pathType: response.data.type || '404'
|
||||
})
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -119,7 +140,7 @@ class App extends Component {
|
|||
|
||||
componentDidMount() {
|
||||
document.title = "loading...";
|
||||
initAxiosInterceptors(this.props);
|
||||
|
||||
this.getAppdata();
|
||||
|
||||
window.addEventListener('error', (event) => {
|
||||
|
@ -196,7 +217,7 @@ class App extends Component {
|
|||
};
|
||||
|
||||
render() {
|
||||
const { mygetHelmetapi } = this.state;
|
||||
const { mygetHelmetapi, pathType } = this.state;
|
||||
let personal = mygetHelmetapi && mygetHelmetapi.personal;
|
||||
return (
|
||||
<Provider store={store}>
|
||||
|
@ -251,27 +272,61 @@ class App extends Component {
|
|||
<Route path="/403" component={Shixunauthority} />
|
||||
|
||||
<Route path="/500" component={http500} />
|
||||
<Route path={"/organize"}
|
||||
render={
|
||||
(props) => {
|
||||
return (<OrganizeIndex {...props} {...this.props} {...this.state} />)
|
||||
}
|
||||
}>
|
||||
</Route>
|
||||
|
||||
{/*404*/}
|
||||
<Route path="/nopage" component={Shixunnopage} />
|
||||
|
||||
{/* 查询 */}
|
||||
<Route path="/search" component={Search} />
|
||||
|
||||
<Route exact path="/explore"
|
||||
render={
|
||||
(props) => (
|
||||
personal && personal.length > 0 ?
|
||||
<InfosIndex {...this.props} {...props} />
|
||||
:
|
||||
<ProjectIndex {...this.props} {...props} />
|
||||
)
|
||||
}
|
||||
/>
|
||||
|
||||
{/* 判断为用户/组织,并进入对应页面 */}
|
||||
{
|
||||
pathType === 'User' ?
|
||||
<Route exact path="/:username"
|
||||
render={
|
||||
(props) => {
|
||||
return (<InfosIndex {...this.props} {...this.state} />)
|
||||
}
|
||||
}
|
||||
/> : pathType === 'Organization' ? <Route path={"/:OIdentifier"}
|
||||
render={
|
||||
(props) => {
|
||||
return (<OrganizeIndex {...props} {...this.props} {...this.state} />)
|
||||
}
|
||||
}>
|
||||
</Route> : pathType === '404' ? <Route path="/nopage" component={Shixunnopage} /> : <Loading />
|
||||
}
|
||||
|
||||
|
||||
{/* 组织 */}
|
||||
{/* <Route path={"/organize"}
|
||||
render={
|
||||
(props) => {
|
||||
return (<OrganizeIndex {...props} {...this.props} {...this.state} />)
|
||||
}
|
||||
}>
|
||||
</Route> */}
|
||||
|
||||
{/* 个人主页 */}
|
||||
<Route path="/users/:username"
|
||||
|
||||
<Route path="/:username"
|
||||
render={
|
||||
(props) => {
|
||||
return (<InfosIndex {...this.props} {...this.state} />)
|
||||
}
|
||||
}></Route>
|
||||
|
||||
<Route exact path="/"
|
||||
render={
|
||||
(props) => (
|
||||
|
|
|
@ -417,7 +417,7 @@ class Detail extends Component {
|
|||
return forked_from_project_id && fork_info ?
|
||||
<div className="color-grey-9 df">
|
||||
<span>复刻自</span>
|
||||
<Link to={`${type ==="Organization" ? "/organize":'/users'}/${fork_info.fork_project_user_login}`} className="show-user-link color-grey-6 ml5">{fork_info.fork_project_user_name}</Link>
|
||||
<Link to={`${type ==="Organization" ? '':'/users'}/${fork_info.fork_project_user_login}`} className="show-user-link color-grey-6 ml5">{fork_info.fork_project_user_name}</Link>
|
||||
<span> / </span>
|
||||
<Link to={`/projects/${fork_info.fork_project_user_login}/${fork_info.fork_project_identifier}`} className="color-grey-6 task-hide flex1" style={{maxWidth:"400px"}} title={fork_info.fork_form_name}>{fork_info.fork_form_name}</Link>
|
||||
</div> : ""
|
||||
|
@ -453,7 +453,7 @@ class Detail extends Component {
|
|||
<AlignTop>
|
||||
<div className="projectallName">
|
||||
{project && project.author &&
|
||||
<Link to={`${project.author.type ==="Organization" ? "/organize":'/users'}/${project.author.login}`}>{project.author.name}</Link>
|
||||
<Link to={`${project.author.type ==="Organization" ? '':'/users'}/${project.author.login}`}>{project.author.name}</Link>
|
||||
}
|
||||
<span className="ml5 mr5">/</span>
|
||||
<Link to={`/projects/${owner}/${projectsId}`} className="projectN mt6">{projectDetail && projectDetail.name}</Link>
|
||||
|
|
|
@ -28,7 +28,7 @@ class IndexItem extends Component {
|
|||
<img className="p-r-photo" alt="" src={item.author && item.author.image_url} ></img>
|
||||
</a>
|
||||
:
|
||||
<Link to={item.author && (item.author.type === "Organization" ? `/organize/${item.author.login}`:`/users/${item.author.login}`)} className="show-user-link">
|
||||
<Link to={item.author && (item.author.type === "Organization" ? `/${item.author.login}`:`/users/${item.author.login}`)} className="show-user-link">
|
||||
<img className="p-r-photo" alt="" src={getImageUrl(`/${item.author && item.author.image_url}`)} ></img>
|
||||
</Link>
|
||||
}
|
||||
|
|
|
@ -77,7 +77,7 @@ function CollaboratorGroup({ newGroupId, owner, projectsId }) {
|
|||
title: "团队名",
|
||||
dataIndex: "name",
|
||||
render: (value, item) => {
|
||||
return <Link to={`/organize/${owner}/group/${item.id}`}>{value}</Link>;
|
||||
return <Link to={`/${owner}/group/${item.id}`}>{value}</Link>;
|
||||
},
|
||||
},
|
||||
{
|
||||
|
|
|
@ -26,18 +26,18 @@ export default (props)=>{
|
|||
|
||||
function returnActive (pathname){
|
||||
let a = 0;
|
||||
if(pathname === `/organize/${OIdentifier}/group/${groupId}/setting/member`){
|
||||
if(pathname === `/${OIdentifier}/group/${groupId}/setting/member`){
|
||||
a = 1;
|
||||
}else if(pathname === `/organize/${OIdentifier}/group/${groupId}/setting/project`){
|
||||
}else if(pathname === `/${OIdentifier}/group/${groupId}/setting/project`){
|
||||
a = 2;
|
||||
}
|
||||
return a;
|
||||
}
|
||||
const active = returnActive(pathname);
|
||||
const array = {list:[
|
||||
{name:'基本设置',icon:"icon-base",href:`/organize/${OIdentifier}/group/${groupId}/setting`},
|
||||
{name:'团队成员管理',icon:"icon-zuzhichengyuan",href:`/organize/${OIdentifier}/group/${groupId}/setting/member`},
|
||||
{name:'团队项目管理',icon:"icon-zuzhixiangmu",href:`/organize/${OIdentifier}/group/${groupId}/setting/project`},
|
||||
{name:'基本设置',icon:"icon-base",href:`/${OIdentifier}/group/${groupId}/setting`},
|
||||
{name:'团队成员管理',icon:"icon-zuzhichengyuan",href:`/${OIdentifier}/group/${groupId}/setting/member`},
|
||||
{name:'团队项目管理',icon:"icon-zuzhixiangmu",href:`/${OIdentifier}/group/${groupId}/setting/project`},
|
||||
],
|
||||
active
|
||||
}
|
||||
|
@ -51,19 +51,19 @@ export default (props)=>{
|
|||
<WhiteBack style={{border:'1px solid #eee'}}>
|
||||
<Switch>
|
||||
<Route
|
||||
path="/organize/:OIdentifier/group/:groupId/setting/project"
|
||||
path="/:OIdentifier/group/:groupId/setting/project"
|
||||
render={() => (
|
||||
<Project {...props} />
|
||||
)}
|
||||
></Route>
|
||||
<Route
|
||||
path="/organize/:OIdentifier/group/:groupId/setting/member"
|
||||
path="/:OIdentifier/group/:groupId/setting/member"
|
||||
render={() => (
|
||||
<Member {...props} />
|
||||
)}
|
||||
></Route>
|
||||
<Route
|
||||
path="/organize/:OIdentifier/group/:groupId/setting"
|
||||
path="/:OIdentifier/group/:groupId/setting"
|
||||
render={() => (
|
||||
<Common {...props} />
|
||||
)}
|
||||
|
|
|
@ -89,7 +89,7 @@ export default ((props) => {
|
|||
axios.delete(url).then((result) => {
|
||||
if (result && result.data) {
|
||||
props.showNotification(`已成功退出团队!`);
|
||||
props.history.push(`/organize/${OIdentifier}`);
|
||||
props.history.push(`/${OIdentifier}`);
|
||||
}
|
||||
}).catch((error) => { });
|
||||
}
|
||||
|
@ -119,7 +119,7 @@ export default ((props) => {
|
|||
<div className="g-tip">
|
||||
<p>管理员团队对 <span>所有仓库</span> 具有操作权限,且对组织具有 <span>管理员权限</span>。 </p>
|
||||
<p>此外,该团队拥有了 <span>创建仓库</span> 的权限:成员可以在组织中创建新的仓库。 </p>
|
||||
{group.is_admin ? <Button type="primary" onClick={()=>props.history.push(`/organize/${OIdentifier}/group/${groupId}/setting`)}><span className="color-white">团队设置</span></Button> : ""}
|
||||
{group.is_admin ? <Button type="primary" onClick={()=>props.history.push(`/${OIdentifier}/group/${groupId}/setting`)}><span className="color-white">团队设置</span></Button> : ""}
|
||||
</div>
|
||||
</div>
|
||||
:
|
||||
|
|
|
@ -76,7 +76,7 @@ export default Form.create()(
|
|||
}).then(result => {
|
||||
if (result && result.data) {
|
||||
showNotification("基本设置更新成功!");
|
||||
history.push(`/organize/${OIdentifier}/group/${groupId}`);
|
||||
history.push(`/${OIdentifier}/group/${groupId}`);
|
||||
}
|
||||
}).catch(error => { })
|
||||
} else {
|
||||
|
@ -86,7 +86,7 @@ export default Form.create()(
|
|||
}).then(result => {
|
||||
if (result && result.data) {
|
||||
showNotification("团队创建成功!");
|
||||
history.push(`/organize/${OIdentifier}/group/${result.data.id}`);
|
||||
history.push(`/${OIdentifier}/group/${result.data.id}`);
|
||||
}
|
||||
}).catch(error => { })
|
||||
}
|
||||
|
@ -134,9 +134,9 @@ export default Form.create()(
|
|||
|
||||
function cancelEdit(){
|
||||
if(groupId){
|
||||
history.push(`/organize/${OIdentifier}/group/${groupId}`);
|
||||
history.push(`/${OIdentifier}/group/${groupId}`);
|
||||
}else{
|
||||
history.push(`/organize/${OIdentifier}`);
|
||||
history.push(`/${OIdentifier}`);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -33,28 +33,28 @@ export default withRouter(CNotificationHOC()(SnackbarHOC()(TPMIndexHOC(
|
|||
<Switch>
|
||||
{/* 组织团队-设置 */}
|
||||
<Route
|
||||
path="/organize/:OIdentifier/group/:groupId/setting"
|
||||
path="/:OIdentifier/group/:groupId/setting"
|
||||
render={(p) => {
|
||||
return <SubDetailIndex {...props} {...p}/>
|
||||
}}
|
||||
></Route>
|
||||
{/* 组织团队-新建 */}
|
||||
<Route
|
||||
path="/organize/:OIdentifier/group/new"
|
||||
path="/:OIdentifier/group/new"
|
||||
render={(p) => {
|
||||
return <GroupNew {...props} {...p}/>
|
||||
}}
|
||||
></Route>
|
||||
{/* 组织团队-子级(包含组织团队列表) */}
|
||||
<Route
|
||||
path="/organize/:OIdentifier/group"
|
||||
path="/:OIdentifier/group"
|
||||
render={(p) => {
|
||||
return <DetailIndex {...props} {...p}/>
|
||||
}}
|
||||
></Route>
|
||||
{/* 组织成员 */}
|
||||
<Route
|
||||
path="/organize/:OIdentifier/member"
|
||||
path="/:OIdentifier/member"
|
||||
render={(p) => {
|
||||
return <DetailIndex {...props} {...p}/>
|
||||
}}
|
||||
|
@ -68,7 +68,7 @@ export default withRouter(CNotificationHOC()(SnackbarHOC()(TPMIndexHOC(
|
|||
></Route>
|
||||
{/* 组织详情(包含组织设置) */}
|
||||
<Route
|
||||
path="/organize/:OIdentifier"
|
||||
path="/:OIdentifier"
|
||||
render={(p) => (
|
||||
<DetailIndex {...props} {...p}/>
|
||||
)}
|
||||
|
|
|
@ -49,7 +49,7 @@ export default Form.create()(
|
|||
}).then(result=>{
|
||||
if(result && result.data){
|
||||
showNotification("组织创建成功!");
|
||||
history.push(`/organize/${result.data.name}`);
|
||||
history.push(`/${result.data.name}`);
|
||||
}
|
||||
}).catch(error=>{})
|
||||
}
|
||||
|
|
|
@ -67,7 +67,7 @@ function RightBox({ OIdentifier , history , admin }) {
|
|||
<div className="list-r">
|
||||
{
|
||||
memberData && memberData.organization_users && memberData.organization_users.length>0 ?
|
||||
<Box name="组织成员" count={memberData && memberData.total_count} url={`/organize/${OIdentifier}/member`}>
|
||||
<Box name="组织成员" count={memberData && memberData.total_count} url={`/${OIdentifier}/member`}>
|
||||
{
|
||||
memberData.organization_users.map((item,key)=>{
|
||||
return(
|
||||
|
@ -87,8 +87,8 @@ function RightBox({ OIdentifier , history , admin }) {
|
|||
<Box
|
||||
name="组织团队"
|
||||
count={groupData && groupData.total_count}
|
||||
bottom={admin && <Button type={'primary'} onClick={()=>history.push(`/organize/${OIdentifier}/group/new`)}>新建团队</Button>}
|
||||
url={`/organize/${OIdentifier}/group`}
|
||||
bottom={admin && <Button type={'primary'} onClick={()=>history.push(`/${OIdentifier}/group/new`)}>新建团队</Button>}
|
||||
url={`/${OIdentifier}/group`}
|
||||
>
|
||||
{
|
||||
groupData && groupData.teams && groupData.teams.length>0?
|
||||
|
@ -97,7 +97,7 @@ function RightBox({ OIdentifier , history , admin }) {
|
|||
return(
|
||||
<div className="teammembers" key={key}>
|
||||
<div>
|
||||
<Link to={`/organize/${OIdentifier}/group/${item.id}`}><ColorListName>{item.name}</ColorListName></Link>
|
||||
<Link to={`/${OIdentifier}/group/${item.id}`}><ColorListName>{item.name}</ColorListName></Link>
|
||||
<Align>
|
||||
<Span>{item.num_users}名成员</Span>
|
||||
<Span>{item.num_projects}个仓库</Span>
|
||||
|
|
|
@ -62,7 +62,7 @@ export default Form.create()(
|
|||
showNotification("组织信息更新成功!");
|
||||
if(values.name !== organizeDetail.name){
|
||||
console.log("false111");
|
||||
history.push(`/organize/${values.name}/setting`);
|
||||
history.push(`/${values.name}/setting`);
|
||||
}
|
||||
updateFunc && updateFunc(values.name,values.description);
|
||||
}
|
||||
|
|
|
@ -30,21 +30,21 @@ export default (( props )=>{
|
|||
|
||||
function returnActive (pathname){
|
||||
let a = 0;
|
||||
if(pathname === `/organize/${OIdentifier}/setting/member`){
|
||||
if(pathname === `/${OIdentifier}/setting/member`){
|
||||
a = 1;
|
||||
}else if(pathname === `/organize/${OIdentifier}/setting/group`){
|
||||
}else if(pathname === `/${OIdentifier}/setting/group`){
|
||||
a = 2;
|
||||
}else if(pathname === `/organize/${OIdentifier}/setting/hooks`){
|
||||
}else if(pathname === `/${OIdentifier}/setting/hooks`){
|
||||
a = 3;
|
||||
}
|
||||
return a;
|
||||
}
|
||||
const active = returnActive(pathname);
|
||||
const array = {list:[
|
||||
{name:'基本设置',icon:"icon-base",href:`/organize/${OIdentifier}/setting`},
|
||||
{name:'组织成员管理',icon:"icon-zuzhichengyuan",href:`/organize/${OIdentifier}/setting/member`},
|
||||
{name:'组织团队管理',icon:"icon-zuzhixiangmu",href:`/organize/${OIdentifier}/setting/group`},
|
||||
// {name:'管理web钩子',icon:"icon-zhongqingdianxinicon10",href:`/organize/${OIdentifier}/setting/hooks`}
|
||||
{name:'基本设置',icon:"icon-base",href:`/${OIdentifier}/setting`},
|
||||
{name:'组织成员管理',icon:"icon-zuzhichengyuan",href:`/${OIdentifier}/setting/member`},
|
||||
{name:'组织团队管理',icon:"icon-zuzhixiangmu",href:`/${OIdentifier}/setting/group`},
|
||||
// {name:'管理web钩子',icon:"icon-zhongqingdianxinicon10",href:`/${OIdentifier}/setting/hooks`}
|
||||
],
|
||||
active
|
||||
}
|
||||
|
@ -58,25 +58,25 @@ export default (( props )=>{
|
|||
<div style={{border:"1px solid #eee"}}>
|
||||
<Switch>
|
||||
<Route
|
||||
path="/organize/:OIdentifier/setting/hooks"
|
||||
path="/:OIdentifier/setting/hooks"
|
||||
render={() => (
|
||||
<Hooks {...props} />
|
||||
)}
|
||||
></Route>
|
||||
<Route
|
||||
path="/organize/:OIdentifier/setting/group"
|
||||
path="/:OIdentifier/setting/group"
|
||||
render={() => (
|
||||
<Group {...props} />
|
||||
)}
|
||||
></Route>
|
||||
<Route
|
||||
path="/organize/:OIdentifier/setting/member"
|
||||
path="/:OIdentifier/setting/member"
|
||||
render={() => (
|
||||
<Member {...props} />
|
||||
)}
|
||||
></Route>
|
||||
<Route
|
||||
path="/organize/:OIdentifier/setting"
|
||||
path="/:OIdentifier/setting"
|
||||
render={() => (
|
||||
<Common {...props} />
|
||||
)}
|
||||
|
|
|
@ -38,12 +38,12 @@ function Detail(props){
|
|||
// 设置页面:顶部不需要设置按钮了
|
||||
useEffect(()=>{
|
||||
if(pathname){
|
||||
if(pathname.indexOf(`/organize/${OIdentifier}/setting`)>-1){
|
||||
if(pathname.indexOf(`/${OIdentifier}/setting`)>-1){
|
||||
setFlag(false);
|
||||
}else{
|
||||
setFlag(true);
|
||||
}
|
||||
if(pathname.indexOf(`/organize/${OIdentifier}/group`)>-1 || pathname.indexOf(`/organize/${OIdentifier}/member`)>-1){
|
||||
if(pathname.indexOf(`/${OIdentifier}/group`)>-1 || pathname.indexOf(`/${OIdentifier}/member`)>-1){
|
||||
setButtonflagFlag(true);
|
||||
}else{
|
||||
setButtonflagFlag(false);
|
||||
|
@ -84,12 +84,12 @@ function Detail(props){
|
|||
rightBtn={
|
||||
<React.Fragment>
|
||||
{flag && !buttonflag && detail.is_admin ?
|
||||
<Link to={`/organize/${OIdentifier}/setting`} className="color-blue ml10 font-14">设置<i className="iconfont icon-shezhi2 ml3 fr"></i></Link>
|
||||
<Link to={`/${OIdentifier}/setting`} className="color-blue ml10 font-14">设置<i className="iconfont icon-shezhi2 ml3 fr"></i></Link>
|
||||
:""}
|
||||
{buttonflag &&
|
||||
<span className="subNavs">
|
||||
<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>
|
||||
<Link to={`/${OIdentifier}/member`} className={pathname ===`/${OIdentifier}/member` ? "active":""}><span>组织成员</span>{detail.num_users && <lable>{detail.num_users}</lable>}</Link>
|
||||
<Link to={`/${OIdentifier}/group`} className={pathname ===`/${OIdentifier}/group` ? "active":""}><span>组织团队</span>{detail.num_teams &&<lable>{detail.num_teams}</lable>}</Link>
|
||||
</span>
|
||||
}
|
||||
</React.Fragment>
|
||||
|
@ -112,33 +112,33 @@ function Detail(props){
|
|||
|
||||
{/* 组织团队-详情 */}
|
||||
<Route
|
||||
path="/organize/:OIdentifier/group/:groupId"
|
||||
path="/:OIdentifier/group/:groupId"
|
||||
render={(p) => {
|
||||
return <GroupDetails {...props} {...p} group={detail}/>
|
||||
}}
|
||||
></Route>
|
||||
{/* 组织成员 */}
|
||||
<Route
|
||||
path="/organize/:OIdentifier/member"
|
||||
path="/:OIdentifier/member"
|
||||
render={(p) => {
|
||||
return <Member {...props} {...p} organizeDetail={detail}/>
|
||||
}}
|
||||
></Route>
|
||||
{/* 组织团队 */}
|
||||
<Route
|
||||
path="/organize/:OIdentifier/group"
|
||||
path="/:OIdentifier/group"
|
||||
render={(p) => {
|
||||
return <Group {...props} {...p} organizeDetail={detail}/>
|
||||
}}
|
||||
></Route>
|
||||
<Route
|
||||
path="/organize/:OIdentifier/setting"
|
||||
path="/:OIdentifier/setting"
|
||||
render={(p) => {
|
||||
return <Setting {...props} {...p} organizeDetail={detail} updateFunc={updateDetail}/>
|
||||
}}
|
||||
></Route>
|
||||
<Route
|
||||
path="/organize/:OIdentifier"
|
||||
path="/:OIdentifier"
|
||||
render={(p) => {
|
||||
return <DetailIndex {...props} {...p} organizeDetail={detail}/>
|
||||
}}
|
||||
|
|
|
@ -22,7 +22,7 @@ export default ((props)=>{
|
|||
// 设置页面:顶部不需要设置按钮了
|
||||
useEffect(()=>{
|
||||
if(pathname){
|
||||
if(pathname.indexOf(`/organize/${OIdentifier}/group/${groupId}/setting`)>-1){
|
||||
if(pathname.indexOf(`/${OIdentifier}/group/${groupId}/setting`)>-1){
|
||||
setFlag(false);
|
||||
}else{
|
||||
setFlag(true);
|
||||
|
@ -48,19 +48,19 @@ export default ((props)=>{
|
|||
<div className="teamDetail" style={{paddingTop:"0px"}}>
|
||||
<div>
|
||||
<i className="iconfont icon-zuobiao mr5"></i>
|
||||
<Link to={`/organize/${OIdentifier}`}>{OIdentifier}</Link>
|
||||
<Link to={`/${OIdentifier}`}>{OIdentifier}</Link>
|
||||
<i className="iconfont icon-youjiantou ml3 mr3 font-12 color-grey-9"></i>
|
||||
<span className="color-grey-9">{detail ? detail.name : "新建团队"}</span>
|
||||
</div>
|
||||
{
|
||||
detail &&
|
||||
<Cards
|
||||
src={`/organize/${OIdentifier}/group/${groupId}`}
|
||||
src={`/${OIdentifier}/group/${groupId}`}
|
||||
title={detail.nickname||detail.name}
|
||||
rightBtn={
|
||||
flag && <span className="subNavs">
|
||||
<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>
|
||||
<Link to={`/${OIdentifier}/member`} className={pathname ===`/${OIdentifier}/member` ? "active":""}><span>组织成员</span>{detail.num_users && <lable>{detail.num_users}</lable>}</Link>
|
||||
<Link to={`/${OIdentifier}/group`} className={pathname ===`/${OIdentifier}/group` ? "active":""}><span>组织团队</span>{detail.num_teams &&<lable>{detail.num_teams}</lable>}</Link>
|
||||
</span>
|
||||
}
|
||||
desc={!flag && detail.description}
|
||||
|
@ -69,7 +69,7 @@ export default ((props)=>{
|
|||
<Switch {...props}>
|
||||
{/* 组织团队-设置 */}
|
||||
<Route
|
||||
path="/organize/:OIdentifier/group/:groupId/setting"
|
||||
path="/:OIdentifier/group/:groupId/setting"
|
||||
render={(p) => {
|
||||
return <GroupSetting {...props} {...p}/>
|
||||
}}
|
||||
|
|
|
@ -53,7 +53,7 @@ function TeamGroupItems({organizeDetail,limit, count , history}){
|
|||
}
|
||||
// 团队设置
|
||||
function toGroupSetting(id){
|
||||
history.push(`/organize/${organizeDetail && organizeDetail.name}/group/${id}/setting`);
|
||||
history.push(`/${organizeDetail && organizeDetail.name}/group/${id}/setting`);
|
||||
}
|
||||
// 解散团队
|
||||
function disMissGroup(id){
|
||||
|
@ -75,7 +75,7 @@ function TeamGroupItems({organizeDetail,limit, count , history}){
|
|||
return(
|
||||
<div key={key}>
|
||||
<p className="g-head">
|
||||
<Link to={`/organize/${organizeDetail.name}/group/${item.id}`} className="color-grey-3 font-16">{item.nickname}</Link>
|
||||
<Link to={`/${organizeDetail.name}/group/${item.id}`} className="color-grey-3 font-16">{item.nickname}</Link>
|
||||
<span>
|
||||
{ item.is_admin && item.authorize!=="owner" && <Popconfirm title={`确定解散团队${item.name}?`} okText="是" cancelText="否" onConfirm={()=>disMissGroup(item.id)}><a className="color-red">解散团队</a></Popconfirm>}
|
||||
{ item.is_member && <LeaveTeam className="ml15" teamID={item.id} onOk={outTeam}/>}
|
||||
|
@ -89,7 +89,7 @@ function TeamGroupItems({organizeDetail,limit, count , history}){
|
|||
k < count ? <Link to={`/users/${i.login}`}><ImgContent title={i.name} key={k} src={getImageUrl(`/${i.image_url}`)}/></Link>
|
||||
:
|
||||
k === count ?
|
||||
<Link to={`/organize/${organizeDetail && organizeDetail.name}/group/${item.id}`} className="moreMember" title="查看更多" ><i className="iconfont icon-zhunbeizhong"></i></Link>
|
||||
<Link to={`/${organizeDetail && organizeDetail.name}/group/${item.id}`} className="moreMember" title="查看更多" ><i className="iconfont icon-zhunbeizhong"></i></Link>
|
||||
:""
|
||||
)
|
||||
})
|
||||
|
|
|
@ -12,11 +12,12 @@ const Infos = Loadable({
|
|||
});
|
||||
export default withRouter(
|
||||
(CNotificationHOC()(SnackbarHOC()(TPMIndexHOC((props)=>{
|
||||
console.log(props);
|
||||
return(
|
||||
<div>
|
||||
<Switch>
|
||||
<Route
|
||||
path="/users/:username"
|
||||
path="/:username"
|
||||
render={(p) => (
|
||||
<Infos {...props} {...p}/>
|
||||
)}
|
||||
|
|
|
@ -72,6 +72,7 @@ class Infos extends Component {
|
|||
|
||||
renderPath=(pathname)=>{
|
||||
const { username } = this.props.match.params;
|
||||
console.log(username);
|
||||
if(pathname === `/users/${username}`){
|
||||
this.setState({menuKey:"0",route_type:undefined});
|
||||
}else if(pathname === `/users/${username}/statistics`){
|
||||
|
@ -226,7 +227,7 @@ class Infos extends Component {
|
|||
<Button
|
||||
block
|
||||
className="text-button-grey"
|
||||
onClick={()=>this.props.history.push(`/users/${user.login}/info`)}
|
||||
onClick={()=>this.props.history.push(`/${user.login}/info`)}
|
||||
type="primary"
|
||||
>
|
||||
{" "}
|
||||
|
|
|
@ -3,7 +3,7 @@ import { getImageUrl } from 'educoder';
|
|||
|
||||
function TeamItem({item,history}){
|
||||
return(
|
||||
<div onClick={()=>{history.push(`/organize/${item.name}`)}} style={{cursor:"pointer"}}>
|
||||
<div onClick={()=>{history.push(`/${item.name}`)}} style={{cursor:"pointer"}}>
|
||||
<div className="imgBox"><img alt="" src={getImageUrl(`/${item.avatar_url}`)}/></div>
|
||||
<div style={{flex:'1'}}>
|
||||
<span className="mb5 font-18 color-grey-3 task-hide">{item.name}</span>
|
||||
|
|
Loading…
Reference in New Issue