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

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 className="commitList-item f-wrap-between">
<div> <div>
<AlignTop> <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> </AlignTop>
<p className="f-wrap-alignCenter mt15 pb5"> <p className="f-wrap-alignCenter mt15 pb5">
<User <User
@ -170,7 +170,7 @@ class CoderRootCommit extends Component{
<div> <div>
<span className="treecopy-cont shadow"> <span className="treecopy-cont shadow">
<img src={Tree} alt="sha" width={"16px"}/> <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}`)}`}/> <input type="text" id={`value${k}`} value={`${truncateCommitId(`${item.sha}`)}`}/>
</span> </span>
<CopyTool beforeText="复制commit id" afterText="复制成功" inputId={`value${k}`}/> <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} />) () => (<CoderRootCommit {...this.props} {...this.state} commit_class="main" getTopCount={this.getTopCount} />)
} }
></Route> ></Route>
<Route path="/:owner/:projectsId/commits/:sha/:branchName" <Route path="/:owner/:projectsId/commits/:sha"
render={ render={
(props) => (<Diff {...this.props} {...props} {...this.state}/>) (props) => (<Diff {...this.props} {...props} {...this.state}/>)
} }

View File

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

View File

@ -67,7 +67,7 @@ function version(props) {
</span> </span>
<span className="color-grey-3 font-12"> <span className="color-grey-3 font-12">
<img src={Tree} width="16px" color="#333333" className="mr3"/> <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>
</span> </span>
<div className="versionInfo_right"> <div className="versionInfo_right">