diff --git a/public/react/src/modules/courses/members/teacherList.js b/public/react/src/modules/courses/members/teacherList.js index 5834ae517..2ce893b5c 100644 --- a/public/react/src/modules/courses/members/teacherList.js +++ b/public/react/src/modules/courses/members/teacherList.js @@ -258,7 +258,7 @@ class studentsList extends Component{ // approval 2 - 拒绝 onAgree = (record, approval = 1) => { const isAdminOrCreator = this.props.isAdminOrCreator() - const { course_groups } = this.state + const { course_groups ,filterKey} = this.state if (approval == 1 && isAdminOrCreator && course_groups && course_groups.length) { this.setState({ clickRecord: record}, () => { this.setGroupChooserModalVisible(true) @@ -280,7 +280,7 @@ class studentsList extends Component{ .then((response) => { if (response.data.status == 0) { this.props.showNotification(`已${approval == 1? '同意' : '拒绝'}`) - this.fetchAll(1) + this.fetchAll(1,filterKey) } }) .catch(function (error) { @@ -304,13 +304,15 @@ class studentsList extends Component{ this.setState({ filterKey:'1' }) + this.fetchAll(1,'1'); }else{ this.setState({ filterKey:'2' }) + this.fetchAll(1,'2'); } - this.fetchAll(1); + const isAdminOrTeacher = this.props.isAdminOrTeacher() const isAdmin = this.props.isAdmin() @@ -330,10 +332,11 @@ class studentsList extends Component{ this.getCourseGroups() } addTeacherSuccessListener = (e, data) => { + // const params = JSON.parse(data) // const coursesId = this.props.match.params.coursesId if (window.location.pathname.endsWith('teachers')) { - this.fetchAll(1) + this.fetchAll(1,this.state.filterKey) } else { // this.props.history.push(`/courses/${coursesId}/teachers`) } @@ -393,10 +396,10 @@ class studentsList extends Component{ }); } onChangeRoleSuccess = () => { - this.fetchAll() + this.fetchAll(undefined,this.state.filterKey) } - fetchAll = async (argPage) => { - let { searchValue, filterKey }=this.state + fetchAll = async (argPage,filterKey) => { + let { searchValue }=this.state this.setState({ isSpin:true @@ -476,8 +479,8 @@ class studentsList extends Component{ // join_graduation_group joinGraduationGroup = (graduation_group_id) => { - const courseId = this.props.match.params.coursesId - + const courseId = this.props.match.params.coursesId + let { filterKey }=this.state let url= `/courses/${courseId}/join_graduation_group.json`; axios.post(url, { course_member_list: this.state.checkBoxValues.map (item => { return { course_member_id: item } }), @@ -485,7 +488,7 @@ class studentsList extends Component{ }).then((result)=>{ if(result.data.status==0){ this.props.showNotification('操作成功。') - this.fetchAll() + this.fetchAll(undefined,filterKey) } }).catch((error)=>{ console.log(error); @@ -493,6 +496,7 @@ class studentsList extends Component{ } onInputSearchChange = (e) => { + let {filterKey}=this.state; this.setState({ searchValue: e.target.value }) @@ -501,12 +505,12 @@ class studentsList extends Component{ clearTimeout(this.timeoutHandler) } this.timeoutHandler = setTimeout(() => { - this.fetchAll(1) + this.fetchAll(1,filterKey) }, 1200) } onPressEnter = (e) => { - this.fetchAll(1) + this.fetchAll(1,this.state.filterKey) } @@ -543,7 +547,7 @@ class studentsList extends Component{ changeRole = (member, role) => { const courseId = this.props.match.params.coursesId - + let {filterKey}=this.state; let url= `/courses/${courseId}/change_course_teacher.json`; axios.post(url, { course_member_id: member.course_member_id @@ -556,7 +560,7 @@ class studentsList extends Component{ }).then((result)=>{ if(result.data.status==0){ this.props.showNotification('操作成功。') - this.fetchAll() + this.fetchAll(undefined,filterKey) } }).catch((error)=>{ console.log(error); @@ -572,9 +576,11 @@ class studentsList extends Component{ this.refs.addAdminModal.setVisible(true) } changeAdminSuccess = () => { - this.fetchAll() + let {filterKey}=this.state; + this.fetchAll(undefined,filterKey) } onDelete = (member) => { + let {filterKey}=this.state; this.props.confirm({ content: `确认要将“${member.name}”从教师列表中移除吗?`, onOk: () => { @@ -590,7 +596,7 @@ class studentsList extends Component{ // {"status":1,"message":"删除成功"} this.props.showNotification('删除成功') trigger('updatabanner') - this.fetchAll() + this.fetchAll(undefined,filterKey) } }) .catch(function (error) { @@ -615,12 +621,13 @@ class studentsList extends Component{ } onTableChange = (pagination, filters, sorter) => { + let {filterKey}=this.state; console.log('Various parameters', pagination, filters, sorter); this.setState({ page: pagination.current, sortedInfo: sorter, }, () => { - this.fetchAll() + this.fetchAll(undefined,filterKey) }); }; clearSelection = () => { @@ -633,7 +640,7 @@ class studentsList extends Component{ page:1, isSpin:true }, () => { - this.fetchAll(); + this.fetchAll(undefined,e.key); }) } setGroupChooserModalVisible = (visible) => { @@ -755,9 +762,11 @@ class studentsList extends Component{
{ course_groups && !!course_groups.length && this.fetchAll(e,this.state.filterKey)} course_groups={course_groups} visible={this.state.groupChooserModalVisible} setVisible={this.setGroupChooserModalVisible}