From d71932c93a6a605400c700aef25fe6d3958d7a8f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com> Date: Mon, 6 Jan 2020 09:54:02 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4=E7=89=88=E6=9C=AC=E5=BA=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/react/config/webpack.config.dev.js | 2 +- .../src/modules/tpm/TPMRepositoryComponent.js | 13 +++-- .../tpm/shixunchild/Repository/Repository.js | 48 ++++++++++--------- 3 files changed, 35 insertions(+), 28 deletions(-) diff --git a/public/react/config/webpack.config.dev.js b/public/react/config/webpack.config.dev.js index d1092894a..4e28af31f 100644 --- a/public/react/config/webpack.config.dev.js +++ b/public/react/config/webpack.config.dev.js @@ -30,7 +30,7 @@ const env = getClientEnvironment(publicUrl); module.exports = { // You may want 'eval' instead if you prefer to see the compiled output in DevTools. // See the discussion in https://github.com/facebookincubator/create-react-app/issues/343.s - //devtool: "cheap-module-eval-source-map", + devtool: "cheap-module-eval-source-map", // 开启调试 //devtool: "source-map", // 开启调试 // These are the "entry points" to our application. diff --git a/public/react/src/modules/tpm/TPMRepositoryComponent.js b/public/react/src/modules/tpm/TPMRepositoryComponent.js index 713af8d97..ed485bdb4 100644 --- a/public/react/src/modules/tpm/TPMRepositoryComponent.js +++ b/public/react/src/modules/tpm/TPMRepositoryComponent.js @@ -93,8 +93,9 @@ class TPMRepositoryComponent extends Component { fileContent: response.data.content, repositoryLoading: false }); - this.props.history - .replace(`${this.props.match.url}/master/shixun_show/${newPathArray.join('/')}`) + if(response.data.content){ + this.props.history.replace(`${this.props.match.url}/master/shixun_show/${newPathArray.join('/')}`) + } } }).catch((error)=>{ @@ -171,9 +172,11 @@ class TPMRepositoryComponent extends Component { ...response.data, repositoryLoading: false }); - this.props.history - .replace(`${this.props.match.url}` + - (newPathArray.length ? `/master/shixun_show/${newPathArray.join('/')}` : '')) + // console.log(response) + // console.log(newPathArray.length) + // this.props.history + // .replace(`${this.props.match.url}` + + // (newPathArray.length ? `/master/shixun_show/${newPathArray.join('/')}` : '')) } // 初始化时,repo接口完毕后需要看是否需要fetchCode diff --git a/public/react/src/modules/tpm/shixunchild/Repository/Repository.js b/public/react/src/modules/tpm/shixunchild/Repository/Repository.js index 6fff5ef3a..d19c4fd57 100644 --- a/public/react/src/modules/tpm/shixunchild/Repository/Repository.js +++ b/public/react/src/modules/tpm/shixunchild/Repository/Repository.js @@ -47,6 +47,9 @@ class Repository extends Component { }) } + onSelectDirectoryTree=(selectedKeys, info)=>{ + this.onRepoFileClick(info.node.props.item) + } render() { let { match, author, git_url, lastest_commit,repositoryLoading, commits,trees,pathArray , TPMRightSectionData } = this.props; let matchpath =this.props.match.path; @@ -222,33 +225,34 @@ class Repository extends Component { }