From 8c8f1e26b5c65d637e96dbf1870e83a4000fc048 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 16:59:49 +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 | 26 +- .../personal/PersonalCompetititem.js | 257 ++++++++++++------ 2 files changed, 201 insertions(+), 82 deletions(-) diff --git a/public/react/src/modules/competition/Registration.js b/public/react/src/modules/competition/Registration.js index 86133231b..d4cc80ca4 100644 --- a/public/react/src/modules/competition/Registration.js +++ b/public/react/src/modules/competition/Registration.js @@ -67,6 +67,7 @@ class Registration extends React.Component { mutiple_limited: false, teamutiple_limited: false, members_count: 0, + mode: 0 } } @@ -87,6 +88,7 @@ class Registration extends React.Component { // this.Getdata(keyword, page, per_page, this.props.isAdmin()); // this.GetenrollmentAPI(); } + this.Getdataheader(); } componentDidUpdate = (prevProps) => { @@ -103,6 +105,25 @@ class Registration extends React.Component { } + // 获取数据头部 + Getdataheader = () => { + const url = `/competitions/${this.props.match.params.identifier}/common_header.json`; + axios.get((url)).then((result) => { + if (result) { + if (result.data) { + this.setState({ + mode: result.data.mode, + }) + + } + } + }).catch((error) => { + + }) + + + } + //获取报名配置API GetenrollmentAPI = () => { // console.log("调用了GetenrollmentAPI"); @@ -524,6 +545,7 @@ class Registration extends React.Component { **/ Createateam = () => { // + if (this.props.user.is_teacher === true) { try { if (this.props.teamutiple_limited === true) { @@ -736,7 +758,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, competition_name, mutiple_limited, teamutiple_limited, members_count} = this.state; + const {page, mode, 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 (
@@ -849,7 +871,7 @@ class Registration extends React.Component { ( data && data.map((item, index) => { return ( - this.Exittheteamshow(itemid)} Createateamedit={(itemid) => this.Createateamedit(itemid)}> ) diff --git a/public/react/src/modules/competition/personal/PersonalCompetititem.js b/public/react/src/modules/competition/personal/PersonalCompetititem.js index 58b25d1e6..5b090c6c3 100644 --- a/public/react/src/modules/competition/personal/PersonalCompetititem.js +++ b/public/react/src/modules/competition/personal/PersonalCompetititem.js @@ -11,8 +11,8 @@ import {TPMIndexHOC} from '../../tpm/TPMIndexHOC'; import competition from '../comcss/competition.css'; import {Button, message, Tooltip} from 'antd'; // 点击按钮复制功能 -function jsCopy() { - var e = document.getElementById("copy_invite_code"); +function jsCopy(s) { + var e = document.getElementById(s); e.select(); document.execCommand("Copy"); codesuccess() @@ -51,7 +51,7 @@ class PersonalCompetititem extends React.Component { } render() { - const {key, item} = this.props; + const {key, item, type, mode} = this.props; // ////console.log("PersonalCompetititem"); // ////console.log(data); // ////console.log(data[0]); @@ -61,6 +61,10 @@ class PersonalCompetititem extends React.Component { // ); // console.log("PersonalCompetititem"); // console.log(data); + console.log("PersonalCompetititem"); + console.log(type); + console.log(mode); + return (
{ @@ -95,45 +99,97 @@ class PersonalCompetititem extends React.Component { }}>{item.name}

{this.props.type === 5 || this.props.type === 2 ? -
- { - item && item.team_members.map((item, index) => { - return ( + (this.props.mode === 3 ? +
+ { + item && item.team_members.map((item, index) => { + return ( + + index === 0 ? + - index === 0 ? - + + : index === 1 ? + - - : index === 1 ? - + + : index === 2 ? + - - : index === 2 ? - + + : index === 3 ? +
+ - - : index === 3 ? -
+ + + + + +
+ : "" + ) + }) + } + +
+ + : +
+ { + item && item.team_members.map((item, index) => { + return ( + + index === 0 ? + + + + : index === 1 ? + + + + : index === 2 ? + : index === 3 ? + - + + : index === 4 ? + - -
- : "" - ) - }) - } + + : index === 5 ? +
+ + + + + -
: + +
+ : "" + ) + }) + } + +
+ ) + :
- @@ -182,10 +238,19 @@ class PersonalCompetititem extends React.Component {
} -
-
@@ -222,7 +287,7 @@ class PersonalCompetititem extends React.Component { marginLeft: "18px", }} onClick={() => { - jsCopy() + jsCopy("copy_invite_code" + this.props.index) }} > @@ -231,49 +296,81 @@ class PersonalCompetititem extends React.Component { { this.props.type === 5 ? -
-
- 战队详情 -
-
this.props.Exittheteamshow(item.id, false)}> -

this.props.Exittheteamshow(item.id, false)}>删除战队

-
-
this.props.Createateamedit(item)}> -

this.props.Createateamedit(item)}>编辑战队

-
+ (this.props.mode === 3 ? +
+
+ 战队详情 +
+
this.props.Exittheteamshow(item.id, false)}> +

this.props.Exittheteamshow(item.id, false)}>删除战队

+
+
this.props.Createateamedit(item)}> +

this.props.Createateamedit(item)}>编辑战队

+
-
- : this.props.type === 2 ? -
+
+ : +
+ +
this.props.Exittheteamshow(item.id, false)}> +

this.props.Exittheteamshow(item.id, false)}>删除战队

+
+
this.props.Createateamedit(item)}> +

this.props.Createateamedit(item)}>编辑战队

+
-
- 战队详情 -
-
this.props.Exittheteamshow(item.id, false)}> -

this.props.Exittheteamshow(item.id, false)}>删除战队

-
-
this.props.Createateamedit(item)}> -

this.props.Createateamedit(item)}>编辑战队

-
-
+
+ + ) + : this.props.type === 2 ? + (this.props.mode === 3 ? +
+
+ 战队详情 +
+
this.props.Exittheteamshow(item.id, false)}> +

this.props.Exittheteamshow(item.id, false)}>删除战队

+
+
this.props.Createateamedit(item)}> +

this.props.Createateamedit(item)}>编辑战队

+
+
+ : +
+
this.props.Exittheteamshow(item.id, false)}> +

this.props.Exittheteamshow(item.id, false)}>删除战队

+
+
this.props.Createateamedit(item)}> +

this.props.Createateamedit(item)}>编辑战队

+
+
+ ) : this.props.type === 3 ?