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 f118939fa..f46f31640 100644
--- a/app/controllers/homework_commons_controller.rb
+++ b/app/controllers/homework_commons_controller.rb
@@ -1048,6 +1048,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)
@@ -1055,7 +1056,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|
diff --git a/public/react/src/AppConfig.js b/public/react/src/AppConfig.js
index c00c5fb62..e1d5da561 100644
--- a/public/react/src/AppConfig.js
+++ b/public/react/src/AppConfig.js
@@ -84,9 +84,9 @@ export function initAxiosInterceptors(props) {
}
config.url = `${proxy}${url}`;
if (config.url.indexOf('?') == -1) {
- config.url = `${config.url}?debug=${'student'}`;
+ config.url = `${config.url}?debug=${debugType}`;
} else {
- config.url = `${config.url}&debug=${'student'}`;
+ config.url = `${config.url}&debug=${debugType}`;
}
} else {
// 加api前缀
diff --git a/public/react/src/modules/courses/coursesPublic/HomeworkModal.js b/public/react/src/modules/courses/coursesPublic/HomeworkModal.js
index 89e747004..a001e6d86 100644
--- a/public/react/src/modules/courses/coursesPublic/HomeworkModal.js
+++ b/public/react/src/modules/courses/coursesPublic/HomeworkModal.js
@@ -48,7 +48,7 @@ class HomeworkModal extends Component{
if(this.props.starttimes!=undefined&&this.props.starttimes!=""){
this.setState({
- endtime:moment(moment(handleDateString(this.props.starttimes)).add(1, 'months')).format("YYYY-MM-DD HH:mm")
+ endtime:moment(moment(handleDateString(this.props.starttimes)).add(1, 'week')).format("YYYY-MM-DD HH:mm")
})
}
}
@@ -70,7 +70,7 @@ class HomeworkModal extends Component{
if(this.props.starttimes!=undefined&&this.props.starttimes!=""){
this.setState({
- endtime:moment(moment(handleDateString(this.props.starttimes)).add(1, 'months')).format("YYYY-MM-DD HH:mm")
+ endtime:moment(moment(handleDateString(this.props.starttimes)).add(1, 'week')).format("YYYY-MM-DD HH:mm")
})
}
}
diff --git a/public/react/src/modules/courses/members/ChangeRolePop.js b/public/react/src/modules/courses/members/ChangeRolePop.js
index 44dfc28fc..7f55910bf 100644
--- a/public/react/src/modules/courses/members/ChangeRolePop.js
+++ b/public/react/src/modules/courses/members/ChangeRolePop.js
@@ -6,7 +6,7 @@ import axios from 'axios'
/**
角色数组, CREATOR: 创建者, PROFESSOR: 教师, ASSISTANT_PROFESSOR: 助教, STUDENT: 学生
*/
-function ChangeRolePop({ member_roles = [], record, courseId, onChangeRoleSuccess, showNotification }) {
+function ChangeRolePop({ member_roles = [], record, courseId, onChangeRoleSuccess, showNotification, getUserId, fetchUser }) {
const [checkBoxRoles, setCheckBoxRoles] = useState(member_roles)
useEffect(() => {
setCheckBoxRoles(member_roles)
@@ -41,7 +41,14 @@ function ChangeRolePop({ member_roles = [], record, courseId, onChangeRoleSucces
user_id: record.user_id
})
if (response.data.status == 0) {
+ showNotification('保存成功')
onChangeRoleSuccess()
+
+ if (fetchUser && record.user_id == getUserId) {
+ fetchUser()
+ trigger('updatabanner')
+ }
+
}
console.log(response)
}
diff --git a/public/react/src/modules/courses/members/studentsList.js b/public/react/src/modules/courses/members/studentsList.js
index e3859345a..5c56afbe0 100644
--- a/public/react/src/modules/courses/members/studentsList.js
+++ b/public/react/src/modules/courses/members/studentsList.js
@@ -155,6 +155,8 @@ const buildColumns = (that,isParent) => {
member_roles={record.member_roles}
onChangeRoleSuccess={that.onChangeRoleSuccess}
showNotification={that.props.showNotification}
+ getUserId={that.props.isUserid}
+ fetchUser={that.props.fetchUser}
>
)
@@ -545,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})
@@ -591,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 {
@@ -702,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()}>删除分班 }
{
diff --git a/public/react/src/modules/courses/members/teacherList.js b/public/react/src/modules/courses/members/teacherList.js
index 72b667300..74271ea5a 100644
--- a/public/react/src/modules/courses/members/teacherList.js
+++ b/public/react/src/modules/courses/members/teacherList.js
@@ -165,6 +165,9 @@ function buildColumns(that) {
member_roles={record.member_roles}
onChangeRoleSuccess={that.onChangeRoleSuccess}
showNotification={that.props.showNotification}
+ getUserId={that.props.isUserid}
+ fetchUser={that.props.fetchUser}
+
>
{/*