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