|
|
@ -16,46 +16,69 @@ class CompetitionCommon extends Component{
|
|
|
|
super(props)
|
|
|
|
super(props)
|
|
|
|
this.state={
|
|
|
|
this.state={
|
|
|
|
data:undefined,
|
|
|
|
data:undefined,
|
|
|
|
bannerdata:undefined
|
|
|
|
bannerdata:undefined,
|
|
|
|
|
|
|
|
module_type:undefined
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
componentDidMount(){
|
|
|
|
componentDidMount(){
|
|
|
|
window.document.title = '竞赛';
|
|
|
|
window.document.title = '竞赛';
|
|
|
|
this.getbannerdata();
|
|
|
|
if(this.props.match.params.identifier!=null){
|
|
|
|
let url=`/competitions/${this.props.match.params.identifier}.json`;
|
|
|
|
this.getbannerdata();
|
|
|
|
|
|
|
|
let url=`/competitions/${this.props.match.params.identifier}.json`;
|
|
|
|
|
|
|
|
axios.get(url).then((response) => {
|
|
|
|
|
|
|
|
if(response.status===200){
|
|
|
|
|
|
|
|
this.setState({
|
|
|
|
|
|
|
|
bannerdata:response.data
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}).catch((error) => {
|
|
|
|
|
|
|
|
console.log(error)
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
getbannerdata=()=>{
|
|
|
|
|
|
|
|
let url=`/competitions/${this.props.match.params.identifier}/common_header.json`;
|
|
|
|
axios.get(url).then((response) => {
|
|
|
|
axios.get(url).then((response) => {
|
|
|
|
if(response.status===200){
|
|
|
|
if(response.status===200){
|
|
|
|
this.setState({
|
|
|
|
this.setState({
|
|
|
|
bannerdata:response.data
|
|
|
|
data:response.data,
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
this.getrightdata(
|
|
|
|
|
|
|
|
response.data.competition_modules[0].id,
|
|
|
|
|
|
|
|
response.data.competition_modules[0].module_type,
|
|
|
|
|
|
|
|
response.data.competition_modules[0].module_url,
|
|
|
|
|
|
|
|
response.data.competition_modules[0].has_url
|
|
|
|
|
|
|
|
)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}).catch((error) => {
|
|
|
|
}).catch((error) => {
|
|
|
|
console.log(error)
|
|
|
|
console.log(error)
|
|
|
|
})
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
getbannerdata=()=>{
|
|
|
|
getrightdata=(id,typeid,module_url,has_url)=>{
|
|
|
|
let url=`/competitions/${this.props.match.params.identifier}/common_header.json`;
|
|
|
|
console.log(id,typeid,module_url,has_url)
|
|
|
|
|
|
|
|
this.setState({
|
|
|
|
|
|
|
|
module_id:id,
|
|
|
|
|
|
|
|
module_type:typeid
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
let url=`${module_url}.json`;
|
|
|
|
axios.get(url).then((response) => {
|
|
|
|
axios.get(url).then((response) => {
|
|
|
|
if(response.status===200){
|
|
|
|
if(response.status===200){
|
|
|
|
this.setState({
|
|
|
|
this.setState({
|
|
|
|
data:response.data
|
|
|
|
mdContent:response.data
|
|
|
|
})
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}).catch((error) => {
|
|
|
|
}).catch((error) => {
|
|
|
|
console.log(error)
|
|
|
|
console.log(error)
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
getrightdata=(id,typeid)=>{
|
|
|
|
|
|
|
|
debugger
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
render() {
|
|
|
|
render() {
|
|
|
|
let {data,bannerdata}=this.state;
|
|
|
|
let {data,bannerdata,module_type,module_id,mdContent}=this.state;
|
|
|
|
// console.log(bannerdata)
|
|
|
|
console.log(module_type)
|
|
|
|
return (
|
|
|
|
return (
|
|
|
|
data===undefined?"":<div className={"educontent clearfix mt20 "}>
|
|
|
|
data===undefined?"":<div className={"educontent clearfix mt20 "}>
|
|
|
|
|
|
|
|
|
|
|
@ -147,7 +170,7 @@ debugger
|
|
|
|
{data&&data.competition_modules.map((item,key)=>{
|
|
|
|
{data&&data.competition_modules.map((item,key)=>{
|
|
|
|
return(
|
|
|
|
return(
|
|
|
|
<Menu.Item key={item.position}>
|
|
|
|
<Menu.Item key={item.position}>
|
|
|
|
{item.has_url===false?<span onClick={()=>this.getrightdata(item.id,item.module_type)}>{item.name}</span>:<a
|
|
|
|
{item.has_url===false?<span onClick={()=>this.getrightdata(item.id,item.module_type,item.module_url,item.has_url)}>{item.name}</span>:<a
|
|
|
|
// target="_blank"
|
|
|
|
// target="_blank"
|
|
|
|
href={item.module_url}
|
|
|
|
href={item.module_url}
|
|
|
|
// onClick={()=>this.getrightdata(item.id,item.module_type)}
|
|
|
|
// onClick={()=>this.getrightdata(item.id,item.module_type)}
|
|
|
@ -160,8 +183,13 @@ debugger
|
|
|
|
</Sider>
|
|
|
|
</Sider>
|
|
|
|
|
|
|
|
|
|
|
|
<Layout className={"teamsLayoutleft"}>
|
|
|
|
<Layout className={"teamsLayoutleft"}>
|
|
|
|
<CompetitionContents/>
|
|
|
|
{this.state.module_type==="chart"?<CompetitionContentsChart
|
|
|
|
<CompetitionContentsChart/>
|
|
|
|
{...this.props}
|
|
|
|
|
|
|
|
{...this.state}
|
|
|
|
|
|
|
|
/>:<CompetitionContents
|
|
|
|
|
|
|
|
{...this.props}
|
|
|
|
|
|
|
|
{...this.state}
|
|
|
|
|
|
|
|
/>}
|
|
|
|
</Layout>
|
|
|
|
</Layout>
|
|
|
|
|
|
|
|
|
|
|
|
</Layout>
|
|
|
|
</Layout>
|
|
|
|