diff --git a/src/App.js b/src/App.js index c1f17c5be..1d4d382b8 100644 --- a/src/App.js +++ b/src/App.js @@ -481,7 +481,7 @@ class App extends Component { this.setState({ mygetHelmetapi: undefined }); - document.title = "EduCoder"; + document.title = "Forge"; var link = document.createElement('link'), oldLink = document.getElementById('dynamic-favicon'); link.id = 'dynamic-favicon'; diff --git a/src/forge/Main/Detail.js b/src/forge/Main/Detail.js index cb567b03a..bf53fe729 100644 --- a/src/forge/Main/Detail.js +++ b/src/forge/Main/Detail.js @@ -1,4 +1,5 @@ import React , { Component } from 'react'; +import { Spin } from 'antd'; import { Link , Route , Switch,withRouter } from 'react-router-dom'; import '../css/index.css' @@ -129,6 +130,7 @@ class Detail extends Component{ constructor(props){ super(props); this.state={ + isSpin:false, projectDetail:undefined, isManager:false, isReporter:false, @@ -162,10 +164,15 @@ class Detail extends Component{ componentDidMount=()=>{ - // this.getUserInfo(); this.getDetail(); } + componentDidUpdate=(prevState)=>{ + if(prevState.match.params.projectsId !== this.props.match.params.projectsId){ + this.getDetail(); + } + } + getDetail=()=>{ const { projectsId } = this.props.match.params; @@ -242,12 +249,18 @@ class Detail extends Component{ // fork项目 forkFunc=()=>{ + this.setState({ + isSpin:true + }) const { project_id } = this.state; const url = `/projects/${project_id}/forks.json`; axios.post(url).then(result=>{ if(result && result.data.status === 0){ this.props.history.push(`/projects/${result.data.id}/coders`); this.props.showNotification(result.data.message); + this.setState({ + isSpin:false + }) }else{ this.props.showNotification(result.data.message); } @@ -278,7 +291,7 @@ class Detail extends Component{ render(){ - const { projectDetail , watchers_count , praises_count , forked_count } = this.state; + const { projectDetail , watchers_count , praises_count , forked_count , isSpin } = this.state; const url = this.props.history.location.pathname; const urlArr= url.split("/"); const urlFlag = (urlArr.length === 3); @@ -290,207 +303,209 @@ class Detail extends Component{ return(
-
-
-
-

- {projectDetail && projectDetail.author && projectDetail.author.name} - / - - { projectDetail && projectDetail.name } - -

-
-
-
    -
  • -1 || urlFlag) ? "active" : ""}>代码
  • -
  • -1 ? "active" : ""}>工单{projectDetail&&projectDetail.issues_count===0?"":projectDetail&&projectDetail.issues_count===0?projectDetail.issues_count:""}
  • -
  • -1 ? "active" : ""}>合并请求{projectDetail&&projectDetail.pull_requests_count===0?"":projectDetail&&projectDetail.pull_requests_count===0?projectDetail.pull_requests_count:""}
  • -
  • -1 ? "active" : ""}>版本发布
  • -
  • -1 ? "active" : ""}>动态
  • - { - isManager && -
  • 0 ? "active" : ""}>仓库设置
  • - } -
- - - this.focusFunc(projectDetail && projectDetail.watched)}> - - {projectDetail && projectDetail.watched ? '取消关注':'关注'} - - {watchers_count} + +
+
+
+

+ {projectDetail && projectDetail.author && projectDetail.author.name} + / + + { projectDetail && projectDetail.name } + +

+
+
+
    +
  • -1 || urlFlag) ? "active" : ""}>代码
  • +
  • -1 ? "active" : ""}>工单{projectDetail&&projectDetail.issues_count===0?"":projectDetail&&projectDetail.issues_count===0?projectDetail.issues_count:""}
  • +
  • -1 ? "active" : ""}>合并请求{projectDetail&&projectDetail.pull_requests_count===0?"":projectDetail&&projectDetail.pull_requests_count===0?projectDetail.pull_requests_count:""}
  • +
  • -1 ? "active" : ""}>版本发布
  • +
  • -1 ? "active" : ""}>动态
  • + { + isManager && +
  • 0 ? "active" : ""}>仓库设置
  • + } +
+ + + this.focusFunc(projectDetail && projectDetail.watched)}> + + {projectDetail && projectDetail.watched ? '取消关注':'关注'} + + {watchers_count} + + + this.pariseFunc(projectDetail && projectDetail.praised)}> + + {projectDetail && projectDetail.praised ? '取消点赞':'点赞'} + + {praises_count} + + + + Fork + {forked_count} + - - this.pariseFunc(projectDetail && projectDetail.praised)}> - - {projectDetail && projectDetail.praised ? '取消点赞':'点赞'} - - {praises_count} - - - - Fork - {forked_count} - - +
-
- - {/* 新建文件 */} - () - } - > - () - } - > + + {/* 新建文件 */} + () + } + > + () + } + > - {/* 标签列表 */} - () - } - > - {/* 仓库设置 */} - () - } - > - {/* 工单详情 */} - () - } - > - {/* 里程碑 */} - () - } - > - {/* 新建里程碑 */} - () - } - > - {/*里程碑详情*/ } - () - } - > - {/*修改里程碑*/} - () - } - > + {/* 标签列表 */} + () + } + > + {/* 仓库设置 */} + () + } + > + {/* 工单详情 */} + () + } + > + {/* 里程碑 */} + () + } + > + {/* 新建里程碑 */} + () + } + > + {/*里程碑详情*/ } + () + } + > + {/*修改里程碑*/} + () + } + > - {/* 新建工单 */} + {/* 新建工单 */} - () - } - > + () + } + > - {/* 修改详情 */} - () - } - > + {/* 修改详情 */} + () + } + > - {/* 复制详情 */} - () - } - > + {/* 复制详情 */} + () + } + > - {/* 动态 */} - () - } - > + {/* 动态 */} + () + } + > - {/* 代码Index */} - () - } - > + {/* 代码Index */} + () + } + > - () - } - > + () + } + > - () - } - > + () + } + > - () - } - > + () + } + > - () - } - > - () - } - > + () + } + > + () + } + > - () - } - > + () + } + > - () - } - > + () + } + > - () - } - > - () - } - > - () - } - > - + () + } + > + () + } + > + () + } + > + +
) } diff --git a/src/modules/tpm/NewHeader.js b/src/modules/tpm/NewHeader.js index 47abca3c4..4f8567b95 100644 --- a/src/modules/tpm/NewHeader.js +++ b/src/modules/tpm/NewHeader.js @@ -691,7 +691,7 @@ submittojoinclass=(value)=>{ this.setState({ mygetHelmetapi2: undefined }); - document.title = "EduCoder"; + document.title = "Forge"; var link = document.createElement('link'), oldLink = document.getElementById('dynamic-favicon'); link.id = 'dynamic-favicon'; diff --git a/src/modules/tpm/TPMIndexHOC.js b/src/modules/tpm/TPMIndexHOC.js index fb57bf65b..60ceab86a 100644 --- a/src/modules/tpm/TPMIndexHOC.js +++ b/src/modules/tpm/TPMIndexHOC.js @@ -264,7 +264,7 @@ export function TPMIndexHOC(WrappedComponent) { this.setState({ mygetHelmetapi: undefined }); - document.title = "EduCoder"; + document.title = "Forge"; var link = document.createElement('link'), oldLink = document.getElementById('dynamic-favicon'); link.id = 'dynamic-favicon';