From 916cc293ac1993c3424544a85b1efbd1c09ce6d7 Mon Sep 17 00:00:00 2001 From: caishi <1149225589@qq.com> Date: Mon, 8 Mar 2021 11:15:05 +0800 Subject: [PATCH] url --- src/forge/Main/Detail.js | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/src/forge/Main/Detail.js b/src/forge/Main/Detail.js index df8a94e5..9886b7e2 100644 --- a/src/forge/Main/Detail.js +++ b/src/forge/Main/Detail.js @@ -115,22 +115,23 @@ const DevIndex = Loadable({ /** * permission:Manager:管理员,Reporter:报告人员(只有读取权限),Developer:开发人员(除不能设置仓库信息外) */ -function checkPathname(pathname){ +function checkPathname(projectsId,owner,pathname){ let name = ""; - if(pathname){ - if(pathname.indexOf("/about")>-1){ + if(pathname && pathname !== `/projects/${owner}/${projectsId}`){ + let url = pathname.split(`/projects/${owner}/${projectsId}`)[1]; + if(url.indexOf("/about")>-1){ name="about" - }else if(pathname.indexOf("/issues")>-1 ||pathname.indexOf("Milepost") > 0){ + }else if(url.indexOf("/issues")>-1 ||url.indexOf("Milepost") > 0){ name = "issues"; - }else if(pathname.indexOf("/pulls")>-1){ + }else if(url.indexOf("/pulls")>-1){ name="pulls" - }else if(pathname.indexOf("/milestones")>-1){ + }else if(url.indexOf("/milestones")>-1){ name="milestones" - }else if(pathname.indexOf("/activity")>-1){ + }else if(url.indexOf("/activity")>-1){ name="activity" - }else if(pathname.indexOf("/setting")>-1){ + }else if(url.indexOf("/setting")>-1){ name="setting" - }else if(pathname.indexOf("/devops")>-1){ + }else if(url.indexOf(`/devops`)>-1){ name="devops" } } @@ -400,9 +401,9 @@ class Detail extends Component { const url = this.props.history.location.pathname; const urlArr = url.split("/"); const urlFlag = (urlArr.length === 3); - let pathname = checkPathname(url); const { projectsId , owner } = this.props.match.params; + let pathname = checkPathname(projectsId,owner,url); const { state } = this.props.history.location;