修改路由issue
This commit is contained in:
parent
f6a0c3b33f
commit
a5bdf26f96
20
src/App.js
20
src/App.js
|
@ -118,7 +118,7 @@ class App extends Component {
|
||||||
this.unlisten = this.props.history.listen((location) => {
|
this.unlisten = this.props.history.listen((location) => {
|
||||||
let newPathname = location.pathname.split('/')[1];
|
let newPathname = location.pathname.split('/')[1];
|
||||||
if (this.state.pathName !== newPathname) {
|
if (this.state.pathName !== newPathname) {
|
||||||
this.setState({ pathType: '' });
|
// this.setState({ pathType: '' });
|
||||||
newPathname && this.getPathnameType(newPathname);
|
newPathname && this.getPathnameType(newPathname);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -313,6 +313,16 @@ class App extends Component {
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
|
||||||
|
{/* 组织 */}
|
||||||
|
<Route path={"/organize"}
|
||||||
|
render={
|
||||||
|
(props) => {
|
||||||
|
return (<OrganizeIndex {...props} {...this.props} {...this.state} />)
|
||||||
|
}
|
||||||
|
}>
|
||||||
|
</Route>
|
||||||
|
|
||||||
{/*新建项目等*/}
|
{/*新建项目等*/}
|
||||||
<Route
|
<Route
|
||||||
path={"/projects"}
|
path={"/projects"}
|
||||||
|
@ -353,14 +363,6 @@ class App extends Component {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
{/* 组织 */}
|
|
||||||
<Route path={"/organize"}
|
|
||||||
render={
|
|
||||||
(props) => {
|
|
||||||
return (<OrganizeIndex {...props} {...this.props} {...this.state} />)
|
|
||||||
}
|
|
||||||
}>
|
|
||||||
</Route>
|
|
||||||
|
|
||||||
{/* 个人主页 */}
|
{/* 个人主页 */}
|
||||||
<Route path="/:username"
|
<Route path="/:username"
|
||||||
|
|
|
@ -347,7 +347,7 @@ function CoderDepot(props){
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
<AlignCenter className="mr20">
|
<AlignCenter className="mr20">
|
||||||
<Link to={`/${owner}/${projectsId}/branchs`} className="color-grey-9">
|
<Link to={`/${owner}/${projectsId}/branches`} className="color-grey-9">
|
||||||
<i className="iconfont icon-fenzhi2 font-18 color-grey-9 mr3"></i>
|
<i className="iconfont icon-fenzhi2 font-18 color-grey-9 mr3"></i>
|
||||||
<span className="color-grey-6 mr3">{projectDetail && projectDetail.branches && projectDetail.branches.total_count}个</span>分支
|
<span className="color-grey-6 mr3">{projectDetail && projectDetail.branches && projectDetail.branches.total_count}个</span>分支
|
||||||
</Link>
|
</Link>
|
||||||
|
|
|
@ -137,7 +137,7 @@ class CoderRootIndex extends Component{
|
||||||
() => (<CoderRootTag {...this.props} {...this.state} />)
|
() => (<CoderRootTag {...this.props} {...this.state} />)
|
||||||
}
|
}
|
||||||
></Route>
|
></Route>
|
||||||
<Route path="/:owner/:projectsId/branchs"
|
<Route path="/:owner/:projectsId/branches"
|
||||||
render={
|
render={
|
||||||
() => (<CoderRootBranch {...this.props} {...this.state} />)
|
() => (<CoderRootBranch {...this.props} {...this.state} />)
|
||||||
}
|
}
|
||||||
|
|
|
@ -544,7 +544,7 @@ class Detail extends Component {
|
||||||
{
|
{
|
||||||
forked_count > 0 ?
|
forked_count > 0 ?
|
||||||
platform ?
|
platform ?
|
||||||
<Link className="detail_tag_btn_count" to={{ pathname: `/${owner}/${projectsId}/fork_users`, state }}>
|
<Link className="detail_tag_btn_count" to={{ pathname: `/${owner}/${projectsId}/members`, state }}>
|
||||||
{forked_count}
|
{forked_count}
|
||||||
</Link>
|
</Link>
|
||||||
:
|
:
|
||||||
|
@ -739,7 +739,7 @@ class Detail extends Component {
|
||||||
(props) => (<PraiseUsers {...this.props} {...props} {...this.state} {...common} />)
|
(props) => (<PraiseUsers {...this.props} {...props} {...this.state} {...common} />)
|
||||||
}
|
}
|
||||||
></Route>
|
></Route>
|
||||||
<Route path="/:owner/:projectsId/fork_users"
|
<Route path="/:owner/:projectsId/members"
|
||||||
render={
|
render={
|
||||||
(props) => (<ForkUsers {...this.props} {...props} {...this.state} {...common} />)
|
(props) => (<ForkUsers {...this.props} {...props} {...this.state} {...common} />)
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,7 +16,7 @@ class DetailTop extends Component {
|
||||||
<i className="iconfont icon-tijiaojilu font-20 mr3 font-bd"></i>
|
<i className="iconfont icon-tijiaojilu font-20 mr3 font-bd"></i>
|
||||||
<span>{(coderCount && coderCount.commits_count) || 0}</span>个提交
|
<span>{(coderCount && coderCount.commits_count) || 0}</span>个提交
|
||||||
</Link>
|
</Link>
|
||||||
<Link to={`/${owner}/${projectsId}/branchs`} className={pathname.indexOf("/branchs") > 0 ? "active" : ""}>
|
<Link to={`/${owner}/${projectsId}/branches`} className={pathname.indexOf("/branches") > 0 ? "active" : ""}>
|
||||||
<i className="iconfont icon-fenzhi1 font-18 mr3"></i>
|
<i className="iconfont icon-fenzhi1 font-18 mr3"></i>
|
||||||
<span>{(coderCount && coderCount.branches_count) || 0}</span>个分支
|
<span>{(coderCount && coderCount.branches_count) || 0}</span>个分支
|
||||||
</Link>
|
</Link>
|
||||||
|
|
|
@ -16,7 +16,6 @@ function DetailBanner({ history,list , owner , projectsId , isManager , url , pa
|
||||||
setMenuName(list);
|
setMenuName(list);
|
||||||
}
|
}
|
||||||
},[list]);
|
},[list]);
|
||||||
console.log('open_devops:'+open_devops)
|
|
||||||
return(
|
return(
|
||||||
<div className="f-wrap-between mt15">
|
<div className="f-wrap-between mt15">
|
||||||
{
|
{
|
||||||
|
|
|
@ -89,7 +89,7 @@ class OrderItem extends Component {
|
||||||
<li style={{color:`${item.done_ratio === "100%"?"#28BD6C":"#F73030"}`}}>{item.done_ratio || "--"}</li>
|
<li style={{color:`${item.done_ratio === "100%"?"#28BD6C":"#F73030"}`}}>{item.done_ratio || "--"}</li>
|
||||||
<li>
|
<li>
|
||||||
<div className="milepostleft">
|
<div className="milepostleft">
|
||||||
<Link to={`/${owner}/${projectsId}/issues/${item.id}/detail`}><i className="iconfont icon-pinglun1 mr3 font-16"></i>{item.journals_count}</Link>
|
<Link to={`/${owner}/${projectsId}/issues/${item.id}`}><i className="iconfont icon-pinglun1 mr3 font-16"></i>{item.journals_count}</Link>
|
||||||
{
|
{
|
||||||
user_admin_or_member ?
|
user_admin_or_member ?
|
||||||
<div style={{ display: orderid === item.id && isdisplay ? 'flex' : 'none' }}>
|
<div style={{ display: orderid === item.id && isdisplay ? 'flex' : 'none' }}>
|
||||||
|
|
|
@ -63,11 +63,11 @@ class Index extends Component {
|
||||||
</li>
|
</li>
|
||||||
<li
|
<li
|
||||||
className={
|
className={
|
||||||
pathname.indexOf("settings/collaborator") > -1 ? "active" : ""
|
pathname.indexOf("settings/collaborators") > -1 ? "active" : ""
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
<p>
|
<p>
|
||||||
<Link to={`/${owner}/${projectsId}/settings/collaborator`} className="w-100">
|
<Link to={`/${owner}/${projectsId}/settings/collaborators`} className="w-100">
|
||||||
<i className="iconfont icon-chengyuan font-18 mr10"></i>
|
<i className="iconfont icon-chengyuan font-18 mr10"></i>
|
||||||
协作者管理
|
协作者管理
|
||||||
</Link>
|
</Link>
|
||||||
|
@ -98,10 +98,10 @@ class Index extends Component {
|
||||||
</p>
|
</p>
|
||||||
</li>
|
</li>
|
||||||
<li
|
<li
|
||||||
className={pathname.indexOf("lables") > -1 ? "active" : ""}
|
className={pathname.indexOf("settings/lables") > -1 ? "active" : ""}
|
||||||
>
|
>
|
||||||
<p>
|
<p>
|
||||||
<Link to={`/${owner}/${projectsId}/lables`} className="w-100">
|
<Link to={`/${owner}/${projectsId}/settings/lables`} className="w-100">
|
||||||
<i className="iconfont icon-biaoqian3 font-18 mr10 color-grey-6"></i>
|
<i className="iconfont icon-biaoqian3 font-18 mr10 color-grey-6"></i>
|
||||||
项目标签
|
项目标签
|
||||||
</Link>
|
</Link>
|
||||||
|
@ -146,14 +146,14 @@ class Index extends Component {
|
||||||
></Route>
|
></Route>
|
||||||
{/* 协作者 */}
|
{/* 协作者 */}
|
||||||
<Route
|
<Route
|
||||||
path="/:owner/:projectsId/settings/collaborator"
|
path="/:owner/:projectsId/settings/collaborators"
|
||||||
render={(props) => (
|
render={(props) => (
|
||||||
<Collaborator {...this.props} {...props} {...this.state} />
|
<Collaborator {...this.props} {...props} {...this.state} />
|
||||||
)}
|
)}
|
||||||
></Route>
|
></Route>
|
||||||
{/* 修改仓库信息 */}
|
{/* 修改仓库信息 */}
|
||||||
<Route
|
<Route
|
||||||
path="/:owner/:projectsId/lables"
|
path="/:owner/:projectsId/settings/lables"
|
||||||
render={(props) => (
|
render={(props) => (
|
||||||
<Tags {...this.props} {...props} {...this.state} />
|
<Tags {...this.props} {...props} {...this.state} />
|
||||||
)}
|
)}
|
||||||
|
|
|
@ -36,11 +36,11 @@ export default withRouter(CNotificationHOC()(SnackbarHOC()(TPMIndexHOC(
|
||||||
return (
|
return (
|
||||||
<div className="newMain">
|
<div className="newMain">
|
||||||
<Switch>
|
<Switch>
|
||||||
{/* 组织团队-设置 */}
|
{/* 新建组织 */}
|
||||||
<Route
|
<Route
|
||||||
path="/:OIdentifier/teams/:groupId/setting"
|
path="/organize/new"
|
||||||
render={(p) => {
|
render={(p) => {
|
||||||
return <SubDetailIndex {...props} {...p}/>
|
return <New {...props} {...p}/>
|
||||||
}}
|
}}
|
||||||
></Route>
|
></Route>
|
||||||
{/* 组织团队-新建 */}
|
{/* 组织团队-新建 */}
|
||||||
|
@ -50,6 +50,13 @@ export default withRouter(CNotificationHOC()(SnackbarHOC()(TPMIndexHOC(
|
||||||
return <GroupNew {...props} {...p}/>
|
return <GroupNew {...props} {...p}/>
|
||||||
}}
|
}}
|
||||||
></Route>
|
></Route>
|
||||||
|
{/* 组织团队-设置 */}
|
||||||
|
<Route
|
||||||
|
path="/:OIdentifier/teams/:groupId/setting"
|
||||||
|
render={(p) => {
|
||||||
|
return <SubDetailIndex {...props} {...p}/>
|
||||||
|
}}
|
||||||
|
></Route>
|
||||||
{/* 组织团队-子级(包含组织团队列表) */}
|
{/* 组织团队-子级(包含组织团队列表) */}
|
||||||
<Route
|
<Route
|
||||||
path="/:OIdentifier/teams"
|
path="/:OIdentifier/teams"
|
||||||
|
@ -64,13 +71,7 @@ export default withRouter(CNotificationHOC()(SnackbarHOC()(TPMIndexHOC(
|
||||||
return <DetailIndex {...props} {...p}/>
|
return <DetailIndex {...props} {...p}/>
|
||||||
}}
|
}}
|
||||||
></Route>
|
></Route>
|
||||||
{/* 新建组织 */}
|
|
||||||
<Route
|
|
||||||
path="/organize/new"
|
|
||||||
render={(p) => {
|
|
||||||
return <New {...props} {...p}/>
|
|
||||||
}}
|
|
||||||
></Route>
|
|
||||||
|
|
||||||
{/* 组织详情(包含组织设置) */}
|
{/* 组织详情(包含组织设置) */}
|
||||||
<Route
|
<Route
|
||||||
|
|
|
@ -3,11 +3,11 @@ import { WhiteBack , Banner } from '../../Component/layout';
|
||||||
import GroupItems from '../TeamGroupItems';
|
import GroupItems from '../TeamGroupItems';
|
||||||
|
|
||||||
const limit = 8;
|
const limit = 8;
|
||||||
function TeamSettingGroup({organizeDetail,history}){
|
function TeamSettingGroup({organizeDetail,history,current_user}){
|
||||||
return(
|
return(
|
||||||
<WhiteBack>
|
<WhiteBack>
|
||||||
<Banner>组织团队管理</Banner>
|
<Banner>组织团队管理</Banner>
|
||||||
<GroupItems limit={limit} organizeDetail={organizeDetail} count={4} history={history}/>
|
<GroupItems limit={limit} organizeDetail={organizeDetail} count={4} history={history} current_user={current_user}/>
|
||||||
</WhiteBack>
|
</WhiteBack>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,11 +3,11 @@ import { Banner } from '../Component/layout';
|
||||||
import GroupItems from './TeamGroupItems';
|
import GroupItems from './TeamGroupItems';
|
||||||
|
|
||||||
const limit = 14;
|
const limit = 14;
|
||||||
function TeamGroup({organizeDetail,history}){
|
function TeamGroup({organizeDetail,history,current_user}){
|
||||||
return(
|
return(
|
||||||
<div style={{background:"#fff",marginBottom:"30px",border:'1px solid #eee'}}>
|
<div style={{background:"#fff",marginBottom:"30px",border:'1px solid #eee'}}>
|
||||||
<Banner>组织团队</Banner>
|
<Banner>组织团队</Banner>
|
||||||
<GroupItems limit={limit} organizeDetail={organizeDetail} count={7} history={history}/>
|
<GroupItems limit={limit} organizeDetail={organizeDetail} count={7} history={history} current_user={current_user}/>
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,7 +17,7 @@ const ImgContent = styled.img`{
|
||||||
border-radius:50%;
|
border-radius:50%;
|
||||||
margin:5px 10px;
|
margin:5px 10px;
|
||||||
}`
|
}`
|
||||||
function TeamGroupItems({organizeDetail,limit, count , history}){
|
function TeamGroupItems({organizeDetail,limit, count , history ,current_user}){
|
||||||
const [ page , setPage ] = useState(1);
|
const [ page , setPage ] = useState(1);
|
||||||
const [ isSpin , setIsSpin ] = useState(true);
|
const [ isSpin , setIsSpin ] = useState(true);
|
||||||
const [ total , setTotal ] = useState(0);
|
const [ total , setTotal ] = useState(0);
|
||||||
|
@ -48,6 +48,7 @@ function TeamGroupItems({organizeDetail,limit, count , history}){
|
||||||
axios.delete(url).then(result =>{
|
axios.delete(url).then(result =>{
|
||||||
if(result && result.data){
|
if(result && result.data){
|
||||||
getData();
|
getData();
|
||||||
|
history.push(`/${current_user && current_user.login}`);
|
||||||
}
|
}
|
||||||
}).catch(error=>{})
|
}).catch(error=>{})
|
||||||
}
|
}
|
||||||
|
|
|
@ -282,7 +282,7 @@ class Infos extends Component {
|
||||||
<Menu selectedKeys={[menuKey]} mode={`horizontal`} className="infosRightMenu">
|
<Menu selectedKeys={[menuKey]} mode={`horizontal`} className="infosRightMenu">
|
||||||
<Menu.Item key="0"><Link to={`/${user && user.login}`}><i className="iconfont icon-gailan"></i>概览</Link></Menu.Item>
|
<Menu.Item key="0"><Link to={`/${user && user.login}`}><i className="iconfont icon-gailan"></i>概览</Link></Menu.Item>
|
||||||
<Menu.Item key="1"><Link to={`/${user && user.login}/statistics`}><i className="iconfont icon-shujutongji"></i>数据统计</Link></Menu.Item>
|
<Menu.Item key="1"><Link to={`/${user && user.login}/statistics`}><i className="iconfont icon-shujutongji"></i>数据统计</Link></Menu.Item>
|
||||||
<Menu.Item key="2"><Link to={`/${user && user.login}/projects/common`}><i className="iconfont icon-xiangmu"></i>项目</Link></Menu.Item>
|
<Menu.Item key="2"><Link to={`/${user && user.login}/projects`}><i className="iconfont icon-xiangmu"></i>项目</Link></Menu.Item>
|
||||||
{
|
{
|
||||||
current_user && user && user.login === current_user.login ?
|
current_user && user && user.login === current_user.login ?
|
||||||
<Menu.Item key="3">
|
<Menu.Item key="3">
|
||||||
|
@ -338,7 +338,7 @@ class Infos extends Component {
|
||||||
}}
|
}}
|
||||||
></Route>
|
></Route>
|
||||||
<Route
|
<Route
|
||||||
path="/:username/projects/:project_type"
|
path="/:username/projects" // /:project_type
|
||||||
render={() => {
|
render={() => {
|
||||||
return <InfosUser {...this.props} {...this.state} />;
|
return <InfosUser {...this.props} {...this.state} />;
|
||||||
}}
|
}}
|
||||||
|
|
Loading…
Reference in New Issue