From 0502fb1317531a02b26b5fff4e532af854af6c0a Mon Sep 17 00:00:00 2001 From: caicai8 <1149225589@qq.com> Date: Thu, 23 Apr 2020 14:11:43 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=87=E6=8D=A2=E5=88=86=E6=94=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/forge/Main/CoderRootDirectory.js | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/forge/Main/CoderRootDirectory.js b/src/forge/Main/CoderRootDirectory.js index b46a7fbb..d08729c3 100644 --- a/src/forge/Main/CoderRootDirectory.js +++ b/src/forge/Main/CoderRootDirectory.js @@ -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;