forked from Gitlink/forgeplus-react
修改路由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) => {
|
||||
let newPathname = location.pathname.split('/')[1];
|
||||
if (this.state.pathName !== newPathname) {
|
||||
this.setState({ pathType: '' });
|
||||
// this.setState({ pathType: '' });
|
||||
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
|
||||
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"
|
||||
|
|
|
@ -347,7 +347,7 @@ function CoderDepot(props){
|
|||
}
|
||||
</div>
|
||||
<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>
|
||||
<span className="color-grey-6 mr3">{projectDetail && projectDetail.branches && projectDetail.branches.total_count}个</span>分支
|
||||
</Link>
|
||||
|
|
|
@ -137,7 +137,7 @@ class CoderRootIndex extends Component{
|
|||
() => (<CoderRootTag {...this.props} {...this.state} />)
|
||||
}
|
||||
></Route>
|
||||
<Route path="/:owner/:projectsId/branchs"
|
||||
<Route path="/:owner/:projectsId/branches"
|
||||
render={
|
||||
() => (<CoderRootBranch {...this.props} {...this.state} />)
|
||||
}
|
||||
|
|
|
@ -544,7 +544,7 @@ class Detail extends Component {
|
|||
{
|
||||
forked_count > 0 ?
|
||||
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}
|
||||
</Link>
|
||||
:
|
||||
|
@ -739,7 +739,7 @@ class Detail extends Component {
|
|||
(props) => (<PraiseUsers {...this.props} {...props} {...this.state} {...common} />)
|
||||
}
|
||||
></Route>
|
||||
<Route path="/:owner/:projectsId/fork_users"
|
||||
<Route path="/:owner/:projectsId/members"
|
||||
render={
|
||||
(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>
|
||||
<span>{(coderCount && coderCount.commits_count) || 0}</span>个提交
|
||||
</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>
|
||||
<span>{(coderCount && coderCount.branches_count) || 0}</span>个分支
|
||||
</Link>
|
||||
|
|
|
@ -16,7 +16,6 @@ function DetailBanner({ history,list , owner , projectsId , isManager , url , pa
|
|||
setMenuName(list);
|
||||
}
|
||||
},[list]);
|
||||
console.log('open_devops:'+open_devops)
|
||||
return(
|
||||
<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>
|
||||
<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 ?
|
||||
<div style={{ display: orderid === item.id && isdisplay ? 'flex' : 'none' }}>
|
||||
|
|
|
@ -63,11 +63,11 @@ class Index extends Component {
|
|||
</li>
|
||||
<li
|
||||
className={
|
||||
pathname.indexOf("settings/collaborator") > -1 ? "active" : ""
|
||||
pathname.indexOf("settings/collaborators") > -1 ? "active" : ""
|
||||
}
|
||||
>
|
||||
<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>
|
||||
协作者管理
|
||||
</Link>
|
||||
|
@ -98,10 +98,10 @@ class Index extends Component {
|
|||
</p>
|
||||
</li>
|
||||
<li
|
||||
className={pathname.indexOf("lables") > -1 ? "active" : ""}
|
||||
className={pathname.indexOf("settings/lables") > -1 ? "active" : ""}
|
||||
>
|
||||
<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>
|
||||
项目标签
|
||||
</Link>
|
||||
|
@ -146,14 +146,14 @@ class Index extends Component {
|
|||
></Route>
|
||||
{/* 协作者 */}
|
||||
<Route
|
||||
path="/:owner/:projectsId/settings/collaborator"
|
||||
path="/:owner/:projectsId/settings/collaborators"
|
||||
render={(props) => (
|
||||
<Collaborator {...this.props} {...props} {...this.state} />
|
||||
)}
|
||||
></Route>
|
||||
{/* 修改仓库信息 */}
|
||||
<Route
|
||||
path="/:owner/:projectsId/lables"
|
||||
path="/:owner/:projectsId/settings/lables"
|
||||
render={(props) => (
|
||||
<Tags {...this.props} {...props} {...this.state} />
|
||||
)}
|
||||
|
|
|
@ -36,11 +36,11 @@ export default withRouter(CNotificationHOC()(SnackbarHOC()(TPMIndexHOC(
|
|||
return (
|
||||
<div className="newMain">
|
||||
<Switch>
|
||||
{/* 组织团队-设置 */}
|
||||
{/* 新建组织 */}
|
||||
<Route
|
||||
path="/:OIdentifier/teams/:groupId/setting"
|
||||
path="/organize/new"
|
||||
render={(p) => {
|
||||
return <SubDetailIndex {...props} {...p}/>
|
||||
return <New {...props} {...p}/>
|
||||
}}
|
||||
></Route>
|
||||
{/* 组织团队-新建 */}
|
||||
|
@ -50,6 +50,13 @@ export default withRouter(CNotificationHOC()(SnackbarHOC()(TPMIndexHOC(
|
|||
return <GroupNew {...props} {...p}/>
|
||||
}}
|
||||
></Route>
|
||||
{/* 组织团队-设置 */}
|
||||
<Route
|
||||
path="/:OIdentifier/teams/:groupId/setting"
|
||||
render={(p) => {
|
||||
return <SubDetailIndex {...props} {...p}/>
|
||||
}}
|
||||
></Route>
|
||||
{/* 组织团队-子级(包含组织团队列表) */}
|
||||
<Route
|
||||
path="/:OIdentifier/teams"
|
||||
|
@ -64,13 +71,7 @@ export default withRouter(CNotificationHOC()(SnackbarHOC()(TPMIndexHOC(
|
|||
return <DetailIndex {...props} {...p}/>
|
||||
}}
|
||||
></Route>
|
||||
{/* 新建组织 */}
|
||||
<Route
|
||||
path="/organize/new"
|
||||
render={(p) => {
|
||||
return <New {...props} {...p}/>
|
||||
}}
|
||||
></Route>
|
||||
|
||||
|
||||
{/* 组织详情(包含组织设置) */}
|
||||
<Route
|
||||
|
|
|
@ -3,11 +3,11 @@ import { WhiteBack , Banner } from '../../Component/layout';
|
|||
import GroupItems from '../TeamGroupItems';
|
||||
|
||||
const limit = 8;
|
||||
function TeamSettingGroup({organizeDetail,history}){
|
||||
function TeamSettingGroup({organizeDetail,history,current_user}){
|
||||
return(
|
||||
<WhiteBack>
|
||||
<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>
|
||||
)
|
||||
}
|
||||
|
|
|
@ -3,11 +3,11 @@ import { Banner } from '../Component/layout';
|
|||
import GroupItems from './TeamGroupItems';
|
||||
|
||||
const limit = 14;
|
||||
function TeamGroup({organizeDetail,history}){
|
||||
function TeamGroup({organizeDetail,history,current_user}){
|
||||
return(
|
||||
<div style={{background:"#fff",marginBottom:"30px",border:'1px solid #eee'}}>
|
||||
<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>
|
||||
)
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@ const ImgContent = styled.img`{
|
|||
border-radius:50%;
|
||||
margin:5px 10px;
|
||||
}`
|
||||
function TeamGroupItems({organizeDetail,limit, count , history}){
|
||||
function TeamGroupItems({organizeDetail,limit, count , history ,current_user}){
|
||||
const [ page , setPage ] = useState(1);
|
||||
const [ isSpin , setIsSpin ] = useState(true);
|
||||
const [ total , setTotal ] = useState(0);
|
||||
|
@ -48,6 +48,7 @@ function TeamGroupItems({organizeDetail,limit, count , history}){
|
|||
axios.delete(url).then(result =>{
|
||||
if(result && result.data){
|
||||
getData();
|
||||
history.push(`/${current_user && current_user.login}`);
|
||||
}
|
||||
}).catch(error=>{})
|
||||
}
|
||||
|
|
|
@ -282,7 +282,7 @@ class Infos extends Component {
|
|||
<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="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 ?
|
||||
<Menu.Item key="3">
|
||||
|
@ -338,7 +338,7 @@ class Infos extends Component {
|
|||
}}
|
||||
></Route>
|
||||
<Route
|
||||
path="/:username/projects/:project_type"
|
||||
path="/:username/projects" // /:project_type
|
||||
render={() => {
|
||||
return <InfosUser {...this.props} {...this.state} />;
|
||||
}}
|
||||
|
|
Loading…
Reference in New Issue