竞赛调整

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

@ -123,10 +123,10 @@ class CompetitionsIndex extends Component{
size="large"
dataSource={datas&&datas}
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"?
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"} >
{item.competition_status==="nearly_published"?
@ -180,18 +180,18 @@ class CompetitionsIndex extends Component{
<List.Item.Meta
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"}>
<span 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)}
>{item.name}{item.sub_title===null?"":`——${item.sub_title}`}</span>
<a className={"competitionstitles"}
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}`}</a>
{/*<span>{item.sub_title===null?"":*/}
{/*<Tag className="competitionsrelative" color="#87d068">{item.sub_title}</Tag>}*/}
{/*</span>*/}
</a>}
/>
{item.description}
<span className={"span666"}>{item.description}</span>
</List.Item>
</div>
</div>
</a>
)

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

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

@ -26,9 +26,9 @@ class CompetitionContents extends Component{
return (
<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 "}>
<Content className={"markdown-body"} dangerouslySetInnerHTML={{__html: markdownToHTML(mdContentdata===undefined?"":mdContentdata.md_content===undefined||mdContentdata.md_content===null?"":mdContentdata.md_content).replace(/▁/g, "▁▁▁")}}>
</Content>

@ -1,6 +1,7 @@
import React, { Component } from 'react';
import {Button,Layout,Tabs,Icon, Card, Avatar, Row, Col ,Table} from 'antd';
import {markdownToHTML,getImageUrl} from 'educoder';
import axios from 'axios';
import NoneData from "../../courses/shixunHomework/shixunHomework";
const { Content } = Layout;
@ -11,17 +12,28 @@ class CompetitionContents extends Component{
constructor(props) {
super(props)
this.state={
personal:undefined
}
}
componentDidMount(){
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() {
const operations =
<div>
const operations = <div>
<Button className={"fr"} type="primary" ghost onClick={()=>this.props.Competitionedit()}>编辑</Button>
<Button className={"fr mr20"} type="primary" ghost>
<a href={`/competitions/${this.props.match.params.identifier}/charts.xlsx`}>导出</a>
@ -71,13 +83,14 @@ class CompetitionContents extends Component{
const data = [];
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)=>{
if(key>2){
let list={
usersum:key+1,
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,
spendtime:item.spend_time,
score:item.score,
@ -92,7 +105,7 @@ class CompetitionContents extends Component{
// console.log(this.props.chartdata&&this.props.chartdata.user_ranks)
return (
<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)=>{
return(
<TabPane tab={item.name} key={item.id===null?0:item.id}>
@ -134,7 +147,7 @@ class CompetitionContents extends Component{
<div className={"mt10"}>
<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}`)} />
<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>
</div>
</li>
@ -170,7 +183,7 @@ class CompetitionContents extends Component{
<div className={"mt10"}>
<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}`)} />
<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>
</div>
</li>
@ -206,7 +219,7 @@ class CompetitionContents extends Component{
<div className={"mt10"}>
<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}`)} />
<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>
</div>
</li>

Loading…
Cancel
Save