Merge branch 'ysm1' of https://bdgit.educoder.net/Hjqreturn/educoder into yslcompetition

dev_sync_trustie
杨树林 6 years ago
commit afb17b85f9

@ -1,6 +1,6 @@
import React, { Component } from 'react'; import React, { Component } from 'react';
import { Link } from 'react-router-dom'; import { Link } from 'react-router-dom';
import { Menu, Icon, List, Avatar,Row, Col,Tag,Pagination} from 'antd'; import { Menu, Icon, List, Avatar,Row, Col,Tag,Pagination,Alert} from 'antd';
import {getImageUrl} from 'educoder'; import {getImageUrl} from 'educoder';
import axios from 'axios'; import axios from 'axios';
import './Competitionsindex.css'; import './Competitionsindex.css';
@ -78,8 +78,7 @@ class CompetitionsIndex extends Component{
} }
render() { render() {
let {datas,page,count}=this.state; let {datas,page,count}=this.state;
admin: true
business: false
console.log(this.props.current_user&&this.props.current_user.business) console.log(this.props.current_user&&this.props.current_user.business)
return ( return (
<div> <div>
@ -133,7 +132,11 @@ class CompetitionsIndex extends Component{
dataSource={datas&&datas} dataSource={datas&&datas}
renderItem={(item,key) => ( renderItem={(item,key) => (
<div> <div>
<div className={"CompetitionsList"} > <div className={"CompetitionsList"} >
{item.competition_status==="nearly_published"?
this.props.current_user&&this.props.current_user.admin===true?"":this.props.current_user&&this.props.current_user.business===true?"":<div className={"CompetitionsListzhezhao"}>即将发布 敬请期待</div>:""}
{/*<div className={"CompetitionsListzhezhao"}>即将发布 敬请期待</div>*/}
{item.description===null||item.description===undefined||item.description===""?<style> {item.description===null||item.description===undefined||item.description===""?<style>
{ {
` `
@ -180,14 +183,14 @@ class CompetitionsIndex extends Component{
} }
> >
<List.Item.Meta <List.Item.Meta
title={<a className={item.competition_status==="ended"?"endedfont":item.competition_status==="nearly_published"? title={<div className={item.competition_status==="ended"?"endedfont":item.competition_status==="nearly_published"?
this.props.current_user&&this.props.current_user.business===true?"":this.props.current_user&&this.props.current_user.admin===true?"":"endedfont":""}> this.props.current_user&&this.props.current_user.admin===true?"competitionstitlesshou":this.props.current_user&&this.props.current_user.business===true?"competitionstitlesshou":"endedfont":"competitionstitlesshou"}>
<span className={"competitionstitles"} <span className={"competitionstitles"}
onClick={()=>this.setcompetitonurl(item.competition_status==="ended"?null:item.competition_status==="nearly_published"? this.props.current_user&&this.props.current_user.business===true?`/newcompetitions/${item.identifier}/common_header`:this.props.current_user&&this.props.current_user.admin===true?`/newcompetitions/${item.identifier}/common_header`:null:item.competition_status==="progressing"?`/newcompetitions/${item.identifier}/common_header`:null)} onClick={()=>this.setcompetitonurl(item.competition_status==="ended"?null:item.competition_status==="nearly_published"? this.props.current_user&&this.props.current_user.business===true?`/newcompetitions/${item.identifier}/common_header`:this.props.current_user&&this.props.current_user.admin===true?`/newcompetitions/${item.identifier}/common_header`:null:item.competition_status==="progressing"?`/newcompetitions/${item.identifier}/common_header`:null)}
>{item.name}</span><span>{item.sub_title===null?"":<Tag className="competitionsrelative" color="#87d068">{ >{item.name}</span><span>{item.sub_title===null?"":<Tag className="competitionsrelative" color="#87d068">{
item.sub_title item.sub_title
}</Tag>}</span> }</Tag>}</span>
</a>} </div>}
/> />
{item.description} {item.description}
</List.Item> </List.Item>
@ -199,7 +202,7 @@ class CompetitionsIndex extends Component{
} }
/>} />}
{datas===undefined?'none':datas.task_count >20 ?<div className="mb40 edu-txt-center padding20-30" {datas===undefined?"":datas.task_count >20 ?<div className="mb40 edu-txt-center padding20-30"
> >
<Pagination <Pagination

@ -117,14 +117,24 @@
.endedfont{ .endedfont{
color:#000 !important; color:#000 !important;
} }
.zhezhaos{ .CompetitionsListzhezhao{
position: absolute;
height: 200px; top: 0px;
overflow: hidden; left: 0px;
position: relative; width: 1206px;
border: 1px solid rgb(235, 237, 240); height: 100%;
border-radius: 2px; z-index: 10000;
padding: 48px; display: none;
background: rgba(51, 51, 51,0.7);
text-align: center; text-align: center;
background: rgb(250, 250, 250); line-height: 170px;
color: #fff;
font-size: 50px;
}
.CompetitionsList:hover .CompetitionsListzhezhao{
display: block;
}
.competitionstitlesshou:hover{
cursor: pointer;
color: #1c91e8 !important;
} }

@ -1,5 +1,5 @@
import React, { Component } from 'react'; import React, { Component } from 'react';
import { Breadcrumb,Layout,Table, Divider, Tag,Badge} from 'antd'; import { Breadcrumb,Layout,Table, Divider, Tag,Badge,Tooltip} from 'antd';
import axios from 'axios'; import axios from 'axios';
@ -156,13 +156,19 @@ class Competitionteams extends Component{
title: '被fork发布的学习人数', title: '被fork发布的学习人数',
dataIndex: 'forked_myshixun_count', dataIndex: 'forked_myshixun_count',
key: 'forked_myshixun_count', key: 'forked_myshixun_count',
render: (text, record) => <div className={record.creator==="合计:"?"teamsLayoucolor-orange":""}>{text}</div>, render: (text, record) =>
<Tooltip placement="bottom" title={"fork该实训产生的新实训学习总人数"}>
<div className={record.creator==="合计:"?"teamsLayoucolor-orange":""}>{text}</div>
</Tooltip>,
}, },
{ {
title: '有效作品数', title: '有效作品数',
dataIndex: 'valid_count', dataIndex: 'valid_count',
key: 'valid_count', key: 'valid_count',
render: (text, record) => <div className={record.creator==="合计:"?"teamsLayoucolor-orange":""}>{text}</div>, render: (text, record) =>
<Tooltip placement="bottom" title={"至少完成了1个关卡"}>
<div className={record.creator==="合计:"?"teamsLayoucolor-orange":""}>{text}</div>
</Tooltip>,
}, },
{ {
title: '应用值', title: '应用值',
@ -195,13 +201,19 @@ class Competitionteams extends Component{
title: '被fork发布的学习人数', title: '被fork发布的学习人数',
dataIndex: 'shixun_homework_count', dataIndex: 'shixun_homework_count',
key: 'shixun_homework_count', key: 'shixun_homework_count',
render: (text, record) => <div className={record.creator==="合计:"?"teamsLayoucolor-orange":""}>{text}</div>, render: (text, record) =>
<Tooltip placement="bottom" title={"fork该实训产生的新实训学习总人数"}>
<div className={record.creator==="合计:"?"teamsLayoucolor-orange":""}>{text}</div>
</Tooltip>,
}, },
{ {
title: '有效作品数', title: '有效作品数',
dataIndex: 'valid_count', dataIndex: 'valid_count',
key: 'valid_count', key: 'valid_count',
render: (text, record) => <div className={record.creator==="合计:"?"teamsLayoucolor-orange":""}>{text}</div>, render: (text, record) =>
<Tooltip placement="bottom" title={"至少完成了1个关卡"}>
<div className={record.creator==="合计:"?"teamsLayoucolor-orange":""}>{text}</div>
</Tooltip>,
}, },
{ {
title: '应用值', title: '应用值',

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

@ -21,7 +21,7 @@ class CompetitionContents extends Component{
render() { render() {
let{mdContent}=this.props;
return ( return (
<div className={"fr"}> <div className={"fr"}>

Loading…
Cancel
Save