import React, {Component} from 'react'; import {getImageUrl} from 'educoder'; import {Modal, Input, Spin, Tooltip, Icon, Dropdown, Button} from 'antd'; import axios from 'axios'; import competition from '../comcss/competition.css'; import Registrationitem from "../Registrationitem"; import InfiniteScroll from 'react-infinite-scroller'; // import PersonModaltion from "./PersonModaltion"; const {Search} = Input; //创建战队 class PersonModal extends Component { //导师是搜索 和学生搜索都会添加到下面框中 constructor(props) { super(props); this.state = { addonAfter: 0, test: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18], test2: [19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40], test3: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18], loading: false, loading1: false, loading2: false, hasMore: true, person1: false, person2: false, Numberofteammentors: "0-3", Thecurrentnumber: "3", keywordteachers: "", team_idstudents: undefined, team_idteachers: undefined, teacher_ids: undefined, keywordstudents: "", Aggregatedata: [], name: "", teacher_idss: [], member_ids: [], } } componentDidMount() { } 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"); let num = parseInt(e.target.value.length); if (num > 60) { return; } this.setState({ addonAfter: num < 0 ? 0 : num }); this.setState({ polls_nametest: e.target.value }) }; //onSearchsou onSearch = (value) => { console.log("搜索的数据" + value); }; handleInfiniteOnLoad = () => { this.setState({ loading: true, }) const test3 = this.state.test; this.state.test2.forEach(function (item) { test3.push(item) }); setTimeout(() => { this.setState({ test: test3, hasMore: true, loading: false, }); }, 1000) } handleInfiniteOnLoad1 = () => { console.log("调用了方法1111"); this.setState({ loading1: true, }) setTimeout(() => { console.log("调用了方法11112"); this.setState({ loading1: false, hasMore: true, }); }, 1000) } handleInfiniteOnLoad2 = () => { console.log("调用了方法1111"); this.setState({ loading2: true, }) setTimeout(() => { console.log("调用了方法11113"); this.setState({ hasMore: true, loading2: false, }); }, 1000) } inputOnBlur = (e) => { console.log("inputOnBlur"); console.log(e); this.setState({ person1: false }) } inputOnBlur2 = (e) => { console.log("inputOnBlur"); console.log(e); this.setState({ person2: false }) } 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) => { console.log("inputOnFocus"); console.log(e); this.setState({ person1: true }) } inputOnFocus2 = (e) => { console.log("inputOnFocus2"); console.log(e); this.setState({ person2: true }) } render() { const { addonAfter, test, test3, Numberofteammentors, Thecurrentnumber, person1, person2, keywordteachers, team_idteachers, teacher_ids, keywordstudents, team_idstudents, student_ids } = this.state; //Modal //keyboard是否支持键盘 esc 关闭 //closable 是否显示右上角的关闭按钮 //底部内容,当不需要默认底部按钮时,可以设为 footer={null} //destroyOnClose 关闭时销毁 Modal 里的子元素 //centered 垂直居中展示 Modal //visible 弹出框是否显示 const listItems = test.map((item, index) =>
陈明
导师/创建者
国防科技大学
职称;教授
{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 = (李小猫{index}
职称:副教授
国防科技大学
已加入其他战队
); const persondiv2 = (* 队名:
* 导师:
{/** 队员:
{/*姓名
角色
单位
其他
操作
战队导师为{Numberofteammentors}人,现在为{Thecurrentnumber}人
this.props.Tmoconfirm1(false)}> 取消
this.props.Tmoconfirm1(true)}>确定