From 39039b3a9149aeea2aab97cfc63cc1e6a4e83638 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com>
Date: Mon, 21 Oct 2019 21:53:34 +0800
Subject: [PATCH] =?UTF-8?q?=E7=AB=9E=E8=B5=9B=E8=B0=83=E6=95=B4?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../src/modules/competition/Registration.js | 54 +++-
.../competition/comcss/competition.css | 1 -
.../competition/competmodal/PersonModal.js | 245 ++++++++++++++----
3 files changed, 241 insertions(+), 59 deletions(-)
diff --git a/public/react/src/modules/competition/Registration.js b/public/react/src/modules/competition/Registration.js
index 7d85818f8..4dcb64a60 100644
--- a/public/react/src/modules/competition/Registration.js
+++ b/public/react/src/modules/competition/Registration.js
@@ -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) =>
);
@@ -165,7 +211,7 @@ class Registration extends React.Component {
{
type === 4 || type === 5 ?
diff --git a/public/react/src/modules/competition/comcss/competition.css b/public/react/src/modules/competition/comcss/competition.css
index a947fb7bd..3f74dddde 100644
--- a/public/react/src/modules/competition/comcss/competition.css
+++ b/public/react/src/modules/competition/comcss/competition.css
@@ -475,7 +475,6 @@
flex-direction: initial;
}
-
.reglistviewdivss2p {
width: 90px;
font-size: 12px;
diff --git a/public/react/src/modules/competition/competmodal/PersonModal.js b/public/react/src/modules/competition/competmodal/PersonModal.js
index 1b563a5fe..e0912dc3d 100644
--- a/public/react/src/modules/competition/competmodal/PersonModal.js
+++ b/public/react/src/modules/competition/competmodal/PersonModal.js
@@ -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 {
>
);
- const cpersondiv1Items = test3.map((item, index) =>
-
-
李小猫{index}
-
职称:副教授
-
国防科技大学
-
- );
+ var cpersondiv1Items = [];
+ if (teacher_ids) {
+ cpersondiv1Items = teacher_ids.map((item, index) =>
+ this.getdatacpersondiv1Items(item)}
+ >
+ {item.name === undefined || item.name === null || item.name === "" ? "--" : item.name}
+ {item.identity === undefined || item.identity === null || item.identity === "" ? "--" : item.identity}
+ {item.school_name === undefined || item.school_name === null || item.school_name === "" ? "--" : item.school_name}
+
+ );
+ }
+
const cpersondiv1 = (
- {
- person1 ?
-
+
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 {
- :
- ""
- }
)
const persondiv2Items = test3.map((item, index) =>
-
+ }}
+ onClick={() => this.getdatacpersondiv1Items2(item)}
+ >
已加入其他战队
-
+
);
const persondiv2 = (
- {
- person2 === true ?
-
+ {/*this.state.loading2*/}
+
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 {
- : ""
- }
-
- )
+ );
return (
-
+
{/*队名*/}