From f0e1858cd4a4daecebfc30fef3fc249aee7ab55c Mon Sep 17 00:00:00 2001 From: caishi <1149225589@qq.com> Date: Mon, 1 Mar 2021 16:01:26 +0800 Subject: [PATCH] update --- src/AppConfig.js | 2 +- src/forge/Main/Detail.js | 82 +++++++++++++------ src/forge/Main/IndexItem.js | 155 ++++++++++++++++++++++++------------ 3 files changed, 160 insertions(+), 79 deletions(-) diff --git a/src/AppConfig.js b/src/AppConfig.js index 8434a70cf..a2b53c06e 100644 --- a/src/AppConfig.js +++ b/src/AppConfig.js @@ -25,7 +25,7 @@ if (isDev) { } debugType = window.location.search.indexOf('debug=t') !== -1 ? 'teacher' : window.location.search.indexOf('debug=s') !== -1 ? 'student' : - window.location.search.indexOf('debug=a') !== -1 ? 'admin' : parsed.debug || 'p86402359' + window.location.search.indexOf('debug=a') !== -1 ? 'admin' : parsed.debug || 'admin' } function clearAllCookie() { cookie.remove('_educoder_session', { path: '/' }); diff --git a/src/forge/Main/Detail.js b/src/forge/Main/Detail.js index 9244af7e8..887896d8f 100644 --- a/src/forge/Main/Detail.js +++ b/src/forge/Main/Detail.js @@ -4,6 +4,7 @@ import { Link, Route, Switch } from 'react-router-dom'; import { Content } from '../Component/layout'; import '../css/index.scss' import './list.css'; +import SpecialModal from './SpecialModal'; import Loadable from 'react-loadable'; import Loading from '../../Loading'; @@ -114,9 +115,9 @@ const DevIndex = Loadable({ /** * permission:Manager:管理员,Reporter:报告人员(只有读取权限),Developer:开发人员(除不能设置仓库信息外) */ -function checkPathname(projectsId,owner,pathname){ +function checkPathname(pathname){ let name = ""; - if(pathname && pathname !== `/projects/${owner}/${projectsId}`){ + if(pathname){ if(pathname.indexOf("/about")>-1){ name="about" }else if(pathname.indexOf("/issues")>-1 ||pathname.indexOf("Milepost") > 0){ @@ -129,7 +130,7 @@ function checkPathname(projectsId,owner,pathname){ name="activity" }else if(pathname.indexOf("/setting")>-1){ name="setting" - }else if(pathname.indexOf(`/devops`)>-1){ + }else if(pathname.indexOf("/devops")>-1){ name="devops" } } @@ -161,7 +162,9 @@ class Detail extends Component { defaultBranch:undefined, // 非本平台项目 - platform:false + platform:false, + visible:false, + user_apply_signatures:[] } } @@ -178,6 +181,7 @@ class Detail extends Component { } getProject = (num) => { + const {user} = this.props; const { projectsId , owner } = this.props.match.params; const url = `/${owner}/${projectsId}/simple.json`; axios.get(url).then((result) => { @@ -187,6 +191,24 @@ class Detail extends Component { open_devops:result.data.open_devops, platform:result.data.platform && result.data.platform !== 'educoder' }) + let signa = result.data.user_apply_signatures && result.data.user_apply_signatures[0]; + if(result.data.is_secret && !result.data.is_member && (!signa || (signa && signa.status !== "passed")) && user.login !== owner){ + this.setState({ + visible:true, + is_secret:result.data.is_secret, + user_apply_signatures:signa + }) + } + + // 工作流:两种状态进入的链接不同 + const pathname = this.props.history.location.pathname; + if(pathname===`/projects/${owner}/${projectsId}/devops`){ + if(result.data.open_devops && pathname === `/projects/${owner}/${projectsId}/devops`){ + this.props.history.push(`/projects/${owner}/${projectsId}/devops/list`); + }else if(result.data.open_devops===false && pathname !== `/projects/${owner}/${projectsId}/devops`){ + this.props.history.push(`/projects/${owner}/${projectsId}/devops`); + } + } if (result.data.type !== 0 && result.data.mirror_status === 1) { console.log("--------start channel --------"); @@ -347,6 +369,7 @@ class Detail extends Component { const url = `/${owner}/${projectsId}/sync_mirror.json`; axios.post(url).then(result => { if (result && result.data && result.data.status === 0) { + this.props.showNotification("镜像同步成功!"); this.getProject(2); } else { this.props.showNotification("镜像同步失败!"); @@ -356,19 +379,30 @@ class Detail extends Component { }) } + hideModal=()=>{ + this.setState({ + visible:false + }) + } + + sureModal=()=>{ + this.hideModal(); + this.props.history.push('/projects'); + } + render() { const { projectDetail, watchers_count, praises_count, forked_count, firstSync , secondSync , isManager, watched, praised, - project , open_devops , platform , defaultBranch } = this.state; + project , open_devops , platform , defaultBranch , project_id , user_apply_signatures , visible } = this.state; 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; @@ -389,18 +423,19 @@ class Detail extends Component { } return (
+
{project && project.author &&
-
+
{project.author.name}
}
- /
+ /
- {project && project.name}
+ {project && project.name}
{
projectDetail && projectDetail.forked_from_project_id && projectDetail.fork_info ?
{item.description}
+ + + : "" + } + { + item.type && item.type !== 0 ? + item.type === 2 ? +{item.description}
-