|
|
|
@ -19,7 +19,8 @@ import RegisListviewdata from './RegisListviewdata';
|
|
|
|
|
import PersonModal from './competmodal/PersonModal';
|
|
|
|
|
import MessagePersonModal from './competmodal/MessagePersonModal';
|
|
|
|
|
import PersonalModalteam from './competmodal/PersonalModalteam';
|
|
|
|
|
import PersonalCompetititem from './personal/PersonalCompetititem'
|
|
|
|
|
import PersonalCompetititem from './personal/PersonalCompetititem';
|
|
|
|
|
import ExittheteamModel from './competmodal/ExittheteamModel';
|
|
|
|
|
// 团队竞赛报名无报名
|
|
|
|
|
class Registration extends React.Component {
|
|
|
|
|
/***
|
|
|
|
@ -44,6 +45,7 @@ class Registration extends React.Component {
|
|
|
|
|
page: 1,
|
|
|
|
|
per_page: 20,
|
|
|
|
|
data: [],
|
|
|
|
|
competition_teams: [],
|
|
|
|
|
count: 0,
|
|
|
|
|
GetenrollmentAPI: undefined,
|
|
|
|
|
personal: false,
|
|
|
|
@ -53,19 +55,35 @@ class Registration extends React.Component {
|
|
|
|
|
member_staff: null,
|
|
|
|
|
messagePer: "提示",
|
|
|
|
|
messagePerbool: false,
|
|
|
|
|
intpermessages: "确认"
|
|
|
|
|
intpermessages: "确认",
|
|
|
|
|
messageexit: "提示",
|
|
|
|
|
messageexitol: false,
|
|
|
|
|
exitintpermessages: "是否退出战队",
|
|
|
|
|
itemid: undefined,
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
componentDidMount() {
|
|
|
|
|
//console.log("componentDidMount Registration");
|
|
|
|
|
// ////console.log("调用子组件 ");
|
|
|
|
|
//console.log(this.props.isAdmin());
|
|
|
|
|
// ////console.log(this.props.isAdmin())
|
|
|
|
|
const {keyword, page, per_page} = this.state;
|
|
|
|
|
this.Getdata(keyword, page, per_page);
|
|
|
|
|
this.GetenrollmentAPI();
|
|
|
|
|
// //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);
|
|
|
|
|
const {keyword, page, per_page} = this.state;
|
|
|
|
|
this.Getdata(keyword, page, per_page, this.props.user.admin);
|
|
|
|
|
this.GetenrollmentAPI();
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//获取报名配置API
|
|
|
|
@ -74,8 +92,8 @@ class Registration extends React.Component {
|
|
|
|
|
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,
|
|
|
|
@ -87,11 +105,11 @@ class Registration extends React.Component {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}).catch((error) => {
|
|
|
|
|
////console.log(error);
|
|
|
|
|
//// //console.log(error);
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Getdata = (keyword, page, per_page) => {
|
|
|
|
|
Getdata = (keyword, page, per_page, admin) => {
|
|
|
|
|
//搜索关键字 keyword
|
|
|
|
|
//页数 page
|
|
|
|
|
//分页 per_page
|
|
|
|
@ -104,17 +122,17 @@ class Registration extends React.Component {
|
|
|
|
|
axios.get((url), {params: datas}).then((result) => {
|
|
|
|
|
if (result) {
|
|
|
|
|
if (result.data) {
|
|
|
|
|
////console.log(result);
|
|
|
|
|
//// //console.log(result);
|
|
|
|
|
if (result.data.count === 0) {
|
|
|
|
|
// 没有创建数据的
|
|
|
|
|
if (this.props.isAdmin() === true) {
|
|
|
|
|
if (admin === true) {
|
|
|
|
|
//管理员
|
|
|
|
|
this.setState({
|
|
|
|
|
type: 4,
|
|
|
|
|
count: result.data.count,
|
|
|
|
|
})
|
|
|
|
|
} else {
|
|
|
|
|
//普通人
|
|
|
|
|
//普通账号
|
|
|
|
|
this.setState({
|
|
|
|
|
type: 1,
|
|
|
|
|
count: result.data.count,
|
|
|
|
@ -122,25 +140,36 @@ class Registration extends React.Component {
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
//有数据的
|
|
|
|
|
if (this.props.isAdmin() === true) {
|
|
|
|
|
if (admin === true) {
|
|
|
|
|
if (result.data.my_teams[0].manage_permission === true) {
|
|
|
|
|
this.setState({
|
|
|
|
|
type: 5,
|
|
|
|
|
data: result.data.competition_teams,
|
|
|
|
|
data: result.data.my_teams,
|
|
|
|
|
count: result.data.count,
|
|
|
|
|
competition_teams: result.data.competition_teams
|
|
|
|
|
|
|
|
|
|
})
|
|
|
|
|
} else {
|
|
|
|
|
this.setState({
|
|
|
|
|
type: 4,
|
|
|
|
|
data: result.data.my_teams,
|
|
|
|
|
count: result.data.count,
|
|
|
|
|
competition_teams: result.data.competition_teams
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
if (result.data.competition_teams[0].manage_permission === true) {
|
|
|
|
|
//学生true 为创建了竞赛
|
|
|
|
|
if (result.data.my_teams[0].manage_permission === true) {
|
|
|
|
|
//普通账号true 为创建了竞赛
|
|
|
|
|
this.setState({
|
|
|
|
|
type: 2,
|
|
|
|
|
data: result.data.competition_teams,
|
|
|
|
|
data: result.data.my_teams,
|
|
|
|
|
count: result.data.count,
|
|
|
|
|
})
|
|
|
|
|
} else {
|
|
|
|
|
//学生true 加入了竞赛
|
|
|
|
|
//普通账号true 加入了竞赛
|
|
|
|
|
this.setState({
|
|
|
|
|
type: 3,
|
|
|
|
|
data: result.data.competition_teams,
|
|
|
|
|
data: result.data.my_teams,
|
|
|
|
|
count: result.data.count,
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
@ -152,7 +181,19 @@ class Registration extends React.Component {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}).catch((error) => {
|
|
|
|
|
////console.log(error);
|
|
|
|
|
if (admin === true) {
|
|
|
|
|
//管理员
|
|
|
|
|
this.setState({
|
|
|
|
|
type: 4,
|
|
|
|
|
count: 0,
|
|
|
|
|
})
|
|
|
|
|
} else {
|
|
|
|
|
//普通账号
|
|
|
|
|
this.setState({
|
|
|
|
|
type: 1,
|
|
|
|
|
count: 0,
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
paginationonChangestwo = (pageNumber) => {
|
|
|
|
@ -219,53 +260,53 @@ class Registration extends React.Component {
|
|
|
|
|
**/
|
|
|
|
|
Createateam = () => {
|
|
|
|
|
//
|
|
|
|
|
if (this.state.enrolled === true) {
|
|
|
|
|
//已经报名
|
|
|
|
|
this.setState({
|
|
|
|
|
messagePerbool: true,
|
|
|
|
|
intpermessages: "您已报名,无需重复报"
|
|
|
|
|
})
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if (this.state.enroll_ended === true) {
|
|
|
|
|
//报名截止
|
|
|
|
|
this.setState({
|
|
|
|
|
messagePerbool: true,
|
|
|
|
|
intpermessages: "报名已截止,无需报名"
|
|
|
|
|
})
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
if (this.props.isAdmin() === true) {
|
|
|
|
|
//老师
|
|
|
|
|
if (this.state.teacher_staff === null) {
|
|
|
|
|
//禁止老师
|
|
|
|
|
this.setState({
|
|
|
|
|
messagePerbool: true,
|
|
|
|
|
intpermessages: "已禁止老师报名"
|
|
|
|
|
})
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
this.setState({
|
|
|
|
|
tmodalsType: true
|
|
|
|
|
})
|
|
|
|
|
} else {
|
|
|
|
|
//学生
|
|
|
|
|
if (this.state.member_staff === null) {
|
|
|
|
|
//禁止学生
|
|
|
|
|
this.setState({
|
|
|
|
|
messagePerbool: true,
|
|
|
|
|
intpermessages: "已禁止学生报名"
|
|
|
|
|
})
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
this.setState({
|
|
|
|
|
tmodalsType: true
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// this.setState({
|
|
|
|
|
// tmodalsType: true
|
|
|
|
|
// if (this.state.enrolled === true) {
|
|
|
|
|
// //已经报名
|
|
|
|
|
// this.setState({
|
|
|
|
|
// messagePerbool: true,
|
|
|
|
|
// intpermessages: "您已报名,无需重复报"
|
|
|
|
|
// })
|
|
|
|
|
// return;
|
|
|
|
|
// }
|
|
|
|
|
// if (this.state.enroll_ended === true) {
|
|
|
|
|
// //报名截止
|
|
|
|
|
// this.setState({
|
|
|
|
|
// messagePerbool: true,
|
|
|
|
|
// intpermessages: "报名已截止,无需报名"
|
|
|
|
|
// })
|
|
|
|
|
// return
|
|
|
|
|
// }
|
|
|
|
|
// if (this.props.isAdmin() === true) {
|
|
|
|
|
// //老师
|
|
|
|
|
// if (this.state.teacher_staff === null) {
|
|
|
|
|
// //禁止老师
|
|
|
|
|
// this.setState({
|
|
|
|
|
// messagePerbool: true,
|
|
|
|
|
// intpermessages: "已禁止老师报名"
|
|
|
|
|
// })
|
|
|
|
|
// return;
|
|
|
|
|
// }
|
|
|
|
|
// this.setState({
|
|
|
|
|
// tmodalsType: true
|
|
|
|
|
// })
|
|
|
|
|
// } else {
|
|
|
|
|
// //学生
|
|
|
|
|
// if (this.state.member_staff === null) {
|
|
|
|
|
// //禁止学生
|
|
|
|
|
// this.setState({
|
|
|
|
|
// messagePerbool: true,
|
|
|
|
|
// intpermessages: "已禁止学生报名"
|
|
|
|
|
// })
|
|
|
|
|
// return;
|
|
|
|
|
// }
|
|
|
|
|
// this.setState({
|
|
|
|
|
// tmodalsType: true
|
|
|
|
|
// })
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
this.setState({
|
|
|
|
|
tmodalsType: true
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -285,7 +326,7 @@ class Registration extends React.Component {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//创建战队确认
|
|
|
|
|
Tmoconfirm1 = (bool) => {
|
|
|
|
|
//boolfalse 取消 true 确认
|
|
|
|
|
this.setState({
|
|
|
|
@ -293,8 +334,7 @@ class Registration extends React.Component {
|
|
|
|
|
})
|
|
|
|
|
if (bool) {
|
|
|
|
|
//确认
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.Refreshteam();
|
|
|
|
|
} else {
|
|
|
|
|
//取消
|
|
|
|
|
|
|
|
|
@ -308,12 +348,62 @@ class Registration extends React.Component {
|
|
|
|
|
messagePerbool: false
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
//显示退出战队弹框
|
|
|
|
|
Exittheteamshow = (itemid) => {
|
|
|
|
|
this.setState({
|
|
|
|
|
messageexitol: true,
|
|
|
|
|
itemid: itemid
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
|
//刷新战队
|
|
|
|
|
Refreshteam = () => {
|
|
|
|
|
|
|
|
|
|
const {keyword, page, per_page} = this.state;
|
|
|
|
|
this.Getdata(keyword, page, per_page, this.props.user.admin);
|
|
|
|
|
this.GetenrollmentAPI();
|
|
|
|
|
}
|
|
|
|
|
//退出战队
|
|
|
|
|
Exittheteam = (bool) => {
|
|
|
|
|
// //console.log(this.state.itemid);
|
|
|
|
|
if (bool) {
|
|
|
|
|
this.setState({
|
|
|
|
|
messageexitol: true
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
let url = `/competitions/${"gcc-course-2019"}/competition_teams/${this.state.itemid}/leave.json`;
|
|
|
|
|
axios.post(url).then((response) => {
|
|
|
|
|
if (response) {
|
|
|
|
|
if (response.data) {
|
|
|
|
|
//console.log("退出战队");
|
|
|
|
|
//console.log(response);
|
|
|
|
|
this.Refreshteam();
|
|
|
|
|
this.setState({
|
|
|
|
|
messageexitol: false
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}).catch((error) => {
|
|
|
|
|
//console.log(error)
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
this.setState({
|
|
|
|
|
messageexitol: false
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
render() {
|
|
|
|
|
const {test, page, pages, limit, type, tmodalsType, tmodalsTypes, data} = this.state;
|
|
|
|
|
const listItems = test.map((item, index) =>
|
|
|
|
|
<RegisListviewdata></RegisListviewdata>
|
|
|
|
|
);
|
|
|
|
|
const {test, page, pages, limit, type, tmodalsType, tmodalsTypes, data, count, competition_teams} = this.state;
|
|
|
|
|
var listItems = "";
|
|
|
|
|
if (competition_teams) {
|
|
|
|
|
listItems = competition_teams.map((item, index) =>
|
|
|
|
|
<RegisListviewdata key={index} item={item}></RegisListviewdata>
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<div className="newMain clearfix ">
|
|
|
|
@ -335,6 +425,8 @@ class Registration extends React.Component {
|
|
|
|
|
Tmoconfirm1={(bool) => this.Tmoconfirm1(bool)}></PersonModal>
|
|
|
|
|
<PersonalModalteam tmodalsTypes={tmodalsTypes} {...this.props} {...this.state}
|
|
|
|
|
Tmoconfirm={(bool) => this.Tmoconfirm(bool)}></PersonalModalteam>
|
|
|
|
|
<ExittheteamModel {...this.props} {...this.state}
|
|
|
|
|
Exittheteam={(bool) => this.Exittheteam(bool)}></ExittheteamModel>
|
|
|
|
|
<div className="educontent mb20 ">
|
|
|
|
|
<p className="clearfix mb20 mt10">
|
|
|
|
|
<a className="btn colorgrey fl hovercolorblue ">在线竞赛</a>
|
|
|
|
@ -357,15 +449,17 @@ class Registration extends React.Component {
|
|
|
|
|
:
|
|
|
|
|
""
|
|
|
|
|
}
|
|
|
|
|
{/*普通账号出现单人 战队弹框*/}
|
|
|
|
|
{
|
|
|
|
|
type === 2 || type === 3 || type === 5 ?
|
|
|
|
|
<PersonalCompetititem type={type} data={data}></PersonalCompetititem>
|
|
|
|
|
<PersonalCompetititem type={type} data={data}
|
|
|
|
|
Exittheteamshow={(itemid) => this.Exittheteamshow(itemid)}></PersonalCompetititem>
|
|
|
|
|
: ""
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
type === 4 || type === 5 ?
|
|
|
|
|
<RegistrationSearch></RegistrationSearch>
|
|
|
|
|
<RegistrationSearch count={count}></RegistrationSearch>
|
|
|
|
|
: ""
|
|
|
|
|
}
|
|
|
|
|
{/*<Registrationitem></Registrationitem>*/}
|
|
|
|
@ -385,12 +479,22 @@ class Registration extends React.Component {
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
type === 4 || type === 5 ?
|
|
|
|
|
<div className="edu-txt-center ysyslxh mt56 " style={{marginBottom: "192px",}}>
|
|
|
|
|
<Pagination showQuickJumper current={pages}
|
|
|
|
|
onChange={this.paginationonChangestwo} pageSize={limit}
|
|
|
|
|
total={30}></Pagination>
|
|
|
|
|
</div>
|
|
|
|
|
: ""
|
|
|
|
|
(
|
|
|
|
|
count < 20 ? <div style={{
|
|
|
|
|
height: "20px",
|
|
|
|
|
minHeight: "20px"
|
|
|
|
|
}}></div> :
|
|
|
|
|
<div className="edu-txt-center ysyslxh mt56 " style={{marginBottom: "192px",}}>
|
|
|
|
|
<Pagination showQuickJumper current={pages}
|
|
|
|
|
onChange={this.paginationonChangestwo} pageSize={limit}
|
|
|
|
|
total={count}></Pagination>
|
|
|
|
|
</div>
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
: <div style={{
|
|
|
|
|
height: "20px",
|
|
|
|
|
minHeight: "20px"
|
|
|
|
|
}}></div>
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|