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