forked from Gitlink/forgeplus-react
切换分支
This commit is contained in:
parent
38709b1cab
commit
0502fb1317
|
@ -163,7 +163,7 @@ class CoderRootDirectory extends Component{
|
|||
}
|
||||
|
||||
// 获取子目录
|
||||
getFileDetail=(path)=>{
|
||||
getFileDetail=(path,ref)=>{
|
||||
const { projectsId } = this.props.match.params;
|
||||
const { branch } = this.state;
|
||||
const url =`/repositories/${projectsId}/sub_entries.json`;
|
||||
|
@ -171,7 +171,7 @@ class CoderRootDirectory extends Component{
|
|||
axios.get(url,{
|
||||
params:{
|
||||
filepath:path,
|
||||
ref:branch
|
||||
ref:ref || branch
|
||||
}
|
||||
}).then((result)=>{
|
||||
if(result && result.data && result.data.length > 0){
|
||||
|
@ -263,8 +263,16 @@ class CoderRootDirectory extends Component{
|
|||
http_url:branchLastCommit && branchLastCommit.http_url,
|
||||
isSpin: true
|
||||
})
|
||||
this.Init();
|
||||
|
||||
const { pathname } = this.props.location;
|
||||
if(pathname && pathname.indexOf("/filesurl/")>-1){
|
||||
let url =pathname.split("filesurl/")[1];
|
||||
this.setState({
|
||||
filePath:url
|
||||
})
|
||||
this.getFileDetail(url,branchLastCommit && branchLastCommit.name);
|
||||
}else{
|
||||
this.getProjectRoot( branchLastCommit && branchLastCommit.name );
|
||||
}
|
||||
}
|
||||
render(){
|
||||
const { rootList , branch ,filePath , fileDetail , subFileType , readMeContent, isSpin } = this.state;
|
||||
|
|
Loading…
Reference in New Issue