diff --git a/public/react/src/modules/competition/CompetitionMaxImg.js b/public/react/src/modules/competition/CompetitionMaxImg.js index 7e1f54513..b05ca56fc 100644 --- a/public/react/src/modules/competition/CompetitionMaxImg.js +++ b/public/react/src/modules/competition/CompetitionMaxImg.js @@ -83,8 +83,8 @@ class CompetitionMaxImg extends React.Component {
{ pint === 1 ? -
-

立即报名

+
this.props.Personalregistration()}> +

this.props.Personalregistration()}>立即报名

: pint === 2 ?
diff --git a/public/react/src/modules/competition/RegisListviewdata.js b/public/react/src/modules/competition/RegisListviewdata.js index d5dcd9cc0..31ea816b5 100644 --- a/public/react/src/modules/competition/RegisListviewdata.js +++ b/public/react/src/modules/competition/RegisListviewdata.js @@ -23,15 +23,15 @@ class RegisListviewdata extends React.Component { } componentDidMount() { - console.log("RegisListviewdata"); - console.log(this.props.item) + //console.log("RegisListviewdata"); + //console.log(this.props.item) this.setState({ item: this.props.item }) } render() { - const {item} = this.state; + const {item} = this.props; return (
diff --git a/public/react/src/modules/competition/Registration.js b/public/react/src/modules/competition/Registration.js index a3e330cfe..76a1d70b9 100644 --- a/public/react/src/modules/competition/Registration.js +++ b/public/react/src/modules/competition/Registration.js @@ -70,19 +70,19 @@ class Registration extends React.Component { } componentDidMount() { - // //console.log("componentDidMount Registration"); - // //// //console.log("调用子组件 "); - // //console.log(this.props.isAdmin()); - // //// //console.log(this.props.isAdmin()) + // ////console.log("componentDidMount Registration"); + // //// ////console.log("调用子组件 "); + // ////console.log(this.props.isAdmin()); + // //// ////console.log(this.props.isAdmin()) } componentDidUpdate = (prevProps) => { if (prevProps.user != this.props.user) { - // //console.log("Registration"); - // //console.log("componentDidUpdate"); - // //console.log(this.props.user.admin); + //console.log("Registration"); + //console.log("componentDidUpdate"); + //console.log(this.props.user.admin); const {keyword, page, per_page} = this.state; this.Getdata(keyword, page, per_page, this.props.user.admin); this.GetenrollmentAPI(); @@ -93,12 +93,12 @@ class Registration extends React.Component { //获取报名配置API GetenrollmentAPI = () => { - const url = `/competitions/${"gcc-course-2019"}/competition_staff.json`; + const url = `/competitions/${"gcc-task-2020"}/competition_staff.json`; axios.get((url)).then((result) => { if (result) { if (result.data) { - //// //console.log("获取报名配置API"); - //// //console.log(result); + //// ////console.log("获取报名配置API"); + //// ////console.log(result); this.setState({ GetenrollmentAPI: result.data, personal: result.data.personal, @@ -107,10 +107,23 @@ class Registration extends React.Component { teacher_staff: result.data.teacher_staff, member_staff: 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 + }) + } } } }).catch((error) => { - //// //console.log(error); + //// ////console.log(error); }) } @@ -123,11 +136,11 @@ class Registration extends React.Component { page: page, per_page: per_page, }; - let url = `/competitions/${"gcc-task-2019"}/competition_teams.json`; + let url = `/competitions/${"gcc-task-2020"}/competition_teams.json`; axios.get((url), {params: datas}).then((result) => { if (result) { if (result.data) { - //// //console.log(result);\ + //// ////console.log(result);\ if (result.data.personal === false) { //不是个人赛 if (result.data.my_teams.length === 0) { @@ -246,16 +259,24 @@ class Registration extends React.Component { page: page, per_page: per_page, }; - let url = `/competitions/${"gcc-task-2019"}/competition_teams.json`; + let url = `/competitions/${"gcc-task-2020"}/competition_teams.json`; axios.get((url), {params: datas}).then((result) => { + this.setState({ + loadingstate: false, + }) if (result) { if (result.data) { - //// //console.log(result); + //// ////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, @@ -266,7 +287,9 @@ class Registration extends React.Component { }) } else { //有数据的 - if (result.data.my_teams[0].manage_permission === true) { + //console.log("b"); + + if (result.data.my_teams[0].manage_permission === true) { this.setState({ type: 5, data: result.data.my_teams, @@ -277,7 +300,9 @@ class Registration extends React.Component { }) } else { - this.setState({ + //console.log("c"); + + this.setState({ type: 4, data: result.data.my_teams, count: result.data.count, @@ -289,6 +314,8 @@ class Registration extends React.Component { } } else { //团队赛 + //console.log("d"); + this.setState({ type: 6, data: result.data.my_teams, @@ -301,12 +328,12 @@ class Registration extends React.Component { } } - this.setState({ - loadingstate: false, - }) + }).catch((error) => { - console.log(error); - console.log("报错了"); + //console.log("k"); + + //console.log(error); + //console.log("报错了"); if (admin === true) { //管理员 this.setState({ @@ -521,18 +548,18 @@ class Registration extends React.Component { } //退出战队 Exittheteam = (bool) => { - // //console.log(this.state.itemid); + // ////console.log(this.state.itemid); if (bool) { this.setState({ messageexitol: true }) - let url = `/competitions/${"gcc-task-2019"}/competition_teams/${this.state.itemid}/leave.json`; + let url = `/competitions/${"gcc-task-2020"}/competition_teams/${this.state.itemid}/leave.json`; axios.post(url).then((response) => { if (response) { if (response.data) { - //console.log("退出战队"); - //console.log(response); + ////console.log("退出战队"); + ////console.log(response); this.Refreshteam(); this.setState({ messageexitol: false @@ -541,7 +568,7 @@ class Registration extends React.Component { } } }).catch((error) => { - //console.log(error) + ////console.log(error) }); } else { @@ -552,8 +579,8 @@ class Registration extends React.Component { } //搜索战队 RegistrationSearchvalue = (value) => { - console.log("RegistrationSearchvalue"); - console.log(this.props.user.admin); + //console.log("RegistrationSearchvalue"); + //console.log(this.props.user.admin); this.setState({ pages: 1, limit: 20, @@ -563,6 +590,45 @@ class Registration extends React.Component { //个人竞赛 // /competitions/:identifier/competition_teams.json + Personalregistration = () => { + let {teacher_staff, member_staff, data} = this.state; + if (teacher_staff) { + if (teacher_staff.mutiple_limited === true) { + if (data) { + if (data.length > teacher_staff.maximum) { + message.success('已限制多次报名!'); + return + } + } + } + + } + if (member_staff) { + if (teacher_staff.mutiple_limited === true) { + if (data) { + if (data.length > teacher_staff.maximum) { + message.success('已限制多次报名!'); + + return; + } + } + } + + } + const url = `/competitions/${"gcc-task-2020"}/competition_teams.json`; + axios.post(url).then((response) => { + if (response) { + if (response.data) { + + this.Refreshteam(); + + + } + } + }).catch((error) => { + + }); + } render() { const {test, page, pages, limit, type, tmodalsType, tmodalsTypes, data, count, competition_teams, Newtit, itemiddata, messagePerbool, messageexitol, GetenrollmentAPI, loadingstate, pint} = this.state; var listItems = ""; @@ -572,9 +638,9 @@ class Registration extends React.Component { // // ); // } - const listItemss = test.map((item, index) => - - ); + // const listItemss = test.map((item, index) => + // + // ); return (
@@ -634,7 +700,9 @@ class Registration extends React.Component { this.Jointheteam()} pint={pint} {...this.props} {...this.state} - Createateam={() => this.Createateam()}> + Createateam={() => this.Createateam()} + Personalregistration={() => this.Personalregistration()} + > {/*大图结尾*/} {/*没数据*/} { @@ -642,7 +710,8 @@ class Registration extends React.Component {
-

参赛总人数:132

+

参赛总人数:{data === null || data === undefined ? 0 : data.length}人 +

: ""} {/*列表*/} @@ -653,9 +722,16 @@ class Registration extends React.Component { marginTop: "31px" }} > - { - listItemss - } + + { + data && data.map((item, index) => { + return ( + + ) + }) + } + +
: ""} @@ -691,10 +767,6 @@ class Registration extends React.Component { {type === 4 || type === 5 ? - {/*{*/} - {/* listItems*/} - {/*}*/} - { competition_teams && competition_teams.map((item, index) => { return ( diff --git a/public/react/src/modules/competition/Registrationitem.js b/public/react/src/modules/competition/Registrationitem.js index 6bcd18534..192166691 100644 --- a/public/react/src/modules/competition/Registrationitem.js +++ b/public/react/src/modules/competition/Registrationitem.js @@ -6,7 +6,7 @@ import { } from 'react-router-dom'; import axios from 'axios'; import moment from 'moment'; -import {SnackbarHOC, WordsBtn} from 'educoder'; +import {SnackbarHOC, WordsBtn, getImageUrl} from 'educoder'; import {TPMIndexHOC} from '../tpm/TPMIndexHOC'; import competition from './comcss/competition.css'; import {Button} from 'antd'; @@ -22,14 +22,16 @@ class Registrationitem extends React.Component { render() { - + let {item} = this.props; return ( - +
+ { + item !== undefined ?
-
+ -
+
小猫头像

+ }}>{item.creator.name}

+ { + item.manage_permission === true ? +

已报名

+ : + "" + } -

已报名

- - + : "" + } +
) } diff --git a/public/react/src/modules/competition/comcss/competition.css b/public/react/src/modules/competition/comcss/competition.css index ba2921020..859759a4d 100644 --- a/public/react/src/modules/competition/comcss/competition.css +++ b/public/react/src/modules/competition/comcss/competition.css @@ -319,7 +319,7 @@ .regitem2 { display: flex; flex-direction: initial; - border-bottom: 1px solid #EDEDED; + margin-top: 19px; } @@ -350,7 +350,6 @@ } .personregitemimg { - border: 0.5px solid; height: 64px; width: 64px; } diff --git a/public/react/src/modules/competition/personal/PersonalCompetititem.js b/public/react/src/modules/competition/personal/PersonalCompetititem.js index 146f7591a..7f157cead 100644 --- a/public/react/src/modules/competition/personal/PersonalCompetititem.js +++ b/public/react/src/modules/competition/personal/PersonalCompetititem.js @@ -49,7 +49,7 @@ class PersonalCompetititem extends React.Component { } render() { - const {data} = this.state; + const {data} = this.props; // //console.log("PersonalCompetititem"); // //console.log(data); // //console.log(data[0]); @@ -142,12 +142,16 @@ class PersonalCompetititem extends React.Component { color: "#05101A", fontSize: "16px", }}>邀请码: - {data[0].invite_code === null || data[0].invite_code === undefined ? "" : data[0].invite_code}
+
{data[0].invite_code === null || data[0].invite_code === undefined ? + } { @@ -184,13 +189,18 @@ class PersonalCompetititem extends React.Component {
: this.props.type === 2 ? -
-

战队详情

+ 战队详情
this.props.Exittheteamshow(data[0].id, false)}>

this.props.Exittheteamshow(data[0].id, false)}>退出战队