dev_sync_trustie
杨树林 5 years ago
parent fc998222ac
commit 8b7f3b6e91

@ -83,8 +83,8 @@ class CompetitionMaxImg extends React.Component {
<div className="registrationbackp2button">
{
pint === 1 ?
<div className="registbut1">
<p>立即报名</p>
<div className="registbut1" onClick={() => this.props.Personalregistration()}>
<p onClick={() => this.props.Personalregistration()}>立即报名</p>
</div>
: pint === 2 ?
<div className="personreg1">

@ -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 (
<div>

@ -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) =>
<Registrationitem></Registrationitem>
);
// const listItemss = test.map((item, index) =>
//
// );
return (
<div className="newMain clearfix ">
@ -634,7 +700,9 @@ class Registration extends React.Component {
<CompetitionMaxImg type={type} Jointheteam={() => this.Jointheteam()}
pint={pint}
{...this.props} {...this.state}
Createateam={() => this.Createateam()}></CompetitionMaxImg>
Createateam={() => this.Createateam()}
Personalregistration={() => this.Personalregistration()}
></CompetitionMaxImg>
{/*大图结尾*/}
{/*没数据*/}
{
@ -642,7 +710,8 @@ class Registration extends React.Component {
<div style={{
marginTop: "22px"
}}>
<p>参赛总人数<span style={{color: "#459BE5"}}>132</span></p>
<p>参赛总人数<span style={{color: "#459BE5"}}>{data === null || data === undefined ? 0 : data.length}</span>
</p>
</div>
: ""}
{/*列表*/}
@ -653,9 +722,16 @@ class Registration extends React.Component {
marginTop: "31px"
}}
>
{
listItemss
}
<Spin spinning={loadingstate}>
{
data && data.map((item, index) => {
return (
<Registrationitem item={item}></Registrationitem>
)
})
}
</Spin>
</div>
: ""}
@ -691,10 +767,6 @@ class Registration extends React.Component {
{type === 4 || type === 5 ?
<Spin spinning={loadingstate}>
{/*{*/}
{/* listItems*/}
{/*}*/}
{
competition_teams && competition_teams.map((item, index) => {
return (

@ -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 (
<div className="yslborderbottom">
{
item !== undefined ?
<div className="regitem2">
<div className="perregitemimg1 ">
<div className="personregitemimg">
<img className="personregitemimg" src={getImageUrl("images/" + item.creator.image_url)}>
</div>
</img>
</div>
<div className="" style={{
marginTop: "19px",
@ -42,14 +44,19 @@ class Registrationitem extends React.Component {
fontSize: "16px",
width: "160px",
textAlign: "center"
}}>小猫头像</p>
}}>{item.creator.name}</p>
{
item.manage_permission === true ?
<p className="" style={{
color: "#459BE5",
fontSize: "16px",
textAlign: "center",
marginLeft: "25px",
}}>已报名</p>
:
""
}
<p className="" style={{
color: "#459BE5",
fontSize: "16px",
textAlign: "center",
marginLeft: "25px",
}}>已报名</p>
</div>
<div className="" style={{
@ -66,8 +73,9 @@ class Registrationitem extends React.Component {
</div>
</div>
: ""
}
</div>
)
}

@ -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;
}

@ -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",
}}>邀请码</span>
<span id="copy_invite_code"
<span
style={{
color: "#05101A",
fontSize: "16px",
}}>{data[0].invite_code === null || data[0].invite_code === undefined ? "" : data[0].invite_code}</span>
</div>
<input style={{
display: "none"
}} id="copy_invite_code"
value={data[0].invite_code === null || data[0].invite_code === undefined ? "" : data[0].invite_code}/>
</div>
{data[0].invite_code === null || data[0].invite_code === undefined ?
<i className="regitemimgs3 iconfont icon-fuzhi1 font-14 font-n"
@ -166,6 +170,7 @@ class PersonalCompetititem extends React.Component {
}}
>
</i>
}
{
@ -184,13 +189,18 @@ class PersonalCompetititem extends React.Component {
</div>
: this.props.type === 2 ?
<div className="regitemimgs4"
<div className="regitemimgs4 "
style={{
marginLeft: "32px",
}}
>
<div className="regitemimgs5">
<p>战队详情</p>
<a href={`/newcompetitions/${"gcc-course-2019"}/competition_teams/${data[0].id}`} style={{
color: "#459be5",
width: "100%",
height: "100%",
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>

Loading…
Cancel
Save