dev_sync_trustie
杨树林 5 years ago
parent cbd2ef6752
commit a58907178d

@ -93,10 +93,11 @@ class RegisListviewdata extends React.Component {
<img className="regitemimgs2" src={getImageUrl("images/" + item.image_url)}> <img className="regitemimgs2" src={getImageUrl("images/" + item.image_url)}>
</img> </img>
: : index === 6 ?
<img className="regitemimgs22" src={pexjiazai}> <img className="regitemimgs22" src={pexjiazai}>
</img> </img>
: ""
) )
}) })
} }

@ -9,7 +9,7 @@ import moment from 'moment';
import {SnackbarHOC, WordsBtn} from 'educoder'; import {SnackbarHOC, WordsBtn} 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, Pagination, message} from 'antd'; import {Button, Pagination, message, Spin} from 'antd';
import Registrationitem from './Registrationitem'; import Registrationitem from './Registrationitem';
import RegisNodata from './RegisNodata'; import RegisNodata from './RegisNodata';
import CompetitionMaxImg from './CompetitionMaxImg'; import CompetitionMaxImg from './CompetitionMaxImg';
@ -60,6 +60,7 @@ class Registration extends React.Component {
messageexitol: false, messageexitol: false,
exitintpermessages: "是否退出战队", exitintpermessages: "是否退出战队",
itemid: undefined, itemid: undefined,
itemiddata: [],
} }
} }
@ -181,9 +182,13 @@ class Registration extends React.Component {
} }
} }
} }
this.setState({
loadingstate: false,
})
}).catch((error) => { }).catch((error) => {
if (admin === true) { if (admin === true) {
//管理员 //管理员
@ -192,6 +197,7 @@ class Registration extends React.Component {
count: 0, count: 0,
competition_teams: [], competition_teams: [],
data: [], data: [],
loadingstate: false,
}) })
} else { } else {
//普通账号 //普通账号
@ -200,9 +206,11 @@ class Registration extends React.Component {
count: 0, count: 0,
competition_teams: [], competition_teams: [],
data: [], data: [],
loadingstate: false,
}) })
} }
}) })
} }
Getdatatype5 = (keyword, page, per_page, admin) => { Getdatatype5 = (keyword, page, per_page, admin) => {
@ -247,8 +255,12 @@ class Registration extends React.Component {
}) })
} }
} }
} }
} }
this.setState({
loadingstate: false,
})
}).catch((error) => { }).catch((error) => {
if (admin === true) { if (admin === true) {
//管理员 //管理员
@ -256,6 +268,7 @@ class Registration extends React.Component {
count: 0, count: 0,
competition_teams: [], competition_teams: [],
data: [], data: [],
loadingstate: false,
}) })
} else { } else {
//普通账号 //普通账号
@ -263,18 +276,22 @@ class Registration extends React.Component {
count: 0, count: 0,
competition_teams: [], competition_teams: [],
data: [], data: [],
loadingstate: false,
}) })
} }
}) })
} }
//团队竞赛翻页
paginationonChangestwo = (pageNumber) => { paginationonChangestwo = (pageNumber) => {
this.setState({ this.setState({
pages: pageNumber, pages: pageNumber,
loadingstate: true, loadingstate: true,
}) })
const {keyword, per_page} = this.state;
this.Getdata(keyword, pageNumber, per_page, this.props.user.admin);
}; };
/** /**
* 加入战队 * 加入战队
@ -361,7 +378,8 @@ class Registration extends React.Component {
// return; // return;
// } // }
// this.setState({ // this.setState({
// tmodalsType: true // tmodalsType: true,
// Newtit:true,
// }) // })
// } else { // } else {
// //学生 // //学生
@ -374,16 +392,25 @@ class Registration extends React.Component {
// return; // return;
// } // }
// this.setState({ // this.setState({
// tmodalsType: true // tmodalsType: true,
// Newtit:true,
// }) // })
// } // }
this.setState({ this.setState({
tmodalsType: true tmodalsType: true,
Newtit: true,
}) })
} }
//编辑战队
Createateamedit = (data) => {
this.setState({
tmodalsType: true,
Newtit: false,
itemiddata: data
})
}
Tmoconfirm = (bool) => { Tmoconfirm = (bool) => {
//boolfalse 取消 true 确认 //boolfalse 取消 true 确认
this.setState({ this.setState({
@ -423,11 +450,21 @@ class Registration extends React.Component {
}) })
} }
//显示退出战队弹框 //显示退出战队弹框
Exittheteamshow = (itemid) => { Exittheteamshow = (itemid, bool) => {
this.setState({ if (bool === true) {
messageexitol: true, this.setState({
itemid: itemid messageexitol: true,
}) itemid: itemid,
exitintpermessages: "是否删除战队",
})
} else {
this.setState({
messageexitol: true,
itemid: itemid,
exitintpermessages: "是否退出战队",
})
}
}; };
//刷新战队 //刷新战队
@ -479,7 +516,7 @@ class Registration extends React.Component {
this.Getdatatype5(value, 1, 20, this.props.user.admin); this.Getdatatype5(value, 1, 20, this.props.user.admin);
} }
render() { render() {
const {test, page, pages, limit, type, tmodalsType, tmodalsTypes, data, count, competition_teams} = this.state; const {test, page, pages, limit, type, tmodalsType, tmodalsTypes, data, count, competition_teams, Newtit, itemiddata, messagePerbool, messageexitol, GetenrollmentAPI, loadingstate} = this.state;
var listItems = ""; var listItems = "";
if (competition_teams) { if (competition_teams) {
listItems = competition_teams.map((item, index) => listItems = competition_teams.map((item, index) =>
@ -502,14 +539,36 @@ class Registration extends React.Component {
` `
} }
</style> </style>
<MessagePersonModal messagePer={this.state.messagePer} {...this.props} {...this.state} {
messagePerboolbuton={() => this.messagePerboolbuton()}></MessagePersonModal> messagePerbool === true ?
<PersonModal modalsType={tmodalsType} {...this.props} {...this.state} Newtit={true} <MessagePersonModal messagePer={this.state.messagePer} {...this.props} {...this.state}
Tmoconfirm1={(bool) => this.Tmoconfirm1(bool)}></PersonModal> messagePerboolbuton={() => this.messagePerboolbuton()}
<PersonalModalteam tmodalsTypes={tmodalsTypes} {...this.props} {...this.state} GetenrollmentAPI={GetenrollmentAPI}></MessagePersonModal>
Tmoconfirm={(bool) => this.Tmoconfirm(bool)}></PersonalModalteam> : ""
<ExittheteamModel {...this.props} {...this.state} }
Exittheteam={(bool) => this.Exittheteam(bool)}></ExittheteamModel>
{
tmodalsType === true ?
<PersonModal modalsType={tmodalsType} {...this.props} {...this.state} Newtit={Newtit}
itemiddata={itemiddata} GetenrollmentAPI={GetenrollmentAPI}
Tmoconfirm1={(bool) => this.Tmoconfirm1(bool)}></PersonModal>
:
""
}
{
tmodalsTypes === true ?
<PersonalModalteam tmodalsTypes={tmodalsTypes} {...this.props} {...this.state}
GetenrollmentAPI={GetenrollmentAPI}
Tmoconfirm={(bool) => this.Tmoconfirm(bool)}></PersonalModalteam>
: ""
}
{
messageexitol === true ?
<ExittheteamModel {...this.props} {...this.state} GetenrollmentAPI={GetenrollmentAPI}
Exittheteam={(bool) => this.Exittheteam(bool)}></ExittheteamModel>
: ""
}
<div className="educontent mb20 "> <div className="educontent mb20 ">
<p className="clearfix mb20 mt10"> <p className="clearfix mb20 mt10">
<a className="btn colorgrey fl hovercolorblue ">在线竞赛</a> <a className="btn colorgrey fl hovercolorblue ">在线竞赛</a>
@ -536,7 +595,8 @@ class Registration extends React.Component {
{ {
type === 2 || type === 3 || type === 5 ? type === 2 || type === 3 || type === 5 ?
<PersonalCompetititem type={type} data={data} <PersonalCompetititem type={type} data={data}
Exittheteamshow={(itemid) => this.Exittheteamshow(itemid)}></PersonalCompetititem> Exittheteamshow={(itemid) => this.Exittheteamshow(itemid)}
Createateamedit={(itemid) => this.Createateamedit(itemid)}></PersonalCompetititem>
: "" : ""
} }
@ -556,7 +616,9 @@ class Registration extends React.Component {
{type === 4 || type === 5 ? {type === 4 || type === 5 ?
listItems <Spin spinning={loadingstate}>
listItems
</Spin>
: :
"" ""
} }

@ -95,6 +95,8 @@ class PersonModal extends Component {
}; };
//创建战队 //创建战队
Createateam = () => { Createateam = () => {
const {polls_nametest, mydatas, GetenrollmentAPI} = this.state; const {polls_nametest, mydatas, GetenrollmentAPI} = this.state;
var myteaherdata = []; var myteaherdata = [];
var myshtudentdata = []; var myshtudentdata = [];
@ -102,85 +104,89 @@ class PersonModal extends Component {
for (var a = 0; a < mydatas.length; a++) { for (var a = 0; a < mydatas.length; a++) {
if (mydatas[a].type === "导师") { if (mydatas[a].type === "导师") {
i++; i++;
var objectt = { // var objectt = {
enrollable: mydatas[a].enrollable, // enrollable: mydatas[a].enrollable,
id: mydatas[a].id, // id: mydatas[a].id,
identity: mydatas[a].identity, // identity: mydatas[a].identity,
name: mydatas[a].name, // name: mydatas[a].name,
school_name: mydatas[a].school_name, // school_name: mydatas[a].school_name,
} // }
myteaherdata.push(objectt); myteaherdata.push(mydatas[a].id);
} else if (mydatas[a].type === "队员") { } else if (mydatas[a].type === "队员") {
var objectts = { // var objectts = {
enrollable: mydatas[a].enrollable, // enrollable: mydatas[a].enrollable,
id: mydatas[a].id, // id: mydatas[a].id,
name: mydatas[a].name, // name: mydatas[a].name,
school_name: mydatas[a].school_name, // school_name: mydatas[a].school_name,
student_id: mydatas[a].student_id, // student_id: mydatas[a].student_id,
} // }
myshtudentdata.push(objectts); myshtudentdata.push(mydatas[a].id);
} }
} }
if (GetenrollmentAPI !== undefined || GetenrollmentAPI !== null) { if (GetenrollmentAPI) {
if (GetenrollmentAPI.teacher_staff !== undefined || GetenrollmentAPI.teacher_staff !== null) { if (GetenrollmentAPI !== undefined || GetenrollmentAPI !== null) {
if (GetenrollmentAPI.teacher_staff.minimum > i) { if (GetenrollmentAPI.teacher_staff !== undefined || GetenrollmentAPI.teacher_staff !== null) {
if (GetenrollmentAPI.teacher_staff.minimum > i) {
this.setState({
Thecurrentnumberbool: true,
Thecurrentnumber: i,
booltech: false,
boolstud: false
})
return
} else if (GetenrollmentAPI.teacher_staff.maximum < i) {
this.setState({
Thecurrentnumberbool: true,
Thecurrentnumber: i,
booltech: false,
boolstud: false
})
return
}
this.setState({
Thecurrentnumberbool: true,
Thecurrentnumber: i,
booltech: false,
boolstud: false
})
return
} else if (GetenrollmentAPI.teacher_staff.maximum < i) {
this.setState({
Thecurrentnumberbool: true,
Thecurrentnumber: i,
booltech: false,
boolstud: false
})
return
} }
} }
} }
// Thecurrentnumber // Thecurrentnumber
let url = `/competitions/${"gcc-course-2019"}/competition_teams.json`; if (this.props.Newtit === true) {
axios.post(url, { //创建新的战队
name: polls_nametest, let url = `/competitions/${"gcc-course-2019"}/competition_teams.json`;
teacher_ids: myteaherdata, axios.post(url, {
member_ids: myshtudentdata, name: polls_nametest,
}).then((result) => { teacher_ids: myteaherdata,
// //console.log("获取到创建战队的数据"); member_ids: myshtudentdata,
// //console.log(result); }).then((result) => {
if (result) { // //console.log("获取到创建战队的数据");
if (result.data) { // //console.log(result);
this.props.Tmoconfirm1(true); if (result) {
if (result.data) {
this.props.Tmoconfirm1(true);
}
} }
} }).catch((error) => {
}).catch((error) => { // //console.log(error)
// //console.log(error) });
}); } else {
//编辑战队
} let url = `/competitions/${"gcc-course-2019"}/competition_teams/${"gcc-course-2019"}.json`;
creident = (name, teacher_ids, member_ids) => { axios.post(url, {
let collaborators = `/competitions/${"gcc-course-2019"}/competition_teams.json`; name: polls_nametest,
axios.post(collaborators, { teacher_ids: myteaherdata,
name: name, member_ids: myshtudentdata,
teacher_ids: teacher_ids, }).then((result) => {
member_ids: member_ids, // //console.log("获取到编辑战队的数据");
}).then((result) => { // //console.log(result);
if (result) { if (result) {
if (result.data) { if (result.data) {
this.props.Tmoconfirm1(true);
}
} }
} }).catch((error) => {
}).catch((error) => { // //console.log(error)
// //console.log(error) });
}); }
} }
Getteacherdata = (keywordteachers, team_idteachers, teacher_ids) => { Getteacherdata = (keywordteachers, team_idteachers, teacher_ids) => {
this.setState({ this.setState({
person1: true, person1: true,
@ -764,6 +770,8 @@ class PersonModal extends Component {
</Spin> </Spin>
</div> </div>
); );
console.log("PersonModal");
console.log(this.props);
return ( return (
<Modal <Modal

@ -111,10 +111,11 @@ class PersonalCompetititem extends React.Component {
<img className="regitemimgs2" src={getImageUrl("images/" + item.image_url)}> <img className="regitemimgs2" src={getImageUrl("images/" + item.image_url)}>
</img> </img>
: : index === 6 ?
<img className="regitemimgs22" src={pexjiazai}> <img className="regitemimgs22" src={pexjiazai}>
</img> </img>
: ""
) )
}) })
} }
@ -143,11 +144,11 @@ class PersonalCompetititem extends React.Component {
marginLeft: "32px", marginLeft: "32px",
}} }}
> >
<div className="regitemimgs5"> <div className="regitemimgs5" onClick={() => this.props.Exittheteamshow(data[0].id, true)}>
<p>删除战队</p> <p onClick={() => this.props.Exittheteamshow(data[0].id, true)}>删除战队</p>
</div> </div>
<div className="regitemimgs6"> <div className="regitemimgs6" onClick={() => this.props.Createateamedit(data[0])}>
<p>编辑战队</p> <p onClick={() => this.props.Createateamedit(data[0])}>编辑战队</p>
</div> </div>
</div> </div>
@ -160,8 +161,8 @@ class PersonalCompetititem extends React.Component {
<div className="regitemimgs5"> <div className="regitemimgs5">
<p>战队详情</p> <p>战队详情</p>
</div> </div>
<div className="regitemimgs6" onClick={() => this.props.Exittheteamshow(data[0].id)}> <div className="regitemimgs6" onClick={() => this.props.Exittheteamshow(data[0].id, false)}>
<p onClick={() => this.props.Exittheteamshow(data[0].id)}>退出战队</p> <p onClick={() => this.props.Exittheteamshow(data[0].id, false)}>退出战队</p>
</div> </div>
</div> </div>
@ -173,8 +174,8 @@ class PersonalCompetititem extends React.Component {
}} }}
> >
<div className="regitemimgs6" onClick={() => this.props.Exittheteamshow(data[0].id)}> <div className="regitemimgs6" onClick={() => this.props.Exittheteamshow(data[0].id, false)}>
<p onClick={() => this.props.Exittheteamshow(data[0].id)}>退出战队</p> <p onClick={() => this.props.Exittheteamshow(data[0].id, false)}>退出战队</p>
</div> </div>
</div> </div>

Loading…
Cancel
Save