竞赛调整

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

@ -25,19 +25,65 @@ class Registration extends React.Component {
this.state = {
test: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20],
loadingstate: false,
page: 1,
pages: 1,
limit: 20,
type: 1,
tmodalsType: false,
tmodalsTypes: false,
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) => {
this.setState({
page: pageNumber,
pages: pageNumber,
loadingstate: true,
})
};
@ -94,7 +140,7 @@ class Registration extends React.Component {
}
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) =>
<RegisListviewdata></RegisListviewdata>
);
@ -165,7 +211,7 @@ class Registration extends React.Component {
{
type === 4 || type === 5 ?
<div className="edu-txt-center ysyslxh mt56 " style={{marginBottom: "192px",}}>
<Pagination showQuickJumper current={page}
<Pagination showQuickJumper current={pages}
onChange={this.paginationonChangestwo} pageSize={limit}
total={30}></Pagination>
</div>

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

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

Loading…
Cancel
Save