提交详情页面-分支信由传参修改为接口参数

This commit is contained in:
谢思 2021-09-30 21:58:26 +08:00
parent 9ce86f4102
commit a91fb41ef0
4 changed files with 8 additions and 8 deletions

View File

@ -153,7 +153,7 @@ class CoderRootCommit extends Component{
<div className="commitList-item f-wrap-between">
<div>
<AlignTop>
<div className="commitDesc"><Link to={{pathname:`/${owner}/${projectsId}/commits/${truncateCommitId(`${item.sha}`)}/${branch}`,query:{commitPage:page}}} className="font-14 color-grey-3 font-bd">{item.message}</Link></div>
<div className="commitDesc"><Link to={{pathname:`/${owner}/${projectsId}/commits/${truncateCommitId(`${item.sha}`)}`,query:{commitPage:page}}} className="font-14 color-grey-3 font-bd">{item.message}</Link></div>
</AlignTop>
<p className="f-wrap-alignCenter mt15 pb5">
<User
@ -170,7 +170,7 @@ class CoderRootCommit extends Component{
<div>
<span className="treecopy-cont shadow">
<img src={Tree} alt="sha" width={"16px"}/>
<Link to={{pathname:`/${owner}/${projectsId}/commits/${truncateCommitId(`${item.sha}`)}/${branch}`,query:{page:page}}}>{truncateCommitId(`${item.sha}`)}</Link>
<Link to={{pathname:`/${owner}/${projectsId}/commits/${truncateCommitId(`${item.sha}`)}`,query:{page:page}}}>{truncateCommitId(`${item.sha}`)}</Link>
<input type="text" id={`value${k}`} value={`${truncateCommitId(`${item.sha}`)}`}/>
</span>
<CopyTool beforeText="复制commit id" afterText="复制成功" inputId={`value${k}`}/>

View File

@ -108,7 +108,7 @@ class CoderRootIndex extends Component{
() => (<CoderRootCommit {...this.props} {...this.state} commit_class="main" getTopCount={this.getTopCount} />)
}
></Route>
<Route path="/:owner/:projectsId/commits/:sha/:branchName"
<Route path="/:owner/:projectsId/commits/:sha"
render={
(props) => (<Diff {...this.props} {...props} {...this.state}/>)
}

View File

@ -50,7 +50,7 @@ export default (props) => {
const [parents, setParents] = useState(undefined);
const [committer, setCommitter] = useState(undefined);
const [isSpin, setIsSpin] = useState(true);
const { sha , projectsId, owner, branchName } = match.params;
const { sha , projectsId, owner } = match.params;
useEffect(() => {
if (projectsId && owner && sha) {
const url = `/${owner}/${projectsId}/commits/${sha}.json`;
@ -63,6 +63,7 @@ export default (props) => {
setParents(result.data.parents);
setCommitter(result.data.committer || (result.data.commit && result.data.commit.committer));
setIsSpin(false);
}
})
.catch(error => {
@ -70,7 +71,6 @@ export default (props) => {
});
}
}, [projectsId , owner, sha]);
return (
<div className="main" style={{padding:"0px",border:"none"}}>
<Spin spinning={isSpin}>
@ -81,7 +81,7 @@ export default (props) => {
{commit && commit.message &&
<pre className="task-hide">{commit.message}</pre>
}
<Link to={`/${owner}/${projectsId}/tree/${branchName}`}><i className="iconfont icon-fenzhi2 font-18"></i>{branchName}</Link>
<Link to={`/${owner}/${projectsId}/tree/${data.branch}`}><i className="iconfont icon-fenzhi2 font-18"></i>{data.branch}</Link>
</div>
<Button type="primary" onClick={()=>{history.push(`/${owner}/${projectsId}/tree/${truncateCommitId(sha)}`)}} className="btnblue" style={{height:"36px"}}>浏览文件</Button>
</div>
@ -103,7 +103,7 @@ export default (props) => {
<div className="ml40 f-wrap-alignCenter">
<label className="mr8">父节点</label>
<img src={Tree} alt="sha" width={"16px"} className="mr4"/>
<Link to={`/${owner}/${projectsId}/commits/${truncateCommitId(`${item.sha}`)}/${branchName}`} className="underline">{truncateCommitId(item.sha)}</Link>
<Link to={`/${owner}/${projectsId}/commits/${truncateCommitId(`${item.sha}`)}/${data.branch}`} className="underline">{truncateCommitId(item.sha)}</Link>
</div>
)
})

View File

@ -67,7 +67,7 @@ function version(props) {
</span>
<span className="color-grey-3 font-12">
<img src={Tree} width="16px" color="#333333" className="mr3"/>
<Link className="hover" to={`/${owner}/${projectsId}/commits/${truncateCommitId(`${item.sha}`)}/${item.branch}`}>{truncateCommitId(item.sha)}</Link>
<Link className="hover" to={`/${owner}/${projectsId}/commits/${truncateCommitId(`${item.sha}`)}`}>{truncateCommitId(item.sha)}</Link>
</span>
</span>
<div className="versionInfo_right">