From f1eb51c1d5b3ad311826554498ba541ede4f424b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com> Date: Tue, 23 Jul 2019 13:25:17 +0800 Subject: [PATCH 1/6] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/react/src/AppConfig.js | 7 ++--- .../courses/coursesPublic/Addcourses.js | 30 ++++++++++++++----- 2 files changed, 25 insertions(+), 12 deletions(-) diff --git a/public/react/src/AppConfig.js b/public/react/src/AppConfig.js index 5721c88a9..8cca8205f 100644 --- a/public/react/src/AppConfig.js +++ b/public/react/src/AppConfig.js @@ -18,10 +18,9 @@ function locationurl(list){ } // TODO 开发期多个身份切换 -const debugType ="" -// window.location.search.indexOf('debug=t') != -1 ? 'teacher' : -// window.location.search.indexOf('debug=s') != -1 ? 'student' : 'admin' -// window._debugType = debugType; +const debugType =window.location.search.indexOf('debug=t') != -1 ? 'teacher' : + window.location.search.indexOf('debug=s') != -1 ? 'mfp2guqj3' : 'admin' +window._debugType = debugType; export function initAxiosInterceptors(props) { // TODO 避免重复的请求 https://github.com/axios/axios#cancellation diff --git a/public/react/src/modules/courses/coursesPublic/Addcourses.js b/public/react/src/modules/courses/coursesPublic/Addcourses.js index 914a82c6d..b7d46eac6 100644 --- a/public/react/src/modules/courses/coursesPublic/Addcourses.js +++ b/public/react/src/modules/courses/coursesPublic/Addcourses.js @@ -117,7 +117,7 @@ class Addcourses extends Component{ hidetojoinclass=()=>{ - + let {Addcoursestype}=this.props; // console.log(this.props) this.setState({ invite_code:undefined, @@ -132,11 +132,16 @@ class Addcourses extends Component{ student:null, Addcoursestypes:false }) - this.props.hideAddcoursestype(); + + if(Addcoursestype===true){ + this.props.hideAddcoursestype(); + } + } submitasyn=(course_id)=>{ - let{professor}=this.state; + let{professor,Addcoursestype}=this.state; + if(professor===1){ this.setState({ loadtype:true, @@ -145,13 +150,17 @@ class Addcourses extends Component{ modalSave:(course_id)=>this.submitasyns(course_id), Addcoursestype:false }) - this.props.hideAddcoursestype(); + if(Addcoursestype===true){ + this.props.hideAddcoursestype(); + } }else{ // let{course_id}=this.state; this.setState({ Addcoursestype:false }) - this.props.hideAddcoursestype(); + if(Addcoursestype===true){ + this.props.hideAddcoursestype(); + } window.location.href ="/courses/"+course_id+"/students"; } @@ -161,6 +170,7 @@ class Addcourses extends Component{ } submittojoinclass=()=>{ + let{Addcoursestype}=this.state; this.setState({ isSpin:true }) @@ -207,7 +217,9 @@ class Addcourses extends Component{ message:"提示", description:response.data.message }); - this.props.hideAddcoursestype(); + if(Addcoursestype===true){ + this.props.hideAddcoursestype(); + } // this.props.showNotification(response.data.message); @@ -220,7 +232,9 @@ class Addcourses extends Component{ this.setState({ Addcoursestype:false }) - this.props.hideAddcoursestype(); + if(Addcoursestype===true){ + this.props.hideAddcoursestype(); + } // this.setState({ @@ -318,7 +332,7 @@ class Addcourses extends Component{ keyboard={false} className={"HomeworkModal"} title="加入课堂" - visible={Addcoursestype===undefined?Addcoursestypes:Addcoursestype} + visible={Addcoursestype===undefined||Addcoursestype===false?Addcoursestypes:Addcoursestype} closable={false} footer={null} destroyOnClose={true} From 1a45a9bee848336fc4443fa83fc1d2143c46e70b Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Tue, 23 Jul 2019 13:47:27 +0800 Subject: [PATCH 2/6] =?UTF-8?q?=E5=8A=A0=E5=85=A5=E8=AF=BE=E5=A0=82?= =?UTF-8?q?=E7=9A=84=E6=8E=A5=E5=8F=A3=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/courses_controller.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/controllers/courses_controller.rb b/app/controllers/courses_controller.rb index 542c33652..7a135b031 100644 --- a/app/controllers/courses_controller.rb +++ b/app/controllers/courses_controller.rb @@ -891,7 +891,7 @@ class CoursesController < ApplicationController # end # 创建学生身份 - if params[:student].present? + if params[:student].present? && params[:student].to_i == 1 existing_student = CourseMember.find_by(course_id: course.id, role: %i[STUDENT], user_id: current_user.id) if existing_student.present? # 如果在该课堂已经存在学生身份,且邀请码为分班邀请码,则将其直接加入分班 @@ -911,7 +911,7 @@ class CoursesController < ApplicationController end # 创建教师身份 - if params[:professor].present? || params[:assistant_professor].present? + if (params[:professor].present? && params[:professor].to_i == 1) || (params[:assistant_professor].present? && params[:assistant_professor].to_i == 1) teacher_already_exist = current_user.teacher_of_course_non_active? course unless teacher_already_exist existing_course_message = CourseMessage.find_by(course_id: course.id, course_message_id: current_user.id, @@ -920,8 +920,8 @@ class CoursesController < ApplicationController course_message = CourseMessage.new(course_id: course.id, user_id: course.tea_id, status: 0, course_message_id: current_user.id, course_message_type: "JoinCourseRequest", viewed: false) - course_message.content = 2 if params[:professor].present? - course_message.content = 3 if params[:assistant_professor].present? + course_message.content = 2 if params[:professor].present? && params[:professor].to_i == 1 + course_message.content = 3 if params[:assistant_professor].present? && params[:assistant_professor].to_i == 1 course_message.save! From b63d94df24d84d7dbab98b5b040458bb80ddb9d2 Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Tue, 23 Jul 2019 14:10:10 +0800 Subject: [PATCH 3/6] =?UTF-8?q?=E5=8A=A0=E5=85=A5=E8=AF=BE=E5=A0=82?= =?UTF-8?q?=E7=9A=84=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/courses_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/courses_controller.rb b/app/controllers/courses_controller.rb index 7a135b031..6042fbc9a 100644 --- a/app/controllers/courses_controller.rb +++ b/app/controllers/courses_controller.rb @@ -14,7 +14,7 @@ class CoursesController < ApplicationController before_action :require_login, except: [:index, :show, :students, :teachers, :board_list, :mine, :all_course_groups, :left_banner, :top_banner] before_action :check_auth, except: [:index, :show, :students, :teachers, :board_list, :mine, :all_course_groups, - :left_banner, :top_banner, :apply_to_join_course] + :left_banner, :top_banner, :apply_to_join_course, :exit_course] before_action :set_course, :user_course_identity, only: [:show, :update, :destroy, :settings, :set_invite_code_halt, :set_public_or_private, :search_teacher_candidate, :teachers, :apply_teachers, :top_banner, :left_banner, :add_teacher_popup, :add_teacher, From 4e33c981900b8362db616c51fa92e81871fb9dc0 Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Tue, 23 Jul 2019 14:13:26 +0800 Subject: [PATCH 4/6] =?UTF-8?q?=E6=96=B0=E5=BB=BA=E5=AE=9E=E8=AE=AD?= =?UTF-8?q?=E8=AF=BE=E7=A8=8B=E7=9A=84=E6=9D=83=E9=99=90=E6=8E=A7=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/subjects_controller.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/controllers/subjects_controller.rb b/app/controllers/subjects_controller.rb index 064061058..e8192ae72 100644 --- a/app/controllers/subjects_controller.rb +++ b/app/controllers/subjects_controller.rb @@ -1,7 +1,7 @@ class SubjectsController < ApplicationController before_action :require_login, :check_auth, except: [:index] # before_action :check_auth, except: [:index] - before_action :find_subject, except: [:index, :create, :append_to_stage] + before_action :find_subject, except: [:index, :create, :new, :append_to_stage] before_action :allowed, only: [:update, :edit, :destroy, :publish, :cancel_publish, :cancel_has_publish, :search_members, :add_subject_members, :statistics, :shixun_report, :school_report, :up_member_position, :down_member_position] @@ -94,6 +94,10 @@ class SubjectsController < ApplicationController @subject.increment!(:visits) end + def new + normal_status("") + end + def create ActiveRecord::Base.transaction do begin From ed10b2c98145711f0f8216e9af4a238ee7e22729 Mon Sep 17 00:00:00 2001 From: SylorHuang Date: Tue, 23 Jul 2019 14:34:10 +0800 Subject: [PATCH 5/6] fixbug --- app/views/exercise_questions/_exercise_questions.json.jbuilder | 2 +- app/views/exercises/edit.json.jbuilder | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/app/views/exercise_questions/_exercise_questions.json.jbuilder b/app/views/exercise_questions/_exercise_questions.json.jbuilder index bfaf6b736..cfae5429b 100644 --- a/app/views/exercise_questions/_exercise_questions.json.jbuilder +++ b/app/views/exercise_questions/_exercise_questions.json.jbuilder @@ -21,7 +21,7 @@ if question.question_type <= 2 #当为选择题或判断题时,只显示选 user_answer_b = user_answer.include?(a.id) json.c_position (index+1) if ex_choice_random_boolean #当选项随机时,选项位置以此为准,否则不出现 json.choice_id a.id - json.choice_text "#{(index+65).chr}.#{a.choice_text}" + json.choice_text (edit_type.present? ? a.choice_text : "#{(index+65).chr}.#{a.choice_text}") json.choice_position a.choice_position if exercise_type == 1 || exercise_type == 4 #1为教师编辑/预览 试卷或问题,2为空白试卷,即标准答案和用户答案都不显示,3为用户开始答题的显示,4为老师评阅试卷或学生在截止后查看试卷 json.standard_boolean standard_answer_b diff --git a/app/views/exercises/edit.json.jbuilder b/app/views/exercises/edit.json.jbuilder index 71a6fcf07..980e6735a 100644 --- a/app/views/exercises/edit.json.jbuilder +++ b/app/views/exercises/edit.json.jbuilder @@ -16,7 +16,8 @@ json.exercise_questions do exercise_type:1, user_answer:[], shixun_type:0, - ques_position:nil + ques_position:nil, + edit_type:true end end From e4f464a01ee165c270ca7cacc551905705589913 Mon Sep 17 00:00:00 2001 From: SylorHuang Date: Tue, 23 Jul 2019 14:38:07 +0800 Subject: [PATCH 6/6] fixbug --- app/views/exercise_questions/edit.json.jbuilder | 3 ++- app/views/exercises/edit.json.jbuilder | 3 +-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/views/exercise_questions/edit.json.jbuilder b/app/views/exercise_questions/edit.json.jbuilder index 35db720c7..bf9272026 100644 --- a/app/views/exercise_questions/edit.json.jbuilder +++ b/app/views/exercise_questions/edit.json.jbuilder @@ -6,4 +6,5 @@ json.partial! "exercise_questions/exercise_questions", shixun_challenges: @exercise_question_shixun, exercise_type:1, user_answer:[], - ques_position:nil \ No newline at end of file + ques_position:nil, + edit_type:true diff --git a/app/views/exercises/edit.json.jbuilder b/app/views/exercises/edit.json.jbuilder index 980e6735a..71a6fcf07 100644 --- a/app/views/exercises/edit.json.jbuilder +++ b/app/views/exercises/edit.json.jbuilder @@ -16,8 +16,7 @@ json.exercise_questions do exercise_type:1, user_answer:[], shixun_type:0, - ques_position:nil, - edit_type:true + ques_position:nil end end