From eb673fcc4b0e606da0b8fc26a43612f9de477d5d Mon Sep 17 00:00:00 2001 From: hjm <63528605@qq.com> Date: Fri, 11 Oct 2019 16:25:36 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8A=A0=E5=85=A5=E5=88=86=E7=8F=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/modules/courses/members/studentsList.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/public/react/src/modules/courses/members/studentsList.js b/public/react/src/modules/courses/members/studentsList.js index 626a76baf..5c56afbe0 100644 --- a/public/react/src/modules/courses/members/studentsList.js +++ b/public/react/src/modules/courses/members/studentsList.js @@ -547,6 +547,19 @@ class studentsList extends Component{ addDir = () => { trigger('groupAdd', this.props.coursesids) } + addToDir = async () => { + const courseId = this.props.match.params.coursesId + const url = `/courses/${courseId}/join_course_group.json` + const course_group_id = this.props.match.params.course_group_id + + const response = await axios.post(url, { + course_group_id + }) + if (response && response.data.status == 0) { + this.props.showNotification('加入成功') + this.fetchAll() + } + } renameDir = () => { const course_group_id = this.props.match.params.course_group_id trigger('groupRename', { id: parseInt(course_group_id), name: this.state.course_group_name}) @@ -593,6 +606,7 @@ class studentsList extends Component{ render(){ const isAdmin = this.props.isAdmin() + const isStudent = this.props.isStudent() const isSuperAdmin = this.props.isSuperAdmin() const isCourseEnd = this.props.isCourseEnd() let { @@ -704,6 +718,8 @@ class studentsList extends Component{ { // pageType !== TYPE_STUDENTS && !isCourseEnd && isAdmin && isParent && this.addDir()}>添加分班 } + { + isStudent && !isParent && course_group_id != 0 && this.addToDir()}>加入分班 } { isAdmin && !isParent && course_group_id != 0 && this.deleteDir()}>删除分班 } {