This commit is contained in:
caicai8 2020-03-20 21:20:35 +08:00
parent 8bb298f062
commit 1621380ba8
7 changed files with 22 additions and 20 deletions

View File

@ -29,7 +29,7 @@ class CoderRootBranch extends Component {
return(
<li>
<div>
<Link to={`/projects/${projectsId}/${author}/coder?branch=${item.name}`} className="color-blue font-15" style={{"maxWidth":"100px"}}>{item.name}</Link>
<Link to={`/projects/${projectsId}/${author}/coders?branch=${item.name}`} className="color-blue font-15" style={{"maxWidth":"100px"}}>{item.name}</Link>
{/*<span className="color-blue font-15">{item.name}</span>*/}
<p className="f-wrap-alignCenter">
<span className="mr5 color-blue">{item.last_commit && item.last_commit.id}</span>

View File

@ -295,7 +295,7 @@ class CoderRootDirectory extends Component{
{
subFileType !== "file" && isManager && isDeveloper &&
<p className="addFile">
<Link to={`/projects/${projectsId}/${author}/coder/${branch}/newfile${urlRoot}`} >新建文件</Link>
<Link to={`/projects/${projectsId}/${author}/coders/${branch}/newfile${urlRoot}`} >新建文件</Link>
<Link to={``}>上传文件</Link>
</p>
}

View File

@ -28,17 +28,17 @@ class CoderRootIndex extends Component{
return(
<div className="main">
<Switch {...this.props}>
<Route path="/projects/:projectsId/:author/coder/commit"
<Route path="/projects/:projectsId/:author/coders/commit"
render={
(props) => (<CoderRootCommit {...this.props} {...props} {...this.state} />)
}
></Route>
<Route path="/projects/:projectsId/:author/coder/branch"
<Route path="/projects/:projectsId/:author/coders/branch"
render={
(props) => (<CoderRootBranch {...this.props} {...props} {...this.state} />)
}
></Route>
<Route path="/projects/:projectsId/:author/coder"
<Route path="/projects/:projectsId/:author/coders"
render={
(props) => (<CoderRootDirectory {...this.props} {...props} {...this.state} />)
}

View File

@ -255,7 +255,7 @@ class Detail extends Component{
const url = `/projects/${project_id}/forks.json`;
axios.post(url).then(result=>{
if(result && result.data.status === 0){
this.props.history.push(`/projects/${result.data.identifier}/${author}/coder`);
this.props.history.push(`/projects/${result.data.identifier}/${author}/coders`);
}else{
this.props.showNotification(result.data.message);
}
@ -289,7 +289,9 @@ class Detail extends Component{
const { projectDetail , watchers_count , praises_count , forked_count , project_id , current_user } = this.state;
const url = this.props.history.location.pathname;
const urlFlag = (url.split("/").length === 3);
const urlArr= url.split("/");
const url_last = urlArr[parseInt(urlArr.length)-1];
const urlFlag = (urlArr.length === 4);
const { isManager , isDeveloper } = this.props;
const { projectsId , author } = this.props.match.params;
@ -303,17 +305,17 @@ class Detail extends Component{
{projectDetail && projectDetail.author && projectDetail.author.name}
<span className="ml5 mr5">/</span>
<span className="hide-1 flex-1">
<Link to={`/projects/${projectsId}/${author}/coder`} className="color-white">{ projectDetail && projectDetail.identifier }</Link>
<Link to={`/projects/${projectsId}/${author}/coders`} className="color-white">{ projectDetail && projectDetail.identifier }</Link>
</span>
</p>
</div>
<div className="f-wrap-between">
<ul className="headerMenu-wrapper">
<li className={(url.indexOf("coder")>0 || urlFlag)? "active" : ""}><Link to={{pathname:`/projects/${projectsId}/${author}/coder`,state}}><img alt="" src={img_1} width="18" />代码</Link></li>
<li className={url.indexOf("orders")>0 ? "active" : ""}><Link to={{pathname:`/projects/${projectsId}/${author}/orders`,state}}><img alt="" src={img_2} width="12" />工单{projectDetail&&projectDetail.issues_count===0?"":projectDetail&&projectDetail.issues_count===0?projectDetail.issues_count:""}</Link></li>
<li className={url.indexOf("merge")>0 ? "active" : ""}><Link to={{pathname:`/projects/${projectsId}/${author}/merge`,state}}><img alt="" src={img_3} width="13" />合并请求{projectDetail&&projectDetail.pull_requests_count===0?"":projectDetail&&projectDetail.pull_requests_count===0?projectDetail.pull_requests_count:""}</Link></li>
<li className={url.indexOf("version")>0 ? "active" : ""}><Link to={{pathname:`/projects/${projectsId}/${author}/version`,state}}><img alt="" src={img_4} width="16" />版本发布</Link></li>
<li className={url.indexOf("trends")>0 ? "active" : ""}><Link to={{pathname:`/projects/${projectsId}/${author}/trends`,state}}><img alt="" src={img_6} width="16" />动态</Link></li>
<li className={(url_last === ("coders") || urlFlag) ? "active" : ""}><Link to={{pathname:`/projects/${projectsId}/${author}/coders`,state}}><img alt="" src={img_1} width="18" />代码</Link></li>
<li className={url_last === ("orders") ? "active" : ""}><Link to={{pathname:`/projects/${projectsId}/${author}/orders`,state}}><img alt="" src={img_2} width="12" />工单{projectDetail&&projectDetail.issues_count===0?"":projectDetail&&projectDetail.issues_count===0?projectDetail.issues_count:""}</Link></li>
<li className={url_last === ("merge") ? "active" : ""}><Link to={{pathname:`/projects/${projectsId}/${author}/merge`,state}}><img alt="" src={img_3} width="13" />合并请求{projectDetail&&projectDetail.pull_requests_count===0?"":projectDetail&&projectDetail.pull_requests_count===0?projectDetail.pull_requests_count:""}</Link></li>
<li className={url_last === ("version") ? "active" : ""}><Link to={{pathname:`/projects/${projectsId}/${author}/version`,state}}><img alt="" src={img_4} width="16" />版本发布</Link></li>
<li className={url_last === ("trends") ? "active" : ""}><Link to={{pathname:`/projects/${projectsId}/${author}/trends`,state}}><img alt="" src={img_6} width="16" />动态</Link></li>
{
isManager &&
<li className={url.indexOf("setting")>0 ? "active" : ""}><Link to={`/projects/${projectsId}/${author}/setting`}><img alt="" src={img_7} width="19" />仓库设置</Link></li>
@ -346,12 +348,12 @@ class Detail extends Component{
<Switch {...this.props}>
{/* 新建文件 */}
<Route path="/projects/:projectsId/:author/coder/:branch/newfile/:path"
<Route path="/projects/:projectsId/:author/coders/:branch/newfile/:path"
render={
(props) => (<FileNew {...this.props} {...props} {...this.state} current_user={current_user}/>)
}
></Route>
<Route path="/projects/:projectsId/:author/coder/:branch/newfile"
<Route path="/projects/:projectsId/:author/coders/:branch/newfile"
render={
(props) => (<FileNew {...this.props} {...props} {...this.state} current_user={current_user}/>)
}
@ -486,7 +488,7 @@ class Detail extends Component{
(props) => (<MergeIndexDetail {...this.props} {...props} {...this.state} current_user={current_user}/>)
}
></Route>
<Route path="/projects/:projectsId/:author/coder"
<Route path="/projects/:projectsId/:author/coders"
render={
(props) => (<CoderRootIndex {...this.props} {...props} {...this.state} current_user={current_user}/>)
}

View File

@ -8,11 +8,11 @@ class DetailTop extends Component{
const { pathname } = this.props.location;
return(
<p className="branch-wrapper">
<Link to={`/projects/${projectsId}/${author}/coder/commit`} className={ pathname.indexOf("/coder/commit") > 0 ? "active" : ""}>
<Link to={`/projects/${projectsId}/${author}/coders/commit`} className={ pathname.indexOf("/coders/commit") > 0 ? "active" : ""}>
<i className="iconfont icon-tijiaojilu font-18 mr3"></i>
<span className="mr3">{projectDetail && projectDetail.commits_count}</span>
</Link>
<Link to={`/projects/${projectsId}/${author}/coder/branch`} className={ pathname.indexOf("/coder/branch") > 0 ? "active" : ""}>
<Link to={`/projects/${projectsId}/${author}/coders/branch`} className={ pathname.indexOf("/coders/branch") > 0 ? "active" : ""}>
<i className="iconfont icon-fenzhi font-18 mr3"></i>
<span className="mr3">{projectDetail && projectDetail.branches_count}</span>
</Link>

View File

@ -129,7 +129,7 @@ class Index extends Component{
isSpin:false
})
this.props.showNotification(`${projectsType === "deposit" ? "托管" :"镜像"}项目创建成功!`);
this.props.history.push(`/projects/${result.data.identifier}/${current_user && current_user.login}/coder`);
this.props.history.push(`/projects/${result.data.identifier}/${current_user && current_user.login}/coders`);
}
}
}).catch((error)=>{

View File

@ -37,7 +37,7 @@ class UserSubmitComponent extends Component{
message:values.desc
}).then((result)=>{
if(result && result.data.name){
this.props.history.push(`/projects/${projectsId}/${author}/coder`);
this.props.history.push(`/projects/${projectsId}/${author}/coders`);
}
}).catch(error=>{
console.log(error);