Merge pull request '细节问题以及去掉不必要的接口' (#133) from caishi/forgeplus-react:pre_develop_dev into pre_develop_dev
This commit is contained in:
commit
4e3215c6f9
|
@ -3,7 +3,6 @@ import { Route , Switch } from 'react-router-dom';
|
|||
// import Top from './DetailTop';
|
||||
import Loadable from 'react-loadable';
|
||||
import Loading from '../../Loading';
|
||||
import axios from 'axios';
|
||||
import './Index.scss';
|
||||
|
||||
const FileNew = Loadable({
|
||||
|
@ -51,37 +50,37 @@ class CoderRootIndex extends Component{
|
|||
}
|
||||
}
|
||||
|
||||
componentDidMount=()=>{
|
||||
this.Init();
|
||||
}
|
||||
componentDidUpdate=(prevProps)=>{
|
||||
const { location } = this.props;
|
||||
const prevlocation = prevProps && prevProps.location;
|
||||
if (location !== prevlocation) {
|
||||
this.Init();
|
||||
}
|
||||
}
|
||||
// componentDidMount=()=>{
|
||||
// this.Init();
|
||||
// }
|
||||
// componentDidUpdate=(prevProps)=>{
|
||||
// const { location } = this.props;
|
||||
// const prevlocation = prevProps && prevProps.location;
|
||||
// if (location !== prevlocation) {
|
||||
// this.Init();
|
||||
// }
|
||||
// }
|
||||
|
||||
Init=()=>{
|
||||
const { branchName } = this.props.match.params;
|
||||
const { defaultBranch } = this.props;
|
||||
this.getTopCount(branchName || defaultBranch);
|
||||
}
|
||||
// Init=()=>{
|
||||
// const { branchName } = this.props.match.params;
|
||||
// const { defaultBranch } = this.props;
|
||||
// this.getTopCount(branchName || defaultBranch);
|
||||
// }
|
||||
|
||||
// 获取<Top />组件里要显示的数据
|
||||
getTopCount=(branch)=>{
|
||||
const { projectsId , owner } = this.props.match.params;
|
||||
const url = `/${owner}/${projectsId}/top_counts.json`;
|
||||
axios.get(url,{params:{
|
||||
ref:branch
|
||||
}}).then(result=>{
|
||||
if(result){
|
||||
this.setState({
|
||||
coderCount:result.data
|
||||
})
|
||||
}
|
||||
}).catch(error=>{console.log(error);})
|
||||
}
|
||||
// getTopCount=(branch)=>{
|
||||
// const { projectsId , owner } = this.props.match.params;
|
||||
// const url = `/${owner}/${projectsId}/top_counts.json`;
|
||||
// axios.get(url,{params:{
|
||||
// ref:branch
|
||||
// }}).then(result=>{
|
||||
// if(result){
|
||||
// this.setState({
|
||||
// coderCount:result.data
|
||||
// })
|
||||
// }
|
||||
// }).catch(error=>{console.log(error);})
|
||||
// }
|
||||
render(){
|
||||
return(
|
||||
<div className="coderSubPage">
|
||||
|
@ -100,12 +99,12 @@ class CoderRootIndex extends Component{
|
|||
></Route>
|
||||
<Route path="/:owner/:projectsId/:branch/newfile"
|
||||
render={
|
||||
(props) => (<FileNew {...this.props} {...props} {...this.state} getTopCount={this.getTopCount} />)
|
||||
(props) => (<FileNew {...this.props} {...props} {...this.state} />)
|
||||
}
|
||||
></Route>
|
||||
<Route path="/:owner/:projectsId/commits/branch/:branchName"
|
||||
render={
|
||||
() => (<CoderRootCommit {...this.props} {...this.state} commit_class="main" getTopCount={this.getTopCount} />)
|
||||
() => (<CoderRootCommit {...this.props} {...this.state} commit_class="main" />)
|
||||
}
|
||||
></Route>
|
||||
<Route path="/:owner/:projectsId/commits/:sha"
|
||||
|
@ -115,7 +114,7 @@ class CoderRootIndex extends Component{
|
|||
></Route>
|
||||
<Route path="/:owner/:projectsId/commits"
|
||||
render={
|
||||
() => (<CoderRootCommit {...this.props} {...this.state} commit_class="main" getTopCount={this.getTopCount} />)
|
||||
() => (<CoderRootCommit {...this.props} {...this.state} commit_class="main" />)
|
||||
}
|
||||
></Route>
|
||||
{/* <Route path="/:owner/:projectsId/releases/:versionId/update"
|
||||
|
|
|
@ -224,7 +224,7 @@
|
|||
height: 8px;
|
||||
width: 8px;
|
||||
left: 0px;
|
||||
top:10px
|
||||
top:8px;
|
||||
}
|
||||
&>span{
|
||||
padding-left: 15px;
|
||||
|
|
|
@ -83,8 +83,7 @@ class UserSubmitComponent extends Component {
|
|||
if (result.data && result.data.name) {
|
||||
this.props.showNotification("文件新建成功!");
|
||||
if(submitType === "1"){
|
||||
const { getTopCount , getDetail } = this.props;
|
||||
getTopCount && getTopCount(values.branchname);
|
||||
const { getDetail } = this.props;
|
||||
getDetail && getDetail();
|
||||
}
|
||||
let url = `/${owner}/${projectsId}${values.branchname ? `/tree/${turnbar(values.branchname)}`: (branch ? `/tree/${turnbar(branch)}` : "")}`;
|
||||
|
|
Loading…
Reference in New Issue