From ae71c3e075532872eeea385a73f5569870364e2b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Thu, 24 Oct 2019 15:11:29 +0800 Subject: [PATCH] tiaozheng --- .../src/modules/competition/Registration.js | 16 ++- .../competition/comcss/competition.css | 3 +- .../competition/competmodal/PersonModal.js | 111 ++++++++++++++---- .../personal/PersonalCompetititem.js | 7 +- 4 files changed, 103 insertions(+), 34 deletions(-) diff --git a/public/react/src/modules/competition/Registration.js b/public/react/src/modules/competition/Registration.js index 9bffc492c..13dcd289d 100644 --- a/public/react/src/modules/competition/Registration.js +++ b/public/react/src/modules/competition/Registration.js @@ -62,7 +62,7 @@ class Registration extends React.Component { itemid: undefined, itemiddata: [], pint: 0, - + competition_name: undefined, } } @@ -101,6 +101,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) { @@ -161,6 +162,7 @@ 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 }) } else { //普通账号 @@ -291,6 +293,7 @@ class Registration extends React.Component { competition_teams: result.data.competition_teams, data: result.data.my_teams, personal: result.data.personal, + competition_name: result.data.competition_name }) } else { @@ -556,7 +559,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) { @@ -618,7 +621,7 @@ 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} = this.state; return (
@@ -646,7 +649,9 @@ class Registration extends React.Component { tmodalsType === true ? this.Tmoconfirm1(bool)}> + Tmoconfirm1={(bool) => this.Tmoconfirm1(bool)} + GetenrollmentAPIopens={() => this.GetenrollmentAPI()} + > : "" } @@ -677,7 +682,8 @@ class Registration extends React.Component {
在线竞赛 - 全国高校计算机大赛 + {competition_name === undefined || competition_name === null || competition_name === "" ? "全国高校计算机大赛" : competition_name} 报名
diff --git a/public/react/src/modules/competition/comcss/competition.css b/public/react/src/modules/competition/comcss/competition.css index 2f7ec665d..8f91b117e 100644 --- a/public/react/src/modules/competition/comcss/competition.css +++ b/public/react/src/modules/competition/comcss/competition.css @@ -411,7 +411,7 @@ height: 22px; width: 22px; font-size: 21px !important; - margin-top: 21px; + margin-top: 19px; color: #1C91E8; } @@ -478,6 +478,7 @@ .packinputs button { background: #459BE5; + width: 100% !important; } .packinputs { diff --git a/public/react/src/modules/competition/competmodal/PersonModal.js b/public/react/src/modules/competition/competmodal/PersonModal.js index 53091d5e5..9a81c4117 100644 --- a/public/react/src/modules/competition/competmodal/PersonModal.js +++ b/public/react/src/modules/competition/competmodal/PersonModal.js @@ -110,30 +110,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"); @@ -627,7 +627,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,6 +641,67 @@ class PersonModal extends Component { mydatas: mydatas, }) } + var myteaherdata = []; + var myshtudentdata = []; + var i = 0; + try { + for (var a = 0; a < mydatas.length; a++) { + if (mydatas[a].type === "导师") { + i++; + // 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 === "队员") { + // 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) { + + } } render() { diff --git a/public/react/src/modules/competition/personal/PersonalCompetititem.js b/public/react/src/modules/competition/personal/PersonalCompetititem.js index bd6a092eb..eadfe1b6f 100644 --- a/public/react/src/modules/competition/personal/PersonalCompetititem.js +++ b/public/react/src/modules/competition/personal/PersonalCompetititem.js @@ -80,7 +80,7 @@ class PersonalCompetititem extends React.Component { marginTop: "29px", marginLeft: "37px" }}> -

-

+
邀请码: {data[0].invite_code === null || data[0].invite_code === undefined ? "" : data[0].invite_code}