forked from Gitlink/forgeplus-react
77 lines
1.9 KiB
JavaScript
77 lines
1.9 KiB
JavaScript
import React, { Component } from 'react';
|
|
|
|
import CheckPublic from './CheckPublic'
|
|
import ModeratorNav from './ModeratorNav';
|
|
|
|
import ApplyPlate from './PreApplyPlate';
|
|
import PrePlateManage from './PrePlateManage'
|
|
import axios from 'axios';
|
|
|
|
class PreModerator extends Component {
|
|
constructor(props){
|
|
super(props);
|
|
this.state={
|
|
activeKey:undefined,
|
|
bread_crumb:undefined,
|
|
is_children:false,
|
|
}
|
|
}
|
|
changeTab=(activeKey)=>{
|
|
this.setState({
|
|
activeKey
|
|
})
|
|
}
|
|
componentDidMount=()=>{
|
|
const { plateId } = this.props.match.params;
|
|
this.getPlateInfo(plateId);
|
|
}
|
|
componentDidUpdate=(prevState)=>{
|
|
let prePlateId = prevState.match.params.plateId;
|
|
const { plateId } = this.props.match.params;
|
|
if(prePlateId !== prePlateId){
|
|
this.getPlateInfo(plateId);
|
|
}
|
|
}
|
|
getPlateInfo=(plateId)=>{
|
|
const url = `/forum_sections/${plateId}/forum_section_header`;
|
|
axios.get(url).then((result)=>{
|
|
if(result){
|
|
this.setState({
|
|
bread_crumb:result.data.bread_crumb,
|
|
is_children:result.data.bread_crumb && result.data.bread_crumb.is_children
|
|
})
|
|
}
|
|
}).catch(error=>{
|
|
|
|
})
|
|
}
|
|
|
|
render(){
|
|
const { bread_crumb , is_children } = this.state;
|
|
const parentManage =()=> {
|
|
if(!is_children){
|
|
return(
|
|
<React.Fragment>
|
|
<PrePlateManage {...this.props} {...this.state} getPlateInfo={this.getPlateInfo}/>
|
|
|
|
{/* 板块申请 */}
|
|
<ApplyPlate {...this.props} {...this.state}/>
|
|
</React.Fragment>
|
|
)
|
|
}
|
|
}
|
|
return(
|
|
<div className="educontent">
|
|
|
|
<ModeratorNav {...this.props} {...this.state}/>
|
|
|
|
{parentManage()}
|
|
|
|
{/* 审批(二级版主只有这一块) */}
|
|
<CheckPublic {...this.props} {...this.state} bread_crumb={bread_crumb}/>
|
|
</div>
|
|
)
|
|
}
|
|
}
|
|
|
|
export default PreModerator; |