竞赛调整

dev_auth
杨树明 5 years ago
parent beffad8b19
commit 61868d1a77

@ -123,10 +123,10 @@ class CompetitionsIndex extends Component{
size="large" size="large"
dataSource={datas&&datas} dataSource={datas&&datas}
renderItem={(item,key) => ( renderItem={(item,key) => (
<div <a href={item.competition_status==="ended"?`/newcompetitions/${item.identifier}/common_header`: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}
className={item.competition_status==="ended"?"competitionstitlesshou":item.competition_status==="nearly_published"? className={item.competition_status==="ended"?"competitionstitlesshou":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"} this.props.current_user&&this.props.current_user.admin===true?"competitionstitlesshou":this.props.current_user&&this.props.current_user.business===true?"competitionstitlesshou":"endedfont":"competitionstitlesshou"}
onClick={()=>this.setcompetitonurl(item.competition_status==="ended"?`/newcompetitions/${item.identifier}/common_header`: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)}> >
<div className={"CompetitionsList"} > <div className={"CompetitionsList"} >
{item.competition_status==="nearly_published"? {item.competition_status==="nearly_published"?
@ -180,18 +180,18 @@ class CompetitionsIndex extends Component{
<List.Item.Meta <List.Item.Meta
title={<a className={item.competition_status==="ended"?"competitionstitlesshou":item.competition_status==="nearly_published"? title={<a className={item.competition_status==="ended"?"competitionstitlesshou":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"}> 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"} <a className={"competitionstitles"}
onClick={()=>this.setcompetitonurl(item.competition_status==="ended"?`/newcompetitions/${item.identifier}/common_header`: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)} href={item.competition_status==="ended"?`/newcompetitions/${item.identifier}/common_header`: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}{item.sub_title===null?"":`——${item.sub_title}`}</span> >{item.name}{item.sub_title===null?"":`——${item.sub_title}`}</a>
{/*<span>{item.sub_title===null?"":*/} {/*<span>{item.sub_title===null?"":*/}
{/*<Tag className="competitionsrelative" color="#87d068">{item.sub_title}</Tag>}*/} {/*<Tag className="competitionsrelative" color="#87d068">{item.sub_title}</Tag>}*/}
{/*</span>*/} {/*</span>*/}
</a>} </a>}
/> />
{item.description} <span className={"span666"}>{item.description}</span>
</List.Item> </List.Item>
</div> </div>
</div> </a>
) )

@ -130,13 +130,14 @@
text-align: center; text-align: center;
color: #fff; color: #fff;
font-size: 22px; font-size: 22px;
display: flex;
align-items: center; align-items: center;
justify-content: space-around; justify-content: space-around;
flex-direction: column; flex-direction: column;
} }
.CompetitionsList:hover .CompetitionsListzhezhao{ .CompetitionsList:hover .CompetitionsListzhezhao{
display: block; display: block;
display: flex;
} }
.competitionstitlesshou:hover a{ .competitionstitlesshou:hover a{
cursor: pointer; cursor: pointer;
@ -155,3 +156,7 @@
background-position: 50% !important; background-position: 50% !important;
background-repeat: no-repeat !important; background-repeat: no-repeat !important;
} }
.span666{
color:#666666 !important;
}

@ -22,7 +22,8 @@ class CompetitionCommon extends Component{
mdContentdata:undefined, mdContentdata:undefined,
chart_rules:undefined, chart_rules:undefined,
Competitionedittype:false, Competitionedittype:false,
chartdata:undefined chartdata:undefined,
has_url:false
} }
} }
@ -148,16 +149,19 @@ class CompetitionCommon extends Component{
}) })
}else{ }else{
if(module_url.substring(0,7)=='http://'||module_url.substring(0,8)=='https://') { if(module_url.substring(0,7)=='http://'||module_url.substring(0,8)=='https://') {
window.location.href= module_url // window.location.href= module_url
window.open(module_url)
}else{ }else{
window.location.href="https://"+module_url; window.open(`https://${module_url}`)
// window.location.href=;
} }
return return
} }
this.setState({ this.setState({
module_id:id, module_id:id,
module_type:typeid module_type:typeid,
has_url:has_url
}) })
} }
@ -217,7 +221,7 @@ class CompetitionCommon extends Component{
} }
render() { render() {
let {data,bannerdata,module_type,Competitionedittype,mdContentdata}=this.state; let {data,has_url,module_type,Competitionedittype,mdContentdata}=this.state;
return ( return (
data===undefined?"":<div className={"educontent clearfix mt20 "}> data===undefined?"":<div className={"educontent clearfix mt20 "}>

@ -26,9 +26,9 @@ class CompetitionContents extends Component{
return ( return (
<div className={"fr"}> <div className={"fr"}>
{this.props.current_user&&this.props.current_user.admin===true||this.props.current_user&&this.props.current_user.business===true?this.props.Competitionedittype===false?<Button className={"fr"} type="primary" ghost onClick={()=>this.props.Competitionedit()}> {this.props.current_user&&this.props.current_user.admin===true||this.props.current_user&&this.props.current_user.business===true?this.props.Competitionedittype===false?this.props.has_url===false?<Button className={"fr"} type="primary" ghost onClick={()=>this.props.Competitionedit()}>
编辑 编辑
</Button>:"":""} </Button>:"":"":""}
<div className={this.props.current_user&&this.props.current_user.admin===true||this.props.current_user&&this.props.current_user.business===true?"mt50 mb100 ":"mb100 "}> <div className={this.props.current_user&&this.props.current_user.admin===true||this.props.current_user&&this.props.current_user.business===true?"mt50 mb100 ":"mb100 "}>
<Content className={"markdown-body"} dangerouslySetInnerHTML={{__html: markdownToHTML(mdContentdata===undefined?"":mdContentdata.md_content===undefined||mdContentdata.md_content===null?"":mdContentdata.md_content).replace(/▁/g, "▁▁▁")}}> <Content className={"markdown-body"} dangerouslySetInnerHTML={{__html: markdownToHTML(mdContentdata===undefined?"":mdContentdata.md_content===undefined||mdContentdata.md_content===null?"":mdContentdata.md_content).replace(/▁/g, "▁▁▁")}}>
</Content> </Content>

@ -1,6 +1,7 @@
import React, { Component } from 'react'; import React, { Component } from 'react';
import {Button,Layout,Tabs,Icon, Card, Avatar, Row, Col ,Table} from 'antd'; import {Button,Layout,Tabs,Icon, Card, Avatar, Row, Col ,Table} from 'antd';
import {markdownToHTML,getImageUrl} from 'educoder'; import {markdownToHTML,getImageUrl} from 'educoder';
import axios from 'axios';
import NoneData from "../../courses/shixunHomework/shixunHomework"; import NoneData from "../../courses/shixunHomework/shixunHomework";
const { Content } = Layout; const { Content } = Layout;
@ -11,17 +12,28 @@ class CompetitionContents extends Component{
constructor(props) { constructor(props) {
super(props) super(props)
this.state={ this.state={
personal:undefined
} }
} }
componentDidMount(){ componentDidMount(){
window.document.title = '竞赛'; window.document.title = '竞赛';
let url=`/competitions/${this.props.match.params.identifier}/competition_staff.json`;
axios.get(url)
.then((response) => {
if(response.status===200){
console.log(response)
this.setState({
personal:response.data.personal
})
}
}).catch((error) => {
console.log(error)
})
} }
render() { render() {
const operations = const operations = <div>
<div>
<Button className={"fr"} type="primary" ghost onClick={()=>this.props.Competitionedit()}>编辑</Button> <Button className={"fr"} type="primary" ghost onClick={()=>this.props.Competitionedit()}>编辑</Button>
<Button className={"fr mr20"} type="primary" ghost> <Button className={"fr mr20"} type="primary" ghost>
<a href={`/competitions/${this.props.match.params.identifier}/charts.xlsx`}>导出</a> <a href={`/competitions/${this.props.match.params.identifier}/charts.xlsx`}>导出</a>
@ -71,13 +83,14 @@ class CompetitionContents extends Component{
const data = []; const data = [];
let {chart_rules,chartdata}=this.props; let {chart_rules,chartdata}=this.props;
let {personal}=this.state;
chartdata===undefined?"":chartdata.teams.length===0||chartdata.teams.length<3?"":chartdata.teams.map((item,key)=>{ chartdata===undefined?"":chartdata.teams.length===0||chartdata.teams.length<3?"":chartdata.teams.map((item,key)=>{
if(key>2){ if(key>2){
let list={ let list={
usersum:key+1, usersum:key+1,
userimg:item.user_image, userimg:item.user_image,
username:item.record_user_name, username:personal===undefined||personal===null?item.record_user_name:personal===false?item.record_user_name:item.team_name,
school:item.school_name, school:item.school_name,
spendtime:item.spend_time, spendtime:item.spend_time,
score:item.score, score:item.score,
@ -92,7 +105,7 @@ class CompetitionContents extends Component{
// console.log(this.props.chartdata&&this.props.chartdata.user_ranks) // console.log(this.props.chartdata&&this.props.chartdata.user_ranks)
return ( return (
<div> <div>
{chart_rules===undefined?"":<Tabs onChange={(e)=>this.props.Competitioncallback(e)} activeKey={this.props.tabkey} tabBarExtraContent={this.props.current_user&&this.props.current_user.admin===true||this.props.current_user&&this.props.current_user.business===true?this.props.Competitionedittype===false?operations:"":""}> {chart_rules===undefined?"":<Tabs onChange={(e)=>this.props.Competitioncallback(e)} activeKey={this.props.tabkey} tabBarExtraContent={this.props.current_user&&this.props.current_user.admin===true||this.props.current_user&&this.props.current_user.business===true?this.props.Competitionedittype===false?this.props.has_url===false?operations:"":"":""}>
{chart_rules.stages.map((item,key)=>{ {chart_rules.stages.map((item,key)=>{
return( return(
<TabPane tab={item.name} key={item.id===null?0:item.id}> <TabPane tab={item.name} key={item.id===null?0:item.id}>
@ -134,7 +147,7 @@ class CompetitionContents extends Component{
<div className={"mt10"}> <div className={"mt10"}>
<a href={`/users/${item.user_login}`} className="color-dark"> <a href={`/users/${item.user_login}`} className="color-dark">
<img className={"rankingimg"} src={getImageUrl(`images/${item.user_image===null?`avatars/User/0?1442652658`:item.user_image}`)} /> <img className={"rankingimg"} src={getImageUrl(`images/${item.user_image===null?`avatars/User/0?1442652658`:item.user_image}`)} />
<p className="task-hide rankName mt5 jinshaifont">{item.user_name}</p> <p className="task-hide rankName mt5 jinshaifont">{personal===undefined||personal===null?item.record_user_name:personal===false?item.record_user_name:item.team_name}</p>
</a> </a>
</div> </div>
</li> </li>
@ -170,7 +183,7 @@ class CompetitionContents extends Component{
<div className={"mt10"}> <div className={"mt10"}>
<a href={`/users/${item.user_login}`} className="color-dark"> <a href={`/users/${item.user_login}`} className="color-dark">
<img className={"rankingimg"} src={getImageUrl(`images/${item.user_image===null?`avatars/User/0?1442652658`:item.user_image}`)} /> <img className={"rankingimg"} src={getImageUrl(`images/${item.user_image===null?`avatars/User/0?1442652658`:item.user_image}`)} />
<p className="task-hide rankName mt5 jinshaifont">{item.record_user_name}</p> <p className="task-hide rankName mt5 jinshaifont">{personal===undefined||personal===null?item.record_user_name:personal===false?item.record_user_name:item.team_name}</p>
</a> </a>
</div> </div>
</li> </li>
@ -206,7 +219,7 @@ class CompetitionContents extends Component{
<div className={"mt10"}> <div className={"mt10"}>
<a href={`/users/${item.user_login}`} className="color-dark"> <a href={`/users/${item.user_login}`} className="color-dark">
<img className={"rankingimg"} src={getImageUrl(`images/${item.user_image===null?`avatars/User/0?1442652658`:item.user_image}`)} /> <img className={"rankingimg"} src={getImageUrl(`images/${item.user_image===null?`avatars/User/0?1442652658`:item.user_image}`)} />
<p className="task-hide rankName mt5 jinshaifont">{item.record_user_name}</p> <p className="task-hide rankName mt5 jinshaifont">{personal===undefined||personal===null?item.record_user_name:personal===false?item.record_user_name:item.team_name}</p>
</a> </a>
</div> </div>
</li> </li>

Loading…
Cancel
Save