竞赛调整

dev_sync_trustie
杨树林 6 years ago
parent 91eb9eac55
commit 39039b3a91

@ -25,19 +25,65 @@ class Registration extends React.Component {
this.state = { this.state = {
test: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20], test: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20],
loadingstate: false, loadingstate: false,
page: 1, pages: 1,
limit: 20, limit: 20,
type: 1, type: 1,
tmodalsType: false, tmodalsType: false,
tmodalsTypes: false, tmodalsTypes: false,
Newtit: true, Newtit: true,
keyword: "",
page: 1,
per_page: 20,
data: [],
count: 0,
} }
} }
componentDidMount() {
// console.log("componentDidMount ");
// console.log("调用子组件 ");
// console.log(this.props);
// console.log(this.props.isAdmin())
const {keyword, page, per_page} = this.state;
this.Getdata(keyword, page, per_page);
}
Getdata = (keyword, page, per_page) => {
//搜索关键字 keyword
//页数 page
//分页 per_page
const datas = {
keyword: keyword,
page: page,
per_page: per_page,
};
let url = `/competitions/${"gcc-course-2019"}/competition_teams.json`;
axios.get((url), {params: datas}).then((result) => {
if (result) {
if (result.data) {
console.log(result);
if (result.data.count === 0) {
this.setState({
type: 1,
count: result.data.count,
})
} else {
this.setState({
data: result.data.competition_teams,
count: result.data.count,
})
}
}
}
}).catch((error) => {
console.log(error);
})
}
paginationonChangestwo = (pageNumber) => { paginationonChangestwo = (pageNumber) => {
this.setState({ this.setState({
page: pageNumber, pages: pageNumber,
loadingstate: true, loadingstate: true,
}) })
}; };
@ -94,7 +140,7 @@ class Registration extends React.Component {
} }
render() { render() {
const {test, page, limit, type, tmodalsType, tmodalsTypes} = this.state; const {test, page, pages, limit, type, tmodalsType, tmodalsTypes} = this.state;
const listItems = test.map((item, index) => const listItems = test.map((item, index) =>
<RegisListviewdata></RegisListviewdata> <RegisListviewdata></RegisListviewdata>
); );
@ -165,7 +211,7 @@ class Registration extends React.Component {
{ {
type === 4 || type === 5 ? type === 4 || type === 5 ?
<div className="edu-txt-center ysyslxh mt56 " style={{marginBottom: "192px",}}> <div className="edu-txt-center ysyslxh mt56 " style={{marginBottom: "192px",}}>
<Pagination showQuickJumper current={page} <Pagination showQuickJumper current={pages}
onChange={this.paginationonChangestwo} pageSize={limit} onChange={this.paginationonChangestwo} pageSize={limit}
total={30}></Pagination> total={30}></Pagination>
</div> </div>

@ -475,7 +475,6 @@
flex-direction: initial; flex-direction: initial;
} }
.reglistviewdivss2p { .reglistviewdivss2p {
width: 90px; width: 90px;
font-size: 12px; font-size: 12px;

@ -8,8 +8,9 @@ import InfiniteScroll from 'react-infinite-scroller';
// import PersonModaltion from "./PersonModaltion"; // import PersonModaltion from "./PersonModaltion";
const {Search} = Input; const {Search} = Input;
//立即申请试用 //创建战队
class PersonModal extends Component { class PersonModal extends Component {
//导师是搜索 和学生搜索都会添加到下面框中
constructor(props) { constructor(props) {
super(props); super(props);
@ -26,18 +27,130 @@ class PersonModal extends Component {
person2: false, person2: false,
Numberofteammentors: "0-3", Numberofteammentors: "0-3",
Thecurrentnumber: "3", Thecurrentnumber: "3",
keywordteachers: "",
team_idstudents: undefined,
team_idteachers: undefined,
teacher_ids: undefined,
keywordstudents: "",
Aggregatedata: [],
name: "",
teacher_idss: [],
member_ids: [],
} }
} }
modalCancel = () => { componentDidMount() {
window.location.href = "/"
} }
setDownload = () => { creident = (name, teacher_ids, member_ids) => {
//立即联系 let collaborators = `/competitions/${"gcc-course-2019"}/competition_teams.json`;
axios.post(collaborators, {
name: name,
teacher_ids: teacher_ids,
member_ids: member_ids,
}).then((result) => {
if (result) {
if (result.data) {
}
}
}).catch((error) => {
console.log(error)
});
}
Getteacherdata = (keywordteachers, team_idteachers, teacher_ids) => {
//老师姓名 keyword
//当前战队ID team_id
//当前老师ID数组 teacher_ids
console.log("搜索的老师");
const datas = {
keyword: keywordteachers,
team_id: team_idteachers,
teacher_ids: teacher_ids,
};
let url = `/competitions/${"gcc-course-2019"}/teachers.json`;
axios.get((url), {params: datas}).then((result) => {
if (result) {
if (result.data) {
console.log(result);
this.setState({
teacher_ids: result.data.teachers
})
}
}
}).catch((error) => {
console.log(error);
})
};
Getstudentsdata = (keywordstudents, team_idstudents, student_ids) => {
//学生姓名 keyword
//当前战队ID team_id
//当前队员ID数组 student_ids
console.log("搜索的学生");
const datas = {
keyword: keywordstudents,
team_id: team_idstudents,
student_ids: student_ids,
};
let url = `/competitions/${"gcc-course-2019"}/students.json`;
axios.get((url), {params: datas}).then((result) => {
if (result) {
if (result.data) {
console.log(result);
this.setState({
member_ids: result.data.teachers
})
}
}
}).catch((error) => {
console.log(error);
})
};
//老师输入框事件
teacheronChange = (e) => {
console.log(e.target.value);
console.log("老师输入框事件|||||||||||123123123");
this.setState({
person1: true,
keywordteachers: e.target.value
})
}; };
//学生输入框事件
studentsonChange = (e) => {
console.log("学生输入框事件");
console.log(e);
this.setState({
person2: true,
keywordstudents: e.target.value
})
}
//点击获取老师数据
getdatacpersondiv1Items = (object) => {
console.log("点击获取老师数据");
console.log(object);
this.setState({
person1: false,
keywordteachers: object.name
})
}
//点击获取学生数据2
getdatacpersondiv1Items2 = (object) => {
console.log("点击获取学生数据2");
console.log(object);
this.setState({
person2: false,
})
}
//输入框事件 //输入框事件
changeTopicName = (e) => { changeTopicName = (e) => {
// console.log("调用了changeTopicName"); // console.log("调用了changeTopicName");
@ -121,6 +234,8 @@ class PersonModal extends Component {
startSearch = (e) => { startSearch = (e) => {
console.log("startSearch"); console.log("startSearch");
console.log(e); console.log(e);
const {keywordteachers, team_idteachers, teacher_ids} = this.state;
this.Getteacherdata(keywordteachers, team_idteachers, teacher_ids);
} }
inputOnFocus = (e) => { inputOnFocus = (e) => {
@ -142,7 +257,9 @@ class PersonModal extends Component {
render() { render() {
const { const {
addonAfter, test, test3, Numberofteammentors, Thecurrentnumber, person1, person2 addonAfter, test, test3, Numberofteammentors, Thecurrentnumber, person1, person2,
keywordteachers, team_idteachers, teacher_ids,
keywordstudents, team_idstudents, student_ids
} = this.state; } = this.state;
//Modal //Modal
//keyboard是否支持键盘 esc 关闭 //keyboard是否支持键盘 esc 关闭
@ -186,42 +303,53 @@ class PersonModal extends Component {
><i className="iconfont icon-guanbi font-12"/></p> ><i className="iconfont icon-guanbi font-12"/></p>
</div> </div>
); );
const cpersondiv1Items = test3.map((item, index) => var cpersondiv1Items = [];
<div className="reglistviewdivss2 " style={{ if (teacher_ids) {
width: "100%", cpersondiv1Items = teacher_ids.map((item, index) =>
display: "flex", <a className="reglistviewdivss2 " key={index} style={{
justifyContent: " space-around", width: "100%",
alignItems: "center", display: "flex",
height: "40px", justifyContent: " space-around",
}}> alignItems: "center",
<p className=" cpersondiv1Items" height: "40px",
style={{
textAlign: "center", }}
}} onClick={() => this.getdatacpersondiv1Items(item)}
>李小猫{index}</p> >
<p className=" cpersondiv1Items" <p className=" cpersondiv1Items"
style={{ style={{
textAlign: "center", textAlign: "center",
}} width: "100px"
>职称副教授</p> }}
<p className=" cpersondiv1Items" >{item.name === undefined || item.name === null || item.name === "" ? "--" : item.name}</p>
style={{ <p className=" cpersondiv1Items"
textAlign: "center", style={{
}} textAlign: "center",
>国防科技大学</p> width: "100px"
</div>
); }}
> {item.identity === undefined || item.identity === null || item.identity === "" ? "--" : item.identity}</p>
<p className=" cpersondiv1Items"
style={{
textAlign: "center",
width: "120px"
}}
>{item.school_name === undefined || item.school_name === null || item.school_name === "" ? "--" : item.school_name}</p>
</a>
);
}
const cpersondiv1 = ( const cpersondiv1 = (
<div className={" backgroundspersondiv cpersondiv1 borders2"}> <div className={" backgroundspersondiv cpersondiv1 borders2"}>
{ <Spin spinning={false}>
person1 ?
<Spin spinning={this.state.loading1}>
<div className="demo-infinite-container2"> <div className="demo-infinite-container2">
<InfiniteScroll <InfiniteScroll
initialLoad={false} initialLoad={false}
pageStart={0} pageStart={0}
loadMore={() => this.handleInfiniteOnLoad1()} loadMore={() => this.handleInfiniteOnLoad1()}
hasMore={!this.state.loading1 && this.state.hasMore} // hasMore={!this.state.loading1 && this.state.hasMore}
hasMore={false}
useWindow={false} useWindow={false}
> >
{ {
@ -231,19 +359,18 @@ class PersonModal extends Component {
</InfiniteScroll> </InfiniteScroll>
</div> </div>
</Spin> </Spin>
:
""
}
</div> </div>
) )
const persondiv2Items = test3.map((item, index) => const persondiv2Items = test3.map((item, index) =>
<div className="reglistviewdivss2 " style={{ <a className="reglistviewdivss2 " key={index} style={{
width: "100%", width: "100%",
display: "flex", display: "flex",
justifyContent: " space-around", justifyContent: " space-around",
alignItems: "center", alignItems: "center",
height: "40px", height: "40px",
}}> }}
onClick={() => this.getdatacpersondiv1Items2(item)}
>
<p className=" cpersondiv1Items" <p className=" cpersondiv1Items"
style={{ style={{
textAlign: "center", textAlign: "center",
@ -265,19 +392,19 @@ class PersonModal extends Component {
color: "#FF6800", color: "#FF6800",
}} }}
>已加入其他战队</p> >已加入其他战队</p>
</div> </a>
); );
const persondiv2 = ( const persondiv2 = (
<div className={" backgroundspersondiv cpersondiv1 borders2"}> <div className={" backgroundspersondiv cpersondiv1 borders2"}>
{ {/*this.state.loading2*/}
person2 === true ? <Spin spinning={false}>
<Spin spinning={this.state.loading2}>
<div className="demo-infinite-container2"> <div className="demo-infinite-container2">
<InfiniteScroll <InfiniteScroll
initialLoad={false} initialLoad={false}
pageStart={0} pageStart={0}
loadMore={() => this.handleInfiniteOnLoad2()} loadMore={() => this.handleInfiniteOnLoad2()}
hasMore={!this.state.loading2 && this.state.hasMore} // hasMore={!this.state.loading2 && this.state.hasMore}
hasMore={false}
useWindow={false} useWindow={false}
> >
{ {
@ -287,11 +414,8 @@ class PersonModal extends Component {
</InfiniteScroll> </InfiniteScroll>
</div> </div>
</Spin> </Spin>
: ""
}
</div> </div>
) );
return ( return (
<Modal <Modal
@ -305,7 +429,16 @@ class PersonModal extends Component {
width="620px" width="620px"
> >
<style>
{
`
a:hover
{
background-color:#F6F4F4;
}
`
}
</style>
<div className="permaindiv"> <div className="permaindiv">
{/*队名*/} {/*队名*/}
<style>{ <style>{
@ -399,10 +532,12 @@ class PersonModal extends Component {
className="yslzxueshiskmcd" className="yslzxueshiskmcd"
placeholder="请输入老师姓名的任意关键字进行搜索,可以后续在添加" placeholder="请输入老师姓名的任意关键字进行搜索,可以后续在添加"
onPressEnter={this.startSearch} onPressEnter={this.startSearch}
onBlur={this.inputOnBlur}
onFocus={this.inputOnFocus} onFocus={this.inputOnFocus}
onChange={(e) => this.teacheronChange(e)}
value={this.state.keywordteachers}
suffix={ suffix={
<i class="iconfont icon-sousuo"/> <i class="iconfont icon-sousuo"
onClick={() => this.Getteacherdata(keywordteachers, team_idteachers, teacher_ids)}/>
} }
/> />
</Dropdown> </Dropdown>
@ -448,10 +583,12 @@ class PersonModal extends Component {
className="yslzxueshiskmcd" className="yslzxueshiskmcd"
placeholder="请输入想要队员姓名的任意关键字进行搜索" placeholder="请输入想要队员姓名的任意关键字进行搜索"
onPressEnter={this.startSearch} onPressEnter={this.startSearch}
onBlur={this.inputOnBlur2}
onFocus={this.inputOnFocus2} onFocus={this.inputOnFocus2}
onChange={(e) => this.studentsonChange(e)}
value={this.state.keywordstudents}
suffix={ suffix={
<i class="iconfont icon-sousuo "/> <i class="iconfont icon-sousuo "
onClick={() => this.Getstudentsdata(keywordstudents, team_idstudents, student_ids)}/>
} }
/> />
</Dropdown> </Dropdown>

Loading…
Cancel
Save