dev_forge
tangjiang 5 years ago
parent ebc175b655
commit abecab3b8d

@ -0,0 +1,225 @@
import React, { Component } from 'react';
import { Link } from 'react-router-dom';
import { Menu, Icon, List, Avatar,Row, Col,Tag,Pagination,Alert} from 'antd';
import {getImageUrl} from 'educoder';
import axios from 'axios';
import './Competitionsindex.css';
import NoneData from "../../courses/coursesPublic/NoneData";
import LoadingSpin from '../../../common/LoadingSpin';
class CompetitionsIndex extends Component{
constructor(props) {
super(props)
this.state={
current: 'all',
datas:undefined,
page:1,
category:undefined
}
}
componentDidMount(){
window.document.title = '竞赛';
let{category,page}=this.state;
this.getdata(category,page)
}
getdata=(category,page)=>{
const Url =`/competitions.json`;
axios.get(Url,{params:{
category:category,
page:page,
per_page:15,
}
}).then((response) => {
if(response.status===200){
this.setState({
datas:response.data.competitions,
count:response.data.count,
})
}
})
.catch(function (error) {
console.log(error);
});
}
handleClick = e => {
this.setState({
current: e.key,
datas:undefined
});
let{category,page}=this.state;
this.getdata(e.key,page)
};
PaginationCourse=(pageNumber)=>{
let {category}=this.state;
this.setState({
page: pageNumber,
})
this.getdata(category,pageNumber);
}
render() {
let {datas,page,count}=this.state;
return (
<div>
<div className="clearfix">
<div>
<div className="clearfix">
<style>
{
`
.courses-head{
width: 100%;
height: 300px;
background-image: url(${getImageUrl(this.props.mygetHelmetapi && this.props.mygetHelmetapi.competition_banner_url === null ?`images/educoder/competitions/courses.jpg`:this.props.mygetHelmetapi&&this.props.mygetHelmetapi.competition_banner_url)});
background-color: #081C4B;
background-position: center;
background-repeat: no-repeat;
}
`
}
</style>
<div className="courses-head pr Competitionshead ">
<div className="edu-txt-center pathNavLine">
<div className="inline path-nav"></div>
</div>
</div>
<div className="competitionstitle mb20">
<div className="competitionstitle2">
<Menu onClick={this.handleClick} selectedKeys={[this.state.current]} mode="horizontal">
<Menu.Item key="all" className={"competitionmr50"}>
<span className={"competitionsvalue"}>全部</span>
</Menu.Item>
<Menu.Item key="nearly_published" className={"competitionmr50"}>
<span className={"competitionsvalue"}>即将发布</span>
</Menu.Item>
<Menu.Item key="progressing" className={"competitionmr50"}>
<span className={"competitionsvalue"}>进行中</span>
</Menu.Item>
<Menu.Item key="ended" className={"competitionmr50"}>
<span className={"competitionsvalue"}>往期比赛</span>
</Menu.Item>
</Menu>
</div>
</div>
<div className={"educontent clearfix mtf10 CompetitionsIndex mb20"}>
{datas===undefined?"":datas.length===0?"":<List
itemLayout="vertical"
size="large"
dataSource={datas&&datas}
renderItem={(item,key) => (
<a target="_blank" href={item.competition_status==="ended"?`/competitions/${item.identifier}`:item.competition_status==="nearly_published"?item.permission.editable==true?`/competitions/${item.identifier}`:null:item.competition_status==="progressing"?`/competitions/${item.identifier}`:null}
className={item.competition_status==="ended"?"competitionstitlesshou":item.competition_status==="nearly_published"?
item.permission.editable==true?"competitionstitlesshou":"endedfont":"competitionstitlesshou"}
>
<div className={"CompetitionsList"} >
{item.competition_status==="nearly_published"?
item.permission.editable==true?"":<div className={"CompetitionsListzhezhao"}>即将发布 敬请期待</div>:""}
{/*<div className={"CompetitionsListzhezhao"}>即将发布 敬请期待</div>*/}
{/*{item.description===null||item.description===undefined||item.description===""?<style>*/}
{/*{*/}
{/*`*/}
{/*// .CompetitionsIndex .ant-list-vertical .ant-list-item-action{*/}
{/*// margin-top:50px;*/}
{/*// }*/}
{/*`*/}
{/*}*/}
{/*</style>:""}*/}
<img className={"competitonimg"}
src={item.competition_status==="ended"?getImageUrl(`images/educoder/competitions/groups1.png`):item.competition_status==="nearly_published"?getImageUrl(`images/educoder/competitions/groups2.png`):item.competition_status==="progressing"?getImageUrl(`images/educoder/competitions/groups3.png`):""} />
<List.Item
key={key}
actions={[
<span>竞赛时间: {item.start_time}{item.end_time}</span>,
<span>报名截止时间{item.enroll_end_time}</span>,
]}
extra={
<div className={"pt50"} style={{"width":'314px'}}>
<Row gutter={16}>
<Col className="gutter-row" span={6}>
<div className="gutter-box CompetitionsIndexdadels">奖金</div>
</Col>
<Col className="gutter-row" span={6}>
<div className="gutter-box CompetitionsIndexdadels">浏览数</div>
</Col>
<Col className="gutter-row" span={6}>
<div className="gutter-box CompetitionsIndexdadels">报名数</div>
</Col>
</Row>
<Row gutter={16}>
<Col className="gutter-row" span={6}>
<div className="gutter-box CompetitionsIndexbottomvalue">¥{item.bonus}</div>
</Col>
<Col className="gutter-row" span={6}>
<div className="gutter-box CompetitionsIndexbottomvalue">{item.competition_status==="nearly_published"?"--":item.visits_count}</div>
</Col>
<Col className="gutter-row" span={6}>
<div className="gutter-box CompetitionsIndexbottomvalue">{item.competition_status==="nearly_published"?"--":item.member_count}</div>
</Col>
</Row>
</div>
}
>
<List.Item.Meta
title={<a className={item.competition_status==="ended"?"competitionstitlesshou":item.competition_status==="nearly_published"?
item.permission.editable==true?"competitionstitlesshou":"endedfont":"competitionstitlesshou"}>
<a target="_blank" className={"competitionstitles"}
href={item.competition_status==="ended"?`/competitions/${item.identifier}`:item.competition_status==="nearly_published"? item.permission.editable==true?`/competitions/${item.identifier}`:null:item.competition_status==="progressing"?`/competitions/${item.identifier}`: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>}
/>
<span className={"span666"}>{item.description}</span>
</List.Item>
</div>
</a>
)
}
/>}
{datas===undefined?"":count===undefined?"":count >15 ?<div className="mb40 edu-txt-center padding20-30"
>
<Pagination
showQuickJumper
defaultCurrent={1}
pageSize={15}
total={count===undefined?"":count}
current={page}
onChange={this.PaginationCourse}
/>
</div>:""}
{
datas===undefined?<LoadingSpin/>:datas && datas.length===0? <NoneData></NoneData>:""
}
</div>
</div>
</div>
</div>
</div>
)
}
}
export default CompetitionsIndex;

@ -0,0 +1,163 @@
.teamsLayout{background: transparent !important;}
.competitionstitle{
height:50px !important;
border-radius: 6px;
background: #fff;
display: flex;
justify-content: center;
}
.competitionstitle2{
height:50px !important;
margin-left: 30px !important;
background: #fff;
width: 1200px;
}
.CompetitionsList{
position: relative;
/*max-height: 210px;*/
}
.competitonimg{
position: absolute;
right: -5px;
width: 80px;
top: 20px;
}
.ant-menu-horizontal {
border-bottom:none !important;
}
.competitionsvalue{
font-size: 16px;
font-family: PingFangSC-Medium,PingFangSC;
font-weight: 500;
}
.competitionmr50 {
margin-right: 50px !important;
}
.CompetitionsIndex .ant-list-item{
background: #fff !important;
margin-top: 20px;
border: none !important;
}
.CompetitionsIndex .ant-list-item{
padding:25px;
}
.CompetitionsIndex .ant-list-item-meta-title{
height:28px;
font-size:28px;
font-family:PingFangSC-Regular,PingFangSC;
font-weight:400;
color:rgba(5,16,26,1);
line-height:28px;
}
.CompetitionsIndex .ant-list-vertical .ant-list-item-meta{
margin-bottom: 20px !important;
}
.CompetitionsIndex .ant-list-vertical .ant-list-item-action {
margin-top: 20px;
margin-left: auto;
}
.CompetitionsIndex .ant-list-item-action-split{
display: none !important;
}
.CompetitionsIndexdadels{
font-family: PingFangSC-Regular,PingFangSC;
font-weight: 400;
color: #777777;
margin-bottom: 14px;
text-align: center;
}
.CompetitionsIndexbottomvalue{
font-size: 24px;
font-family: ArialMT;
color: rgba(5,16,26,1);
text-align: center;
}
.CompetitionsIndex .gutter-row{
/*margin-right:20px;*/
width: 33%;
}
.pt50{
padding-top: 50px;
}
.competitionstitles{
max-width: 789px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
display: inline-block;
margin-right: 15px;
color:#000 !important;
}
.competitionsrelative{
position: absolute;
top: 28px;
}
.CompetitionsList:hover{
/*box-shadow: 0 2px 6px rgba(51,51,51,.09);*/
box-shadow:3px 4px 10px 2px rgba(229,229,229,0.5);
opacity: 1;
border-radius: 2px;
}
.endedfont{
color:#000 !important;
}
.CompetitionsListzhezhao{
position: absolute;
top: 0px;
left: 0px;
width: 1206px;
height: 100%;
z-index: 10000;
display: none;
background: rgba(0,0,0,0.33);
text-align: center;
color: #fff;
font-size: 22px;
align-items: center;
justify-content: space-around;
flex-direction: column;
}
.CompetitionsList:hover .CompetitionsListzhezhao{
display: block;
display: flex;
}
.competitionstitlesshou:hover a{
cursor: pointer;
color: #1c91e8 !important;
}
.competitionstitlesshou{
cursor: pointer;
}
.Competitionshead{
background-color: #2d28ba !important;
background-position: center !important;
background-position: 50% !important;
background-repeat: no-repeat !important;
}
.span666{
color:#666666 !important;
}

@ -0,0 +1,53 @@
.teamsLayout{background: transparent !important;}
.teamsLayout .teamsLayoutitle{
font-size:18px;
font-family:PingFangSC-Semibold,PingFang SC;
font-weight:600;
color:rgba(5,16,26,1);
line-height:25px;
margin-top: 10px;
margin-bottom: 10px;
}
.teamsLayoutTable .ant-table-bordered .ant-table-thead > tr > th, .ant-table-bordered .ant-table-tbody > tr > td {
border-right: 1px solid transparent !important;
}
.teamsLayoutTable .ant-table-body .ant-table-thead > tr> th:nth-last-child(1){
border-right: 1px solid #e8e8e8 !important;
}
.teamsLayoutTable .ant-table-body .ant-table-tbody > tr> td:nth-last-child(1){
border-right: 1px solid #e8e8e8 !important;
}
.teamsLayoutTable .ant-table-bordered .ant-table-thead > tr > th{
background:#EEEEEE;
font-size: 14px;
font-family: PingFangSC-Regular,PingFang SC;
font-weight: 400;
color: rgba(102,102,102,1);
line-height: 20px;
}
.teamsLayoutTable .ant-table-bordered .ant-table-tbody > tr > th{
background:#EEEEEE;
font-size:14px;
font-family:PingFangSC-Regular,PingFang SC;
font-weight:400;
color:rgba(5,16,26,1);
line-height:20px;
}
.teamsLayout .mt40{
margin-top: 40px !important;
}
.teamsLayoutheji{
color: #878787;
font-size: 16px;
}
.teamsLayoucolor-orange {
color: #ff6800!important;
font-size: 16px;
}

@ -0,0 +1,267 @@
import React, { Component } from 'react';
import { Breadcrumb,Layout,Table, Divider, Tag,Badge,Tooltip} from 'antd';
import { Link } from 'react-router-dom';
import axios from 'axios';
import './Competitionteams.css';
const { Content } = Layout;
class Competitionteams extends Component{
constructor(props) {
super(props)
this.state={
shixundata: undefined,
coursedata:undefined,
}
}
componentDidMount(){
window.document.title = '竞赛';
if(this.props.match.params.identifier!=null){
let url=`/competitions/${this.props.match.params.identifier}/common_header.json`;
axios.get(url).then((response) => {
if(response.status===200){
this.setState({
data:response.data,
})
}
}).catch((error) => {
console.log(error)
})
}
this.getshixundata();
this.getcoursedata();
}
getshixundata=()=>{
const Url =`/competitions/${this.props.match.params.identifier}/competition_teams/${this.props.match.params.competition_team_id}/shixun_detail.json`;
axios.get(Url).then((response) => {
if(response.status===200){
// let data={
// shixuns: [
// {
// creator: "黄井泉", // 创建者
// shixun_name: "单链表的学习与应用I", // 实训名称
// shixun_identifier: "mnf6b7z3",
// forked: false, // false:原创
// myshixuns_count: 179, // 学习人数
// forked_myshixun_count: 0, // 被fork发布的学习人数
// valid_count: 82, // 有效作品数
// score: 1320 // 应用值
// }
// ],
// shixun_count: 1, // 实训总计
// total_myshixun_count: 179, // 学习人数总计
// total_forked_myshixun_count: 0, // 被fork发布的学习人数总计
// total_valid_count: 82, // 有效作品数总计
// total_shixun_score: 1320 // 应用值总计
// }
let data=response.data;
let newarr=data.shixuns;
let newobj={
creator:"合计:",
shixun_name:data.shixun_count,
myshixuns_count:data.total_myshixun_count,
forked_myshixun_count:data.total_forked_myshixun_count,
valid_count:data.total_valid_count,
score:data.total_shixun_score
}
newarr.push(newobj)
this.setState({
shixundata:newarr
})
}
})
.catch(function (error) {
console.log(error);
});
}
getcoursedata=()=>{
const Url =`/competitions/${this.props.match.params.identifier}/competition_teams/${this.props.match.params.competition_team_id}/course_detail.json`;
axios.get(Url).then((response) => {
if(response.status===200){
// let data={
// courses: [
// {
// creator: "周海芳", // 创建者
// creator_login: "Nancy", // login
// course_name: "大学计算机基础2018年秋季",
// course_id: 1502,
// students_count: 122, // 学生数量
// shixun_homework_count: 8, // 发布的实训作业数量
// valid_count: 977, // 有效作品数
// score: 29810 // 应用值
// }
// ],
// total_course_count: 1, // 课堂总计
// total_students_count: 122, // 学生数总计
// total_shixun_homework_count: 8, // 实训作业数总计
// total_valid_count: 977, // 有效作品数总计
// total_course_score: 29810 // 应用值总计
// }
let data=response.data;
let newarr=data.courses;
let newobj={
creator:"合计:",
course_name:data.total_course_count,
students_count:data.total_students_count,
shixun_homework_count:data.total_shixun_homework_count,
valid_count:data.total_valid_count,
score:data.total_course_score
}
newarr.push(newobj)
this.setState({
coursedata:newarr
})
}
})
.catch(function (error) {
console.log(error);
});
}
render() {
let {data}=this.state;
const shixuncolumns = [
{
title: '创建者',
dataIndex: 'creator',
key: 'creator',
render: (text, record) => <div className={record.creator==="合计:"?"teamsLayoutheji":""}>{text}</div>,
},
{
title: '名称',
dataIndex: 'shixun_name',
key: 'shixun_name',
render: (text, record) =>
<div className={record.creator==="合计:"?"teamsLayoucolor-orange":""}>{text}{record.forked===true?<Badge count={"原创"} style={{ backgroundColor: '#459BE5' }} />:""}</div>,
},
{
title: '学习人数',
dataIndex: 'myshixuns_count',
key: 'myshixuns_count',
render: (text, record) => <div className={record.creator==="合计:"?"teamsLayoucolor-orange":""}>{text}</div>,
},
{
title: '被fork发布的学习人数',
dataIndex: 'forked_myshixun_count',
key: 'forked_myshixun_count',
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) =>
<Tooltip placement="bottom" title={"至少完成了1个关卡"}>
<div className={record.creator==="合计:"?"teamsLayoucolor-orange":""}>{text}</div>
</Tooltip>,
},
{
title: '应用值',
dataIndex: 'score',
key: 'score',
render: (text, record) => <div className={record.creator==="合计:"?"teamsLayoucolor-orange":""}>{text}</div>,
},
];
const coursecolumns = [
{
title: '创建者',
dataIndex: 'creator',
key: 'creator',
render: (text, record) => <div className={record.creator==="合计:"?"teamsLayoutheji":""}>{text}</div>,
},
{
title: '名称',
dataIndex: 'course_name',
key: 'course_name',
render: (text, record) => <div className={record.creator==="合计:"?"teamsLayoucolor-orange":""}>{text}</div>,
},
{
title: '学生数量',
dataIndex: 'students_count',
key: 'students_count',
render: (text, record) => <div className={record.creator==="合计:"?"teamsLayoucolor-orange":""}>{text}</div>,
},
{
title: '发布的实训作业数量',
dataIndex: 'shixun_homework_count',
key: 'shixun_homework_count',
render: (text, record) =>
<div className={record.creator==="合计:"?"teamsLayoucolor-orange":""}>{text}</div>
,
},
{
title: '有效作品数',
dataIndex: 'valid_count',
key: 'valid_count',
render: (text, record) =>
<Tooltip placement="bottom" title={"至少完成了1个关卡"}>
<div className={record.creator==="合计:"?"teamsLayoucolor-orange":""}>{text}</div>
</Tooltip>,
},
{
title: '应用值',
dataIndex: 'score',
key: 'score',
render: (text, record) => <div className={record.creator==="合计:"?"teamsLayoucolor-orange":""}>{text}</div>,
},
];
// console.log(this.state.shixundata)
return (
<div className={"educontent clearfix mt20 "}>
<Breadcrumb separator=">">
<Breadcrumb.Item><Link to={"/competitions"}>{data&&data.name}</Link></Breadcrumb.Item>
<Breadcrumb.Item><Link to={`/competitions/${this.props.match.params.identifier}/enroll`}>报名</Link></Breadcrumb.Item>
<Breadcrumb.Item>战队详情</Breadcrumb.Item>
</Breadcrumb>
<Layout className={"teamsLayout"}>
<Content className={"teamsLayoutitle"}>实训项目</Content>
<Content className={"teamsLayoutContent"}>
<Table className="teamsLayoutTable" columns={shixuncolumns} dataSource={this.state.shixundata} bordered pagination={false}/>
</Content>
<Content className={"teamsLayoutitle mt40"}>翻转课堂</Content>
<Content className={"teamsLayoutContents"}>
<Table className="teamsLayoutTable" columns={coursecolumns} dataSource={this.state.coursedata} bordered pagination={false}/>
</Content>
</Layout>
</div>
)
}
}
export default Competitionteams;

@ -0,0 +1,438 @@
.teamsLayout{background: transparent !important;}
.teamsLayout .ant-layout-sider{
background: transparent !important;
flex: 0 0 180px !important;
max-width: 180px !important;
min-width: 180px !important;
width: 180px !important;
}
.teamsLayout .teamsLayoutitle{
font-size:18px;
font-family:PingFangSC-Semibold,PingFang SC;
font-weight:600;
color:rgba(5,16,26,1);
line-height:25px;
margin-top: 10px;
margin-bottom: 10px;
}
.teamsLayoutTable .ant-table-bordered .ant-table-thead > tr > th, .ant-table-bordered .ant-table-tbody > tr > td {
border-right: 1px solid transparent !important;
}
.teamsLayoutTable .ant-table-body .ant-table-thead > tr> th:nth-last-child(1){
border-right: 1px solid #e8e8e8 !important;
}
.teamsLayoutTable .ant-table-body .ant-table-tbody > tr> td:nth-last-child(1){
border-right: 1px solid #e8e8e8 !important;
}
.teamsLayoutTable .ant-table-bordered .ant-table-thead > tr > th{
background:#EEEEEE;
font-size: 14px;
font-family: PingFangSC-Regular,PingFang SC;
font-weight: 400;
color: rgba(102,102,102,1);
line-height: 20px;
}
.teamsLayoutTable .ant-table-bordered .ant-table-tbody > tr > th{
background:#EEEEEE;
font-size:14px;
font-family:PingFangSC-Regular,PingFang SC;
font-weight:400;
color:rgba(5,16,26,1);
line-height:20px;
}
.teamsLayout .mt40{
margin-top: 40px !important;
}
.teamsLayoutheji{
color: #878787;
font-size: 16px;
}
.teamsLayoucolor-orange {
color: #ff6800 !important;
font-size: 16px;
}
.CompetitionCommonbanner{
padding: 20px;
background:rgba(255,255,255,1);
box-shadow:3px 2px 12px 2px rgba(0,0,0,0.05);
position: relative;
}
.CompetitionCommonbannerfont{
height:100%;
width: 365px !important;
line-height: 34px;
}
.CompetitionCommonbannerfont .competitionbannerdiv:nth-child(1){
max-height:100px;
font-size:25px;
font-weight:400;
color:rgba(5,16,26,1);
line-height: 30px;
}
.CompetitionCommonbannerfont .competitionbannerdiv:nth-child(2){
max-height: 70px;
font-size:16px;
font-weight:400;
/*color:rgba(155,155,155,1);*/
color:#05101A;
}
.CompetitionCommonbannerfont .competitionbannerdiv:nth-child(3){
max-height: 70px;
font-size: 16px;
font-weight: 400;
/*color: rgba(155,155,155,1);*/
color:#05101A;
}
.Competitioncolor9b{
color: #9B9B9B;
}
.Competitioncolor77{
color: #777777;
font-size: 14px;
}
.Competitioncolor516{
font-size:24px;
color:rgba(5,16,26,1);
}
.Competitionfontsize22{
font-size:22px;
font-weight:500;
color:rgba(255,255,255,1);
}
.Competitionfontsize16{
font-size: 16px;
font-weight: 400;
color: rgba(102,102,102,1);
}
.ant-layout-sider {
position: relative;
min-width: 0;
background: #001529;
-webkit-transition: all 0.2s;
-o-transition: all 0.2s;
transition: all 0.2s;
}
.CompetitionMenu .ant-menu-item::after {
left: 0px !important;
right: auto;
border-right: 5px solid #4CACFF;
}
.CompetitionMenu .ant-menu-item{
height: 30px;
line-height: 30px;
background:none;
color:#666;
}
.ant-menu:not(.ant-menu-horizontal) .ant-menu-item-selected {
background-color: transparent;
}
.CompetitionMenu .ant-menu-item:not(:last-child){
margin-bottom: 40px;
background: transparent;
color:#666;
}
.CompetitionMenu .ant-menu-item{
font-size: 18px;
}
.CompetitionMenu .ant-menu-item-selected {
color: rgba(76,172,255,1) !important;
}
.CompetitionMenu{
width: 145px;
background: #fff;
border: 1px solid rgba(239,239,239,1);
padding-top: 20px;
padding-bottom: 40px !important;
}
.teamsLayoutleft{
background: transparent !important;
}
.Competitioncharts{
font-size: 24px;
color: rgba(5,16,26,1);
}
.Competitionfirst{
width:233px;
height:298px;
background:rgba(250,250,250,1);
box-shadow:0px 2px 8px 2px rgba(255,134,34,0.5);
border-radius:5px;
}
.Competitionsecondary{
width:234px;
height:298px;
background:rgba(250,250,250,1);
box-shadow:0px 3px 5px 0px rgba(254,190,154,1);
border-radius:5px;
}
.Competitionthird{
width: 234px;
height: 298px;
background: rgba(250,250,250,1);
box-shadow: 0px 4px 5px 0px rgba(200,200,202,1);
border-radius: 5px;
}
.Competition399{
height:399px;
}
.Competitiontransparent table{
background: transparent;
}
.Commonimg{
position: absolute;
right: -5px;
width:93px;
top: 10px;
}
.Competitionthirdbox{
width:234px;
height:167px;
background:rgba(223,223,225,1);
position: relative;
}
.Competitionfirstbox{
width:233px;
height:167px;
background:rgba(255,231,160,1);
position: relative;
}
.Competitionsecondarybox{
width:234px;
height:167px;
background:rgba(253,230,217,1);
position: relative;
}
.rankingimg{
width: 60px;
height: 60px;
border-radius: 50% !important;
box-shadow: 0px 0px 12px rgba(0,0,0,0.2);
border: 2px solid #459BE5;
}
.Competitioncenter{
text-align: center;
padding-top: 20px;
}
.jinshaifont{
font-size: 16px;
color: rgba(5,16,26,1);
margin-top: 13px !important;
}
.Competitionthird .ant-card-body {
padding: 12px;
zoom: 1;
}
/*.Competitionthird .ant-card-meta-title{*/
/*margin-bottom: 0px !important;*/
/*}*/
.Competitionfirst .ant-card-body {
padding: 12px;
zoom: 1;
}
.Competitionsecondary .ant-card-body {
padding: 12px;
zoom: 1;
}
.center{
text-align: center;
}
.rankfonttop{
font-size:14px;
color:rgba(102,102,102,1);
}
.rankfontmid{
font-size:18px;
color:rgba(102,102,102,1);
}
.rankfontbottom{
font-size:26px;
color:rgba(165,91,41,1);
text-align: center;
}
.rankfontbottoms{
font-size:28px;
color:rgba(165,91,41,1);
text-align: center;
}
.Competitionuserimg{
width: 64px;
height: 63px;
border-radius: 50%;
border: 2px solid #459BE5;
}
.CompetitionsListzhezhao{
position: absolute;
top: 0px;
left: 0px;
width: 1206px;
height: 100%;
z-index: 10000;
display: none;
background: rgba(0,0,0,0.33);
text-align: center;
color: #fff;
font-size: 22px;
}
.relative{position: relative;}
.relative:hover .CompetitionsListzhezhao{
display: block;
display: flex;
align-items: center;
justify-content: space-around;
flex-direction: column;
}
.image_urlbox{
width: 790px;
height: 340px;
}
.CompetitionContents{
background: #fff !important;
padding: 40px;
box-shadow: 3px 2px 12px 2px rgba(0,0,0,0.05);
border: 1px solid rgba(239,239,239,1);
}
.rankbeicenter{
text-align: center;
}
.rankbei{
font-size: 16px;
color: rgba(119,119,119,1);
}
.youranklist{
background: rgba(226,241,255,1);
line-height: 50px;
text-align: center;
padding-left: 20px;
}
.ranknames{
font-size: 16px;
color: rgba(62,62,62,1);
}
.ranknameslast{
font-size:16px;
color:rgba(12,158,254,1);
}
.textleft{
text-align: left;
}
.textright{
text-align: right;
}
.userranksclass{
text-align: left;
width: 18%;
padding-left: 12px;
margin-right: 28px;
}
.Commonimgbox{
width: 800px !important;
}
.CompetitionCommonbannerfont{
width: 350px !important;
margin-left:10px;
}
.color000{
color: #000;
}
.cursorpointer{
cursor: pointer;
}
.rankfonttop{
overflow:hidden;
text-overflow:ellipsis;
white-space:nowrap
}
.usernamebox{
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
cursor: default;
max-width: 100px;
display: inherit;
}
.competimgabsolute{
position: absolute;
left: 72px;
bottom: -10px;
}
.competimgabsolute .ant-badge-count{
box-shadow: none !important;
}
.competimgabsoluteijmg{
position: absolute;
left: -11px;
bottom: 0px;
}

@ -0,0 +1,548 @@
import React, { Component } from 'react';
import { Breadcrumb,Layout,Table, Divider, Tag,Badge,Row, Col,Button, Menu, Icon} from 'antd';
import { Link } from 'react-router-dom';
import axios from 'axios';
import {markdownToHTML,getImageUrl} from 'educoder';
import CompetitionContents from './CompetitionCommonChild/CompetitionContents';
import CompetitionContentsChart from './CompetitionCommonChild/CompetitionContentsChart';
import CompetitionContentsMd from './CompetitionCommonChild/CompetitionContentsMd';
import CompetitionContentspdf from './CompetitionCommonChild/CompetitionContentspdf';
import './CompetitionCommon.css';
const {Sider } = Layout;
class CompetitionCommon extends Component{
constructor(props) {
super(props)
this.state={
data: undefined,
bannerdata: undefined,
module_type: undefined,
mdContentdata: undefined,
chart_rules: undefined,
Competitionedittype: false,
chartdata: undefined,
has_url: false,
signupdata: undefined
}
}
componentDidMount(){
window.document.title = '竞赛';
if(this.props.match.params.identifier!=null){
this.getbannerdata();
// this.setState({
// thiskeys:this.props.location.search.replace('?menu=', '')
// })
// 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)
// })
}
}
componentDidUpdate = (prevProps) => {
if (prevProps.user != this.props.user) {
//console.log("componentDidUpdatess");
//console.log(this.props.user);
if (this.props.user && this.props.user.login != "") {
const zul = `/competitions/${this.props.match.params.identifier}/competition_staff.json`;
axios.get((zul)).then((result) => {
if (result) {
if (result.data) {
this.setState({
signupdata: result.data
})
}
}
}).catch((error) => {
////console.log(error);
})
}
}
}
//获取头部信息
getbannerdata=()=>{
// let menuid=this.props.location.search.replace('?menu=', '');
let query=this.props.location&&this.props.location.search;
const types = query.split('&')
const menuid = types[0].split('?menu=')
let url=`/competitions/${this.props.match.params.identifier}/common_header.json`;
axios.get(url).then((response) => {
if(response.status===200){
this.setState({
data: response.data,
thiskeys: menuid[1] === undefined || menuid[1] === "" ? response.data.competition_modules[0].id : menuid[1],
mode: response.data.mode
})
if(menuid[1]===undefined||menuid[1]===""){
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
)
}else{
let newlist=response.data.competition_modules;
newlist.map((item,key)=>{
if(`${item.id}`===`${menuid[1]}`){
this.getrightdata(
item.id,
item.module_type,
item.module_url,
item.has_url
)
}
})
}
}
}).catch((error) => {
//console.log(error)
})
//this.props.user 有可能为空
if (this.props.user && this.props.user.login != "") {
const zul = `/competitions/${this.props.match.params.identifier}/competition_staff.json`;
axios.get((zul)).then((result) => {
if (result) {
if (result.data) {
this.setState({
signupdata: result.data
})
}
}
}).catch((error) => {
////console.log(error);
})
}
}
getrightdatas=(e)=>{
let keys = parseInt(e.key);
this.getlistdata(keys)
this.props.history.replace(`?menu=${keys}`);
}
getlistdata=(keys,listkey)=>{
let{data}=this.state;
this.setState({
thiskeys:keys
})
data&&data.competition_modules.map((item,key)=>{
if(item.module_type!="enroll") {
if (keys === item.id) {
this.getrightdata(item.id, item.module_type, item.module_url, item.has_url, listkey)
return
}
}
})
}
getnewchartdata=(typeid,tabkey)=>{
if(typeid==="chart"){
let url=`/competitions/${this.props.match.params.identifier}/chart_rules.json`;
axios.get(url)
.then((response) => {
if(response.status===200){
this.setState({
chart_rules:response.data,
tabkey: tabkey === undefined ? response.data.stages[0].id === null ? "0" : `${response.data.stages[0].id}` : tabkey
})
}
}).catch((error) => {
//console.log(error)
})
}
}
getrightdata=(id,typeid,module_url,has_url,listkey)=>{
// if(typeid==="enroll"){
// this.props.history.replace(`/competitions/${this.props.match.params.identifier}/enroll`);
// return
// }
this.getnewchartdata(typeid, listkey)
if(has_url===false){
let url=`${module_url}`;
axios.get(url).then((response) => {
if(response.status===200){
if(typeid==="chart"){
this.setState({
chartdata:response.data
})
}else{
this.setState({
mdContentdata:response.data
})
}
}
}).catch((error) => {
//console.log(error)
})
}else{
if (module_url.substring(0, 7) == 'http://' || module_url.substring(0, 8) == 'https://') {
// window.location.href= module_url
window.open(module_url)
}else{
window.open(`https://${module_url}`)
// window.location.href=;
}
return
}
this.setState({
module_id:id,
module_type:typeid,
has_url:has_url
})
}
Competitionedit=()=>{
this.setState({
Competitionedittype: true
})
}
hideCompetitionedit=()=>{
this.setState({
Competitionedittype:false
})
}
newgotocourse=(url)=>{
if(this.props.checkIfLogin()===false){
this.props.showLoginDialog()
return
}
if(this.props.checkIfProfileCompleted()===false){
this.props.showProfileCompleteDialog()
return
}
window.open(url);
}
gotocourse=(url)=>{
if(this.props.checkIfLogin()===false){
this.props.showLoginDialog()
return
}
if(this.props.checkIfProfileCompleted()===false){
this.props.showProfileCompleteDialog()
return
}
if(url===undefined){
let {data,signupdata}=this.state;
// if(signupdata.enrolled===true){
// this.props.history.replace(`/courses/${data.course_id}`);
// }else{ }
if (data.member_of_course === true) {
// this.props.history.replace(`/courses/${data.course_id}`);
window.open(`/courses/${data.course_id}`)
} else {
// 以学生身份调用加入课堂 进入课堂首页
let url = "/courses/apply_to_join_course.json"
axios.post(url, {
invite_code: data.invite_code,
student: 1
}
).then((response) => {
if (response.data.status === 0) {
// this.props.history.replace();
this.getbannerdata()
window.open(`/courses/${data.course_id}`);
}
})
}
}else{
if (url === "personal") {
let urls = `/competitions/${this.props.match.params.identifier}/enroll`;
this.Personalregistration(urls)
} else {
window.open(url);
}
}
}
Personalregistration = (urls) => {
let {signupdata} = this.state;
if (signupdata.enroll_ended === true) {
//已截止
this.props.showNotification(`报名已截止`);
return;
}
if (signupdata.enrolled === true) {
this.props.showNotification(`你已经报名,不能重复报名!`);
return;
}
const url = `/competitions/${this.props.match.params.identifier}/competition_teams.json`;
axios.post(url).then((response) => {
if (response) {
if (response.data) {
this.props.showNotification(`报名成功,预祝您夺得桂冠!`);
// this.props.history.replace(urls);
this.getbannerdata()
window.open(urls)
}
}
}).catch((error) => {
});
}
Competitioncallback=(key)=>{
this.setState({
tabkey:key
})
let url=`/competitions/${this.props.match.params.identifier}/charts.json`;
axios.get(url,{params:{
stage_id:key===0||key===null?undefined:key
}}).then((response) => {
if(response.status===200){
this.setState({
chartdata:response.data
})
}
}).catch((error) => {
//console.log(error)
})
}
render() {
let {data, module_type, Competitionedittype, signupdata} = this.state;
return (
data===undefined?"":<div className={"educontent clearfix mt20 "}>
<Breadcrumb separator=">">
<Breadcrumb.Item><Link to={"/competitions"}>在线竞赛</Link></Breadcrumb.Item>
<Breadcrumb.Item>{data && data.name}</Breadcrumb.Item>
</Breadcrumb>
<div className={"mt10 relative"}>
<Row className={"CompetitionCommonbanner"}>
{data.competition_status === "nearly_published" ?
data && data.permission.editable === true ? "" :
<div className={"CompetitionsListzhezhao"}>即将发布 敬请期待</div> : ""}
<img className={"Commonimg"}
src={data.competition_status === "ended" ? getImageUrl(`images/educoder/competitions/groups1.png`) : data.competition_status === "nearly_published" ? getImageUrl(`images/educoder/competitions/groups2.png`) : data.competition_status === "progressing" ? getImageUrl(`images/educoder/competitions/groups3.png`) : ""}/>
<Col span={15} className={"Commonimgbox"}>
<img className={"image_urlbox"}
src={data === undefined ? getImageUrl(`images/educoder/competitions/mainbanner.jpg`) : data.avatar_url === null ? getImageUrl(`images/educoder/competitions/mainbanner.jpg`) : getImageUrl(data.avatar_url)}/>
</Col>
<Col className={"CompetitionCommonbannerfont"} span={9}>
<Col
className={data && data.name.length > 15 ? "competitionbannerdiv mt30" : "competitionbannerdiv mt30"}>{data && data.name}</Col>
<Col className={"competitionbannerdiv mt10"}>
<Col className={"Competitioncolor9b"}>竞赛时间<span
className={"color000"}>{data && data.start_time}{data && data.end_time}</span></Col>
{/*<Col></Col>*/}
</Col>
<style>
{
`
.ant-col-6{
width: 30%;
}
`
}
</style>
<Col className={"competitionbannerdiv mt10"}>
<Row gutter={16}>
<Col className="gutter-row" span={6}>
<div className="gutter-box CompetitionsIndexdadels Competitioncolor77">奖金</div>
</Col>
<Col className="gutter-row ml20 rankbeicenter" span={6}>
<div className="gutter-box CompetitionsIndexdadels Competitioncolor77">浏览数</div>
</Col>
<Col className="gutter-row rankbeicenter" span={6}>
<div className="gutter-box CompetitionsIndexdadels Competitioncolor77">报名数</div>
</Col>
</Row>
<Row gutter={16}>
<Col className="gutter-row" span={6}>
<div
className="gutter-box CompetitionsIndexbottomvalue Competitioncolor516">¥{data && data.bonus}</div>
</Col>
<Col className="gutter-row ml20 rankbeicenter" span={6}>
<div
className="gutter-box CompetitionsIndexbottomvalue Competitioncolor516">{data.competition_status === "nearly_published" ? "--" : data && data.visits_count}</div>
</Col>
<Col className="gutter-row rankbeicenter" span={6}>
{data.competition_status === "ended" ?
<div className={data.mode === 2 ?data.member_of_course==true?"gutter-box CompetitionsIndexbottomvalue Competitioncolor516 cursorpointer":"gutter-box CompetitionsIndexbottomvalue Competitioncolor516":"gutter-box CompetitionsIndexbottomvalue Competitioncolor516 cursorpointer"}
// 已结束onClick={data.competition_status === "nearly_published" ? "" : () => this.gotocourse(`/competitions/${this.props.match.params.identifier}/enroll`)}
onClick={ data.mode === 2 ?data.member_of_course==true?() => this.newgotocourse(`/courses/${data.course_id}`):"":() => this.newgotocourse(`/competitions/${this.props.match.params.identifier}/enroll`)}
>{data && data.member_count}</div>
:data.competition_status === "nearly_published" ?
<div className="gutter-box CompetitionsIndexbottomvalue Competitioncolor516"
// onClick={data.competition_status === "nearly_published" ? "" : () => this.gotocourse(`/competitions/${this.props.match.params.identifier}/enroll`)}
>{"--"}</div> :
data.competition_status === "progressing" ?
data.mode === 2 ?
<div className="gutter-box CompetitionsIndexbottomvalue Competitioncolor516 cursorpointer" onClick={() => this.gotocourse()}>{data && data.member_count}</div> : signupdata && signupdata.personal === true ?
<div className="gutter-box CompetitionsIndexbottomvalue Competitioncolor516 cursorpointer" onClick={() => this.gotocourse("personal")}>{data && data.member_count}</div> : <div
className="gutter-box CompetitionsIndexbottomvalue Competitioncolor516 cursorpointer"
onClick={() => this.gotocourse(`/competitions/${this.props.match.params.identifier}/enroll`)}>{data && data.member_count}</div>
:""}
</Col>
</Row>
</Col>
{data.competition_status === "ended" ? <style>
{
`
.Competitionfontsize22{
height: 50px;
border-radius: 4px;
}
`
}
</style> : <style>
{
`
.Competitionfontsize22{
height: 50px;
background: rgba(76,172,255,1);
border-radius: 4px;
}
`
}
</style>}
<Col className={"competitionbannerdiv mt20"}>
{data.competition_status === "ended" ?
<Button type="primary" block className={"Competitionfontsize22"} disabled={true}>
已结束
</Button> : data.enroll_end === true ?
<Button type="primary" block className={"Competitionfontsize22"} disabled={true}>
{data.competition_status === "nearly_published" ? "未发布" : "报名截止"}
</Button> :
data.competition_status === "progressing" ?
<Button type="primary" block className={"Competitionfontsize22"}>
{data.mode === 2 ?
<a onClick={() => this.gotocourse()}>立即报名</a> : signupdata && signupdata.personal === true ?
<a onClick={() => this.gotocourse("personal")}>立即报名</a> : <a
onClick={() => this.gotocourse(`/competitions/${this.props.match.params.identifier}/enroll`)}>立即报名</a>}
</Button>:""}
</Col>
<Col
className={"mt10 Competitionfontsize16"}>{data && data.enroll_end_time === null ? "" : `报名截止时间:${data && data.enroll_end_time}`}</Col>
</Col>
</Row>
</div>
<style>
{
`
.CompetitionMenu .ant-menu-item a{
overflow:hidden;
text-overflow:ellipsis;
white-space:nowrap
}
`
}
</style>
<Layout className={'teamsLayout mt40'}>
<Sider>
<Menu mode="inline" className="CompetitionMenu" selectedKeys={[`${this.state.thiskeys}`]}
onClick={(e) => this.getrightdatas(e)}>
{data && data.competition_modules.map((item, key) => {
if (item.module_type != "enroll") {
return (
<Menu.Item key={item.id}>
{/*{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)}*/}
{/*>{item.name}</a>}*/}
<a title={item.name}>{item.name}</a>
</Menu.Item>
)
}
})}
</Menu>
{/*<Menu mode="inline" className="CompetitionMenu" onClick={(e)=>this.isdownloadpdf(e)}>*/}
{/*<Menu.Item>*/}
{/*<a>证书下载</a>*/}
{/*</Menu.Item>*/}
{/*</Menu>*/}
</Sider>
{module_type === "certificate" ? "" : <Layout className={"teamsLayoutleft CompetitionContents mb30"}>
{this.state.module_type === "chart" ? Competitionedittype === false ? <CompetitionContentsChart
{...this.props}
{...this.state}
Competitionedit={() => this.Competitionedit()}
Competitioncallback={(e) => this.Competitioncallback(e)}
/> : "" : Competitionedittype === false ? <CompetitionContents
Competitionedit={() => this.Competitionedit()}
{...this.props}
{...this.state}
/> : ""}
{/*<CompetitionContentsChart*/}
{/*{...this.props}*/}
{/*{...this.state}*/}
{/*/>*/}
{Competitionedittype === true ? <CompetitionContentsMd
hideCompetitionedit={() => this.hideCompetitionedit()}
getlistdata={(keys, listkey) => this.getlistdata(keys, listkey)}
Competitioncallback={(e) => this.Competitioncallback(e)}
{...this.props}
{...this.state}
/> : ""}
</Layout>}
{module_type === "certificate" ? <Layout className={"teamsLayoutleft CompetitionContents mb30"}>
<CompetitionContentspdf
{...this.props}
{...this.state}
/>
</Layout> : ""}
</Layout>
</div>
)
}
}
export default CompetitionCommon;

@ -0,0 +1,45 @@
import React, { Component } from 'react';
import {Button,Layout} from 'antd';
import axios from 'axios';
import {markdownToHTML,getImageUrl,AttachmentList} from 'educoder';
const { Header, Footer, Sider, Content } = Layout;
class CompetitionContents extends Component{
constructor(props) {
super(props)
this.state={
hash:undefined
}
}
componentDidMount(){
window.document.title = '竞赛';
this.props.MdifHasAnchorJustScorll();
}
render() {
let {mdContentdata, data} = this.props;
//mdhash滚动
this.props.MdifHasAnchorJustScorll();
return (
<div className={"fr"}>
{data && data.permission.editable === true ? this.props.Competitionedittype === false ? this.props.has_url === false ?
<Button className={"fr"} type="primary" ghost onClick={() => this.props.Competitionedit()}>
编辑
</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>
<div className={"mt30"}>
<AttachmentList {...this.props} {...this.state} attachments={mdContentdata===undefined?[]:mdContentdata.attachments===undefined?[]:mdContentdata.attachments}></AttachmentList>
</div>
</div>
</div>
)
}
}
export default CompetitionContents;

@ -0,0 +1,423 @@
import React, { Component } from 'react';
import {Button,Layout,Tabs,Icon, Card, Avatar, Row, Col ,Table,Badge} from 'antd';
import {markdownToHTML,getImageUrl} from 'educoder';
import axios from 'axios';
const { Content } = Layout;
const { TabPane } = Tabs;
const { Meta } = Card;
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)
})
this.props.MdifHasAnchorJustScorll();
}
derivefun=(url)=>{
axios.get(url).then((response)=>{
if(response === undefined){
return
}
if(response.data.status&&response.data.status===-1){
this.props.showNotification(response.data.message);
}else if(response.data.status&&response.data.status===-2){
// if(response.data.message === "100"){
// // 已超出文件导出的上限数量100 ),建议:
//
// this.setState({
// DownloadType:true,
// DownloadMessageval:100
// })
// }else {
// //因附件资料超过500M
// this.setState({
// DownloadType:true,
// DownloadMessageval:500
// })
// }
this.props.showNotification(response.data.message);
}else {
// this.props.showNotification(`正在下载中`);
// window.open("/api"+url, '_blank');
this.props.slowDownload(url);
}
}).catch((error) => {
console.log(error)
});
}
render() {
this.props.MdifHasAnchorJustScorll();
const operations = <div>
<Button className={"fr"} type="primary" ghost onClick={()=>this.props.Competitionedit()}>编辑</Button>
<Button className={"fr mr20"} type="primary" ghost>
<a onClick={()=>this.derivefun(`/competitions/${this.props.match.params.identifier}/charts.xlsx`)}>导出</a>
</Button>
</div>
const columns = [
{
title: 'usersum',
dataIndex: 'usersum',
key: 'name',
render: text => <span className={"color-blue"}>{text}</span>,
},
{
title: 'userimg',
dataIndex: 'userimg',
key: 'userimg',
render: (text, record) =>(
<a href={`/users/${record.user_login}`} target={"_blank"} className="color-dark">
<div className={"relativef"}>
<img className={"Competitionuserimg mb10"} src={getImageUrl(`images/${record.userimg===null?`avatars/User/0?1442652658`:record.userimg}`)}/>
<div className={"competimgabsoluteijmg"}><Badge count={record.competition_prize} style={{ backgroundColor: '#459BE5' }} title={record.competition_prize}/></div>
</div>
</a>),
},
{
title: 'username',
dataIndex: 'username',
key: 'username',
render: text => <span title={text} title={text}>{text}</span>,
},
{
title: 'school',
dataIndex: 'school',
key: 'school',
render: text => <span title={text} title={text}>{text}</span>,
},
{
title: 'spendtime',
dataIndex: 'spendtime',
key: 'spendtime',
render: text => <span>{text}</span>,
},
{
title: 'score',
dataIndex: 'score',
key: 'score',
render: text => <span className={"color-blue"}>{text}</span>,
},
];
const datas = [];
let {chart_rules, chartdata, data} = this.props;
let {personal}=this.state;
if(this.props&&this.props.mode!=1){
columns.some((item,key)=> {
if (item.title === "spendtime") {
columns.splice(key, 1)
return true
}
}
)
}
{chartdata===undefined?"":chartdata.teams.length===0?"":chartdata.teams.map((item,key)=>{
let list={
usersum:key+1,
userimg:item.user_image,
username:personal===undefined||personal===null?item.record_user_name:personal===true?item.record_user_name:item.team_name,
school:item.school_name,
spendtime:item.spend_time,
score:item.score<50?"< 50 分":item.score,
user_login:item.user_login,
competition_prize:item.competition_prize
}
datas.push(list)
})}
// console.log(this.props&&this.props.mode)
// console.log(columns)
return (
<div>
<style>
{
`
.ant-tabs-nav .ant-tabs-tab{
font-size: 20px;
margin: 0 10px 0 0;
}
.ant-badge{
width:90px;
}
.ant-badge sup{
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
`
}
</style>
{chart_rules === undefined ? "" :
<Tabs onChange={(e) => this.props.Competitioncallback(e)} activeKey={this.props.tabkey}
tabBarExtraContent={data && data.permission.editable === 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}>
{chart_rules.rule_contents.map((items,keys)=>{
if(item.id===items.competition_stage_id){
return(
<Content key={keys} className={"markdown-body "} dangerouslySetInnerHTML={{__html: markdownToHTML(items.content===undefined||items.content===null?"":items.content).replace(/▁/g, "▁▁▁")}}></Content>
)
}else if(item.id===null&&items.competition_stage_id===0){
return(
<Content key={keys} className={"markdown-body "} dangerouslySetInnerHTML={{__html: markdownToHTML(items.content===undefined||items.content===null?"":items.content).replace(/▁/g, "▁▁▁")}}></Content>
)
}
})}
</TabPane>
)
})}
</Tabs>}
<Col className="gutter-row Competitioncharts mt30 mb30">总排名</Col>
{chartdata===undefined?"":chartdata.teams.length===0?<Col className="gutter-row Competitioncharts mt30 mb30 rankbeicenter">
<img src={getImageUrl(`images/educoder/competitions/trophy.png`)}/>
<div className={"rankbei mt10"}>要抓住一切机会向所有人证明你自己证明你能够迎接荣耀</div>
</Col>:""}
<Row calssName={"Competition399"}>
{chartdata===undefined?"":chartdata.teams.length===0?"":chartdata.teams.map((item,key)=>{
if(key===1){
return(
<Col className="mt40" xs={{ span: 5, offset: 1 }} lg={{ span: 6, offset: 2 }}>
<Card
className={"Competitionthird"}
cover={
<div className={"Competitionthirdbox center"}>
<li className="pr Competitioncenter">
<img src={getImageUrl("images/educoder/huangguan-two.png")}/>
<div className={"mt10"}>
<a href={`/users/${item.user_login}`} target={"_blank"} className="color-dark ">
<div className={"relativef"}>
<img className={"rankingimg"} src={getImageUrl(`images/${item.user_image===null?`avatars/User/0?1442652658`:item.user_image}`)} />
<div className={"competimgabsolute"}><Badge count={item.competition_prize} style={{ backgroundColor: '#459BE5' }} title={item.competition_prize}/></div>
</div>
<p className="task-hide rankName mt5 jinshaifont">{personal===undefined||personal===null?item.record_user_name:personal===true?item.record_user_name:item.team_name}</p>
</a>
</div>
</li>
</div>
}
>
<Meta
title={<div className={"center"}>
<div className={"rankfonttop"} title={item.school_name}>{item.school_name}</div>
{this.props&&this.props.mode===1?<div className={"rankfontmid"}>{item.spend_time}</div>:""}
</div>}
description={
<div className={"rankfontbottom"}>{item.score<50?"< 50 分":item.score}</div>
}
/>
</Card>
</Col>
)
}
})}
{chartdata===undefined?"":chartdata.teams.length===0?"":chartdata.teams.map((item,key)=>{
if(key===0){
return(
<Col xs={{ span: 11, offset: 1 }} lg={{ span: 6, offset: 1 }}>
<Card
className={"Competitionfirst"}
cover={
<div className={"Competitionfirstbox center"}>
<li className="pr Competitioncenter">
<img src={getImageUrl("images/educoder/huangguan.png")}/>
<div className={"mt10"}>
<a href={`/users/${item.user_login}`} target={"_blank"} className="color-dark">
<div className={"relativef"}>
<img className={"rankingimg"} src={getImageUrl(`images/${item.user_image===null?`avatars/User/0?1442652658`:item.user_image}`)} />
<div className={"competimgabsolute"}><Badge count={item.competition_prize} style={{ backgroundColor: '#459BE5' }} title={item.competition_prize}/></div>
</div>
<p className="task-hide rankName mt5 jinshaifont">{personal===undefined||personal===null?item.record_user_name:personal===true?item.record_user_name:item.team_name}</p>
</a>
</div>
</li>
</div>
}
>
<Meta
title={<div className={"center"}>
<div className={"rankfonttop"} title={item.school_name}>{item.school_name}</div>
{this.props&&this.props.mode===1?<div className={"rankfontmid"}>{item.spend_time}</div>:""}
</div>}
description={
<div className={"rankfontbottoms"}>{item.score<50?"< 50 分":item.score}</div>
}
/>
</Card>
</Col>
)
}
})}
{chartdata===undefined?"":chartdata.teams.length===0?"":chartdata.teams.map((item,key)=>{
if(key===2){
return(
<Col className="mt30" xs={{ span: 5, offset: 1 }} lg={{ span: 6, offset: 1 }}>
<Card
className={"Competitionsecondary "}
cover={
<div className={"Competitionsecondarybox center"}>
<li className=" pr Competitioncenter ">
<img src={getImageUrl("images/educoder/huangguan-three.png")}/>
<div className={"mt10"}>
<a href={`/users/${item.user_login}`} target={"_blank"} className="color-dark">
<div className={"relativef"}>
<img className={"rankingimg"} src={getImageUrl(`images/${item.user_image===null?`avatars/User/0?1442652658`:item.user_image}`)} />
<div className={"competimgabsolute"}><Badge count={item.competition_prize} style={{ backgroundColor: '#459BE5' }} title={item.competition_prize}/></div>
</div>
<p className="task-hide rankName mt5 jinshaifont">{personal===undefined||personal===null?item.record_user_name:personal===true?item.record_user_name:item.team_name}</p>
</a>
</div>
</li>
</div>
}
>
<Meta
title={<div className={"center"}>
<div className={"rankfonttop"} title={item.school_name}>{item.school_name}</div>
{this.props&&this.props.mode===1?<div className={"rankfontmid"}>{item.spend_time}</div>:""}
</div>}
description={
<div className={"rankfontbottom"}>{item.score<50?"< 50 分":item.score}</div>
}
/>
</Card>
</Col>
)
}
})}
</Row>
{chartdata===undefined?"":chartdata.user_ranks.length===0?"":<div className={"youranklist mt50"}>
<style>
{
`
.ant-col-9 {
width: 35.5%;
}
.col13{
width:13%;
text-align:left;
}
.col24{
width: 24%;
text-align: left;
padding-left: 33px;
}
.col15{
width: 14%;
text-align: right;
}
.col12{
width: 12%;
text-align: right;
}
.col10{
width: 10%;
}
.col6{
width: 6%;
}
`
}
</style>
{chartdata.user_ranks.map((item,key)=>{
return(
<Row type="flex" key={key}>
<Col span={4} order={1} className={"col13"}>
<span className={"ranknames"}>您当前排名:{item.rank}</span>
</Col>
<Col className="userranksclass" span={3} order={2} className={"col24"}>
{personal===undefined||personal===null?item.record_user_name:personal===true?item.user_name:item.team_name}
</Col>
<Col className="textleft" span={9} order={3}>
{/*{item.team_name}*/}
</Col>
{item.cost_time=== "--"?<Col span={3} order={4} className={"col6"}>
{this.props&&this.props.mode===1?item.cost_time:""}
</Col>:<Col span={3} order={4} className={"col10"}>
{this.props&&this.props.mode===1?item.cost_time:""}
</Col>}
{item.cost_time=== "--"?<Col className="textright" span={3} order={5} className={"col15"}>
<span className={"ranknameslast"}>{item.score<50?"< 50 分":item.score}</span>
</Col>:<Col className="textright" span={3} order={5} className={"col12"}>
<span className={"ranknameslast"}>{item.score<50?"< 50 分":item.score}</span>
</Col>}
</Row>
)
})}
</div>}
<Row className={"mt20 mb80"}>
<style>
{
`
.ant-table-tbody > tr > td:nth-last-child(4){
overflow: hidden;
max-width: 100px;
-o-text-overflow: ellipsis;
text-overflow: ellipsis;
white-space: nowrap;
cursor: default;
}
.ant-table-tbody > tr > td:nth-last-child(3){
overflow: hidden;
max-width: 200px;
-o-text-overflow: ellipsis;
text-overflow: ellipsis;
white-space: nowrap;
cursor: default;
}
.ant-table-tbody>tr>td, .ant-table-thead>tr>th {
padding: 5px;
}
`
}
</style>
{chartdata === undefined ? "" : chartdata.teams.length === 0 ? "" :
<Table className="Competitiontransparent" columns={columns} dataSource={datas} showHeader={false}
pagination={false}/>}
</Row>
</div>
)
}
}
export default CompetitionContents;

@ -0,0 +1,232 @@
import React, { Component } from 'react';
import {Button, Card, Row, Col ,Upload,Icon,message,Tabs} from 'antd';
import axios from 'axios';
import {getImageUrl,getUrl,appendFileSizeToUploadFileAll,appendFileSizeToUploadFile} from 'educoder';
import TPMMDEditor from '../../../tpm/challengesnew/TPMMDEditor';
const { TabPane } = Tabs;
class CompetitionContentsMd extends Component{
constructor(props) {
super(props)
this.contentMdRef = React.createRef();
this.state={
contentFileList:[],
chartmodule_id:undefined
}
}
componentDidUpdate =(prevState)=>{
if(prevState!=this.props){
this.getchartdata();
}
}
componentDidMount(){
window.document.title = '竞赛';
this.getchartdata()
}
getchartdata=()=>{
let {mdContentdata,chart_rules}=this.props;
// is_pdf: false
if(this.props.module_type==="chart"){
let type=true;
if(chart_rules===undefined){
}else{
chart_rules.rule_contents.map((items,keys)=>{
debugger
if(parseInt(this.props.tabkey)===items.competition_stage_id){
console.log(items)
this.contentMdRef.current.setValue(items.content);
this.setState({
contentFileList:undefined,
chartmodule_id:items.id
})
type=false;
}
})
if(type===true){
this.contentMdRef.current.setValue("");
this.setState({
contentFileList:undefined,
chartmodule_id:undefined
})
}
}
}else{
let contentFileList = mdContentdata===undefined?[]:mdContentdata.attachments===undefined?[]:mdContentdata.attachments.map((item) => {
return {
id: item.id,
uid: item.id,
name: appendFileSizeToUploadFile(item),
url: item.url,
filesize: item.filesize,
status: 'done',
response:{id: item.id}
}
})
this.setState({
contentFileList:contentFileList
})
this.contentMdRef.current.setValue(mdContentdata===undefined?"":mdContentdata.md_content===undefined?"":mdContentdata.md_content || '')
}
}
handleContentUploadChange = (info) => {
if (info.file.status === 'uploading' || info.file.status === 'done' || info.file.status === 'removed') {
let contentFileList = info.fileList;
this.setState({ contentFileList: appendFileSizeToUploadFileAll(contentFileList) });
}
}
onAttachmentRemove = (file, stateName) => {
if(file.response!=undefined){
this.props.confirm({
content: '是否确认删除?',
onOk: () => {
this.deleteAttachment(file, stateName)
},
onCancel() {
console.log('Cancel');
},
});
return false;
}
}
deleteAttachment = (file, stateName) => {
// 初次上传不能直接取uid
const url = `/attachments/${file.response ? file.response.id : file.uid}.json`
axios.delete(url, {
})
.then((response) => {
if (response.data) {
const { status } = response.data;
if (status == 0) {
console.log('--- success')
this.props.showNotification(response.data.message);
this.setState((state) => {
const index = state[stateName].indexOf(file);
const newFileList = state[stateName].slice();
newFileList.splice(index, 1);
return {
[stateName]: newFileList,
};
});
}
}
})
.catch(function (error) {
console.log(error);
});
}
handleSubmit = () => {
let {contentFileList}=this.state;
const mdContnet = this.contentMdRef.current.getValue().trim();
// if(mdContnet.length>10000){
// this.props.showNotification("内容超过10000个字");
// return
// }
let attachment_ids=undefined
if(contentFileList!=undefined){
attachment_ids= contentFileList.map(item => {
return item.response ? item.response.id : item.id
})
}
let newstage_id=parseInt(this.props.tabkey)===0||null?undefined:parseInt(this.props.tabkey)
let data={}
if(this.props.module_type==="chart"){
data={
md_content_id:this.state.chartmodule_id,
competition_module_id:this.props.module_id,
stage_id:newstage_id,
content:mdContnet,
}
}else{
data={
md_content_id:this.props.mdContentdata.md_id,
competition_module_id:this.props.mdContentdata.id,
content:mdContnet,
attachment_ids:attachment_ids
}
}
let url=`/competitions/${this.props.match.params.identifier}/update_md_content.json`;
axios.post(url,data
).then((response) => {
if(response.data.status===0){
this.props.showNotification(response.data.message);
this.props.getlistdata(this.props.thiskeys,this.props.tabkey);
this.props.hideCompetitionedit();
}else{
this.props.showNotification(response.data.message);
}
}).catch((error) => {
console.log(error)
})
}
render() {
let {contentFileList}=this.state;
let {chart_rules}=this.props;
const uploadProps = {
width: 600,
fileList: contentFileList,
multiple: true,
// https://github.com/ant-design/ant-design/issues/15505
// showUploadList={false},然后外部拿到 fileList 数组自行渲染列表。
// showUploadList: false,
action: `${getUrl()}/api/attachments.json`,
onChange: this.handleContentUploadChange,
onRemove: (file) => this.onAttachmentRemove(file, 'contentFileList'),
beforeUpload: (file) => {
console.log('beforeUpload', file.name);
const isLt150M = file.size / 1024 / 1024 < 150;
if (!isLt150M) {
this.props.showNotification("文件大小必须小于150MB");
}
return isLt150M;
},
};
// console.log(this.props.tabkey)
// console.log(chart_rules)
console.log(this.props.mdContentdata)
return (
<div>
{chart_rules===undefined?"":this.props.module_type==="chart"?<Tabs activeKey={this.props.tabkey} onChange={(e)=>this.props.Competitioncallback(e)}>
{chart_rules.stages.map((item,key)=>{
return(
<TabPane tab={item.name} key={item.id===null?0:item.id}></TabPane>
)
})}
</Tabs>:""}
<TPMMDEditor ref={this.contentMdRef} placeholder="请输入内容说明" mdID={'courseContentMD'} refreshTimeout={1500}
className="courseMessageMD" initValue={this.state.description}></TPMMDEditor>
{this.props.module_type==="chart"?"":<Upload {...uploadProps} className="upload_1 newWorkUpload">
<Button className="uploadBtn">
<Icon type="upload" /> 上传附件
</Button>
(单个文件150M以内)
</Upload>}
<div className="clearfix mt30 mb30">
{/* htmlType="submit" */}
<Button type="primary" onClick={this.handleSubmit} className="defalutSubmitbtn fl mr20">提交</Button>
<a className="defalutCancelbtn fl" onClick={() => this.props.hideCompetitionedit()}>取消</ a>
</div>
</div>
)
}
}
export default CompetitionContentsMd;

@ -0,0 +1,64 @@
import React, { Component } from 'react';
import {Tabs} from 'antd';
import axios from 'axios';
import {markdownToHTML,getImageUrl,AttachmentList} from 'educoder';
import CompetitionContentspdfdownload from './CompetitionContentspdfChild/CompetitionContentspdfdownload';
import CompetitionContentspdfpeopledata from './CompetitionContentspdfChild/CompetitionContentspdfpeopledata';
// import NoneData from "../../../courses/shixunHomework/shixunHomework";
const { TabPane } = Tabs;
class CompetitionContentspdf extends Component{
constructor(props) {
super(props)
this.state={
Tabskey:"1"
}
}
componentDidMount(){
window.document.title = '竞赛';
let query=this.props.location&&this.props.location.search;
const types = query.split('user_id=')
if(types[1]===undefined){
}else{
this.setState({
Tabskey:"2"
})
}
}
Competitioncallback=(key)=>{
this.setState({
Tabskey:key
})
}
render() {
return (
<div className={"fr"}>
<div className={"mb100 "}>
<Tabs defaultActiveKey="1" onChange={(e) => this.Competitioncallback(e)} activeKey={this.state.Tabskey}>
<TabPane tab="获奖证书下载" key="1" >
{this.state.Tabskey==="1"?<CompetitionContentspdfdownload
{...this.props}
{...this.state}
Competitioncallback={(e)=>this.Competitioncallback(e)}
/>:""}
</TabPane>
<TabPane tab="完善个人信息" key="2">
{this.state.Tabskey==="2"?<CompetitionContentspdfpeopledata
{...this.props}
{...this.state}
/>:""}
</TabPane>
</Tabs>
</div>
</div>
)
}
}
export default CompetitionContentspdf;

@ -0,0 +1,292 @@
import React, {Component} from 'react';
import {Button, Layout, Input, Form} from 'antd';
import axios from 'axios';
import {getImageUrl} from 'educoder';
import mycompetotionchild from './mycompetotionchild.css';
import {getHiddenName} from "../../../../user/account/AccountBasicEdit";
import '../../../../courses/css/Courses.css'
export const identityMap = {"teacher": "教师", "student": "学生", "professional": "专业人士"}
class Bankcardnumberverification extends Component {
constructor(props) {
super(props)
this.state = {
basicInfo: {},
updating: '',
secondsFlag: false,
seconds: 60,
phonebool: false,
emailbool: false,
formationdata: [],
bank_account_editable: false,
leader: false,
bank_account: undefined,
certification: 1
}
}
componentDidMount() {
window.document.title = '竞赛';
// console.log("3获取用户信息");
// console.log(this.props)
try {
this.props.triggerRef(this);
}catch (e) {
}
console.log(this.props.bank_account);
//初始化值
if (this.props.bank_account) {
this.props.form.setFieldsValue({
openingbank: this.props.bank_account.bank,
subbranch: this.props.bank_account.second_bank,
subbranchs: this.props.bank_account.card_no,
})
this.setState({
openingbank: this.props.bank_account.bank,
subbranch: this.props.bank_account.second_bank,
subbranchs: this.props.bank_account.card_no,
})
}
}
setdata(bank,second_bank,card_no){
this.props.form.setFieldsValue({
openingbank: bank,
subbranch: second_bank,
subbranchs:card_no,
})
}
componentDidUpdate = (prevProps) => {
if (prevProps.bank_account != this.props.bank_account) {
console.log("componentDidUpdate");
console.log(this.props);//是新数据
console.log(prevProps);//是老数据
////console.log("Registration");
////console.log("componentDidUpdate");
////console.log(this.props.user.admin);
try {
if(this.props.bank_account){
this.props.form.setFieldsValue({
openingbank: this.props.bank_account.bank,
subbranch: this.props.bank_account.second_bank,
subbranchs: this.props.bank_account.card_no,
})
}
this.setState({
openingbank: this.props.bank_account.bank,
subbranch: this.props.bank_account.second_bank,
subbranchs: this.props.bank_account.card_no,
})
}catch (e) {
}
}
}
yhBankstrue = () => {
this.props.form.validateFieldsAndScroll((err, values) => {
if (!err) {
let url = `/competitions/${this.props.match.params.identifier}/prize_leader_account.json`;
axios.patch(url, {
user_id:this.props.userdata.id,
bank: values.openingbank,
second_bank: values.subbranch ,
card_no: values.subbranchs
})
.then((result) => {
try {
if (result.data.status === 0) {
try {
// console.log(values.openingbank);
// console.log(values.subbranch);
// console.log(values.subbranchs);
this.props.form.setFieldsValue({
openingbank: values.openingbank,
subbranch: values.subbranch,
subbranchs: values.subbranchs,
});
this.setState({
openingbank: values.openingbank,
subbranch: values.subbranch,
subbranchs: values.subbranchs,
})
}catch (e) {
}
try {
this.props.showNotification(`提交成功,等待审核!`);
}catch (e) {
}
try {
this.props.getdata(this.props.userdata.id);
}catch (e) {
}
try {
this.props.GetawardinformationAPI();
}catch (e) {
}
}
} catch (e) {
}
}).catch((error) => {
console.log(error);
})
}
})
}
render() {
const {getFieldDecorator} = this.props.form;
const {updating, seconds, secondsFlag, basicInfo, phonebool, emailbool, certification, formationdata, bank_account_editable, leader, bank_account} = this.state
return (
<div>
<div className="flexdirections mt36">
<p className="fontcolorsyslhei font-16">//开户行及银行卡号</p>
<p className="fontcolorsyslhui font-14 ml11">为保障奖金的及时发放请队长如实填写你名下的银行卡信息</p>
</div>
<div className="ml38">
<style>{`
.flexRow {
padding: 20px 0;
}
.flexRow .name {
margin-left: 12px;
color: #666666;
text-align: center;
flex: 0 0 100px;
}
.flexRow .description {
margin-left: 10px;
flex: 1;
color: #CDCDCD;
}
.description span {
margin-right: 20px;
color: #05101A;
}
.flexRow .status {
width: 100px;
color: #28AC7F;
text-align: right;
}
.flexTable .flexTable {
border-bottom: 1px solid #EBEBEB;
}
.settingFormsy label{
color: #666666;
font-size: 14px !important ;
}
.settingFormsy input {
width: 340px;
height: 40px;
}
.settingFormsy input.validateInput {
width: 220px;
}
.settingFormsy .formItemInline button {
width: 110px;
margin-left: 10px;
}
.settingFormsy .ant-form-item-label {
width: 60px;
text-align: left;
}
.formItemInline .ant-form-explain{
position:absolute;
bottom:-22px;
left:0px;
width:100%;
}
.yslzxueshi .ant-input{
height: 40px !important;
width: 276px !important
}
// class="ant-col ant-form-item-label"
`}</style>
<div className="settingFormsy">
<React.Fragment>
<Form>
<Form.Item
label="开户行:"
className="formItemInline hideRequireTag mb20 mt20"
>
{getFieldDecorator('openingbank', {
rules: [{
initialValue:this.state.openingbank,
required: true,
message: '请输入开户行',
}],
})(
<Input placeholder={`例如:中国工商银行`}></Input>
)}
</Form.Item>
<Form.Item
label="支行:"
className="formItemInline hideRequireTag mb20 mt20"
>
{getFieldDecorator('subbranch', {
rules: [{
initialValue: this.state.subbranch,
required: true,
message: '请输入支行',
}],
})(
<Input placeholder={`例如:长沙天河支行`}></Input>
)}
</Form.Item>
<Form.Item
label="账号:"
className="formItemInline hideRequireTag mb20 mt20"
>
{getFieldDecorator('subbranchs', {
rules: [{
initialValue: this.state.subbranchs,
required: true,
message: '请输入账号',
}],
})(
<Input placeholder={`请填写银行卡账号`}></Input>
)}
</Form.Item>
<div className="flexdirections yslzxueshi ml38 mt34">
<p className="fontcolorsyslhui1 font-14 w300 myysllineheight myyslminwidth"></p>
<div className="myyslminwidth276 flexdirections">
{/*<div className="buttongo mycompitcursor" onClick={()=>this.yhBanksfalse()}><p className="fontwenzi mycompitcursor" >取消</p></div>*/}
<Button type="primary" onClick={() => this.yhBankstrue()}>确定</Button>
</div>
</div>
</Form>
</React.Fragment>
</div>
</div>
</div>
)
}
}
const Bankcardnumberverifications = Form.create({name: 'Bankcardnumberverification'})(Bankcardnumberverification);
export default Bankcardnumberverifications;

@ -0,0 +1,24 @@
.pdfdownload {
max-width: 791px;
height: 40px;
background: rgba(249, 249, 249, 1);
line-height: 40px;
padding-left: 15px;
}
.pdfpicture {
font-size: 16px;
color: rgba(0, 0, 0, 1);
}
.pdfdownloadfont4CACFF {
color: #4CACFF !important;
}
.pdfdownloadfont00CC5F {
color: #00CC5F;
}
.pdfdownloadfontFF6602 {
color: #FF6602;
}

@ -0,0 +1,215 @@
import React, { Component } from 'react';
import {Button,Layout,Row, Col,Divider,Table} from 'antd';
import axios from 'axios';
import {getImageUrl} from 'educoder';
import './CompetitionContentspdfdownload.css';
// import NoneData from "../../../courses/shixunHomework/shixunHomework";
class CompetitionContentspdfdownload extends Component{
constructor(props) {
super(props)
this.state={
data:undefined,
teams:undefined
}
}
componentDidMount(){
window.document.title = '竞赛';
let url=`/competitions/${this.props.match.params.identifier}/prize.json`;
let query=this.props.location&&this.props.location.search;
const types = query.split('user_id=')
let userid;
if(types[1]===undefined){
userid=this.props.user&&this.props.user.user_id;
}else{
userid=types[1];
}
axios.get(url,{params:{
user_id:userid,
}
}).then((response) => {
if(response.status===200){
let datas=response.data.teams;
if(datas.length>0){
datas.map((item,key)=>{
let lista=item.team_members;
if(lista.length>0){
console.log(lista)
lista.map((i,k)=>{
i["bank_account"]=item.bank_account;
})
}
})
}
this.setState({
data:response.data,
teams:datas,
})
}
}).catch((error) => {
console.log(error)
})
}
render() {
let {data,teams}=this.state;
const columns = [
{
title: '角色',
dataIndex: 'type',
key: 'type',
render: (text, record) => (
<span>
{record.role}
</span>
),
},
{
title: '姓名',
dataIndex: 'name',
key: 'name',
render: (text, record) => (
<span>
{record.name}
</span>
),
},
{
title: '实名认证',
dataIndex: 'namecertify',
key: 'namecertify',
render: (text, record) => (
<span>
{record.real_name_auth==="authed"?<span className={"pdfdownloadfont00CC5F"}>已认证</span>:record.real_name_auth==="authing"?<span className={"pdfdownloadfontFF6602"}></span>:record.real_name_auth==="not_authed"?<span className={"color-red"}></span>:""}
</span>
),
},
{
title: '职业认证',
key: 'certify',
dataIndex: 'certify',
render: (text, record) => (
<span>
{record.professional_auth==="authed"?<span className={"pdfdownloadfont00CC5F"}>已认证</span>:record.professional_auth==="authing"?<span className={"pdfdownloadfontFF6602"}></span>:record.professional_auth==="not_authed"?<span className={"color-red"}></span>:""}
</span>
),
},
{
title: '手机绑定',
key: 'mobile',
dataIndex: 'mobile',
render: (text, record) => (
<span>
{record.phone_binded===true?<span className={"pdfdownloadfont00CC5F"}>已绑定</span>:<span className={"color-red"}></span>}
</span>
),
},
{
title: '邮箱绑定',
key: 'mail',
dataIndex: 'mail',
render: (text, record) => (
<span>
{record.email_binded===true?<span className={"pdfdownloadfont00CC5F"}>已绑定</span>:<span className={"color-red"}></span>}
</span>
),
},
{
title: '开户行及银行卡号信息(队长填写)',
key: 'idcard',
dataIndex: 'idcard',
render: (value, record, index) => {
if (index === 0&&record.bank_account!=null) {
return {
children: <span>{record.bank_account.bank + record.bank_account.second_bank + record.bank_account.card_no}</span>,
};
}
},
},
];
let people=[ { url: '/api/competitions/xxxxx/certificates/1/personal' },
{ url: '/api/competitions/xxxxx/certificates/2/personal' },]
return (
<React.Fragment>
<Row>
<Col className={"pdfdownload"}>温馨提示填写的个人信息经审批后将提供个人获奖证书下载团队队员信息全部审批后将提供团队获奖证书下载</Col>
</Row>
<Row className={"mt30"}>
<Col className={"pdfpicture"}>证书情况</Col>
</Row>
<Row className={"mt30"}>
<Col>个人证书{data&&data.personal_certifications.length===0&&data&&data.all_certified===false?
<span><span className={"pdfpicture font-14"}>暂未生成</span> <span className={"ml20"}><span className={"pdfpicture font-14"}></span><a className={"pdfdownloadfont4CACFF"} onClick={()=>this.props.Competitioncallback("2")}></a></span></span>:
data&&data.personal_certifications.length===0&&data&&data.all_certified===true?
<span><span className={"pdfpicture font-14"}>暂未生成</span> <span className={"ml20"}><span className={"pdfpicture font-14"}></span></span></span>:
data&&data.personal_certifications.map((item,key)=>{
return(
<span className={"mr10"} key={key}>
<img src={ getImageUrl(`images/educoder/pdfs.png`)} />
<a className={"pdfdownloadfont4CACFF ml10"} href={item.url} download=""
title="下载" mce_href="#">立即下载</a>
</span>
)
})}</Col>
</Row>
<Row className={"mt30"}>
<Col>团队证书
{data&&data.team_certifications.length===0?<span className={"pdfpicture font-14"}>暂未生成</span>
:data&&data.team_certifications.map((item,key)=>{
return(
<span className={"mr10"} key={key}>
<img src={ getImageUrl(`images/educoder/pdfs.png`)} />
<a className={"pdfdownloadfont4CACFF ml10"} href={item.url} download=""
title="下载" mce_href="#">立即下载</a>
</span>
)
})}
</Col>
</Row>
<Divider />
<style>
{
`
.pdfdownloadTable .ant-table-column-title{
color:#000;
}
.pdfdownloadTable .ant-table-tbody > tr > td{
color:#666666;
border-bottom: 1px solid transparent;
}
.pdfdownloadTable .ant-table-thead > tr > th, .ant-table-tbody > tr > td{
text-align: center;
}
`
}
</style>
{teams&&teams.map((item,key)=>{
return(
<Row className={"mt30"} key={key}>
<Col className={"pdfpicture mb20"}>{item.name}战队信息填报概况</Col>
<Table columns={columns} dataSource={item.team_members} className={"pdfdownloadTable"} pagination={false}/>
</Row>
)
})
}
</React.Fragment>
)
}
}
export default CompetitionContentspdfdownload;

@ -0,0 +1,596 @@
import React, {Component} from 'react';
import {Button, Layout, Input, Form} from 'antd';
import axios from 'axios';
import {getImageUrl} from 'educoder';
import mycompetotionchild from './mycompetotionchild.css';
import {getHiddenName} from "../../../../user/account/AccountBasicEdit";
import '../../../../courses/css/Courses.css'
import RealNameCertificationModal from "../../../../user/modal/RealNameCertificationModal";
import Phonenumberverifications from './Phonenumberverification';
import Mailboxvalidations from './Mailboxvalidation'
import Bankcardnumberverifications from './Bankcardnumberverification'
export const identityMap = {"teacher": "教师", "student": "学生", "professional": "专业人士"}
class CompetitionContentspdfpeopledata extends Component {
constructor(props) {
super(props)
this.state = {
basicInfo: {},
updating: '',
secondsFlag: false,
seconds: 60,
phonebool: false,
emailbool: false,
formationdata: [],
bank_account_editable: false,
leader: false,
bank_account: undefined,
certification: 1,
userdata:undefined
}
}
componentDidMount() {
window.document.title = '竞赛';
console.log("获取用户信息");
console.log(this.props);
this.GetawardinformationAPI();
let query=this.props.location&&this.props.location.search;
const types = query.split('user_id=')
let userid;
if(types[1]===undefined){
userid=this.props.user&&this.props.user.user_id;
}else{
userid=types[1];
}
this.getdata(userid);
this.GetuseridApi(userid);
}
GetuseridApi=(id)=>{
//个人信息API 获取个人信息
let url = `/users/accounts/${id}.json`;
axios.get(url).then((result) => {
if (result.data) {
console.log("GetuseridApi");
console.log(result.data);
this.setState({
userdata:result.data
})
}
}).catch((error) => {
console.log(error);
})
}
GetawardinformationAPI = () => {
let url = `/competitions/${this.props.match.params.identifier}/prize.json`;
let query=this.props.location&&this.props.location.search;
const types = query.split('user_id=')
let userid;
if(types[1]===undefined){
userid=this.props.user&&this.props.user.user_id;
}else{
userid=types[1];
}
axios.get(url,{params:{
user_id:userid,
}
}).then((result) => {
if (result.data) {
this.setState({
formationdata: result.data.formationdata,
bank_account_editable: result.data.bank_account_editable, //队长是否可以编辑
leader: result.data.leader, //是否是队长
bank_account: result.data.bank_account, //队长银行卡号信息
})
}
}).catch((error) => {
console.log(error);
})
}
getdata = (id) => {
this.setState({
certification: 3
})
this.GetuseridApi(id);
};
// 绑定手机
onPhoneSubmit = () => {
this.props.form.validateFieldsAndScroll((err, values) => {
if (!err) {
let {id} =this.state.userdata;
let reg = /^1\d{10}$/;
if (reg.test(values.phone)) {
let url = `/users/accounts/${id}/phone_bind.json`
axios.post((url), {
phone: values.phone,
code: values.phoneValidateCode
}).then((result) => {
if (result) {
this.props.showNotification("手机号码绑定成功!");
this.setState({
phonebool: false
})
this.getdata(this.state.userdata.id);
}
}).catch((error) => {
console.log(error);
})
} else {
this.props.showNotification("请输入有效的11位手机号码");
}
}
})
}
// 绑定邮箱
onEmailSubmit = () => {
this.props.form.validateFieldsAndScroll((err, values) => {
if (!err) {
let {id} =this.state.userdata;
let reg = /^[a-zA-Z0-9]+([.\-_\\]*[a-zA-Z0-9])*@([a-z0-9]+[-a-z0-9]*[a-z0-9]+.){1,63}[a-z0-9]+$/;
if (reg.test(values.email)) {
let url = `/users/accounts/${id}/email_bind.json`
axios.post((url), {
email: values.email,
code: values.emailValidateCode
}).then((result) => {
if (result) {
this.props.showNotification("邮箱地址绑定成功!");
this.setState({
emailbool: false
})
this.getdata(this.state.userdata.id);
}
}).catch((error) => {
console.log(error);
})
} else {
this.props.showNotification("请输入正确的邮箱地址");
}
}
})
}
//取消编辑
hideUpdating = (i) => {
if (i === 1) {
this.setState({
phonebool: false
})
} else if (i === 2) {
this.setState({
emailbool: false
})
} else if (i === 3) {
}
}
// 获取验证码
getCode = (index) => {
let url = `/accounts/get_verification_code.json`
let login = '';
let values = this.props.form.getFieldsValue();
if (index == 3) {
//绑定手机号码
login = values.phone;
let reg = /^1\d{10}$/;
if (reg.test(login) == false) {
this.props.showNotification(`请先输入正确的手机号码`);
return;
}
} else if (index == 4) {
// 绑定邮箱
login = values.email;
let reg = /^[a-zA-Z0-9]+([.\-_\\]*[a-zA-Z0-9])*@([a-z0-9]+[-a-z0-9]*[a-z0-9]+.){1,63}[a-z0-9]+$/;
if (reg.test(login) == false) {
this.props.showNotification(`请先输入正确的邮箱地址`);
return;
}
}
let type = index;
if (!login) {
this.props.showNotification(`请先输入${index == 3 ? "手机号码" : "邮箱地址"}`);
return;
}
axios.get((url), {
params: {
login, type
}
}).then((result) => {
if (result) {
// 倒计时
this.setState({
secondsFlag: true
})
this.remainTime();
}
}).catch((error) => {
console.log(error);
})
}
// 获取验证码倒计时
remainTime = () => {
this.setState({
seconds: 60
})
this.timer = setInterval(() => {
let {seconds} = this.state;
let s = parseInt(seconds) - 1;
if (s > -1) {
this.setState({
seconds: s
})
} else {
this.setState({
secondsFlag: false
})
clearInterval(this.timer);
}
}, 1000)
}
phonebools = () => {
this.setState({
phonebool: true
})
}
emailbools = () => {
console.log("点击了邮箱");
this.setState({
emailbool: true
})
}
//立即认证
checkBasicInfo = (index) => {
if (this.state.userdata.base_info_completed == true) {
this.showRealNameCertificationModal(index)
} else {
try {
this.props.confirm({
okText: `立即完善`,
content: `请先完善基本信息`,
onOk: () => {
this.props.history.push('/account/profile/edit')
}
})
} catch (e) {
this.props.history.push(`/account/profile/edit`);
}
}
}
showRealNameCertificationModal = (index) => {
this.setState({
certification: index,
}, () => {
if (index == 1) {
this.realNameCertificationModal1.setVisible(true)
} else if (index == 2) {
this.realNameCertificationModal2.setVisible(true)
}
})
}
//绑定银行确认
yhBankstrue = () => {
this.props.form.validateFieldsAndScroll((err, values) => {
if (!err) {
let url = `/competitions/${this.props.match.params.identifier}/prize_leader_account.json`;
axios.patch(url, {
user_id:this.state.userdata.id,
bank: values.openingbank,
second_bank: values.subbranchs,
card_no: values.subbranch
})
.then((result) => {
try {
if (result.data.status == 0) {
// console.log(JSON.stringify(result));
this.props.showNotification(`提交成功`);
this.getdata(this.state.userdata.id);
this.GetawardinformationAPI();
}
} catch (e) {
}
}).catch((error) => {
console.log(error);
})
}
})
}
//取消认证弹框
onCancel = () => {
this.getdata(this.state.userdata.id);
}
bindRef = ref => { this.child = ref }
//撤销认证
Cancellationofapplication = (index) => {
let userid;
let query=this.props.location&&this.props.location.search;
const types = query.split('user_id=')
if(types[1]===undefined){
userid=this.props.user&&this.props.user.user_id;
}else{
userid=types[1];
}
let url = ""
if (index === 1) {
url = `/users/accounts/${userid}/authentication_apply.json`;
} else if (index === 2) {
url = `/users/accounts/${userid}/professional_auth_apply.json`;
}
axios.delete(url)
.then((response) => {
try {
if (response.data.status == 0) {
if (index === 1) {
this.props.showNotification('撤销实名认证成功')
} else if (index === 2) {
this.props.showNotification('撤销职业认证成功')
}
try {
this.getdata(this.state.userdata.id);
}catch (e) {
}
}
} catch (e) {
}
})
.catch(function (error) {
console.log(error);
});
}
render() {
const admins=this.props.user.admin;
if(admins===undefined||admins===null) {
admins === false;
}
const {updating, seconds, secondsFlag,userdata, basicInfo, phonebool, emailbool, certification, formationdata, bank_account_editable, leader, bank_account} = this.state
return (
<div className="flexdidirectionss mt17">
{this.state.certification === 1 &&userdata?
<RealNameCertificationModal {...this.props} {...this.state} basicInfo={userdata}
wrappedComponentRef={(form) => this.realNameCertificationModal1 = form}
certification={certification}
Getdata={(id) => this.getdata(id)}
onCancel={() => this.onCancel()}
></RealNameCertificationModal>
: ""}
{this.state.certification === 2 &&userdata ?
<RealNameCertificationModal {...this.props} {...this.state} basicInfo={userdata}
wrappedComponentRef={(form) => this.realNameCertificationModal2 = form}
certification={certification}
Getdata={(id) => this.getdata(id)}
onCancel={() => this.onCancel()}
></RealNameCertificationModal> : ""}
<div className="flexdirections ">
<p className="fontcolorsyslhei font-16 w98"><span className="fontcolorsysl font-16">*</span><span></span>
</p>
{userdata && userdata.authentication == "uncertified" ?
<p className="fontcolorsyslhui font-14 w200">通过实名认证后才能获得证书</p> : ""
}
{userdata && userdata.authentication == "uncertified" ?
<p className="fontcolorsysllan font-14 ml3 mycompitcursor"
onClick={() => this.checkBasicInfo(1)}>立即认证</p> : ""
}
</div>
<div className="flexdirections ml38 mt23">
<p className="fontcolorsyslhui1">姓名</p>
<p className="fontcolorsyslhei flexdirections">{userdata && userdata.name}
{
userdata && userdata.authentication == "uncertified" ? "" :
userdata && userdata.authentication == "applying" ?
<p className="flexdirections"><p className="iconfont icon-tishi colorgreenorg font-14 ml20"></p><p
className="colorgreenorg font-14 ml6">待审核</p><p
className="fontcolorsysllan borcolors font-12 w64 mycompitcursor"
onClick={() => this.Cancellationofapplication(1)}>撤销认证</p></p>
:
<p className="flexdirections">
<p className="iconfont icon-wancheng colorgreenlight font-14 ml20"></p><p
className="colorgreenlight font-14 ml6">已认证</p>
</p>
}
</p>
</div>
<div className="flexdirections ml38 mt19">
<p className="fontcolorsyslhui1">性别</p>
<p className="fontcolorsyslhei"> {userdata && userdata.gender == 0 ? "男" : "女"}</p>
</div>
<div className="flexdirections mt36 ">
<p className="fontcolorsyslhei font-16 w98"><span className="fontcolorsysl font-16">*</span><span></span>
</p>
{
userdata && userdata.professional_certification == "uncertified" ?
<p className="fontcolorsyslhui font-14 w200">通过职业认证后才能获得证书</p>
: ""}
{
userdata && userdata.professional_certification == "uncertified" ?
<p className="fontcolorsysllan font-14 ml3 mycompitcursor" onClick={() => this.checkBasicInfo(2)}>立即认证</p>
: ""}
</div>
<div className="flexdirections ml38 mt23">
<p className="fontcolorsyslhui1">职业</p>
<p
className="fontcolorsyslhei flexdirections">{userdata && userdata.identity && identityMap[userdata.identity]}
{
userdata && userdata.professional_certification == "uncertified" ?
"" :
userdata && userdata.professional_certification == "applying" ?
<p className="flexdirections">
<p className="iconfont icon-tishi colorgreenorg font-14 ml20"></p><p
className="colorgreenorg font-14 ml6">待审核</p><p
className="fontcolorsysllan borcolors font-12 w64 mycompitcursor ml6"
onClick={() => this.Cancellationofapplication(2)}>撤销认证</p>
</p>
:
<p className="flexdirections">
<p className="iconfont icon-wancheng colorgreenlight font-14 ml20"></p><p
className="colorgreenlight font-14 ml6">已认证</p>
<p className="fontcolorsysllan borcolors font-12 w64 mycompitcursor ml6"
onClick={() => this.checkBasicInfo(2)}>重新认证</p>
</p>
}
</p>
</div>
<div className="flexdirections ml38 mt19">
<p
className="fontcolorsyslhui1">{userdata && userdata.technical_title ? "职称:" : ""}{userdata && userdata.student_id ? "学号:" : ""}</p>
<p className="fontcolorsyslhei">{userdata && (userdata.technical_title || userdata.student_id)}</p>
</div>
<div className="flexdirections ml38 mt19">
<p className="fontcolorsyslhui1">学校</p>
<p className="fontcolorsyslhei">{userdata && userdata.school_name}</p>
</div>
<div className="flexdirections ml38 mt19">
<p className="fontcolorsyslhui1">院系</p>
<p className="fontcolorsyslhei"> {userdata && userdata.department_name}</p>
</div>
<div className="flexdirections mt36 ">
<p className="fontcolorsyslhei font-16 w98"><span className="fontcolorsysl font-16">*</span><span></span>
</p>
</div>
<div className="flexdirections ml38 mt23">
<p className="fontcolorsyslhui1 w60 ">手机号</p>
{
userdata && userdata.phone ?
<p className="fontcolorsyslhei w200 ">{userdata && userdata.phone}</p>
:
<p className="fontcolorsysljin w200 ">未绑定</p>
}
<p className="fontcolorsysllan mycompitcursor"
onClick={() => this.phonebools()}>{userdata && userdata.phone ? (phonebool === false ? "更换" : "") : (phonebool === false ? "立即绑定" : "")}</p>
</div>
{/*手机号绑定*/}
{
phonebool === true &&userdata ?
<Phonenumberverifications {...this.props} {...this.state} basicInfo={userdata}
hideUpdating={(i) => this.hideUpdating(i)}
getdata={(id) => this.getdata(id)}></Phonenumberverifications>
: ""
}
<div className="flexdirections ml38 mt19">
<p className="fontcolorsyslhui1 w60">Email</p>
<p className="fontcolorsyslhei w200">{userdata && userdata.mail}</p>
<p className="fontcolorsysllan mycompitcursor"
onClick={() => this.emailbools()}>{userdata && userdata.mail ? (emailbool === false ? "更换" : "") : (emailbool === false ? "立即绑定" : "")}</p>
</div>
{
emailbool === false ? "" :
(
userdata?
<Mailboxvalidations {...this.props} {...this.state} basicInfo={userdata}
hideUpdating={(i) => this.hideUpdating(i)}
getdata={(id) => this.getdata(id)}></Mailboxvalidations>
:""
)
}
{
leader === true ?
<div>
{
bank_account_editable === true ?
<Bankcardnumberverifications triggerRef={this.bindRef} {...this.props} {...this.state} basicInfo={userdata}
hideUpdating={(i) => this.hideUpdating(i)}
getdata={(id) => this.getdata(id)}
GetawardinformationAPI={() => this.GetawardinformationAPI()}
bank_account={this.state.bank_account}
></Bankcardnumberverifications>
:
admins===true?
<Bankcardnumberverifications triggerRef={this.bindRef} {...this.props} {...this.state} basicInfo={userdata}
hideUpdating={(i) => this.hideUpdating(i)}
getdata={(id) => this.getdata(id)}
GetawardinformationAPI={() => this.GetawardinformationAPI()}
bank_account={this.state.bank_account}
></Bankcardnumberverifications>
:
<div>
<div className="flexdirections mt36">
<p className="fontcolorsyslhei font-16">//开户行及银行卡号</p>
<p className="fontcolorsyslhui font-14 ml11">为保障奖金的及时发放请队长如实填写你名下的银行卡信息</p>
</div>
{
bank_account && bank_account ?
<div>
<div className="flexdirections ml38 mt19">
<p className="fontcolorsyslhui1 w56">开户行</p>
<p className="fontcolorsyslhei">{bank_account && bank_account.bank}</p>
</div>
<div className="flexdirections ml38 mt19">
<p className="fontcolorsyslhui1 w56" style={{textAlign: "right"}}>支行</p>
<p className="fontcolorsyslhei">{bank_account && bank_account.second_bank}</p>
</div>
<div className="flexdirections ml38 mt19">
<p className="fontcolorsyslhui1 w56" style={{textAlign: "right"}}>账号</p>
<p className="fontcolorsyslhei"> {bank_account && bank_account.card_no}</p>
</div>
</div>
:
""
}
</div>
}
</div>
:
<div>
{
admins===true?
<Bankcardnumberverifications triggerRef={this.bindRef} {...this.props} {...this.state} basicInfo={userdata}
hideUpdating={(i) => this.hideUpdating(i)}
getdata={(id) => this.getdata(id)}
GetawardinformationAPI={() => this.GetawardinformationAPI()}
bank_account={this.state.bank_account}
></Bankcardnumberverifications>
:""
}
</div>
}
</div>
)
}
}
export default CompetitionContentspdfpeopledata;

@ -0,0 +1,270 @@
import React, {Component} from 'react';
import {Button, Layout, Input, Form} from 'antd';
import axios from 'axios';
import {getImageUrl} from 'educoder';
import mycompetotionchild from './mycompetotionchild.css';
import {getHiddenName} from "../../../../user/account/AccountBasicEdit";
import '../../../../courses/css/Courses.css'
export const identityMap = {"teacher": "教师", "student": "学生", "professional": "专业人士"}
class Mailboxvalidation extends Component {
constructor(props) {
super(props)
this.state = {
basicInfo: {},
updating: '',
secondsFlag: false,
seconds: 60,
phonebool: false,
emailbool: false,
formationdata: [],
bank_account_editable: false,
leader: false,
bank_account: undefined,
certification: 1
}
}
componentDidMount() {
window.document.title = '竞赛';
// console.log("3获取用户信息");
// console.log(this.props);
}
// 绑定邮箱
onEmailSubmit = () => {
this.props.form.validateFieldsAndScroll((err, values) => {
if (!err) {
let {id} = this.props.userdata;
let reg = /^[a-zA-Z0-9]+([.\-_\\]*[a-zA-Z0-9])*@([a-z0-9]+[-a-z0-9]*[a-z0-9]+.){1,63}[a-z0-9]+$/;
if (reg.test(values.email)) {
let url = `/users/accounts/${id}/email_bind.json`
axios.post((url), {
email: values.email,
code: values.emailValidateCode
}).then((result) => {
if (result) {
this.props.showNotification("邮箱地址绑定成功!");
this.hideUpdating(2);
this.props.getdata(id);
}
}).catch((error) => {
console.log(error);
})
} else {
this.props.showNotification("请输入正确的邮箱地址");
}
}
})
}
//取消编辑
hideUpdating = (i) => {
if (i === 1) {
this.props.hideUpdating(1);
} else if (i === 2) {
this.props.hideUpdating(2);
} else if (i === 3) {
}
}
// 获取验证码
getCode = (index) => {
let url = `/accounts/get_verification_code.json`
let login = '';
let values = this.props.form.getFieldsValue();
if (index == 3) {
//绑定手机号码
login = values.phone;
let reg = /^1\d{10}$/;
if (reg.test(login) == false) {
this.props.showNotification(`请先输入正确的手机号码`);
return;
}
} else if (index == 4) {
// 绑定邮箱
login = values.email;
let reg = /^[a-zA-Z0-9]+([.\-_\\]*[a-zA-Z0-9])*@([a-z0-9]+[-a-z0-9]*[a-z0-9]+.){1,63}[a-z0-9]+$/;
if (reg.test(login) == false) {
this.props.showNotification(`请先输入正确的邮箱地址`);
return;
}
}
let type = index;
if (!login) {
this.props.showNotification(`请先输入${index == 3 ? "手机号码" : "邮箱地址"}`);
return;
}
axios.get((url), {
params: {
login, type
}
}).then((result) => {
if (result) {
// 倒计时
this.setState({
secondsFlag: true
})
this.remainTime();
}
}).catch((error) => {
console.log(error);
})
}
// 获取验证码倒计时
remainTime = () => {
this.setState({
seconds: 60
})
this.timer = setInterval(() => {
let {seconds} = this.state;
let s = parseInt(seconds) - 1;
if (s > -1) {
this.setState({
seconds: s
})
} else {
this.setState({
secondsFlag: false
})
clearInterval(this.timer);
}
}, 1000)
}
phonebools = () => {
this.setState({
phonebool: true
})
}
emailbools = () => {
console.log("点击了邮箱");
this.setState({
emailbool: true
})
}
render() {
const {getFieldDecorator} = this.props.form;
const {updating, seconds, secondsFlag, basicInfo, phonebool, emailbool, certification, formationdata, bank_account_editable, leader, bank_account} = this.state
console.log(emailbool);
return (
<div>
<style>{`
.flexRow {
padding: 20px 0;
}
.flexRow .name {
margin-left: 12px;
color: #666666;
text-align: center;
flex: 0 0 100px;
}
.flexRow .description {
margin-left: 10px;
flex: 1;
color: #CDCDCD;
}
.description span {
margin-right: 20px;
color: #05101A;
}
.flexRow .status {
width: 100px;
color: #28AC7F;
text-align: right;
}
.flexTable .flexTable {
border-bottom: 1px solid #EBEBEB;
}
.settingForm label{
color: #666666;
font-size: 14px !important ;
}
.settingForm input {
width: 340px;
height: 40px;
}
.settingForm input.validateInput {
width: 220px;
}
.settingForm .formItemInline button {
width: 110px;
margin-left: 10px;
}
.settingForm .ant-form-item-label {
text-align: left;
width: 84px;
}
.formItemInline .ant-form-explain{
position:absolute;
bottom:-22px;
left:0px;
width:100%;
}
`}</style>
<div className="settingForm ml38">
<React.Fragment>
<Form>
<Form.Item
label="邮箱地址"
className="formItemInline hideRequireTag mb20 mt20"
>
{getFieldDecorator('email', {
rules: [{
// initialValue: this.state.cityDefaultValue,
required: true,
message: basicInfo && basicInfo.mail ? '请输入要更换的新邮箱地址' : '请输入邮箱地址',
}],
})(
<Input placeholder={`${basicInfo && basicInfo.mail ? '请输入要更换的新邮箱地址' : '请输入邮箱地址'}`}></Input>
)}
</Form.Item>
<Form.Item
label="邮箱验证码"
className="mb20 formItemInline hideRequireTag"
>
{getFieldDecorator('emailValidateCode', {
rules: [{
// initialValue: this.state.cityDefaultValue,
required: true,
message: '请输入邮箱收到的验证码',
}],
})(
<Input placeholder="请输入邮箱收到的验证码" className="validateInput"></Input>
)}
<Button type="primary" disabled={secondsFlag} onClick={() => this.getCode(4)}>
{!secondsFlag ? "获取验证码" : `重新发送${seconds}s`}</Button>
</Form.Item>
<div className="mb20" style={{marginLeft: '204px'}}>
<Button type="primary" onClick={() => this.onEmailSubmit()}>确定</Button>
<Button type="primary grayBtn" style={{marginLeft: '20px'}}
onClick={() => this.hideUpdating(2)}>取消</Button>
</div>
</Form>
</React.Fragment>
</div>
</div>
)
}
}
const Mailboxvalidations = Form.create({name: 'Mailboxvalidation'})(Mailboxvalidation);
export default Mailboxvalidations;

@ -0,0 +1,262 @@
import React, {Component} from 'react';
import {Button, Layout, Input, Form} from 'antd';
import axios from 'axios';
import {getImageUrl} from 'educoder';
import mycompetotionchild from './mycompetotionchild.css';
import {getHiddenName} from "../../../../user/account/AccountBasicEdit";
import '../../../../courses/css/Courses.css'
import RealNameCertificationModal from "../../../../user/modal/RealNameCertificationModal";
export const identityMap = {"teacher": "教师", "student": "学生", "professional": "专业人士"}
class Phonenumberverification extends Component {
constructor(props) {
super(props)
this.state = {
updating: '',
secondsFlag: false,
seconds: 60,
phonebool: false,
emailbool: false,
formationdata: [],
bank_account_editable: false,
leader: false,
bank_account: undefined,
certification: 1
}
}
componentDidMount() {
window.document.title = '竞赛';
// console.log("获取用户信息");
// console.log(this.props);
}
// 绑定手机
onPhoneSubmit = () => {
this.props.form.validateFieldsAndScroll((err, values) => {
if (!err) {
let {id} = this.props.userdata;
let reg = /^1\d{10}$/;
if (reg.test(values.phone)) {
let url = `/users/accounts/${id}/phone_bind.json`
axios.post((url), {
phone: values.phone,
code: values.phoneValidateCode
}).then((result) => {
if (result) {
this.props.showNotification("手机号码绑定成功!");
this.props.hideUpdating(1)
this.props.getdata(id);
}
}).catch((error) => {
console.log(error);
})
} else {
this.props.showNotification("请输入有效的11位手机号码");
}
}
})
}
//取消编辑
hideUpdating = (i) => {
if (i === 1) {
this.props.hideUpdating(1);
} else if (i === 2) {
this.props.hideUpdating(2);
} else if (i === 3) {
}
}
// 获取验证码
getCode = (index) => {
let url = `/accounts/get_verification_code.json`
let login = '';
let values = this.props.form.getFieldsValue();
if (index == 3) {
//绑定手机号码
login = values.phone;
let reg = /^1\d{10}$/;
if (reg.test(login) == false) {
this.props.showNotification(`请先输入正确的手机号码`);
return;
}
} else if (index == 4) {
// 绑定邮箱
login = values.email;
let reg = /^[a-zA-Z0-9]+([.\-_\\]*[a-zA-Z0-9])*@([a-z0-9]+[-a-z0-9]*[a-z0-9]+.){1,63}[a-z0-9]+$/;
if (reg.test(login) == false) {
this.props.showNotification(`请先输入正确的邮箱地址`);
return;
}
}
let type = index;
if (!login) {
this.props.showNotification(`请先输入${index == 3 ? "手机号码" : "邮箱地址"}`);
return;
}
axios.get((url), {
params: {
login, type
}
}).then((result) => {
if (result) {
// 倒计时
this.setState({
secondsFlag: true
})
this.remainTime();
}
}).catch((error) => {
console.log(error);
})
}
// 获取验证码倒计时
remainTime = () => {
this.setState({
seconds: 60
})
this.timer = setInterval(() => {
let {seconds} = this.state;
let s = parseInt(seconds) - 1;
if (s > -1) {
this.setState({
seconds: s
})
} else {
this.setState({
secondsFlag: false
})
clearInterval(this.timer);
}
}, 1000)
}
phonebools = () => {
this.setState({
phonebool: true
})
}
render() {
const {getFieldDecorator} = this.props.form;
const {updating, seconds, secondsFlag, phonebool, emailbool, certification, formationdata, bank_account_editable, leader, bank_account} = this.state
const {basicInfo} = this.props
console.log(emailbool);
return (
<div>
<style>{`
.flexRow {
padding: 20px 0;
}
.flexRow .name {
margin-left: 12px;
color: #666666;
text-align: center;
flex: 0 0 100px;
}
.flexRow .description {
margin-left: 10px;
flex: 1;
color: #CDCDCD;
}
.description span {
margin-right: 20px;
color: #05101A;
}
.flexRow .status {
width: 100px;
color: #28AC7F;
text-align: right;
}
.flexTable .flexTable {
border-bottom: 1px solid #EBEBEB;
}
.settingForm label{
color: #666666;
font-size: 14px !important ;
}
.settingForm input {
width: 340px;
height: 40px;
}
.settingForm input.validateInput {
width: 220px;
}
.settingForm .formItemInline button {
width: 110px;
margin-left: 10px;
}
.settingForm .ant-form-item-label {
text-align: left;
width: 84px;
}
.formItemInline .ant-form-explain{
position:absolute;
bottom:-22px;
left:0px;
width:100%;
}
`}</style>
<div className="settingForm ml38">
<React.Fragment>
<Form>
<Form.Item
label="你的手机号"
className="formItemInline hideRequireTag mb20 mt20"
>
{getFieldDecorator('phone', {
rules: [{
// initialValue: this.state.cityDefaultValue,
required: true,
message: `请输入要${basicInfo.phone ? '更换' : '绑定'}的手机号码`,
}],
})(
<Input placeholder={`请输入要${basicInfo.phone ? '更换' : '绑定'}的手机号码`}></Input>
)}
</Form.Item>
<Form.Item
label="手机验证码"
className="mb20 formItemInline hideRequireTag"
>
{getFieldDecorator('phoneValidateCode', {
rules: [{
// initialValue: this.state.cityDefaultValue,
required: true,
message: '请输入手机获取的验证码',
}],
})(
<Input placeholder="请输入手机获取的验证码" className="validateInput"></Input>
)}
<Button type="primary" disabled={secondsFlag} onClick={() => this.getCode(3)}>
{!secondsFlag ? "获取验证码" : `重新发送${seconds}s`}
</Button>
</Form.Item>
<div className="mb20" style={{marginLeft: '204px'}}>
<Button type="primary" onClick={() => this.onPhoneSubmit()}>确定</Button>
<Button type="primary grayBtn" style={{marginLeft: '20px'}}
onClick={() => this.hideUpdating(1)}>取消</Button>
</div>
</Form>
</React.Fragment>
</div>
</div>
)
}
}
const Phonenumberverifications = Form.create({name: 'Phonenumberverification'})(Phonenumberverification);
export default Phonenumberverifications;

@ -0,0 +1,314 @@
/*
*/
.flexdirectionjust {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}
.directstwebkitflex {
display: flex;
display: -webkit-flex;
flex-direction: column;
align-items: center;
}
.diredisplayitflex {
display: flex;
display: -webkit-flex;
align-items: center;
}
/*垂直布局*/
/*
*/
.flexdirection {
display: flex;
flex-direction: row;
}
.flexdirections {
display: flex;
flex-direction: initial;
}
/*
*/
/*靠右侧八 七 六 五 四 三 二 一*/
.flexdirectionss {
display: flex;
flex-direction: row-reverse;
}
/*
*/
.flexdidirectionss {
display: flex;
flex-direction: column;
}
/*
*/
.flexdidireverses {
display: flex;
flex-direction: column-reverse;
}
.fontcolorsysl {
color: #FF0000
}
.fontcolorsyslhei {
color: #000000
}
.fontcolorsyslhui {
color: #888888
}
.fontcolorsyslhui1 {
color: #666666;
}
.fontcolorsysllan {
color: #4CACFF
}
.fontcolorsysljin {
color: #DD7600
}
.w200 {
width: 200px;
}
.w64 {
width: 64px;
}
.w60 {
width: 60px;
}
.w98 {
width: 98px;
}
.myysllineheight {
line-height: 40px;
}
.myyslminwidth {
min-width: 60px;
}
.myyslminwidth276 {
width: 276px;
}
.buttongo {
background: #E7E7E7;
border: 1px solid #E7E7E7;
width: 60px;
height: 30px;
border-radius: 4px;
color: #999999;
font-size: 16px;
}
.buttongo2 {
background: #4CACFF;
border: 1px solid #4CACFF;
width: 64px;
height: 32px;
border-radius: 4px;
color: #FFFFFF;
font-size: 16px;
}
.fontwenzi {
text-align: center;
line-height: 30px;
}
.mt17 {
margin-top: 17px;
}
.mt36 {
margin-top: 36px;
}
.mt23 {
margin-top: 23px;
}
.mt19 {
margin-top: 19px;
}
.mt23 {
margin-top: 23px;
}
.mt34 {
margin-top: 34px;
}
.ml11 {
margin-left: 11px;
}
.ml38 {
margin-left: 38px;
}
.ml7 {
margin-left: 7px;
}
.colorgreenlight {
color: #6EC76E
}
.colorgreenorg {
color: #FF7300;
}
.borcolors {
border: 1px solid #4CACFF;
text-align: center;
}
.mycompitcursor {
cursor: pointer;
}
.basicForm {
background: #fff;
padding: 30px;
margin-bottom: 10px;
box-sizing: border-box;
width: 100%;
min-height: 390px;
}
.basicForm .title {
font-size: 16px;
padding-left: 30px;
margin-bottom: 10px;
}
.flexTable {
display: flex;
flex-direction: column;
}
.flexRow {
display: flex;
}
.mb15 {
margin-bottom: 15px !important;
}
/* BUTTOn */
.ant-btn {
border-radius: 2px;
}
button.ant-btn.ant-btn-primary.grayBtn {
background: #CBCBCB;
border-color: #CBCBCB;
}
.borderBottom {
border-bottom: 1px solid #4CACFF;
}
/* form ---------------- START */
.formItemInline {
display: flex;
}
.formItemInline .ant-form-item-control-wrapper {
display: inline-block;
}
.hideRequireTag .ant-form-item-required:before {
display: none;
}
/* .basicForm .ant-form-item-label {
width: 100px;
padding-right: 10px;
}
.basicForm .ant-form-item-label label {
color: #979797
} */
.courseNormalForm .ant-select-show-search {
height: 40px;
}
.courseNormalForm .ant-select-auto-complete.ant-select .ant-input {
height: 40px;
}
.courseNormalForm .ant-select-search__field__mirror {
height: 40px;
}
.courseNormalForm .ant-input-lg {
height: 40px;
}
.courseNormalForm .ant-select-selection--single {
height: 40px;
}
.courseNormalForm .ant-select-auto-complete.ant-select .ant-select-selection--single {
height: 40px
}
.courseNormalForm .ant-input-affix-wrapper {
height: 40px;
}
/* 职业 */
.courseNormalForm .ant-select-selection-selected-value {
line-height: 38px
}
.courseNormalForm input {
height: 40px;
}
.w300 {
width: 300px;
}
.w56 {
width: 56px;
}

@ -0,0 +1,92 @@
import React, { Component } from 'react';
import { Redirect } from 'react-router';
import { Route, Link, Switch } from "react-router-dom";
import Loading from '../../Loading';
import Loadable from 'react-loadable';
import { TPMIndexHOC } from '../tpm/TPMIndexHOC';
import { CNotificationHOC } from '../courses/common/CNotificationHOC';
//新版竞赛首页
const CompetitionsIndex = Loadable({
loader: () => import('./Competitimain/CompetitionsIndex'),
loading: Loading,
})
//竞赛详情页
const CompetitionCommon=Loadable({
loader: () => import('./Competitioncommon/CompetitionCommon'),
loading: Loading,
})
//战队详情
const CompetitionTeams = Loadable({
loader: () => import('./Competition_teams/Competitionteams'),
loading: Loading,
})
//团队竞赛报名
const Registration = Loadable({
loader: () => import('../competition/Registration'),
loading: Loading,
});
class Competitions extends Component {
constructor(props) {
super(props)
}
componentDidMount(){
window.document.title = '竞赛';
}
render() {
return (
<div className="newMain clearfix">
<Switch>
{/*新版竞赛战队详情*/}
<Route path="/competitions/:identifier/competition_teams/:competition_team_id"
render={
(props) => (<CompetitionTeams {...this.props} {...props} {...this.state} />)
}
></Route>
{/*新版竞赛报名*/}
<Route
path="/competitions/:identifier/enroll"
render={
(props) => (<Registration {...this.props} {...props} {...this.state}/>)
}
/>
{/*新版竞赛详情页面*/}
<Route path="/competitions/:identifier"
render={
(props) => (<CompetitionCommon {...this.props} {...props} {...this.state} />)
}
></Route>
{/*新版竞赛首页*/}
<Route path="/competitions"
render={
(props) => (<CompetitionsIndex {...this.props} {...props} {...this.state} />)
}
></Route>
</Switch>
</div>
);
}
}
export default CNotificationHOC() (TPMIndexHOC (Competitions)) ;
Loading…
Cancel
Save