This commit is contained in:
caicai8 2020-03-24 16:51:34 +08:00
parent 34312abc24
commit e7d8a4f0cc
4 changed files with 199 additions and 184 deletions

View File

@ -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';

View File

@ -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,6 +303,7 @@ class Detail extends Component{
return(
<div>
<Spin spinning={isSpin}>
<div className="detailHeader-wrapper">
<div className="normal">
<div className="f-wrap-between mb20">
@ -491,6 +505,7 @@ class Detail extends Component{
}
></Route>
</Switch>
</Spin>
</div>
)
}

View File

@ -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';

View File

@ -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';