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 1/3] =?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()}>删除分班 } { From 038ff29699542cabdf4b6b9a2bc45119d32e4e86 Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Fri, 11 Oct 2019 16:27:05 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/exercises_controller.rb | 2 +- app/controllers/homework_commons_controller.rb | 2 +- app/controllers/polls_controller.rb | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/controllers/exercises_controller.rb b/app/controllers/exercises_controller.rb index f9d9531f1..e25bec7f2 100644 --- a/app/controllers/exercises_controller.rb +++ b/app/controllers/exercises_controller.rb @@ -694,6 +694,7 @@ class ExercisesController < ApplicationController #首页批量或单独 立即发布,应是跳出弹窗,设置开始时间和截止时间。 def publish + group_ids = params[:group_ids]&.reject(&:blank?) if params[:detail].blank? tip_exception("缺少截止时间参数") if params[:end_time].blank? tip_exception("截止时间不能早于当前时间") if params[:end_time] <= strf_time(Time.now) @@ -701,7 +702,6 @@ class ExercisesController < ApplicationController @course.end_date.present? && params[:end_time] > strf_time(@course.end_date.end_of_day) else group_end_times = params[:group_end_times].reject(&:blank?).map{|time| time.to_time} - group_ids = params[:group_ids].reject(&:blank?) tip_exception("缺少截止时间参数") if group_end_times.blank? tip_exception("截止时间和分班参数的个数不一致") if group_end_times.length != group_ids.length group_end_times.each do |time| diff --git a/app/controllers/homework_commons_controller.rb b/app/controllers/homework_commons_controller.rb index 9941e1d42..5d75604ee 100644 --- a/app/controllers/homework_commons_controller.rb +++ b/app/controllers/homework_commons_controller.rb @@ -1044,6 +1044,7 @@ class HomeworkCommonsController < ApplicationController def publish_homework tip_exception("请至少选择一个分班") if params[:group_ids].blank? && @course.course_groups.size != 0 + group_ids = params[:group_ids]&.reject(&:blank?) if params[:detail].blank? tip_exception("缺少截止时间参数") if params[:end_time].blank? tip_exception("截止时间不能早于当前时间") if params[:end_time] <= strf_time(Time.now) @@ -1051,7 +1052,6 @@ class HomeworkCommonsController < ApplicationController @course.end_date.present? && params[:end_time] > strf_time(@course.end_date.end_of_day) else group_end_times = params[:group_end_times].reject(&:blank?).map{|time| time.to_time} - group_ids = params[:group_ids].reject(&:blank?) tip_exception("缺少截止时间参数") if group_end_times.blank? tip_exception("截止时间和分班参数的个数不一致") if group_end_times.length != group_ids.length group_end_times.each do |time| diff --git a/app/controllers/polls_controller.rb b/app/controllers/polls_controller.rb index 2259907e4..da5917e1b 100644 --- a/app/controllers/polls_controller.rb +++ b/app/controllers/polls_controller.rb @@ -254,6 +254,7 @@ class PollsController < ApplicationController #首页批量或单独 立即发布,应是跳出弹窗,设置开始时间和截止时间。 def publish + group_ids = params[:group_ids]&.reject(&:blank?) if params[:detail].blank? tip_exception("缺少截止时间参数") if params[:end_time].blank? tip_exception("截止时间不能早于当前时间") if params[:end_time] <= strf_time(Time.now) @@ -261,7 +262,6 @@ class PollsController < ApplicationController @course.end_date.present? && params[:end_time] > strf_time(@course.end_date.end_of_day) else group_end_times = params[:group_end_times].reject(&:blank?).map{|time| time.to_time} - group_ids = params[:group_ids].reject(&:blank?) tip_exception("缺少截止时间参数") if group_end_times.blank? tip_exception("截止时间和分班参数的个数不一致") if group_end_times.length != group_ids.length group_end_times.each do |time| From 663083a63e1be5c1eea50d05a2df33ca5b8bd242 Mon Sep 17 00:00:00 2001 From: hjm <63528605@qq.com> Date: Fri, 11 Oct 2019 16:33:00 +0800 Subject: [PATCH 3/3] isAdminOrCreator --- public/react/src/modules/courses/members/teacherList.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/public/react/src/modules/courses/members/teacherList.js b/public/react/src/modules/courses/members/teacherList.js index 74271ea5a..fe46e9bf4 100644 --- a/public/react/src/modules/courses/members/teacherList.js +++ b/public/react/src/modules/courses/members/teacherList.js @@ -649,6 +649,7 @@ class studentsList extends Component{ combineArray = this.state.application_list } const isAdminOrTeacher = this.props.isAdminOrTeacher() + const isAdminOrCreator = this.props.isAdminOrCreator() const isSuperAdmin = this.props.isSuperAdmin() const hasGraduationModule = this.hasGraduationModule() const coursesId = this.props.match.params.coursesId @@ -685,7 +686,7 @@ class studentsList extends Component{ {/* { isAdmin && this.addTeacher()}>添加教师 } { isAdmin && this.addStudent()}>添加学生 } */} - { isAdmin && this.showChangeAdminModal()}>更换管理员} + { isAdminOrCreator && this.showChangeAdminModal()}>更换管理员} }