From 7ceca2da755d6905928b6df3acde693c69ded1f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Fri, 25 Oct 2019 21:50:03 +0800 Subject: [PATCH] =?UTF-8?q?=E7=AB=9E=E8=B5=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/modules/competition/Registration.js | 58 +++++++++++++++---- public/react/src/modules/tpm/TPMIndexHOC.js | 2 + 2 files changed, 50 insertions(+), 10 deletions(-) diff --git a/public/react/src/modules/competition/Registration.js b/public/react/src/modules/competition/Registration.js index 758feddb8..6e14ab1d6 100644 --- a/public/react/src/modules/competition/Registration.js +++ b/public/react/src/modules/competition/Registration.js @@ -88,6 +88,7 @@ class Registration extends React.Component { // this.Getdata(keyword, page, per_page, this.props.isAdmin()); // this.GetenrollmentAPI(); } + //取模式 this.Getdataheader(); } @@ -100,6 +101,7 @@ class Registration extends React.Component { ////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(); } @@ -144,6 +146,7 @@ class Registration extends React.Component { }) try { + //获取学生是否被限制多次报名 if (result.data.member_staff) { this.setState({ mutiple_limited: result.data.member_staff.mutiple_limited, @@ -157,6 +160,7 @@ class Registration extends React.Component { } try { + //获取老师是否被限制多次报名 if (result.data.teacher_staff) { this.setState({ teamutiple_limited: result.data.teacher_staff.mutiple_limited @@ -167,6 +171,7 @@ class Registration extends React.Component { } + //是否是个人赛做处理 if (result.data.personal === true) { if (result.data.enroll_ended === true) { this.setState({ @@ -211,15 +216,28 @@ class Registration extends React.Component { // 没有创建数据的 if (admin === true) { //管理员 - this.setState({ - type: 4, - count: result.data.count, - 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 - }) + try { + this.setState({ + type: result.data.competition_teams.length === 0 ? 1 : 4, + count: result.data.count, + 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 + }) + } catch (e) { + this.setState({ + type: 4, + count: result.data.count, + 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 { //普通账号 this.setState({ @@ -463,6 +481,17 @@ class Registration extends React.Component { * 加入战队 * */ Jointheteam = () => { + if (this.props.checkIfLogin() === false) { + this.props.showLoginDialog() + return + } + if (this.props.checkIfProfileCompleted() === false) { + this.props.showProfileCompleteDialog() + return + } + + + if (this.props.user.is_teacher === true) { try { if (this.state.teamutiple_limited === true) { @@ -544,7 +573,16 @@ class Registration extends React.Component { * 创建战队 **/ Createateam = () => { - // + if (this.props.checkIfLogin() === false) { + this.props.showLoginDialog() + return + } + if (this.props.checkIfProfileCompleted() === false) { + this.props.showProfileCompleteDialog() + return + } + + if (this.props.user.is_teacher === true) { try { diff --git a/public/react/src/modules/tpm/TPMIndexHOC.js b/public/react/src/modules/tpm/TPMIndexHOC.js index 3ee678a9a..ee42ace21 100644 --- a/public/react/src/modules/tpm/TPMIndexHOC.js +++ b/public/react/src/modules/tpm/TPMIndexHOC.js @@ -516,6 +516,7 @@ export function TPMIndexHOC(WrappedComponent) { isloginCancel:"iscancel" }) } + //验证登录是否成功方法 checkIfLogin = () => { return this.state.current_user && this.state.current_user.login != '' } @@ -531,6 +532,7 @@ export function TPMIndexHOC(WrappedComponent) { AccountProfiletype: true }) } + //验证是否完善资料 checkIfProfileCompleted = () => { return this.state.current_user && this.state.current_user.profile_completed }