dev_sync_trustie
杨树明 5 years ago
parent a6ad7db235
commit e7dad06de2

@ -321,7 +321,7 @@ module.exports = {
},
compress: {
drop_debugger: true,
drop_console: true
drop_console: false
}
}
}),

@ -16,9 +16,6 @@ class CompetitionMaxImg extends React.Component {
componentDidUpdate = (prevProps) => {
if (prevProps.GetenrollmentAPI != this.props.GetenrollmentAPI) {
// ////console.log("团队竞赛报名大图componentDidUpdate");
// ////console.log(this.props);
// ////console.log(this.props.GetenrollmentAPI);
this.setState({
GetenrollmentAPI: this.props.GetenrollmentAPI,
})

@ -2,7 +2,8 @@ import React, {Component} from 'react';
import {
BrowserRouter as Router,
Route,
Switch
Switch,
Link
} from 'react-router-dom';
import axios from 'axios';
import moment from 'moment';
@ -62,13 +63,16 @@ class Registration extends React.Component {
itemid: undefined,
itemiddata: [],
pint: 0,
competition_name: undefined,
mutiple_limited: false,
teamutiple_limited: false,
members_count: 0,
}
}
componentDidMount() {
console.log(this.props);
// console.log(this.props);
// //////console.log("componentDidMount Registration");
// //// //////console.log("调用子组件 ");
@ -87,8 +91,8 @@ class Registration extends React.Component {
componentDidUpdate = (prevProps) => {
if (prevProps.user != this.props.user) {
console.log("componentDidUpdate");
console.log(this.props);
// console.log("componentDidUpdate");
// console.log(this.props);
////console.log("Registration");
////console.log("componentDidUpdate");
////console.log(this.props.user.admin);
@ -101,6 +105,7 @@ class Registration extends React.Component {
//获取报名配置API
GetenrollmentAPI = () => {
// console.log("调用了GetenrollmentAPI");
const url = `/competitions/${this.props.match.params.identifier}/competition_staff.json`;
axios.get((url)).then((result) => {
if (result) {
@ -112,26 +117,56 @@ class Registration extends React.Component {
personal: result.data.personal,
enroll_ended: result.data.enroll_ended,
enrolled: result.data.enrolled,
teacher_staff: result.data.teacher_staff,
member_staff: result.data.member_staff,
teacher_staff: result.data.teacher_staff === undefined || result.data.teacher_staff === null ? undefined : result.data.teacher_staff,
member_staff: result.data.member_staff === undefined || result.data.member_staff === null ? undefined : result.data.member_staff,
})
if (result.data.enroll_ended === true) {
this.setState({
pint: 0
})
} else if (result.data.enrolled === true) {
this.setState({
pint: 2
})
} else if (result.data.enrolled === false) {
this.setState({
pint: 1
})
try {
if (result.data.member_staff) {
this.setState({
mutiple_limited: result.data.member_staff.mutiple_limited,
})
}
} catch (e) {
}
try {
if (result.data.teacher_staff) {
this.setState({
teamutiple_limited: result.data.teacher_staff.mutiple_limited
})
}
} catch (e) {
}
if (result.data.personal === true) {
if (result.data.enroll_ended === true) {
this.setState({
pint: 0
})
} else if (result.data.enrolled === true) {
this.setState({
pint: 2
})
} else if (result.data.enrolled === false) {
this.setState({
pint: 1
})
}
}
}
}
}).catch((error) => {
//// //////console.log(error);
console.log("GetenrollmentAPI");
console.log(error);
})
}
@ -161,6 +196,8 @@ class Registration extends React.Component {
data: result.data.my_teams,
competition_teams: result.data.competition_teams,
personal: result.data.personal,
competition_name: result.data.competition_name,
members_count: result.data.members_count
})
} else {
//普通账号
@ -170,6 +207,8 @@ class Registration extends React.Component {
data: result.data.my_teams,
competition_teams: result.data.competition_teams,
personal: result.data.personal,
competition_name: result.data.competition_name,
members_count: result.data.members_count
})
}
} else {
@ -183,6 +222,9 @@ class Registration extends React.Component {
count: result.data.count,
competition_teams: result.data.competition_teams,
personal: result.data.personal,
competition_name: result.data.competition_name,
members_count: result.data.members_count
})
} else {
@ -192,6 +234,9 @@ class Registration extends React.Component {
count: result.data.count,
competition_teams: result.data.competition_teams,
personal: result.data.personal,
competition_name: result.data.competition_name,
members_count: result.data.members_count
})
}
@ -203,6 +248,9 @@ class Registration extends React.Component {
data: result.data.my_teams,
count: result.data.count,
personal: result.data.personal,
competition_name: result.data.competition_name,
members_count: result.data.members_count
})
} else {
@ -212,6 +260,9 @@ class Registration extends React.Component {
data: result.data.my_teams,
count: result.data.count,
personal: result.data.personal,
competition_name: result.data.competition_name,
members_count: result.data.members_count
})
}
@ -225,6 +276,9 @@ class Registration extends React.Component {
count: result.data.count,
competition_teams: result.data.competition_teams,
personal: result.data.personal,
competition_name: result.data.competition_name,
members_count: result.data.members_count
})
@ -258,109 +312,120 @@ class Registration extends React.Component {
}
Getdatatype5 = (keyword, page, per_page, admin) => {
//搜索关键字 keyword
//页数 page
//分页 per_page
const datas = {
keyword: keyword,
page: page,
per_page: per_page,
};
let url = `/competitions/${this.props.match.params.identifier}/competition_teams.json`;
axios.get((url), {params: datas}).then((result) => {
this.setState({
loadingstate: false,
})
if (result) {
if (result.data) {
//// //////console.log(result);
if (result.data.personal === false) {
//不是个人赛
////console.log("Getdatatype5");
////console.log(result.data.my_teams.length);
if (result.data.my_teams.length === 0) {
// 没有创建数据的
//管理员
////console.log("a");
////console.log(this.state.competition_teams);
////console.log(result.data.competition_teams);
this.setState({
type: 4,
count: result.data.count,
competition_teams: result.data.competition_teams,
data: result.data.my_teams,
personal: result.data.personal,
})
} else {
//有数据的
////console.log("b");
if (result.data.my_teams[0].manage_permission === true) {
this.setState({
type: 5,
data: result.data.my_teams,
count: result.data.count,
competition_teams: result.data.competition_teams,
personal: result.data.personal,
})
} else {
////console.log("c");
this.setState({
type: 4,
data: result.data.my_teams,
count: result.data.count,
competition_teams: result.data.competition_teams,
personal: result.data.personal,
})
}
}
} else {
//团队赛
//////console.log("d");
this.setState({
type: 6,
data: result.data.my_teams,
count: result.data.count,
competition_teams: result.data.competition_teams,
personal: result.data.personal,
})
}
}
}
}).catch((error) => {
////console.log("k");
////console.log(error);
////console.log("报错了");
if (admin === true) {
//管理员
this.setState({
count: 0,
competition_teams: [],
data: [],
loadingstate: false,
})
} else {
//普通账号
this.setState({
count: 0,
competition_teams: [],
data: [],
loadingstate: false,
})
}
})
}
// Getdatatype5 = (keyword, page, per_page, admin) => {
// //搜索关键字 keyword
// //页数 page
// //分页 per_page
// const datas = {
// keyword: keyword,
// page: page,
// per_page: per_page,
// };
// let url = `/competitions/${this.props.match.params.identifier}/competition_teams.json`;
// axios.get((url), {params: datas}).then((result) => {
// this.setState({
// loadingstate: false,
// })
// if (result) {
// if (result.data) {
// //// //////console.log(result);
// if (result.data.personal === false) {
// //不是个人赛
// ////console.log("Getdatatype5");
// ////console.log(result.data.my_teams.length);
// if (result.data.my_teams.length === 0) {
// // 没有创建数据的
// //管理员
// ////console.log("a");
// ////console.log(this.state.competition_teams);
// ////console.log(result.data.competition_teams);
// this.setState({
// type: 4,
// count: result.data.count,
// competition_teams: result.data.competition_teams,
// data: result.data.my_teams,
// personal: result.data.personal,
// competition_name: result.data.competition_name,
// members_count:result.data.members_count
//
//
// })
// } else {
// //有数据的
// ////console.log("b");
//
// if (result.data.my_teams[0].manage_permission === true) {
// this.setState({
// type: 5,
// data: result.data.my_teams,
// count: result.data.count,
// competition_teams: result.data.competition_teams,
// personal: result.data.personal,
// competition_name: result.data.competition_name,
// members_count:result.data.members_count
//
//
// })
// } else {
// ////console.log("c");
//
// this.setState({
// type: 4,
// data: result.data.my_teams,
// count: result.data.count,
// competition_teams: result.data.competition_teams,
// personal: result.data.personal,
// competition_name: result.data.competition_name,
// members_count:result.data.members_count
//
//
// })
// }
// }
// } else {
// //团队赛
// //////console.log("d");
//
// this.setState({
// type: 6,
// data: result.data.my_teams,
// count: result.data.count,
// competition_teams: result.data.competition_teams,
// personal: result.data.personal,
// competition_name: result.data.competition_name,
// members_count:result.data.members_count
//
//
// })
// }
//
// }
// }
//
// }).catch((error) => {
// ////console.log("k");
//
// ////console.log(error);
// ////console.log("报错了");
// if (admin === true) {
// //管理员
// this.setState({
// count: 0,
// competition_teams: [],
// data: [],
// loadingstate: false,
// })
// } else {
// //普通账号
// this.setState({
// count: 0,
// competition_teams: [],
// data: [],
// loadingstate: false,
// })
// }
// })
// }
//团队竞赛翻页
@ -370,7 +435,7 @@ class Registration extends React.Component {
loadingstate: true,
})
const {keyword, per_page} = this.state;
this.Getdatatype5(keyword, pageNumber, per_page, this.props.user.admin);
this.Getdata(keyword, pageNumber, per_page, this.props.user.admin);
};
/**
@ -381,7 +446,7 @@ class Registration extends React.Component {
//已经报名
this.setState({
messagePerbool: true,
intpermessages: "您已报名,无需重复报"
intpermessages: "你已经报名,不能重复报名"
})
return;
}
@ -493,7 +558,7 @@ class Registration extends React.Component {
})
if (bool) {
//确认
this.Refreshteam();
} else {
//取消
@ -556,7 +621,7 @@ class Registration extends React.Component {
messageexitol: true
})
let url = `/competitions/${"gcc-task-2020"}/competition_teams/${this.state.itemid}/leave.json`;
let url = `/competitions/${this.props.match.params.identifier}/competition_teams/${this.state.itemid}/leave.json`;
axios.post(url).then((response) => {
if (response) {
if (response.data) {
@ -587,7 +652,7 @@ class Registration extends React.Component {
pages: 1,
limit: 20,
})
this.Getdatatype5(value, 1, 20, this.props.user.admin);
this.Getdata(value, 1, 20, this.props.user.admin);
}
//个人竞赛
@ -618,10 +683,10 @@ class Registration extends React.Component {
render() {
const {page, pages, limit, type, tmodalsType, tmodalsTypes, data, count, competition_teams, Newtit, itemiddata, messagePerbool, messageexitol, GetenrollmentAPI, loadingstate, pint} = this.state;
const {page, pages, limit, type, tmodalsType, tmodalsTypes, data, count, competition_teams, Newtit, itemiddata, messagePerbool, messageexitol, GetenrollmentAPI, loadingstate, pint, competition_name, mutiple_limited, teamutiple_limited, members_count} = this.state;
return (
<div className="newMain clearfix ">
<div className="newMain clearfix newMainybot">
<div className={"educontent mb20 persmstyle"} style={{width: "1200px", marginTop: "26px"}}>
<style>
@ -645,8 +710,12 @@ class Registration extends React.Component {
{
tmodalsType === true ?
<PersonModal modalsType={tmodalsType} {...this.props} {...this.state} Newtit={Newtit}
mutiple_limited={mutiple_limited}
teamutiple_limited={teamutiple_limited}
itemiddata={itemiddata} GetenrollmentAPI={GetenrollmentAPI}
Tmoconfirm1={(bool) => this.Tmoconfirm1(bool)}></PersonModal>
Tmoconfirm1={(bool) => this.Tmoconfirm1(bool)}
GetenrollmentAPIopens={() => this.GetenrollmentAPI()}
></PersonModal>
:
""
}
@ -664,21 +733,15 @@ class Registration extends React.Component {
: ""
}
{/*<div className="educontent mb20 ">*/}
{/* <p className="clearfix mb20 mt10">*/}
{/* <a className="btn colorgrey fl hovercolorblue ">在线竞赛</a>*/}
{/* <span className="color-grey-9 fl ml3 mr3">&gt;</span>*/}
{/* <a*/}
{/* className=" btn colorgrey fl hovercolorblue ">全国高校计算机大赛-项目挑战</a>*/}
{/* <span className="color-grey-9 fl ml3 mr3">&gt;</span>*/}
{/* <WordsBtn className="fl">报名</WordsBtn>*/}
{/* </p>*/}
{/*</div>*/}
<div style={{marginBottom: '12px'}}>
<Breadcrumb separator=">">
<Breadcrumb.Item href="/newcompetitions">在线竞赛</Breadcrumb.Item>
<Breadcrumb.Item href="">全国高校计算机大赛</Breadcrumb.Item>
<Breadcrumb.Item href="">报名</Breadcrumb.Item>
<Breadcrumb.Item><Link to={"/newcompetitions"}>在线竞赛</Link></Breadcrumb.Item>
<Breadcrumb.Item><Link
to={`/newcompetitions/${this.props.match.params.identifier}/common_header`}>{competition_name === undefined || competition_name === null || competition_name === "" ? "全国高校计算机大赛" : competition_name}</Link></Breadcrumb.Item>
{/*<Breadcrumb.Item*/}
{/* href={`/newcompetitions/${this.props.match.params.identifier}/common_header`}></Breadcrumb.Item>*/}
<Breadcrumb.Item>报名</Breadcrumb.Item>
</Breadcrumb>
</div>
{/*大图*/}
@ -695,7 +758,7 @@ class Registration extends React.Component {
<div style={{
marginTop: "22px"
}}>
<p>参赛总人数<span style={{color: "#459BE5"}}>{data === null || data === undefined ? 0 : data.length}</span><span
<p>参赛总人数<span style={{color: "#459BE5"}}>{members_count}</span><span
style={{marginLeft: "5px"}}></span>
</p>
</div>

@ -6,6 +6,10 @@
.borders2 {
border: 1px solid #D9D9D9;
}
.newMainybot {
padding-bottom: 0px !important;
}
/*All*/
/*Registration.js*/
/*.registrationback {*/
@ -406,12 +410,21 @@
}
.regitemimgs222 {
margin-top: 12px;
width: 28px;
height: 28px;
margin-left: 20px;
border-radius: 50%;
}
.regitemimgs3 {
/* border: 0.5px solid; */
height: 22px;
width: 22px;
font-size: 21px !important;
margin-top: 21px;
margin-top: 19px;
color: #1C91E8;
}
@ -422,6 +435,11 @@
margin-top: 18px;
}
.regitemimgs444 {
display: flex;
flex-direction: row-reverse;
margin-top: 18px;
}
.regitemimgs5 {
margin-left: 10px;
text-align: center;
@ -438,6 +456,23 @@
cursor: pointer
}
.regitemimgs555 {
margin-left: 33px;
text-align: center;
background: #ffffff;
height: 40px;
width: 72px;
color: #459be5;
border-radius: 4px;
display: flex;
align-items: center;
justify-content: center;
border: 1px;
border-style: solid;
border-color: #459BE5;
cursor: pointer
}
.regitemimgs6 {
text-align: center;
background: #ffffff;
@ -478,6 +513,7 @@
.packinputs button {
background: #459BE5;
width: 100% !important;
}
.packinputs {
@ -510,6 +546,13 @@
flex-direction: initial;
}
.reglistviewdivss2c {
display: flex;
flex-direction: initial;
cursor: not-allowed;
}
.reglistviewdivss2p {
width: 90px;
font-size: 12px;
@ -542,6 +585,13 @@
}
.reglistviewdivss333p {
width: 31px;
font-size: 12px;
color: #666666;
text-align: center;
}
.reglistviewdivss3p {
width: 31px;
font-size: 12px;
@ -577,6 +627,17 @@ reglistviewdivs2 {
/*PersonModal.js*/
.yslanswerList {
}
.yslanswerList li {
}
.yslanswerList li:hover {
background-color: #F6F4F4;
}
.permaindiv {
display: flex;
flex-direction: column;
@ -762,6 +823,31 @@ reglistviewdivs2 {
cursor: default;
}
.maxnamewidth85 {
max-width: 85px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
cursor: default;
}
.maxnamewidth90 {
max-width: 90px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
cursor: default;
}
.maxnamewidth110 {
max-width: 110px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
cursor: default;
}
.maxnamewidth160 {
max-width: 160px;
overflow: hidden;

@ -10,6 +10,8 @@ import NoneData from '../../../modules/courses/coursesPublic/NoneData'
const {Search} = Input;
//创建战队
var myabool = true;
var myabool2 = true;
class PersonModal extends Component {
//导师是搜索 和学生搜索都会添加到下面框中
/**
@ -50,7 +52,8 @@ class PersonModal extends Component {
myteaherdata: [],
myshtudentdata: [],
Thecurrentnumberbool: false,
Thecurrentnumberboolstu: false,
Thecurrentnumberstu: "",
}
@ -65,7 +68,7 @@ class PersonModal extends Component {
school_name: this.props.user.user_school,
student_id: null,
identity: this.props.user.user_identity,
type: "导师",
type: this.props.user.is_teacher === true ? "导师" : "队员",
};
data.push(datas);
@ -110,30 +113,30 @@ class PersonModal extends Component {
}
componentDidUpdate = (prevProps) => {
if (prevProps.user != this.props.user) {
////console.log("Registration.js componentDidUpdate");
////console.log(this.props);
// ////console.log(prevProps);
//identity职场称
//user_school学校
//real_name姓名
//type 类型
var data = [];
var datas = {
enrollable: false,
id: undefined,
name: this.props.user.real_name,
school_name: this.props.user.user_school,
student_id: null,
identity: this.props.user.user_identity,
type: "导师",
};
data.push(datas);
this.setState({
myuser: this.props.user,
mydatas: data,
})
}
// if (prevProps.user != this.props.user) {
// ////console.log("Registration.js componentDidUpdate");
// ////console.log(this.props);
// // ////console.log(prevProps);
// //identity职场称
// //user_school学校
// //real_name姓名
// //type 类型
// var data = [];
// var datas = {
// enrollable: false,
// id: undefined,
// name: this.props.user.real_name,
// school_name: this.props.user.user_school,
// student_id: null,
// identity: this.props.user.user_identity,
// type: "导师",
// };
// data.push(datas);
// this.setState({
// myuser: this.props.user,
// mydatas: data,
// })
// }
if (prevProps.GetenrollmentAPI != this.props.GetenrollmentAPI) {
////console.log("Registration.js GetenrollmentAPIcomponentDidUpdate");
@ -145,12 +148,23 @@ class PersonModal extends Component {
};
//创建战队
Createateam = () => {
debugger
try {
if (this.state.polls_nametest.length === 0) {
this.props.showNotification(`请输入您的战队名称最多不超过60个字符`);
return
}
} catch (e) {
}
const {polls_nametest, mydatas, GetenrollmentAPI} = this.state;
var myteaherdata = [];
var myshtudentdata = [];
var i = 0;
var s = 0;
for (var a = 0; a < mydatas.length; a++) {
if (mydatas[a].type === "导师") {
i++;
@ -163,6 +177,7 @@ class PersonModal extends Component {
// }
myteaherdata.push(mydatas[a].id);
} else if (mydatas[a].type === "队员") {
s++;
// var objectts = {
// enrollable: mydatas[a].enrollable,
// id: mydatas[a].id,
@ -174,7 +189,26 @@ class PersonModal extends Component {
}
}
// try {
// if (i === 0) {
// this.props.showNotification(`请添加导师`);
// return;
// }
// } catch (e) {
//
// }
//
// try {
// if (s === 0) {
// this.props.showNotification(`请添加队员`);
// return;
// }
// } catch (e) {
//
// }
//确认的时候 去确认老师人数是否符合
try {
if (GetenrollmentAPI) {
if (GetenrollmentAPI.teacher_staff) {
@ -195,13 +229,52 @@ class PersonModal extends Component {
})
return
}
this.setState({
Thecurrentnumberbool: false,
Thecurrentnumber: i,
booltech: false,
boolstud: false
})
}
}
} catch (e) {
}
//确认的时候 去确认学生人数是否符合
try {
if (GetenrollmentAPI) {
if (GetenrollmentAPI.member_staff) {
if (GetenrollmentAPI.member_staff.minimum > s) {
this.setState({
Thecurrentnumberboolstu: true,
Thecurrentnumberstu: s,
booltech: false,
boolstud: false
})
return
} else if (GetenrollmentAPI.member_staff.maximum < s) {
this.setState({
Thecurrentnumberboolstu: true,
Thecurrentnumberstu: s,
booltech: false,
boolstud: false
})
return
}
this.setState({
Thecurrentnumberboolstu: false,
Thecurrentnumberstu: s,
booltech: false,
boolstud: false
})
}
}
} catch (e) {
}
// Thecurrentnumber
if (this.props.Newtit === true) {
//创建新的战队
@ -252,8 +325,8 @@ class PersonModal extends Component {
// ////console.log("搜索的老师");
const datas = {
keyword: keywordteachers,
team_id: team_idteachers,
teacher_ids: teacher_ids,
team_id: null,
teacher_ids: null,
};
let url = `/competitions/${this.props.match.params.identifier}/teachers.json`;
axios.get((url), {params: datas}).then((result) => {
@ -280,8 +353,8 @@ class PersonModal extends Component {
// ////console.log("搜索的学生");
const datas = {
keyword: keywordstudents,
team_id: team_idstudents,
student_ids: student_ids,
team_id: null,
student_ids: null,
};
let url = `/competitions/${this.props.match.params.identifier}/students.json`;
axios.get((url), {params: datas}).then((result) => {
@ -306,7 +379,8 @@ class PersonModal extends Component {
this.setState({
keywordteachers: e.target.value,
booltech: false,
Thecurrentnumberbool: false
Thecurrentnumberbool: false,
Thecurrentnumberboolstu: false,
})
// try {
// if (e.target.value.length > 0) {
@ -345,8 +419,10 @@ class PersonModal extends Component {
this.setState({
keywordstudents: e.target.value,
boolstud: false,
Thecurrentnumberbool: false
Thecurrentnumberbool: false,
Thecurrentnumberboolstu: false,
});
// try {
// if (e.target.value.length > 0) {
// this.setState({
@ -379,7 +455,18 @@ class PersonModal extends Component {
//点击获取老师数据
getdatacpersondiv1Items = (object) => {
try {
if (this.props.teamutiple_limited === true) {
if (object.enrollable === false) {
myabool = false;
return
}
}
} catch (e) {
myabool = true;
}
myabool = true;
var datas = {
enrollable: object.enrollable,
id: object.id,
@ -421,6 +508,19 @@ class PersonModal extends Component {
}
//点击获取学生数据2
getdatacpersondiv1Items2 = (object) => {
//
try {
if (this.props.GetenrollmentAPI.teacher_staff.mutiple_limited === true) {
if (object.enrollable === false) {
myabool2 = false;
return
}
}
} catch (e) {
myabool2 = true;
}
myabool2 = true;
var datas = {
enrollable: object.enrollable,
id: object.id,
@ -531,18 +631,26 @@ class PersonModal extends Component {
}
inputOnBlur = (e) => {
// ////console.log("inputOnBlur");
// ////console.log(e);
this.setState({
person1: false
})
console.log("inputOnBlur");
console.log(e);
if (myabool === true) {
this.setState({
person1: false,
person2: false
})
}
}
inputOnBlur2 = (e) => {
// ////console.log("inputOnBlur");
// ////console.log(e);
this.setState({
person2: false
})
if (myabool2 === true) {
this.setState({
person1: false,
person2: false
})
}
}
startSearch = (e) => {
@ -627,7 +735,7 @@ class PersonModal extends Component {
})
}
deletedata = (item) => {
var {mydatas} = this.state;
var {mydatas, GetenrollmentAPI} = this.state;
if (item) {
var pos = mydatas.indexOf(item);
// ////console.log("deletedata");
@ -641,14 +749,118 @@ class PersonModal extends Component {
mydatas: mydatas,
})
}
var myteaherdata = [];
var myshtudentdata = [];
var i = 0;
var s = 0;
try {
for (var a = 0; a < mydatas.length; a++) {
if (mydatas[a].type === "导师") {
i = i + 1;
// var objectt = {
// enrollable: mydatas[a].enrollable,
// id: mydatas[a].id,
// identity: mydatas[a].identity,
// name: mydatas[a].name,
// school_name: mydatas[a].school_name,
// }
myteaherdata.push(mydatas[a].id);
} else if (mydatas[a].type === "队员") {
s = s + 1;
// var objectts = {
// enrollable: mydatas[a].enrollable,
// id: mydatas[a].id,
// name: mydatas[a].name,
// school_name: mydatas[a].school_name,
// student_id: mydatas[a].student_id,
// }
myshtudentdata.push(mydatas[a].id);
}
}
} catch (e) {
}
// console.log("deletedata");
// console.log(i);
//删除老师的时候判断是否符合人数
try {
if (GetenrollmentAPI) {
if (GetenrollmentAPI.teacher_staff) {
if (GetenrollmentAPI.teacher_staff.minimum > i) {
this.setState({
Thecurrentnumberbool: true,
Thecurrentnumber: i,
booltech: false,
boolstud: false
})
return
} else if (GetenrollmentAPI.teacher_staff.maximum < i) {
this.setState({
Thecurrentnumberbool: true,
Thecurrentnumber: i,
booltech: false,
boolstud: false
})
return
}
this.setState({
Thecurrentnumberbool: false,
Thecurrentnumber: i,
})
}
}
} catch (e) {
}
// debugger
//删除学生的时候判断是否符合人数
try {
if (GetenrollmentAPI) {
if (GetenrollmentAPI.member_staff) {
if (GetenrollmentAPI.member_staff.minimum > s) {
this.setState({
Thecurrentnumberboolstu: true,
Thecurrentnumberstu: s,
booltech: false,
boolstud: false
})
return
} else if (GetenrollmentAPI.member_staff.maximum < s) {
this.setState({
Thecurrentnumberboolstu: true,
Thecurrentnumberstu: s,
booltech: false,
boolstud: false
})
return
}
this.setState({
Thecurrentnumberboolstu: false,
Thecurrentnumberstu: s,
})
}
}
} catch (e) {
}
}
render() {
// console.log('Registration.js');
// console.log(this.props.mutiple_limited);
const {
addonAfter, Numberofteammentors, Thecurrentnumber, person1, person2,
keywordteachers, team_idteachers, teacher_ids,
keywordstudents, team_idstudents, student_ids,
member_ids, mydatas, booltech, boolstud, GetenrollmentAPI, Thecurrentnumberbool
member_ids, mydatas, booltech, boolstud, GetenrollmentAPI, Thecurrentnumberbool,
Thecurrentnumberboolstu, Thecurrentnumberstu
} = this.state;
//Modal
//keyboard是否支持键盘 esc 关闭
@ -665,11 +877,21 @@ class PersonModal extends Component {
alignItems: "center",
height: "40px",
}}>
<p className=" reglistviewdivss4p"
<style>
{
`
a:hover
{
color: #05101A;
}
`
}
</style>
<a title={item.name} className=" reglistviewdivss4p maxnamewidth90"
style={{
textAlign: "center",
}}
>{item.name === undefined || item.name === null || item.name === "" ? "--" : item.name}</p>
>{item.name === undefined || item.name === null || item.name === "" ? "--" : item.name}</a>
{
index === 0 ?
<p className=" reglistviewdivss4p"
@ -678,32 +900,32 @@ class PersonModal extends Component {
}}
>创建者</p>
:
<p className=" reglistviewdivss4p"
<a title={item.type} className=" reglistviewdivss4p maxnamewidth90"
style={{
textAlign: "center",
}}
>{item.type === undefined || item.type === null || item.type === "" ? "--" : item.type}</p>
>{item.type === undefined || item.type === null || item.type === "" ? "--" : item.type}</a>
}
<p className=" reglistviewdivss5p"
<a title={item.school_name} className=" reglistviewdivss5p maxnamewidth110"
style={{
textAlign: "center",
}}
>{item.school_name === undefined || item.school_name === null || item.school_name === "" ? "--" : item.school_name}</p>
<p className=" reglistviewdivss2p"
>{item.school_name === undefined || item.school_name === null || item.school_name === "" ? "--" : item.school_name}</a>
<a title={item.identity} className=" reglistviewdivss2p maxnamewidth90"
style={{
textAlign: "center",
}}
>{item.identity === undefined || item.identity === null || item.identity === "" ? "--" : item.identity}</p>
>{item.identity === undefined || item.identity === null || item.identity === "" ? "--" : item.identity}</a>
{
index === 0 ?
<p className=" reglistviewdivss33p"
<p className=" reglistviewdivss333p"
style={{
textAlign: "center",
}}
></p>
:
<p className=" reglistviewdivss33p"
<p className=" reglistviewdivss333p"
style={{
textAlign: "center",
}}
@ -712,46 +934,119 @@ class PersonModal extends Component {
</div>
);
var cpersondiv1Items = [];
// console.log("this.props.teamutiple_limited ");
// console.log(this.props.teamutiple_limited );
if (teacher_ids) {
cpersondiv1Items = teacher_ids.map((item, index) =>
<a className="reglistviewdivss2" key={index} style={{
<div className={"yslanswerList"}>
<li
className={this.props.teamutiple_limited === undefined || this.props.teamutiple_limited === null ? "reglistviewdivss2 " : (this.props.teamutiple_limited === true && item.enrollable === false ? "reglistviewdivss2c" : "reglistviewdivss2 ")}
key={index} style={{
width: "100%",
display: "flex",
justifyContent: " space-around",
alignItems: "center",
height: "40px",
}}
onClick={() => this.getdatacpersondiv1Items(item)}
onMouseDown={() => this.getdatacpersondiv1Items(item)}
>
<p className=" cpersondiv1Items"
style={{
textAlign: "center",
width: "100px"
}}
>{item.name === undefined || item.name === null || item.name === "" ? "--" : item.name}</p>
<p className=" cpersondiv1Items"
style={{
textAlign: "center",
width: "100px"
}}
> {item.identity === undefined || item.identity === null || item.identity === "" ? "--" : item.identity}</p>
<p className=" cpersondiv1Items"
style={{
textAlign: "center",
width: "120px"
}}
>{item.school_name === undefined || item.school_name === null || item.school_name === "" ? "--" : item.school_name}</p>
</a>
<style>
{
`
a:hover
{
color: #05101A;
}
`
}
</style>
{item.name === undefined || item.name === null || item.name === "" ?
<a className=" cpersondiv1Items"
style={{
textAlign: "center",
width: "90px"
}}
>--</a>
:
<a title={item.name} className=" cpersondiv1Items maxnamewidth90"
style={{
textAlign: "center",
width: "90px"
}}
>{item.name}</a>
}
{item.identity === undefined || item.identity === null || item.identity === "" ?
<p className=" cpersondiv1Items maxnamewidth85"
style={{
textAlign: "center",
width: "85px"
}}
>--</p>
:
<a title={item.identity} className=" cpersondiv1Items maxnamewidth85"
style={{
textAlign: "center",
width: "85px"
}}
>{item.identity}</a>}
{item.school_name === undefined || item.school_name === null || item.school_name === "" ?
<p className=" cpersondiv1Items"
style={{
textAlign: "center",
width: "110px"
}}
>--</p>
:
<a title={item.school_name} className=" cpersondiv1Items maxnamewidth110"
style={{
textAlign: "center",
width: "110px"
}}
>{item.school_name}</a>
}
{
this.props.teamutiple_limited === undefined || this.props.teamutiple_limited === null ?
<p className=" cpersondiv1Items"
style={{
textAlign: "center",
width: "87px"
}}
>{""}</p>
:
(
this.props.teamutiple_limited === true ?
<p className=" cpersondiv1Items"
style={{
textAlign: "center",
color: "#FF6800",
width: "87px"
}}
>{item.enrollable === false ? "已加入其他战队" : ""}</p>
:
<p className=" cpersondiv1Items"
style={{
textAlign: "center",
width: "87px"
}}
>{""}</p>
)
}
</li>
</div>
);
}
const cpersondiv1 = (
<div className={" backgroundspersondiv cpersondiv1 borders2"}>
<Spin spinning={false}>
<div className={cpersondiv1Items.length === 0 ? "demo-infinite-container33" : "demo-infinite-container2"}>
<div
className={cpersondiv1Items.length === 0 ? "demo-infinite-container33 yslanswerList" : "demo-infinite-container2 yslanswerList"}>
{
cpersondiv1Items.length === 0 ?
<Empty image={Empty.PRESENTED_IMAGE_SIMPLE}/>
@ -778,48 +1073,115 @@ class PersonModal extends Component {
var persondiv2Items = [];
if (member_ids) {
persondiv2Items = member_ids.map((item, index) =>
<a className="reglistviewdivss2 " key={index} style={{
<div className={"yslanswerList"}>
<li
className={this.props.mutiple_limited === undefined || this.props.mutiple_limited === null ? "reglistviewdivss2 " : (this.props.mutiple_limited === true && item.enrollable === false ? "reglistviewdivss2c" : "reglistviewdivss2 ")}
key={index} style={{
width: "100%",
display: "flex",
justifyContent: " space-around",
alignItems: "center",
height: "40px",
}}
onClick={() => this.getdatacpersondiv1Items2(item)}
onMouseDown={() => this.getdatacpersondiv1Items2(item)}
>
<p className=" cpersondiv1Items"
style={{
textAlign: "center",
width: "90px"
}}
>{item.name === undefined || item.name === null || item.name === "" ? "--" : item.name}</p>
<p className=" cpersondiv1Items"
style={{
textAlign: "center",
width: "85px"
}}
>{item.identity === undefined || item.identity === null || item.identity === "" ? "--" : item.identity}</p>
<p className=" cpersondiv1Items"
style={{
textAlign: "center",
width: "110px"
}}
>{item.school_name === undefined || item.school_name === null || item.school_name === "" ? "--" : item.school_name}</p>
<p className=" cpersondiv1Items"
style={{
textAlign: "center",
color: "#FF6800",
width: "87px"
}}
>{item.enrollable === false ? "" : "已加入其他战队"}</p>
</a>
<style>
{
`
a:hover
{
color: #05101A;
}
`
}
</style>
{item.name === undefined || item.name === null || item.name === "" ?
<a className=" cpersondiv1Items"
style={{
textAlign: "center",
width: "90px"
}}
>--</a>
:
<a title={item.name} className=" cpersondiv1Items maxnamewidth90"
style={{
textAlign: "center",
width: "90px"
}}
>{item.name}</a>
}
{item.student_id === undefined || item.student_id === null || item.student_id === "" ?
<p className=" cpersondiv1Items maxnamewidth85"
style={{
textAlign: "center",
width: "85px"
}}
>--</p>
:
<a title={"学号:" + item.student_id} className=" cpersondiv1Items maxnamewidth85"
style={{
textAlign: "center",
width: "85px"
}}
>{"学号:" + item.student_id}</a>}
{item.school_name === undefined || item.school_name === null || item.school_name === "" ?
<p className=" cpersondiv1Items"
style={{
textAlign: "center",
width: "110px"
}}
>--</p>
:
<a title={item.school_name} className=" cpersondiv1Items maxnamewidth110"
style={{
textAlign: "center",
width: "110px"
}}
>{item.school_name}</a>
}
{
this.props.mutiple_limited === undefined || this.props.mutiple_limited === null ?
<p className=" cpersondiv1Items"
style={{
textAlign: "center",
width: "87px"
}}
>{""}</p>
:
(
this.props.mutiple_limited === true ?
<p className=" cpersondiv1Items"
style={{
textAlign: "center",
color: "#FF6800",
width: "87px"
}}
>{item.enrollable === false ? "已加入其他战队" : ""}</p>
:
<p className=" cpersondiv1Items"
style={{
textAlign: "center",
width: "87px"
}}
>{""}</p>
)
}
</li>
</div>
);
}
const persondiv2 = (
<div className={" backgroundspersondiv cpersondiv1 borders2"}>
{/*this.state.loading2*/}
<Spin spinning={false}>
<div className={persondiv2Items.length === 0 ? "demo-infinite-container33" : "demo-infinite-container2"}>
<div className={persondiv2Items.length === 0 ? "demo-infinite-container33 " : "demo-infinite-container2 "}>
{
persondiv2Items.length === 0 ?
<Empty image={Empty.PRESENTED_IMAGE_SIMPLE}/>
@ -857,16 +1219,16 @@ class PersonModal extends Component {
width="620px"
>
<style>
{
`
a:hover
{
background-color:#F6F4F4;
}
`
}
</style>
{/*<style>*/}
{/* {*/}
{/* `*/}
{/* a:hover*/}
{/* {*/}
{/* background-color:#F6F4F4;*/}
{/* }*/}
{/* `*/}
{/* }*/}
{/*</style>*/}
<div className="permaindiv">
{/*队名*/}
<style>{
@ -963,6 +1325,7 @@ class PersonModal extends Component {
placeholder="请输入老师姓名的任意关键字进行搜索,可以后续在添加"
onPressEnter={this.startSearch}
onFocus={this.inputOnFocus}
onBlur={this.inputOnBlur}
onChange={(e) => this.teacheronChange(e)}
value={this.state.keywordteachers}
suffix={
@ -1008,11 +1371,6 @@ class PersonModal extends Component {
`
}
</style>
{/*<Search*/}
{/* */}
{/* placeholder="请输入想要队员姓名的任意关键字进行搜索"*/}
{/* onSearch={(value) => this.onSearch(value)}*/}
{/*/>*/}
<Dropdown overlay={persondiv2} getPopupContainer={trigger => trigger.parentNode}
visible={this.state.person2}>
@ -1021,6 +1379,7 @@ class PersonModal extends Component {
placeholder="请输入想要队员姓名的任意关键字进行搜索"
onPressEnter={this.startSearch2}
onFocus={this.inputOnFocus2}
onBlur={this.inputOnBlur2}
onChange={(e) => this.studentsonChange(e)}
value={this.state.keywordstudents}
suffix={
@ -1114,8 +1473,21 @@ class PersonModal extends Component {
) :
""
}
{
GetenrollmentAPI && GetenrollmentAPI.member_staff ?
(
Thecurrentnumberboolstu === true ?
<p style={{
marginLeft: "53px",
color: "#D0021B",
fontSize: "12px",
marginTop: "9px"
}}>战队队员为{GetenrollmentAPI.member_staff.minimum}-{GetenrollmentAPI.member_staff.maximum},现在为{Thecurrentnumberstu}</p>
: ""
) :
""
}
<div style={{
marginTop: "24px",

@ -20,6 +20,19 @@ class PersonalModalteam extends Component {
Tmoconfirmto = () => {
try {
if (this.state.yslzxueshiskmcdm1) {
if (this.state.yslzxueshiskmcdm1.length === 0) {
this.props.showNotification(`请输入您的邀请码`);
return
}
}
} catch (e) {
}
let url = `/competitions/${this.props.match.params.identifier}/competition_teams/join.json`;
axios.post(url, {
invite_code: this.state.yslzxueshiskmcdm1

@ -9,13 +9,21 @@ import moment from 'moment';
import {SnackbarHOC, WordsBtn, getImageUrl} from 'educoder';
import {TPMIndexHOC} from '../../tpm/TPMIndexHOC';
import competition from '../comcss/competition.css';
import {Button, message} from 'antd';
import {Button, message, Tooltip} from 'antd';
// 点击按钮复制功能
function jsCopy() {
var e = document.getElementById("copy_invite_code");
e.select();
document.execCommand("Copy");
codesuccess()
// const range=document.createRange();
// window.getSelection().removeAllRanges();
// range.selectNode(e.target);
// window.getSelection().addRange(range);
// const successful =document.execCommand('copy');
// if(successful){
// codesuccess()
// }
}
function codesuccess() {
@ -80,7 +88,7 @@ class PersonalCompetititem extends React.Component {
marginTop: "29px",
marginLeft: "37px"
}}>
<p style={{
<p className="maxnamewidth160" style={{
color: "#05101A",
fontSize: "16px",
@ -88,71 +96,115 @@ class PersonalCompetititem extends React.Component {
textAlign: "center"
}}>{data[0].name}</p>
</div>
<div className=" " style={{
marginLeft: "37px",
display: "flex",
flexDirection: "initial",
width: "487px"
}}>
{
data && data[0].team_members.map((item, index) => {
return (
{this.props.type === 5 || this.props.type === 2 ?
<div className=" " style={{
marginLeft: "37px",
display: "flex",
flexDirection: "initial",
width: "357px"
}}>
{
data && data[0].team_members.map((item, index) => {
return (
index === 0 ?
<img className="regitemimgs" src={getImageUrl("images/" + item.image_url)}>
</img>
: index === 1 ?
<img className="regitemimgs2" src={getImageUrl("images/" + item.image_url)}>
</img>
: index === 2 ?
<img className="regitemimgs2" src={getImageUrl("images/" + item.image_url)}>
</img>
: index === 3 ?
<div>
<img className="regitemimgs2" src={getImageUrl("images/" + item.image_url)}>
</img>
index === 0 ?
<img className="regitemimgs" src={getImageUrl("images/" + item.image_url)}>
<img className="regitemimgs222"
src={getImageUrl(`images/educoder/competitions/pexjiazai.png`)}>
</img>
</div>
: ""
)
})
}
</img>
: index === 1 ?
<img className="regitemimgs2" src={getImageUrl("images/" + item.image_url)}>
</div> :
<div className=" " style={{
marginLeft: "37px",
display: "flex",
flexDirection: "initial",
width: "487px"
}}>
{
data && data[0].team_members.map((item, index) => {
return (
</img>
: index === 2 ?
<img className="regitemimgs2" src={getImageUrl("images/" + item.image_url)}>
index === 0 ?
<img className="regitemimgs" src={getImageUrl("images/" + item.image_url)}>
</img>
: index === 3 ?
</img>
: index === 1 ?
<img className="regitemimgs2" src={getImageUrl("images/" + item.image_url)}>
</img>
: index === 4 ?
: index === 2 ?
<img className="regitemimgs2" src={getImageUrl("images/" + item.image_url)}>
</img>
: index === 5 ?
<div>
: index === 3 ?
<img className="regitemimgs2" src={getImageUrl("images/" + item.image_url)}>
</img>
: index === 4 ?
<img className="regitemimgs2" src={getImageUrl("images/" + item.image_url)}>
<img className="regitemimgs22"
src={getImageUrl(`images/educoder/competitions/pexjiazai.png`)}>
</img>
: index === 5 ?
<div>
<img className="regitemimgs2" src={getImageUrl("images/" + item.image_url)}>
</img>
</div>
: ""
)
})
}
</img>
</div>
<div className=" " style={{
<img className="regitemimgs22"
src={getImageUrl(`images/educoder/competitions/pexjiazai.png`)}>
</img>
</div>
: ""
)
})
}
</div>
}
<div className=" " style={this.props.type === 5 || this.props.type === 2 ? {
marginLeft: "20px",
} : {
marginLeft: "37px",
}}>
<div style={{marginTop: "23px",}}>
<div style={{marginTop: "23px", width: '140px'}}>
<span style={{
color: "#05101A",
fontSize: "16px",
}}>邀请码</span>
<span
style={{
color: "#05101A",
color: "#05101A",
fontSize: "16px",
}}>{data[0].invite_code === null || data[0].invite_code === undefined ? "" : data[0].invite_code}</span>
</div>
<div style={{
overflow: 'hidden',
height: "0px",
width: "0px"
height: "1px",
width: "1px"
}}>
<input id="copy_invite_code"
value={data[0].invite_code === null || data[0].invite_code === undefined ? "" : data[0].invite_code}/>
@ -166,27 +218,36 @@ class PersonalCompetititem extends React.Component {
>
</i>
:
<i className="regitemimgs3 iconfont icon-fuzhi1 font-14 font-n"
style={{
marginLeft: "18px",
}}
onClick={() => {
jsCopy()
}}
>
</i>
<Tooltip placement="bottom" title={"复制邀请码"}>
<i className="regitemimgs3 iconfont icon-fuzhi1 font-14 font-n"
style={{
marginLeft: "18px",
}}
onClick={() => {
jsCopy()
}}
>
</i>
</Tooltip>
}
{
this.props.type === 5 ?
<div className="regitemimgs4"
<div className="regitemimgs444"
style={{
marginLeft: "32px",
}}
>
<div className="regitemimgs5" onClick={() => this.props.Exittheteamshow(data[0].id, true)}>
<p onClick={() => this.props.Exittheteamshow(data[0].id, true)}>删除战队</p>
<div className="regitemimgs555">
<a href={`/newcompetitions/${"gcc-course-2019"}/competition_teams/${data[0].id}`} style={{
color: "#459be5",
width: "100%",
height: "100%",
lineHeight: "39px",
}}>战队详情</a>
</div>
<div className="regitemimgs555" onClick={() => this.props.Exittheteamshow(data[0].id, false)}>
<p onClick={() => this.props.Exittheteamshow(data[0].id, false)}>删除战队</p>
</div>
<div className="regitemimgs6" onClick={() => this.props.Createateamedit(data[0])}>
<p onClick={() => this.props.Createateamedit(data[0])}>编辑战队</p>
@ -194,12 +255,13 @@ class PersonalCompetititem extends React.Component {
</div>
: this.props.type === 2 ?
<div className="regitemimgs4 "
<div className="regitemimgs444 "
style={{
marginLeft: "32px",
}}
>
<div className="regitemimgs5">
<div className="regitemimgs555">
<a href={`/newcompetitions/${"gcc-course-2019"}/competition_teams/${data[0].id}`} style={{
color: "#459be5",
width: "100%",
@ -207,10 +269,12 @@ class PersonalCompetititem extends React.Component {
lineHeight: "39px",
}}>战队详情</a>
</div>
<div className="regitemimgs6" onClick={() => this.props.Exittheteamshow(data[0].id, false)}>
<p onClick={() => this.props.Exittheteamshow(data[0].id, false)}>退出战队</p>
<div className="regitemimgs555" onClick={() => this.props.Exittheteamshow(data[0].id, false)}>
<p onClick={() => this.props.Exittheteamshow(data[0].id, false)}>删除战队</p>
</div>
<div className="regitemimgs6" onClick={() => this.props.Createateamedit(data[0])}>
<p onClick={() => this.props.Createateamedit(data[0])}>编辑战队</p>
</div>
</div>
:
this.props.type === 3 ?

@ -1,20 +1,11 @@
import React, { Component } from 'react';
import { Link } from 'react-router-dom';
import { Menu, Icon, List, Avatar,Row, Col,Tag,Pagination} from 'antd';
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";
const { SubMenu } = Menu;
const IconText = ({ type, text }) => (
<span>
<Icon type={type} style={{ marginRight: 8 }} />
{text}
</span>
);
class CompetitionsIndex extends Component{
constructor(props) {
super(props)
@ -78,9 +69,8 @@ class CompetitionsIndex extends Component{
}
render() {
let {datas,page,count}=this.state;
admin: true
business: false
console.log(this.props.current_user&&this.props.current_user.business)
return (
<div>
<div className="clearfix">
@ -133,7 +123,11 @@ class CompetitionsIndex extends Component{
dataSource={datas&&datas}
renderItem={(item,key) => (
<div>
<div className={"CompetitionsList"} >
{item.competition_status==="nearly_published"?
this.props.current_user&&this.props.current_user.admin===true?"":this.props.current_user&&this.props.current_user.business===true?"":<div className={"CompetitionsListzhezhao"}>即将发布 敬请期待</div>:""}
{/*<div className={"CompetitionsListzhezhao"}>即将发布 敬请期待</div>*/}
{item.description===null||item.description===undefined||item.description===""?<style>
{
`
@ -180,14 +174,14 @@ class CompetitionsIndex extends Component{
}
>
<List.Item.Meta
title={<a className={item.competition_status==="ended"?"endedfont":item.competition_status==="nearly_published"?
this.props.current_user&&this.props.current_user.business===true?"":this.props.current_user&&this.props.current_user.admin===true?"":"endedfont":""}>
title={<div className={item.competition_status==="ended"?"endedfont":item.competition_status==="nearly_published"?
this.props.current_user&&this.props.current_user.admin===true?"competitionstitlesshou":this.props.current_user&&this.props.current_user.business===true?"competitionstitlesshou":"endedfont":"competitionstitlesshou"}>
<span className={"competitionstitles"}
onClick={()=>this.setcompetitonurl(item.competition_status==="ended"?null:item.competition_status==="nearly_published"? this.props.current_user&&this.props.current_user.business===true?`/newcompetitions/${item.identifier}/common_header`:this.props.current_user&&this.props.current_user.admin===true?`/newcompetitions/${item.identifier}/common_header`:null:item.competition_status==="progressing"?`/newcompetitions/${item.identifier}/common_header`:null)}
>{item.name}</span><span>{item.sub_title===null?"":<Tag className="competitionsrelative" color="#87d068">{
item.sub_title
}</Tag>}</span>
</a>}
</div>}
/>
{item.description}
</List.Item>
@ -199,7 +193,7 @@ class CompetitionsIndex extends Component{
}
/>}
{datas===undefined?'none':datas.task_count >20 ?<div className="mb40 edu-txt-center padding20-30"
{datas===undefined?"":datas.task_count >20 ?<div className="mb40 edu-txt-center padding20-30"
>
<Pagination

@ -117,14 +117,24 @@
.endedfont{
color:#000 !important;
}
.zhezhaos{
height: 200px;
overflow: hidden;
position: relative;
border: 1px solid rgb(235, 237, 240);
border-radius: 2px;
padding: 48px;
.CompetitionsListzhezhao{
position: absolute;
top: 0px;
left: 0px;
width: 1206px;
height: 100%;
z-index: 10000;
display: none;
background: rgba(51, 51, 51,0.7);
text-align: center;
background: rgb(250, 250, 250);
line-height: 170px;
color: #fff;
font-size: 50px;
}
.CompetitionsList:hover .CompetitionsListzhezhao{
display: block;
}
.competitionstitlesshou:hover{
cursor: pointer;
color: #1c91e8 !important;
}

@ -1,12 +1,12 @@
import React, { Component } from 'react';
import { Breadcrumb,Layout,Table, Divider, Tag,Badge} from 'antd';
import { Breadcrumb,Layout,Table, Divider, Tag,Badge,Tooltip} from 'antd';
import { Link } from 'react-router-dom';
import axios from 'axios';
import NoneData from "../../courses/shixunHomework/shixunHomework";
import './Competitionteams.css';
const { Header, Footer, Sider, Content } = Layout;
const { Content } = Layout;
class Competitionteams extends Component{
constructor(props) {
@ -19,6 +19,18 @@ class Competitionteams extends Component{
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();
@ -131,7 +143,7 @@ class Competitionteams extends Component{
}
render() {
let {data}=this.state;
const shixuncolumns = [
{
title: '创建者',
@ -156,13 +168,19 @@ class Competitionteams extends Component{
title: '被fork发布的学习人数',
dataIndex: 'forked_myshixun_count',
key: 'forked_myshixun_count',
render: (text, record) => <div className={record.creator==="合计:"?"teamsLayoucolor-orange":""}>{text}</div>,
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) => <div className={record.creator==="合计:"?"teamsLayoucolor-orange":""}>{text}</div>,
render: (text, record) =>
<Tooltip placement="bottom" title={"至少完成了1个关卡"}>
<div className={record.creator==="合计:"?"teamsLayoucolor-orange":""}>{text}</div>
</Tooltip>,
},
{
title: '应用值',
@ -195,13 +213,19 @@ class Competitionteams extends Component{
title: '被fork发布的学习人数',
dataIndex: 'shixun_homework_count',
key: 'shixun_homework_count',
render: (text, record) => <div className={record.creator==="合计:"?"teamsLayoucolor-orange":""}>{text}</div>,
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) => <div className={record.creator==="合计:"?"teamsLayoucolor-orange":""}>{text}</div>,
render: (text, record) =>
<Tooltip placement="bottom" title={"至少完成了1个关卡"}>
<div className={record.creator==="合计:"?"teamsLayoucolor-orange":""}>{text}</div>
</Tooltip>,
},
{
title: '应用值',
@ -212,14 +236,14 @@ class Competitionteams extends Component{
];
console.log(this.state.shixundata)
// console.log(this.state.shixundata)
return (
<div className={"educontent clearfix mt20 "}>
<Breadcrumb separator=">">
<Breadcrumb.Item>全国高校计算机大赛战</Breadcrumb.Item>
<Breadcrumb.Item href="">报名</Breadcrumb.Item>
<Breadcrumb.Item href="">战队详情</Breadcrumb.Item>
<Breadcrumb.Item><Link to={"/newcompetitions"}>{data&&data.name}</Link></Breadcrumb.Item>
<Breadcrumb.Item><Link to={`/newcompetitions/${this.props.match.params.identifier}/enroll`}>报名</Link></Breadcrumb.Item>
<Breadcrumb.Item>战队详情</Breadcrumb.Item>
</Breadcrumb>
<Layout className={"teamsLayout"}>

@ -1,4 +1,5 @@
.teamsLayout{background: transparent !important;}
.teamsLayout .ant-layout-sider{
background: transparent !important;
flex: 0 0 180px !important;
@ -213,4 +214,126 @@
right: -5px;
width:93px;
top: 20px;
}
}
.Competitionthirdbox{
width:234px;
height:163px;
background:rgba(223,223,225,1);
}
.Competitionthirdbox{
width:234px;
height:163px;
background:rgba(223,223,225,1);
}
.Competitionthirdbox{
width:234px;
height:163px;
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:155px;
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);
}
.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%;
}
.CompetitionsListzhezhao{
position: absolute;
top: 0px;
left: 0px;
width: 1206px;
height: 100%;
z-index: 10000;
display: none;
background: rgba(51, 51, 51,0.7);
text-align: center;
line-height: 416px;
color: #fff;
font-size: 50px;
}
.relative{position: relative;}
.relative:hover .CompetitionsListzhezhao{ display: block;}

@ -5,34 +5,42 @@ import axios from 'axios';
import {markdownToHTML,getImageUrl} from 'educoder';
import CompetitionContents from './CompetitionContents';
import CompetitionContentsChart from './CompetitionContentsChart';
import CompetitionContentsMd from './CompetitionContentsMd';
import NoneData from "../../courses/shixunHomework/shixunHomework";
import './CompetitionCommon.css';
const { Header, Footer, Sider, Content } = Layout;
const {Sider } = Layout;
class CompetitionCommon extends Component{
constructor(props) {
super(props)
this.state={
data:undefined,
bannerdata:undefined
bannerdata:undefined,
module_type:undefined,
mdContentdata:undefined,
chart_rules:undefined,
Competitionedittype:false,
chartdata:undefined
}
}
componentDidMount(){
window.document.title = '竞赛';
this.getbannerdata();
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)
})
if(this.props.match.params.identifier!=null){
this.getbannerdata();
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)
})
}
}
getbannerdata=()=>{
@ -40,32 +48,183 @@ class CompetitionCommon extends Component{
axios.get(url).then((response) => {
if(response.status===200){
this.setState({
data:response.data
data:response.data,
thiskeys:response.data.competition_modules[0].position
})
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
)
}
}).catch((error) => {
console.log(error)
})
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);
})
}
}
getrightdata=(id,typeid)=>{
debugger
getrightdatas=(e)=>{
let keys=parseInt(e.key);
this.getlistdata(keys)
}
getlistdata=(keys,listkey)=>{
let{data}=this.state;
this.setState({
thiskeys:keys
})
data&&data.competition_modules.map((item,key)=>{
if(keys===item.position){
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(`/newcompetitions/${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{
this.props.history.replace(module_url);
return
}
this.setState({
module_id:id,
module_type:typeid
})
}
Competitionedit=()=>{
this.setState({
Competitionedittype:true
})
}
hideCompetitionedit=()=>{
this.setState({
Competitionedittype:false
})
}
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}`);
}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(`/courses/${data.course_id}`);
}
})
}
}
}else{
this.props.history.replace(url);
}
}
Competitioncallback=(key)=>{
this.setState({
tabkey:key
})
}
render() {
let {data,bannerdata}=this.state;
// console.log(bannerdata)
let {data,bannerdata,module_type,Competitionedittype,mdContentdata}=this.state;
return (
data===undefined?"":<div className={"educontent clearfix mt20 "}>
<Breadcrumb separator=">">
<Breadcrumb.Item href="">在线竞赛</Breadcrumb.Item>
<Breadcrumb.Item href="">{data&&data.name}</Breadcrumb.Item>
<Breadcrumb.Item><Link to={"/newcompetitions"}>在线竞赛</Link></Breadcrumb.Item>
<Breadcrumb.Item>{data&&data.name}</Breadcrumb.Item>
</Breadcrumb>
<div className={"mt10"}>
<div className={"mt10 relative"}>
<Row className={"CompetitionCommonbanner"}>
{data.competition_status==="nearly_published"?
this.props.current_user&&this.props.current_user.admin===true?"":this.props.current_user&&this.props.current_user.business===true?"":<div className={"CompetitionsListzhezhao"}>即将发布 敬请期待</div>:""}
<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}>
@ -101,7 +260,7 @@ debugger
<div className="gutter-box CompetitionsIndexbottomvalue Competitioncolor516">{data.competition_status==="nearly_published"?"--":data&&data.visits_count}</div>
</Col>
<Col className="gutter-row" span={6}>
<div className="gutter-box CompetitionsIndexbottomvalue Competitioncolor516">{data.competition_status==="nearly_published"?"--":data&&data.member_count}</div>
<div className="gutter-box CompetitionsIndexbottomvalue Competitioncolor516" onClick={data.competition_status==="nearly_published"?"":()=>this.gotocourse(`/newcompetitions/${this.props.match.params.identifier}/enroll`)}>{data.competition_status==="nearly_published"?"--":data&&data.member_count}</div>
</Col>
</Row>
</Col>
@ -131,9 +290,9 @@ debugger
<Button type="primary" block className={"Competitionfontsize22"} disabled={true}>
已结束
</Button>:
<Button type="primary" block className={"Competitionfontsize22"}>
<Link to={`/newcompetitions/${this.props.match.params.identifier}/enroll`}>立即报名</Link>
</Button>}
data.competition_status==="progressing"?<Button type="primary" block className={"Competitionfontsize22"}>
{data.mode===2?<a onClick={()=>this.gotocourse()}>立即报名</a>:<a onClick={()=>this.gotocourse(`/newcompetitions/${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>
@ -142,12 +301,13 @@ debugger
<Layout className={'teamsLayout mt40'}>
<Sider>
<Menu mode="inline" className="CompetitionMenu" defaultSelectedKeys={['1']}>
<Menu mode="inline" className="CompetitionMenu" defaultSelectedKeys={['1']} onClick={(e)=>this.getrightdatas(e)}>
{data&&data.competition_modules.map((item,key)=>{
return(
<Menu.Item key={item.position}>
{item.has_url===false?<span onClick={()=>this.getrightdata(item.id,item.module_type)}>{item.name}</span>:<a
{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)}
@ -155,13 +315,31 @@ debugger
</Menu.Item>
)
})}
</Menu>
</Sider>
<Layout className={"teamsLayoutleft"}>
<CompetitionContents/>
<CompetitionContentsChart/>
{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>
</Layout>

@ -1,7 +1,7 @@
import React, { Component } from 'react';
import {Button,Layout} from 'antd';
import axios from 'axios';
import {markdownToHTML,getImageUrl} from 'educoder';
import {markdownToHTML,getImageUrl,AttachmentList} from 'educoder';
import NoneData from "../../courses/shixunHomework/shixunHomework";
const { Header, Footer, Sider, Content } = Layout;
@ -21,15 +21,22 @@ class CompetitionContents extends Component{
render() {
let{mdContentdata}=this.props;
//
return (
<div className={"fr"}>
<Button className={"fr"} type="primary" ghost>
{this.props.current_user&&this.props.current_user.admin===true||this.props.current_user&&this.props.current_user.business===true?this.props.Competitionedittype===false?<Button className={"fr"} type="primary" ghost onClick={()=>this.props.Competitionedit()}>
编辑
</Button>
<Content className={"markdown-body"} dangerouslySetInnerHTML={{__html: markdownToHTML("").replace(/▁/g, "▁▁▁")}}>
</Content>
</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).replace(/▁/g, "▁▁▁")}}>
</Content>
<div className={"mt30"}>
<AttachmentList {...this.props} {...this.state} attachments={mdContentdata===undefined?[]:mdContentdata.attachments===undefined?[]:mdContentdata.attachments}></AttachmentList>
</div>
</div>
</div>
)

@ -1,10 +1,9 @@
import React, { Component } from 'react';
import {Button,Layout,Tabs,Icon, Card, Avatar, Row, Col ,Table} from 'antd';
import axios from 'axios';
import {markdownToHTML,getImageUrl} from 'educoder';
import NoneData from "../../courses/shixunHomework/shixunHomework";
const { Header, Footer, Sider, Content } = Layout;
const { Content } = Layout;
const { TabPane } = Tabs;
const { Meta } = Card;
@ -18,166 +17,212 @@ class CompetitionContents extends Component{
componentDidMount(){
window.document.title = '竞赛';
}
render() {
const operations = <Icon type="form" />;
const operations =
<div>
<Button className={"fr"} type="primary" ghost onClick={()=>this.props.Competitionedit()}>编辑</Button>
<Button className={"fr mr20"} type="primary" ghost>
<a href={`/competitions/${this.props.match.params.identifier}/charts.xlsx`}>导出</a>
</Button>
</div>
const columns = [
{
title: 'Name',
dataIndex: 'name',
title: 'usersum',
dataIndex: 'usersum',
key: 'name',
render: text => <a>{text}</a>,
},
{
title: 'Age',
dataIndex: 'age',
key: 'age',
},
{
title: 'Address',
dataIndex: 'address',
key: 'address',
render: text => <a className={"color-blue"}>{text}</a>,
},
{
title: 'Tags',
key: 'tags',
dataIndex: 'tags',
render: tags => (
<span>
123123
</span>
),
title: 'userimg',
dataIndex: 'userimg',
key: 'userimg',
render: text => <img className={"Competitionuserimg"} src={getImageUrl("images/avatars/User/60969?t=1569488691")}/>,
},
{
title: 'Action',
key: 'action',
render: (text, record) => (
<span>
<a>Invite {record.name}</a>
<a>Delete</a>
</span>
),
},
{
title: 'Values',
key: 'values',
dataIndex: 'values',
render: tags => (
<span>
123123
</span>
),
title: 'username',
dataIndex: 'username',
key: 'username',
render: text => <a>{text}</a>,
},
];
const data = [
{
key: '1',
name: 'John Brown',
age: 32,
address: 'New York No. 1 Lake Park',
tags: ['nice', 'developer'],
values:123
title: 'school',
dataIndex: 'school',
key: 'school',
render: text => <a>{text}</a>,
},
{
key: '2',
name: 'Jim Green',
age: 42,
address: 'London No. 1 Lake Park',
tags: ['loser'],
values:123
title: 'spendtime',
dataIndex: 'spendtime',
key: 'spendtime',
render: text => <a>{text}</a>,
},
{
key: '3',
name: 'Joe Black',
age: 32,
address: 'Sidney No. 1 Lake Park',
tags: ['cool', 'teacher'],
values:123
title: 'score',
dataIndex: 'score',
key: 'score',
render: text => <a className={"color-blue"}>{text}</a>,
},
];
return (
const data = [];
let {chart_rules,chartdata}=this.props;
chartdata===undefined?"":chartdata.teams.length===0?"":chartdata.teams.map((item,key)=>{
if(key>3){
let list={
usersum:key,
userimg:item.user_image,
username:item.record_user_name,
school:item.school_name,
spendtime:item.spend_time,
score:item.score,
user_login:item.user_login
}
data.push(list)
}
})
console.log(this.props.chartdata&&this.props.chartdata.user_ranks)
return (
<div>
<Tabs tabBarExtraContent={operations}>
<TabPane tab="总排行榜" key="1">
<Content className={"markdown-body"} dangerouslySetInnerHTML={{__html: markdownToHTML("Content of tab 1").replace(/▁/g, "▁▁▁")}}>
</Content>
</TabPane>
<TabPane tab="决赛排行榜" key="2">
<Content className={"markdown-body"} dangerouslySetInnerHTML={{__html: markdownToHTML("Content of tab 2").replace(/▁/g, "▁▁▁")}}>
</Content>
</TabPane>
<TabPane tab="预赛排行榜" key="3">
<Content className={"markdown-body"} dangerouslySetInnerHTML={{__html: markdownToHTML("Content of tab 3").replace(/▁/g, "▁▁▁")}}>
</Content>
</TabPane>
</Tabs>
<Col className="gutter-row Competitioncharts mt30 mb30">
总排名
</Col>
{chart_rules===undefined?"":<Tabs onChange={(e)=>this.props.Competitioncallback(e)} activeKey={this.props.tabkey} tabBarExtraContent={this.props.current_user&&this.props.current_user.admin===true||this.props.current_user&&this.props.current_user.business===true?this.props.Competitionedittype===false?operations:"":""}>
{chart_rules.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).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).replace(/▁/g, "▁▁▁")}}></Content>
)
}
})}
</TabPane>
)
})}
</Tabs>}
<Col className="gutter-row Competitioncharts mt30 mb30">总排名</Col>
<Row calssName={"Competition399"}>
<Col className="mt40" xs={{ span: 5, offset: 1 }} lg={{ span: 6, offset: 2 }}>
<Card
className={"Competitionthird"}
cover={
<img
alt="example"
src="https://gw.alipayobjects.com/zos/rmsportal/JiqGstEfoWAOHiTxclqi.png"
/>
}
>
<Meta
title="Card title"
description="This is the description"
/>
</Card>
</Col>
<Col xs={{ span: 11, offset: 1 }} lg={{ span: 6, offset: 1 }}>
<Card
className={"Competitionfirst"}
cover={
<img
alt="example"
src="https://gw.alipayobjects.com/zos/rmsportal/JiqGstEfoWAOHiTxclqi.png"
/>
}
>
<Meta
title="Card title"
description="This is the description"
/>
</Card>
</Col>
<Col className="mt30" xs={{ span: 5, offset: 1 }} lg={{ span: 6, offset: 1 }}>
<Card
className={"Competitionsecondary"}
cover={
<img
alt="example"
src="https://gw.alipayobjects.com/zos/rmsportal/JiqGstEfoWAOHiTxclqi.png"
/>
}
>
<Meta
title="Card title"
description="This is the description"
/>
</Card>
</Col>
{chartdata===undefined?"":chartdata.teams.length===0?"":chartdata.teams.map((item,key)=>{
if(key===1){
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}`} className="color-dark">
<img className={"rankingimg"} src={getImageUrl(item.user_image)} />
<p className="task-hide rankName mt5 jinshaifont">{item.record_user_name}</p>
</a>
</div>
</li>
</div>
}
>
<Meta
title={<div className={"center"}>
<div className={"rankfonttop"}>{item.school_name}</div>
<div className={"rankfontmid"}>{item.spend_time}</div>
</div>}
description={
<div className={"rankfontbottoms"}>{item.score}</div>
}
/>
</Card>
</Col>
)
}
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}`} className="color-dark">
<img className={"rankingimg"} src={getImageUrl(item.user_image)} />
<p className="task-hide rankName mt5 jinshaifont">{item.record_user_name}</p>
</a>
</div>
</li>
</div>
}
>
<Meta
title={<div className={"center"}>
<div className={"rankfonttop"}>{item.school_name}</div>
<div className={"rankfontmid"}>{item.spend_time}</div>
</div>}
description={
<div className={"rankfontbottom"}>{item.score}</div>
}
/>
</Card>
</Col>
)
}
if(key===3){
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}`} className="color-dark">
<img className={"rankingimg"} src={getImageUrl(item.user_image)} />
<p className="task-hide rankName mt5 jinshaifont">{item.user_name}</p>
</a>
</div>
</li>
</div>
}
>
<Meta
title={<div className={"center"}>
<div className={"rankfonttop"}>{item.school_name}</div>
<div className={"rankfontmid"}>{item.spend_time}</div>
</div>}
description={
<div className={"rankfontbottom"}>{item.score}</div>
}
/>
</Card>
</Col>
)
}
})}
</Row>
<Row className={"mt80 mb80"}>
<Table className="Competitiontransparent" columns={columns} dataSource={data} showHeader={false} pagination={false}/>
{chartdata===undefined?"":chartdata.teams.length===0?"":<Table className="Competitiontransparent" columns={columns} dataSource={data} showHeader={false} pagination={false}/>}
</Row>

@ -0,0 +1,225 @@
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) => {
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();
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) {
message.error('文件大小必须小于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="请输入任务内容说明最大限制5000个字符" 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;

@ -2,13 +2,13 @@ import React, { Component } from 'react';
import { Redirect } from 'react-router';
import { BrowserRouter as Router, Route, Link, Switch } from "react-router-dom";
import { Route, Link, Switch } from "react-router-dom";
import Loading from '../../Loading';
import Loadable from 'react-loadable';
import { TPMIndexHOC } from '../tpm/TPMIndexHOC';
import { SnackbarHOC } from 'educoder';
import { CNotificationHOC } from '../courses/common/CNotificationHOC';
//新版竞赛首页
const CompetitionsIndex = Loadable({
@ -41,8 +41,7 @@ class Competitions extends Component {
}
componentDidMount(){
console.log("Competitions竞赛");
console.log(this.props);
window.document.title = '竞赛';
}
@ -90,4 +89,4 @@ class Competitions extends Component {
}
}
export default SnackbarHOC() (TPMIndexHOC (Competitions)) ;
export default CNotificationHOC() (TPMIndexHOC (Competitions)) ;

@ -481,9 +481,9 @@ class CoursesBanner extends Component {
document.title=coursedata===undefined || coursedata.status===401 || coursedata.status===407?"":coursedata.name;
return (
<div>
{
is_guide && <Guide></Guide>
}
{/*{*/}
{/* is_guide && <Guide></Guide>*/}
{/*}*/}
{AccountProfiletype===true?<AccountProfile
hideAccountProfile={()=>this.hideAccountProfile()}

@ -385,10 +385,7 @@ class GraduationTasksedit extends Component{
{description===undefined?"":
<div>
{/*<Form >*/}
{/* <Form >*/}
{/*内容*/}
<div className="stud-class-set bor-bottom-greyE pt20 pl20 pr20 pb0 edu-back-white">
<Form.Item label="类型">
@ -407,12 +404,12 @@ class GraduationTasksedit extends Component{
<style>
{
`
.yslgraduainputedit .ant-input{
border-right: none !important;
height: 40px !important;
}
`
.yslgraduainputedit .ant-input{
border-right: none !important;
height: 40px !important;
}
`
}
</style>
<Form.Item label="任务标题" >

Loading…
Cancel
Save