From e7d8a4f0ccd544db8ce1ad052a5aa5ce12bbc262 Mon Sep 17 00:00:00 2001 From: caicai8 <1149225589@qq.com> Date: Tue, 24 Mar 2020 16:51:34 +0800 Subject: [PATCH] issue --- src/App.js | 2 +- src/forge/Main/Detail.js | 377 +++++++++++++++++---------------- src/modules/tpm/NewHeader.js | 2 +- src/modules/tpm/TPMIndexHOC.js | 2 +- 4 files changed, 199 insertions(+), 184 deletions(-) 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 } - -
-+ {projectDetail && projectDetail.author && projectDetail.author.name} + / + + { projectDetail && projectDetail.name } + +
+