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

dev_sync_trustie
杨树林 5 years ago
commit afb17b85f9

@ -1,6 +1,6 @@
import React, { Component } from 'react';
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 axios from 'axios';
import './Competitionsindex.css';
@ -78,8 +78,7 @@ class CompetitionsIndex extends Component{
}
render() {
let {datas,page,count}=this.state;
admin: true
business: false
console.log(this.props.current_user&&this.props.current_user.business)
return (
<div>
@ -133,7 +132,11 @@ class CompetitionsIndex extends Component{
dataSource={datas&&datas}
renderItem={(item,key) => (
<div>
<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>
{
`
@ -180,14 +183,14 @@ class CompetitionsIndex extends Component{
}
>
<List.Item.Meta
title={<a 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":""}>
title={<div className={item.competition_status==="ended"?"endedfont":item.competition_status==="nearly_published"?
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"}
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.sub_title
}</Tag>}</span>
</a>}
</div>}
/>
{item.description}
</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

@ -117,14 +117,24 @@
.endedfont{
color:#000 !important;
}
.zhezhaos{
height: 200px;
overflow: hidden;
position: relative;
border: 1px solid rgb(235, 237, 240);
border-radius: 2px;
padding: 48px;
.CompetitionsListzhezhao{
position: absolute;
top: 0px;
left: 0px;
width: 1206px;
height: 100%;
z-index: 10000;
display: none;
background: rgba(51, 51, 51,0.7);
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 { Breadcrumb,Layout,Table, Divider, Tag,Badge} from 'antd';
import { Breadcrumb,Layout,Table, Divider, Tag,Badge,Tooltip} from 'antd';
import axios from 'axios';
@ -156,13 +156,19 @@ class Competitionteams extends Component{
title: '被fork发布的学习人数',
dataIndex: '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: '有效作品数',
dataIndex: '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: '应用值',
@ -195,13 +201,19 @@ class Competitionteams extends Component{
title: '被fork发布的学习人数',
dataIndex: '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: '有效作品数',
dataIndex: '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: '应用值',

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

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

Loading…
Cancel
Save