dev_sync_trustie
杨树林 5 years ago
parent a8be9376c0
commit bb1cee4d86

@ -16,9 +16,6 @@ class CompetitionMaxImg extends React.Component {
componentDidUpdate = (prevProps) => {
if (prevProps.GetenrollmentAPI != this.props.GetenrollmentAPI) {
// ////console.log("团队竞赛报名大图componentDidUpdate");
// ////console.log(this.props);
// ////console.log(this.props.GetenrollmentAPI);
this.setState({
GetenrollmentAPI: this.props.GetenrollmentAPI,
})

@ -63,12 +63,13 @@ class Registration extends React.Component {
itemiddata: [],
pint: 0,
competition_name: undefined,
mutiple_limited: false,
}
}
componentDidMount() {
console.log(this.props);
// console.log(this.props);
// //////console.log("componentDidMount Registration");
// //// //////console.log("调用子组件 ");
@ -87,8 +88,8 @@ class Registration extends React.Component {
componentDidUpdate = (prevProps) => {
if (prevProps.user != this.props.user) {
console.log("componentDidUpdate");
console.log(this.props);
// console.log("componentDidUpdate");
// console.log(this.props);
////console.log("Registration");
////console.log("componentDidUpdate");
////console.log(this.props.user.admin);
@ -101,7 +102,7 @@ class Registration extends React.Component {
//获取报名配置API
GetenrollmentAPI = () => {
console.log("调用了GetenrollmentAPI");
// console.log("调用了GetenrollmentAPI");
const url = `/competitions/${this.props.match.params.identifier}/competition_staff.json`;
axios.get((url)).then((result) => {
if (result) {
@ -115,6 +116,7 @@ class Registration extends React.Component {
enrolled: result.data.enrolled,
teacher_staff: result.data.teacher_staff,
member_staff: result.data.member_staff,
mutiple_limited: result.data.member_staff.mutiple_limited,
})
if (result.data.enroll_ended === true) {
this.setState({
@ -172,6 +174,7 @@ class Registration extends React.Component {
data: result.data.my_teams,
competition_teams: result.data.competition_teams,
personal: result.data.personal,
competition_name: result.data.competition_name
})
}
} else {
@ -185,6 +188,7 @@ class Registration extends React.Component {
count: result.data.count,
competition_teams: result.data.competition_teams,
personal: result.data.personal,
competition_name: result.data.competition_name
})
} else {
@ -194,6 +198,7 @@ class Registration extends React.Component {
count: result.data.count,
competition_teams: result.data.competition_teams,
personal: result.data.personal,
competition_name: result.data.competition_name
})
}
@ -205,6 +210,7 @@ class Registration extends React.Component {
data: result.data.my_teams,
count: result.data.count,
personal: result.data.personal,
competition_name: result.data.competition_name
})
} else {
@ -214,6 +220,7 @@ class Registration extends React.Component {
data: result.data.my_teams,
count: result.data.count,
personal: result.data.personal,
competition_name: result.data.competition_name
})
}
@ -227,6 +234,7 @@ class Registration extends React.Component {
count: result.data.count,
competition_teams: result.data.competition_teams,
personal: result.data.personal,
competition_name: result.data.competition_name
})
@ -307,7 +315,7 @@ class Registration extends React.Component {
count: result.data.count,
competition_teams: result.data.competition_teams,
personal: result.data.personal,
competition_name: result.data.competition_name
})
} else {
@ -319,6 +327,7 @@ class Registration extends React.Component {
count: result.data.count,
competition_teams: result.data.competition_teams,
personal: result.data.personal,
competition_name: result.data.competition_name
})
}
@ -333,6 +342,7 @@ class Registration extends React.Component {
count: result.data.count,
competition_teams: result.data.competition_teams,
personal: result.data.personal,
competition_name: result.data.competition_name
})
}
@ -621,7 +631,7 @@ class Registration extends React.Component {
render() {
const {page, pages, limit, type, tmodalsType, tmodalsTypes, data, count, competition_teams, Newtit, itemiddata, messagePerbool, messageexitol, GetenrollmentAPI, loadingstate, pint, competition_name} = this.state;
const {page, pages, limit, type, tmodalsType, tmodalsTypes, data, count, competition_teams, Newtit, itemiddata, messagePerbool, messageexitol, GetenrollmentAPI, loadingstate, pint, competition_name, mutiple_limited} = this.state;
return (
<div className="newMain clearfix newMainybot">
@ -648,6 +658,7 @@ class Registration extends React.Component {
{
tmodalsType === true ?
<PersonModal modalsType={tmodalsType} {...this.props} {...this.state} Newtit={Newtit}
mutiple_limited={mutiple_limited}
itemiddata={itemiddata} GetenrollmentAPI={GetenrollmentAPI}
Tmoconfirm1={(bool) => this.Tmoconfirm1(bool)}
GetenrollmentAPIopens={() => this.GetenrollmentAPI()}
@ -669,16 +680,7 @@ class Registration extends React.Component {
: ""
}
{/*<div className="educontent mb20 ">*/}
{/* <p className="clearfix mb20 mt10">*/}
{/* <a className="btn colorgrey fl hovercolorblue ">在线竞赛</a>*/}
{/* <span className="color-grey-9 fl ml3 mr3">&gt;</span>*/}
{/* <a*/}
{/* className=" btn colorgrey fl hovercolorblue ">全国高校计算机大赛-项目挑战</a>*/}
{/* <span className="color-grey-9 fl ml3 mr3">&gt;</span>*/}
{/* <WordsBtn className="fl">报名</WordsBtn>*/}
{/* </p>*/}
{/*</div>*/}
<div style={{marginBottom: '12px'}}>
<Breadcrumb separator=">">
<Breadcrumb.Item href="/newcompetitions">在线竞赛</Breadcrumb.Item>

@ -515,6 +515,13 @@
flex-direction: initial;
}
.reglistviewdivss2c {
display: flex;
flex-direction: initial;
cursor: not-allowed;
}
.reglistviewdivss2p {
width: 90px;
font-size: 12px;

@ -50,7 +50,8 @@ class PersonModal extends Component {
myteaherdata: [],
myshtudentdata: [],
Thecurrentnumberbool: false,
Thecurrentnumberboolstu: false,
Thecurrentnumberstu: "",
}
@ -151,6 +152,7 @@ class PersonModal extends Component {
var myteaherdata = [];
var myshtudentdata = [];
var i = 0;
var s = 0;
for (var a = 0; a < mydatas.length; a++) {
if (mydatas[a].type === "导师") {
i++;
@ -163,6 +165,7 @@ class PersonModal extends Component {
// }
myteaherdata.push(mydatas[a].id);
} else if (mydatas[a].type === "队员") {
s++;
// var objectts = {
// enrollable: mydatas[a].enrollable,
// id: mydatas[a].id,
@ -174,7 +177,7 @@ class PersonModal extends Component {
}
}
//确认的时候 去确认老师人数是否符合
try {
if (GetenrollmentAPI) {
if (GetenrollmentAPI.teacher_staff) {
@ -202,6 +205,35 @@ class PersonModal extends Component {
}
//确认的时候 去确认学生人数是否符合
try {
if (GetenrollmentAPI) {
if (GetenrollmentAPI.member_staff) {
if (GetenrollmentAPI.member_staff.minimum > s) {
this.setState({
Thecurrentnumberboolstu: true,
Thecurrentnumberstu: s,
booltech: false,
boolstud: false
})
return
} else if (GetenrollmentAPI.member_staff.maximum < s) {
this.setState({
Thecurrentnumberboolstu: true,
Thecurrentnumberstu: s,
booltech: false,
boolstud: false
})
return
}
}
}
} catch (e) {
}
// Thecurrentnumber
if (this.props.Newtit === true) {
//创建新的战队
@ -306,7 +338,8 @@ class PersonModal extends Component {
this.setState({
keywordteachers: e.target.value,
booltech: false,
Thecurrentnumberbool: false
Thecurrentnumberbool: false,
Thecurrentnumberboolstu: false,
})
// try {
// if (e.target.value.length > 0) {
@ -345,8 +378,10 @@ class PersonModal extends Component {
this.setState({
keywordstudents: e.target.value,
boolstud: false,
Thecurrentnumberbool: false
Thecurrentnumberbool: false,
Thecurrentnumberboolstu: false,
});
// try {
// if (e.target.value.length > 0) {
// this.setState({
@ -421,6 +456,19 @@ class PersonModal extends Component {
}
//点击获取学生数据2
getdatacpersondiv1Items2 = (object) => {
//
try {
if (this.props.GetenrollmentAPI.teacher_staff.mutiple_limited === true) {
if (object.enrollable === false) {
return
}
}
} catch (e) {
}
var datas = {
enrollable: object.enrollable,
id: object.id,
@ -644,10 +692,11 @@ class PersonModal extends Component {
var myteaherdata = [];
var myshtudentdata = [];
var i = 0;
var s = 0;
try {
for (var a = 0; a < mydatas.length; a++) {
if (mydatas[a].type === "导师") {
i++;
i = i + 1;
// var objectt = {
// enrollable: mydatas[a].enrollable,
// id: mydatas[a].id,
@ -657,6 +706,7 @@ class PersonModal extends Component {
// }
myteaherdata.push(mydatas[a].id);
} else if (mydatas[a].type === "队员") {
s = s + 1;
// var objectts = {
// enrollable: mydatas[a].enrollable,
// id: mydatas[a].id,
@ -672,6 +722,7 @@ class PersonModal extends Component {
}
// console.log("deletedata");
// console.log(i);
//删除老师的时候判断是否符合人数
try {
if (GetenrollmentAPI) {
if (GetenrollmentAPI.teacher_staff) {
@ -702,14 +753,54 @@ class PersonModal extends Component {
} catch (e) {
}
// debugger
//删除学生的时候判断是否符合人数
try {
if (GetenrollmentAPI) {
if (GetenrollmentAPI.member_staff) {
if (GetenrollmentAPI.member_staff.minimum > s) {
this.setState({
Thecurrentnumberboolstu: true,
Thecurrentnumberstu: s,
booltech: false,
boolstud: false
})
return
} else if (GetenrollmentAPI.member_staff.maximum < s) {
this.setState({
Thecurrentnumberboolstu: true,
Thecurrentnumberstu: s,
booltech: false,
boolstud: false
})
return
}
this.setState({
Thecurrentnumberboolstu: false,
Thecurrentnumberstu: s,
})
}
}
} catch (e) {
}
}
render() {
// console.log('Registration.js');
// console.log(this.props.mutiple_limited);
const {
addonAfter, Numberofteammentors, Thecurrentnumber, person1, person2,
keywordteachers, team_idteachers, teacher_ids,
keywordstudents, team_idstudents, student_ids,
member_ids, mydatas, booltech, boolstud, GetenrollmentAPI, Thecurrentnumberbool
member_ids, mydatas, booltech, boolstud, GetenrollmentAPI, Thecurrentnumberbool,
Thecurrentnumberboolstu, Thecurrentnumberstu
} = this.state;
//Modal
//keyboard是否支持键盘 esc 关闭
@ -839,14 +930,16 @@ class PersonModal extends Component {
var persondiv2Items = [];
if (member_ids) {
persondiv2Items = member_ids.map((item, index) =>
<a className="reglistviewdivss2 " key={index} style={{
<a
className={this.props.mutiple_limited === undefined || this.props.mutiple_limited === null ? "reglistviewdivss2 " : (this.props.mutiple_limited === true && item.enrollable === false ? "reglistviewdivss2c" : "reglistviewdivss2 ")}
key={index} style={{
width: "100%",
display: "flex",
justifyContent: " space-around",
alignItems: "center",
height: "40px",
}}
onClick={() => this.getdatacpersondiv1Items2(item)}
onClick={() => this.getdatacpersondiv1Items2(item)}
>
<p className=" cpersondiv1Items"
style={{
@ -866,13 +959,37 @@ class PersonModal extends Component {
width: "110px"
}}
>{item.school_name === undefined || item.school_name === null || item.school_name === "" ? "--" : item.school_name}</p>
<p className=" cpersondiv1Items"
style={{
textAlign: "center",
color: "#FF6800",
width: "87px"
}}
>{item.enrollable === false ? "" : "已加入其他战队"}</p>
{
this.props.mutiple_limited === undefined || this.props.mutiple_limited === null ?
<p className=" cpersondiv1Items"
style={{
textAlign: "center",
width: "87px"
}}
>{""}</p>
:
(
this.props.mutiple_limited === true ?
<p className=" cpersondiv1Items"
style={{
textAlign: "center",
color: "#FF6800",
width: "87px"
}}
>{item.enrollable === false ? "已加入其他战队" : ""}</p>
:
<p className=" cpersondiv1Items"
style={{
textAlign: "center",
width: "87px"
}}
>{""}</p>
)
}
</a>
);
}
@ -1175,8 +1292,21 @@ class PersonModal extends Component {
) :
""
}
{
GetenrollmentAPI && GetenrollmentAPI.member_staff ?
(
Thecurrentnumberboolstu === true ?
<p style={{
marginLeft: "53px",
color: "#D0021B",
fontSize: "12px",
marginTop: "9px"
}}>战队队员为{GetenrollmentAPI.member_staff.minimum}-{GetenrollmentAPI.member_staff.maximum},现在为{Thecurrentnumberstu}</p>
: ""
) :
""
}
<div style={{
marginTop: "24px",

Loading…
Cancel
Save