统计模块,竞赛权限调整

dev_local_cqdsj
杨树明 5 years ago
parent 762fa4b04e
commit f51b6a7f77

@ -53,14 +53,6 @@ class CompetitionsIndex extends Component{
this.getdata(e.key,page)
};
setcompetitonurl=(url)=>{
if(url!=null){
// this.props.history.push(url);
window.location.href=url;
}
}
PaginationCourse=(pageNumber)=>{
let {category}=this.state;
this.setState({
@ -68,6 +60,7 @@ class CompetitionsIndex extends Component{
})
this.getdata(category,pageNumber);
}
render() {
let {datas,page,count}=this.state;
@ -124,14 +117,14 @@ class CompetitionsIndex extends Component{
size="large"
dataSource={datas&&datas}
renderItem={(item,key) => (
<a target="_blank" href={item.competition_status==="ended"?`/competitions/${item.identifier}/common_header`:item.competition_status==="nearly_published"? this.props.current_user&&this.props.current_user.business===true?`/competitions/${item.identifier}/common_header`:this.props.current_user&&this.props.current_user.admin===true?`/competitions/${item.identifier}/common_header`:null:item.competition_status==="progressing"?`/competitions/${item.identifier}/common_header`:null}
<a target="_blank" href={item.competition_status==="ended"?`/competitions/${item.identifier}/common_header`:item.competition_status==="nearly_published"?item.permission.editable==true?`/competitions/${item.identifier}/common_header`:null:item.competition_status==="progressing"?`/competitions/${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"}
item.permission.editable==true?"competitionstitlesshou":"endedfont":"competitionstitlesshou"}
>
<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>:""}
item.permission.editable==true?"":<div className={"CompetitionsListzhezhao"}>即将发布 敬请期待</div>:""}
{/*<div className={"CompetitionsListzhezhao"}>即将发布 敬请期待</div>*/}
{/*{item.description===null||item.description===undefined||item.description===""?<style>*/}
{/*{*/}
@ -180,9 +173,9 @@ 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"}>
item.permission.editable==true?"competitionstitlesshou":"endedfont":"competitionstitlesshou"}>
<a target="_blank" className={"competitionstitles"}
href={item.competition_status==="ended"?`/competitions/${item.identifier}/common_header`:item.competition_status==="nearly_published"? this.props.current_user&&this.props.current_user.business===true?`/competitions/${item.identifier}/common_header`:this.props.current_user&&this.props.current_user.admin===true?`/competitions/${item.identifier}/common_header`:null:item.competition_status==="progressing"?`/competitions/${item.identifier}/common_header`:null}
href={item.competition_status==="ended"?`/competitions/${item.identifier}/common_header`:item.competition_status==="nearly_published"? item.permission.editable==true?`/competitions/${item.identifier}/common_header`:null:item.competition_status==="progressing"?`/competitions/${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>}*/}

@ -1,6 +1,6 @@
import React,{ Component } from "react";
import {Table, Pagination,Tooltip,Spin, Row, Col ,Tabs} from "antd";
import { WordsBtn,on, off, trigger } from 'educoder';
import { WordsBtn,on, off, trigger ,getImageUrl} from 'educoder';
import {BrowserRouter as Router,Route,Switch,Link} from 'react-router-dom';
import axios from'axios';
import './Statistics.css';
@ -11,14 +11,28 @@ class Statistics extends Component{
this.state={
nd1:60,
nd2:40,
nd3:20
nd3:20,
data:undefined
}
}
componentDidMount() {
this.setState({
isSpin:true,
})
let courseId=this.props.match.params.coursesId;
let url=`/courses/${courseId}/statistics.json`;
axios.get(url).then((result) => {
if (result) {
this.setState({
data:result.data.top_scores
})
}
}).catch((error) => {
console.log(error);
this.setState({
isSpins:false,
})
})
}
@ -28,7 +42,7 @@ class Statistics extends Component{
}
render(){
let {nd1,nd2,nd3}=this.state;
let {nd1,nd2,nd3,data}=this.state;
return(
<React.Fragment >
@ -42,80 +56,148 @@ class Statistics extends Component{
</Row>
<Row type="flex" justify="center" align="bottom">
<Col span={3}>
<li className="pr rankingss">
<a href="https://test-newweb.educoder.net/users/cao_jl" className="color-dark">
<img src="https://test-newweb.educoder.net/images/avatars/User/g"/>
</a>
</li>
</Col>
<Col span={5}>
<li className="pr rankingss">
<a href="https://test-newweb.educoder.net/users/cao_jl" className="color-dark">
<img src="https://test-newweb.educoder.net/images/avatars/User/g" className={"mb10"}/>
</a>
</li>
<Col className={`height-${nd2}`}>
</Col>
</Col>
<Col span={5} className={"relatives"}>
<li className="pr rankingss">
<img src="https://test-newweb.educoder.net/images/educoder/huangguan.png" className="huangguans mb5" />
<a href="https://test-newweb.educoder.net/users/cao_jl" className="color-dark">
<img src="https://test-newweb.educoder.net/images/avatars/User/g" className={"mb10"}/>
</a>
</li>
<Col className={`height-${nd1}`}>
</Col>
</Col>
<Col span={5}>
<li className="pr rankingss">
<a href="https://test-newweb.educoder.net/users/cao_jl" className="color-dark">
<img src="https://test-newweb.educoder.net/images/avatars/User/g" className={"mb10"}/>
</a>
</li>
<Col className={`height-${nd3}`}>
{data&&data.map((item,key)=>{
if(key===3){
return(
<Col span={3}>
<li className="pr rankingss">
<a href={`/users/${item.user_login}`} className="color-dark">
<img src={getImageUrl(`images/${item.avatar_url}`)}/>
</a>
</li>
</Col>
)
}
})}
{data&&data.map((item,key)=>{
if(key===1){
return(
<Col span={5}>
<li className="pr rankingss">
<a href={`/users/${item.user_login}`} className="color-dark">
<img src={getImageUrl(`images/${item.avatar_url}`)} className={"mb10"}/>
</a>
</li>
<Col className={`height-${nd2}`}>
</Col>
</Col>
)
}
})}
{data&&data.map((item,key)=>{
if(key===0){
return(
<Col span={5} className={"relatives"}>
<li className="pr rankingss">
<img src="https://test-newweb.educoder.net/images/educoder/huangguan.png" className="huangguans mb5" />
<a href={`/users/${item.user_login}`} className="color-dark">
<img src={getImageUrl(`images/${item.avatar_url}`)} className={"mb10 mt5"}/>
</a>
</li>
<Col className={`height-${nd1}`}>
</Col>
</Col>
)
}
})}
{data&&data.map((item,key)=>{
if(key===2){
return(
<Col span={5}>
<li className="pr rankingss">
<a href={`/users/${item.user_login}`} className="color-dark">
<img src={getImageUrl(`images/${item.avatar_url}`)} className={"mb10"}/>
</a>
</li>
<Col className={`height-${nd3}`}>
</Col>
</Col>
)
}
})}
{data&&data.map((item,key)=>{
if(key===4){
return(
<Col span={3}>
<li className="pr rankingss">
<a href={`/users/${item.user_login}`} className="color-dark">
<img src={getImageUrl(`images/${item.avatar_url}`)}/>
</a>
</li>
</Col>
)
}
})}
</Col>
</Col>
<Col span={3}>
<li className="pr rankingss">
<a href="https://test-newweb.educoder.net/users/cao_jl" className="color-dark">
<img src="https://test-newweb.educoder.net/images/avatars/User/g"/>
</a>
</li>
</Col>
</Row>
<Row className="mt10" type="flex" justify="center" align="bottom">
<Col span={3} className={"Statisticscenter"}>
<Col>威震江湖</Col>
<Col>4th</Col>
</Col>
<Col span={5} className={"Statisticscenter"}>
<Col>神魔遮天</Col>
<Col>2th</Col>
</Col>
<Col span={5} className={"Statisticscenter"}>
<Col>雄霸天下</Col>
<Col>1th</Col>
</Col>
<Col span={5} className={"Statisticscenter"}>
<Col>不灭战神</Col>
<Col>3th</Col>
</Col>
<Col span={3} className={"Statisticscenter"}>
<Col>霸气初现</Col>
<Col>5th</Col>
</Col>
{data&&data.map((item,key)=>{
if(key===3){
return(
<Col span={3} className={"Statisticscenter"}>
<Col>{item.user_name}</Col>
<Col>4th</Col>
</Col>
)
}
})}
{data&&data.map((item,key)=>{
if(key===1){
return(
<Col span={5} className={"Statisticscenter"}>
<Col>{item.user_name}</Col>
<Col>2th</Col>
</Col>
)
}
})}
{data&&data.map((item,key)=>{
if(key===0){
return(
<Col span={5} className={"Statisticscenter"}>
<Col>{item.user_name}</Col>
<Col>1th</Col>
</Col>
)
}
})}
{data&&data.map((item,key)=>{
if(key===2){
return(
<Col span={5} className={"Statisticscenter"}>
<Col>{item.user_name}</Col>
<Col>3th</Col>
</Col>
)
}
})}
{data&&data.map((item,key)=>{
if(key===4){
return(
<Col span={3} className={"Statisticscenter"}>
<Col>{item.user_name}</Col>
<Col>5th</Col>
</Col>
)
}
})}
</Row>
</p>
</div>

Loading…
Cancel
Save