From 084f77fcca1ef50b79af36c47c8b7cf553c48ffb Mon Sep 17 00:00:00 2001
From: cxt <853663049@qq.com>
Date: Wed, 11 Mar 2020 16:39:29 +0800
Subject: [PATCH 1/2] =?UTF-8?q?=E8=AF=95=E5=8D=B7=E7=9A=84=E5=8A=A9?=
=?UTF-8?q?=E6=95=99=E6=9D=83=E9=99=90?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/controllers/exercises_controller.rb | 5 ++++-
app/views/exercises/common_header.json.jbuilder | 2 +-
app/views/exercises/index.json.jbuilder | 2 +-
db/migrate/20200311082736_add_auth_to_exercise.rb | 5 +++++
4 files changed, 11 insertions(+), 3 deletions(-)
create mode 100644 db/migrate/20200311082736_add_auth_to_exercise.rb
diff --git a/app/controllers/exercises_controller.rb b/app/controllers/exercises_controller.rb
index 15f5c67d9..e5d9fc495 100644
--- a/app/controllers/exercises_controller.rb
+++ b/app/controllers/exercises_controller.rb
@@ -379,6 +379,7 @@ class ExercisesController < ApplicationController
#试卷的提交设置
def commit_setting
+ tip_exception("助教无权限修改本试卷") if @user_course_identity == Course::ASSISTANT_PROFESSOR && !@exercise.assistant_auth
ActiveRecord::Base.transaction do
error_count = 0 # 判断循环里是否有已发布/已截止的,且时间更改了的分班。
# course_group_ids = @course.teacher_course_group_ids(current_user.id) #当前老师的班级id数组
@@ -398,6 +399,7 @@ class ExercisesController < ApplicationController
choice_random = params[:choice_random] ? true : false
score_open = params[:score_open] ? true : false #分数是否公开
answer_open = params[:answer_open] ? true : false #答案是否公开
+ assistant_auth = params[:assistant_auth] ? true : false # 助教权限
# 统一设置或者分班为0,则更新试卷,并删除试卷分组
if unified_setting || (course_group_ids.size == 0)
@@ -426,7 +428,8 @@ class ExercisesController < ApplicationController
:answer_open => answer_open,
:exercise_status => exercise_status_n,
:publish_time => params_publish_time,
- :end_time => params_end_time
+ :end_time => params_end_time,
+ :assistant_auth => assistant_auth
}
@exercise.update!(exercise_params)
@exercise.exercise_group_settings.destroy_all
diff --git a/app/views/exercises/common_header.json.jbuilder b/app/views/exercises/common_header.json.jbuilder
index d43d7c3f8..7843c260e 100644
--- a/app/views/exercises/common_header.json.jbuilder
+++ b/app/views/exercises/common_header.json.jbuilder
@@ -1,5 +1,5 @@
json.course_is_end @course.is_end # true表示已结束,false表示未结束
-json.extract! @exercise, :id,:exercise_name,:exercise_description,:show_statistic
+json.extract! @exercise, :id,:exercise_name,:exercise_description,:show_statistic,:assistant_auth
json.time (@user_left_time.to_i / 60)
json.exercise_status @ex_status
diff --git a/app/views/exercises/index.json.jbuilder b/app/views/exercises/index.json.jbuilder
index c8f6cd380..e1c8bd3a4 100644
--- a/app/views/exercises/index.json.jbuilder
+++ b/app/views/exercises/index.json.jbuilder
@@ -2,7 +2,7 @@
if @exercises_count > 0
json.exercises do
json.array! @exercises do |exercise|
- json.extract! exercise, :id, :exercise_name,:is_public,:created_at
+ json.extract! exercise, :id, :exercise_name,:is_public,:created_at,:assistant_auth
if @is_teacher_or == 2
second_left = get_exercise_left_time(exercise,@current_user_)
json.time second_left.present? ? (second_left / 60) : nil
diff --git a/db/migrate/20200311082736_add_auth_to_exercise.rb b/db/migrate/20200311082736_add_auth_to_exercise.rb
new file mode 100644
index 000000000..fceb96e0c
--- /dev/null
+++ b/db/migrate/20200311082736_add_auth_to_exercise.rb
@@ -0,0 +1,5 @@
+class AddAuthToExercise < ActiveRecord::Migration[5.2]
+ def change
+ add_column :exercises, :assistant_auth, :boolean, default: 1
+ end
+end
From 6f12e3de097841e7c70b77448c7189da65e39932 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com>
Date: Wed, 11 Mar 2020 16:43:39 +0800
Subject: [PATCH 2/2] =?UTF-8?q?=E8=B0=83=E6=95=B4?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../src/modules/question/Questionitem_banks.js | 3 ++-
.../modules/question/component/ChoquesEditor.js | 12 ++++++++++++
.../question/component/JudquestionEditor.js | 15 +++++++++++++++
.../modules/question/component/SingleEditor.js | 12 ++++++++++++
4 files changed, 41 insertions(+), 1 deletion(-)
diff --git a/public/react/src/modules/question/Questionitem_banks.js b/public/react/src/modules/question/Questionitem_banks.js
index 345ca9753..503e6f5de 100644
--- a/public/react/src/modules/question/Questionitem_banks.js
+++ b/public/react/src/modules/question/Questionitem_banks.js
@@ -529,6 +529,7 @@ class Questionitem_banks extends Component {
}
handleShowUploadImage=(url)=>{
+ debugger
this.setState({
url:url
})
@@ -550,7 +551,7 @@ class Questionitem_banks extends Component {
>
{url?
-