From 16e1a517c65d61477c9fcc8541c783fd04173a1e Mon Sep 17 00:00:00 2001 From: hjm <63528605@qq.com> Date: Mon, 24 Jun 2019 18:23:56 +0800 Subject: [PATCH] .state --- .../modules/courses/coursesDetail/CoursesBanner.js | 8 ++++++-- .../src/modules/courses/members/studentsList.js | 13 ++++++++----- .../src/modules/courses/members/teacherList.js | 3 ++- 3 files changed, 16 insertions(+), 8 deletions(-) diff --git a/public/react/src/modules/courses/coursesDetail/CoursesBanner.js b/public/react/src/modules/courses/coursesDetail/CoursesBanner.js index 74e79b172..3a1ab9331 100644 --- a/public/react/src/modules/courses/coursesDetail/CoursesBanner.js +++ b/public/react/src/modules/courses/coursesDetail/CoursesBanner.js @@ -1,7 +1,7 @@ import React, {Component} from 'react'; import {Link} from "react-router-dom"; import axios from 'axios'; -import {getImageUrl, trigger} from 'educoder'; +import {getImageUrl, trigger, on, off} from 'educoder'; import { Tooltip, message,Popover} from 'antd'; import CoursesListType from '../coursesPublic/CoursesListType'; import Addcourses from '../coursesPublic/Addcourses'; @@ -48,8 +48,12 @@ class CoursesBanner extends Component { componentDidMount() { this.onloadupdatabanner() - + on('updatabanner', this.updatabanner) + } + componentWillUnmount() { + off('updatabanner', this.updatabanner) } + onloadupdatabanner=()=>{ this.updatabanner() diff --git a/public/react/src/modules/courses/members/studentsList.js b/public/react/src/modules/courses/members/studentsList.js index ba29dfccb..3cb9bff77 100644 --- a/public/react/src/modules/courses/members/studentsList.js +++ b/public/react/src/modules/courses/members/studentsList.js @@ -79,7 +79,7 @@ const buildColumns = (that) => { return columns; } -// 1-按照学号排序 2-按照分班排序, +// 1-按照学生学号 2-按照分班名称, const ORDER_BY_NUM = 1; const ORDER_BY_GROUP = 2; @@ -317,6 +317,8 @@ class studentsList extends Component{ if (result.data.status == 0) { this.props.showNotification('移动成功') this.fetchAll() + this.props.updataleftNavfun() + } }).catch((error)=>{ console.log(error); @@ -362,6 +364,7 @@ class studentsList extends Component{ this.props.showNotification('删除成功') this.fetchAll() this.setState({checkBoxValues: []}) + trigger('updatabanner') } }).catch((error)=>{ console.log(error); @@ -428,9 +431,9 @@ class studentsList extends Component{ checkBoxValues, checkAllValue }=this.state; - let currentOrderName = '学号排序' + let currentOrderName = '学生学号' if (order == ORDER_BY_GROUP) { - currentOrderName = '分班排序' + currentOrderName = '分班名称' } const { coursesids } = this.props const course_group_id = this.props.match.params.course_group_id @@ -574,8 +577,8 @@ class studentsList extends Component{
  • {currentOrderName}
  • diff --git a/public/react/src/modules/courses/members/teacherList.js b/public/react/src/modules/courses/members/teacherList.js index 02fab16a9..c9637f1f8 100644 --- a/public/react/src/modules/courses/members/teacherList.js +++ b/public/react/src/modules/courses/members/teacherList.js @@ -51,7 +51,7 @@ function buildColumns(that) { dataIndex: 'role', key: 'role', }] - that.course_groups && that.course_groups.length && columns.push({ + that.state.course_groups && that.state.course_groups.length && columns.push({ title: 管理权限, width: 230, key: 'course_groups', @@ -462,6 +462,7 @@ class studentsList extends Component{ if (response.data.status == 0) { // {"status":1,"message":"删除成功"} this.props.showNotification('删除成功') + trigger('updatabanner') this.fetchAll() } })