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

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

@ -23,15 +23,15 @@ class RegisListviewdata extends React.Component {
} }
componentDidMount() { componentDidMount() {
console.log("RegisListviewdata"); //console.log("RegisListviewdata");
console.log(this.props.item) //console.log(this.props.item)
this.setState({ this.setState({
item: this.props.item item: this.props.item
}) })
} }
render() { render() {
const {item} = this.state; const {item} = this.props;
return ( return (
<div> <div>

@ -70,19 +70,19 @@ class Registration extends React.Component {
} }
componentDidMount() { componentDidMount() {
// //console.log("componentDidMount Registration"); // ////console.log("componentDidMount Registration");
// //// //console.log("调用子组件 "); // //// ////console.log("调用子组件 ");
// //console.log(this.props.isAdmin()); // ////console.log(this.props.isAdmin());
// //// //console.log(this.props.isAdmin()) // //// ////console.log(this.props.isAdmin())
} }
componentDidUpdate = (prevProps) => { componentDidUpdate = (prevProps) => {
if (prevProps.user != this.props.user) { if (prevProps.user != this.props.user) {
// //console.log("Registration"); //console.log("Registration");
// //console.log("componentDidUpdate"); //console.log("componentDidUpdate");
// //console.log(this.props.user.admin); //console.log(this.props.user.admin);
const {keyword, page, per_page} = this.state; const {keyword, page, per_page} = this.state;
this.Getdata(keyword, page, per_page, this.props.user.admin); this.Getdata(keyword, page, per_page, this.props.user.admin);
this.GetenrollmentAPI(); this.GetenrollmentAPI();
@ -93,12 +93,12 @@ class Registration extends React.Component {
//获取报名配置API //获取报名配置API
GetenrollmentAPI = () => { GetenrollmentAPI = () => {
const url = `/competitions/${"gcc-course-2019"}/competition_staff.json`; const url = `/competitions/${"gcc-task-2020"}/competition_staff.json`;
axios.get((url)).then((result) => { axios.get((url)).then((result) => {
if (result) { if (result) {
if (result.data) { if (result.data) {
//// //console.log("获取报名配置API"); //// ////console.log("获取报名配置API");
//// //console.log(result); //// ////console.log(result);
this.setState({ this.setState({
GetenrollmentAPI: result.data, GetenrollmentAPI: result.data,
personal: result.data.personal, personal: result.data.personal,
@ -107,10 +107,23 @@ class Registration extends React.Component {
teacher_staff: result.data.teacher_staff, teacher_staff: result.data.teacher_staff,
member_staff: result.data.member_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) => { }).catch((error) => {
//// //console.log(error); //// ////console.log(error);
}) })
} }
@ -123,11 +136,11 @@ class Registration extends React.Component {
page: page, page: page,
per_page: per_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) => { axios.get((url), {params: datas}).then((result) => {
if (result) { if (result) {
if (result.data) { if (result.data) {
//// //console.log(result);\ //// ////console.log(result);\
if (result.data.personal === false) { if (result.data.personal === false) {
//不是个人赛 //不是个人赛
if (result.data.my_teams.length === 0) { if (result.data.my_teams.length === 0) {
@ -246,16 +259,24 @@ class Registration extends React.Component {
page: page, page: page,
per_page: per_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) => { axios.get((url), {params: datas}).then((result) => {
this.setState({
loadingstate: false,
})
if (result) { if (result) {
if (result.data) { if (result.data) {
//// //console.log(result); //// ////console.log(result);
if (result.data.personal === false) { if (result.data.personal === false) {
//不是个人赛 //不是个人赛
//console.log("Getdatatype5");
//console.log(result.data.my_teams.length);
if (result.data.my_teams.length === 0) { if (result.data.my_teams.length === 0) {
// 没有创建数据的 // 没有创建数据的
//管理员 //管理员
//console.log("a");
//console.log(this.state.competition_teams);
//console.log(result.data.competition_teams);
this.setState({ this.setState({
type: 4, type: 4,
count: result.data.count, count: result.data.count,
@ -266,7 +287,9 @@ class Registration extends React.Component {
}) })
} else { } else {
//有数据的 //有数据的
if (result.data.my_teams[0].manage_permission === true) { //console.log("b");
if (result.data.my_teams[0].manage_permission === true) {
this.setState({ this.setState({
type: 5, type: 5,
data: result.data.my_teams, data: result.data.my_teams,
@ -277,7 +300,9 @@ class Registration extends React.Component {
}) })
} else { } else {
this.setState({ //console.log("c");
this.setState({
type: 4, type: 4,
data: result.data.my_teams, data: result.data.my_teams,
count: result.data.count, count: result.data.count,
@ -289,6 +314,8 @@ class Registration extends React.Component {
} }
} else { } else {
//团队赛 //团队赛
//console.log("d");
this.setState({ this.setState({
type: 6, type: 6,
data: result.data.my_teams, data: result.data.my_teams,
@ -301,12 +328,12 @@ class Registration extends React.Component {
} }
} }
this.setState({
loadingstate: false,
})
}).catch((error) => { }).catch((error) => {
console.log(error); //console.log("k");
console.log("报错了");
//console.log(error);
//console.log("报错了");
if (admin === true) { if (admin === true) {
//管理员 //管理员
this.setState({ this.setState({
@ -521,18 +548,18 @@ class Registration extends React.Component {
} }
//退出战队 //退出战队
Exittheteam = (bool) => { Exittheteam = (bool) => {
// //console.log(this.state.itemid); // ////console.log(this.state.itemid);
if (bool) { if (bool) {
this.setState({ this.setState({
messageexitol: true 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) => { axios.post(url).then((response) => {
if (response) { if (response) {
if (response.data) { if (response.data) {
//console.log("退出战队"); ////console.log("退出战队");
//console.log(response); ////console.log(response);
this.Refreshteam(); this.Refreshteam();
this.setState({ this.setState({
messageexitol: false messageexitol: false
@ -541,7 +568,7 @@ class Registration extends React.Component {
} }
} }
}).catch((error) => { }).catch((error) => {
//console.log(error) ////console.log(error)
}); });
} else { } else {
@ -552,8 +579,8 @@ class Registration extends React.Component {
} }
//搜索战队 //搜索战队
RegistrationSearchvalue = (value) => { RegistrationSearchvalue = (value) => {
console.log("RegistrationSearchvalue"); //console.log("RegistrationSearchvalue");
console.log(this.props.user.admin); //console.log(this.props.user.admin);
this.setState({ this.setState({
pages: 1, pages: 1,
limit: 20, limit: 20,
@ -563,6 +590,45 @@ class Registration extends React.Component {
//个人竞赛 //个人竞赛
// /competitions/:identifier/competition_teams.json // /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() { render() {
const {test, page, pages, limit, type, tmodalsType, tmodalsTypes, data, count, competition_teams, Newtit, itemiddata, messagePerbool, messageexitol, GetenrollmentAPI, loadingstate, pint} = this.state; const {test, page, pages, limit, type, tmodalsType, tmodalsTypes, data, count, competition_teams, Newtit, itemiddata, messagePerbool, messageexitol, GetenrollmentAPI, loadingstate, pint} = this.state;
var listItems = ""; var listItems = "";
@ -572,9 +638,9 @@ class Registration extends React.Component {
// //
// ); // );
// } // }
const listItemss = test.map((item, index) => // const listItemss = test.map((item, index) =>
<Registrationitem></Registrationitem> //
); // );
return ( return (
<div className="newMain clearfix "> <div className="newMain clearfix ">
@ -634,7 +700,9 @@ class Registration extends React.Component {
<CompetitionMaxImg type={type} Jointheteam={() => this.Jointheteam()} <CompetitionMaxImg type={type} Jointheteam={() => this.Jointheteam()}
pint={pint} pint={pint}
{...this.props} {...this.state} {...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={{ <div style={{
marginTop: "22px" 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> </div>
: ""} : ""}
{/*列表*/} {/*列表*/}
@ -653,9 +722,16 @@ class Registration extends React.Component {
marginTop: "31px" marginTop: "31px"
}} }}
> >
{ <Spin spinning={loadingstate}>
listItemss {
} data && data.map((item, index) => {
return (
<Registrationitem item={item}></Registrationitem>
)
})
}
</Spin>
</div> </div>
: ""} : ""}
@ -691,10 +767,6 @@ class Registration extends React.Component {
{type === 4 || type === 5 ? {type === 4 || type === 5 ?
<Spin spinning={loadingstate}> <Spin spinning={loadingstate}>
{/*{*/}
{/* listItems*/}
{/*}*/}
{ {
competition_teams && competition_teams.map((item, index) => { competition_teams && competition_teams.map((item, index) => {
return ( return (

@ -6,7 +6,7 @@ import {
} from 'react-router-dom'; } from 'react-router-dom';
import axios from 'axios'; import axios from 'axios';
import moment from 'moment'; import moment from 'moment';
import {SnackbarHOC, WordsBtn} from 'educoder'; import {SnackbarHOC, WordsBtn, getImageUrl} from 'educoder';
import {TPMIndexHOC} from '../tpm/TPMIndexHOC'; import {TPMIndexHOC} from '../tpm/TPMIndexHOC';
import competition from './comcss/competition.css'; import competition from './comcss/competition.css';
import {Button} from 'antd'; import {Button} from 'antd';
@ -22,14 +22,16 @@ class Registrationitem extends React.Component {
render() { render() {
let {item} = this.props;
return ( return (
<div className="yslborderbottom">
{
item !== undefined ?
<div className="regitem2"> <div className="regitem2">
<div className="perregitemimg1 "> <div className="perregitemimg1 ">
<div className="personregitemimg"> <img className="personregitemimg" src={getImageUrl("images/" + item.creator.image_url)}>
</div> </img>
</div> </div>
<div className="" style={{ <div className="" style={{
marginTop: "19px", marginTop: "19px",
@ -42,14 +44,19 @@ class Registrationitem extends React.Component {
fontSize: "16px", fontSize: "16px",
width: "160px", width: "160px",
textAlign: "center" 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>
<div className="" style={{ <div className="" style={{
@ -66,8 +73,9 @@ class Registrationitem extends React.Component {
</div> </div>
</div> </div>
: ""
}
</div>
) )
} }

@ -319,7 +319,7 @@
.regitem2 { .regitem2 {
display: flex; display: flex;
flex-direction: initial; flex-direction: initial;
border-bottom: 1px solid #EDEDED;
margin-top: 19px; margin-top: 19px;
} }
@ -350,7 +350,6 @@
} }
.personregitemimg { .personregitemimg {
border: 0.5px solid;
height: 64px; height: 64px;
width: 64px; width: 64px;
} }

@ -49,7 +49,7 @@ class PersonalCompetititem extends React.Component {
} }
render() { render() {
const {data} = this.state; const {data} = this.props;
// //console.log("PersonalCompetititem"); // //console.log("PersonalCompetititem");
// //console.log(data); // //console.log(data);
// //console.log(data[0]); // //console.log(data[0]);
@ -142,12 +142,16 @@ class PersonalCompetititem extends React.Component {
color: "#05101A", color: "#05101A",
fontSize: "16px", fontSize: "16px",
}}>邀请码</span> }}>邀请码</span>
<span id="copy_invite_code" <span
style={{ style={{
color: "#05101A", color: "#05101A",
fontSize: "16px", fontSize: "16px",
}}>{data[0].invite_code === null || data[0].invite_code === undefined ? "" : data[0].invite_code}</span> }}>{data[0].invite_code === null || data[0].invite_code === undefined ? "" : data[0].invite_code}</span>
</div> </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> </div>
{data[0].invite_code === null || data[0].invite_code === undefined ? {data[0].invite_code === null || data[0].invite_code === undefined ?
<i className="regitemimgs3 iconfont icon-fuzhi1 font-14 font-n" <i className="regitemimgs3 iconfont icon-fuzhi1 font-14 font-n"
@ -166,6 +170,7 @@ class PersonalCompetititem extends React.Component {
}} }}
> >
</i> </i>
} }
{ {
@ -184,13 +189,18 @@ class PersonalCompetititem extends React.Component {
</div> </div>
: this.props.type === 2 ? : this.props.type === 2 ?
<div className="regitemimgs4" <div className="regitemimgs4 "
style={{ style={{
marginLeft: "32px", marginLeft: "32px",
}} }}
> >
<div className="regitemimgs5"> <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>
<div className="regitemimgs6" onClick={() => this.props.Exittheteamshow(data[0].id, false)}> <div className="regitemimgs6" onClick={() => this.props.Exittheteamshow(data[0].id, false)}>
<p onClick={() => this.props.Exittheteamshow(data[0].id, false)}>退出战队</p> <p onClick={() => this.props.Exittheteamshow(data[0].id, false)}>退出战队</p>

Loading…
Cancel
Save