From f7167b69fb8ceefb452f8227898265672bceb7db Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Fri, 6 Sep 2019 14:49:05 +0800 Subject: [PATCH 1/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 --- app/controllers/application_controller.rb | 7 +++++++ app/controllers/exercise_banks_controller.rb | 2 -- app/controllers/gtopic_banks_controller.rb | 2 -- app/controllers/homework_banks_controller.rb | 2 -- app/controllers/task_banks_controller.rb | 3 +-- app/helpers/courses_helper.rb | 2 +- 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 6046be5af..86d6312ab 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -45,6 +45,13 @@ class ApplicationController < ActionController::Base uid_logger("###############user_course_identity:#{@user_course_identity}") end + # 题库的访问权限 + def bank_visit_auth + tip_exception("未通过职业认证") if current_user.is_teacher? && !current_user.certification_teacher? && !current_user.admin? && @bank.user_id != current_user.id && @bank.is_public + tip_exception(403, "无权限") unless @bank.user_id == current_user.id || current_user.admin? || + (current_user.certification_teacher? && @bank.is_public) + end + # 判断用户的邮箱或者手机是否可用 # params[:type] 1: 注册;2:忘记密码 diff --git a/app/controllers/exercise_banks_controller.rb b/app/controllers/exercise_banks_controller.rb index ce6259c19..160393e0c 100644 --- a/app/controllers/exercise_banks_controller.rb +++ b/app/controllers/exercise_banks_controller.rb @@ -64,8 +64,6 @@ class ExerciseBanksController < ApplicationController def find_bank @bank = ExerciseBank.find_by!(id: params[:id]) - tip_exception(403, "无权限") unless @bank.user_id == current_user.id || current_user.admin? || - (current_user.certification_teacher? && @bank.is_public) end def bank_admin diff --git a/app/controllers/gtopic_banks_controller.rb b/app/controllers/gtopic_banks_controller.rb index 291302bc2..e0382b21a 100644 --- a/app/controllers/gtopic_banks_controller.rb +++ b/app/controllers/gtopic_banks_controller.rb @@ -23,8 +23,6 @@ class GtopicBanksController < ApplicationController def find_bank @bank = GtopicBank.find_by!(id: params[:id]) - tip_exception(403, "无权限") unless @bank.user_id == current_user.id || current_user.admin? || - (current_user.certification_teacher? && @bank.is_public) end def bank_admin diff --git a/app/controllers/homework_banks_controller.rb b/app/controllers/homework_banks_controller.rb index 7bdf425bf..31e733245 100644 --- a/app/controllers/homework_banks_controller.rb +++ b/app/controllers/homework_banks_controller.rb @@ -44,8 +44,6 @@ class HomeworkBanksController < ApplicationController def find_bank @bank = HomeworkBank.find_by!(id: params[:id]) - tip_exception(403, "无权限") unless @bank.user_id == current_user.id || current_user.admin? || - (current_user.certification_teacher? && @bank.is_public) end def bank_admin diff --git a/app/controllers/task_banks_controller.rb b/app/controllers/task_banks_controller.rb index e2e7f0a1a..1d3aca955 100644 --- a/app/controllers/task_banks_controller.rb +++ b/app/controllers/task_banks_controller.rb @@ -1,6 +1,7 @@ class TaskBanksController < ApplicationController before_action :require_login before_action :find_bank + before_action :bank_visit_auth before_action :bank_admin, only: [:update] def show @@ -25,8 +26,6 @@ class TaskBanksController < ApplicationController def find_bank @bank = GtaskBank.find_by!(id: params[:id]) - tip_exception(403, "无权限") unless @bank.user_id == current_user.id || current_user.admin? || - (current_user.certification_teacher? && @bank.is_public) end def bank_admin diff --git a/app/helpers/courses_helper.rb b/app/helpers/courses_helper.rb index b98073d7c..cdb3225d6 100644 --- a/app/helpers/courses_helper.rb +++ b/app/helpers/courses_helper.rb @@ -111,7 +111,7 @@ module CoursesHelper when "announcement" course.informs.count when "online_learning" - course.subject.stage_shixuns_count + course.subject&.shixuns_count end end From 7c13d9a4d83f3ed92a96c8325e828f495cd14aef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com> Date: Fri, 6 Sep 2019 15:01:01 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E6=96=B0=E5=BB=BA=E8=AF=BE=E5=A0=82?= =?UTF-8?q?=E6=90=9C=E7=B4=A2=E5=AD=A6=E6=A0=A1=E5=A2=9E=E5=8A=A0=E5=8A=A0?= =?UTF-8?q?=E8=BD=BD=E6=95=88=E6=9E=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/modules/courses/new/CoursesNew.js | 38 +++++++++++++------ .../src/modules/courses/new/Goldsubject.js | 19 ++++++++-- 2 files changed, 42 insertions(+), 15 deletions(-) diff --git a/public/react/src/modules/courses/new/CoursesNew.js b/public/react/src/modules/courses/new/CoursesNew.js index a2cc45916..c15a6e9a0 100644 --- a/public/react/src/modules/courses/new/CoursesNew.js +++ b/public/react/src/modules/courses/new/CoursesNew.js @@ -48,6 +48,7 @@ class CoursesNew extends Component { addonAfteronelenone:0, addonAfteronelentwo:0, bordebool:false, + smallspinning:false } } componentDidMount() { @@ -450,8 +451,10 @@ class CoursesNew extends Component { // }); this.setState({ fetching: true, - school: value + school: value, + smallspinning:true }) + this.getschool(value) } }; @@ -478,6 +481,7 @@ class CoursesNew extends Component { }; getschool=(value)=>{ + // this.props.form.setFieldsValue({ // school: value // }) @@ -488,20 +492,27 @@ class CoursesNew extends Component { } }).then((result)=>{ if(result){ - if (result.data.status===0) { - this.setState({ - searchlistscholl: result.data.school_names, - - }) - if(result.data.school_names.length!=0){ - this.setState({ - fetching: false - }) - } - } + if (result.data.status===0) { + this.setState({ + searchlistscholl: result.data.school_names, + smallspinning:false + }) + if(result.data.school_names.length!=0){ + this.setState({ + fetching: false, + }) + } + }else{ + this.setState({ + smallspinning:false + }) + } } }).catch((error)=>{ console.log(error) + this.setState({ + smallspinning:false + }) }) } showApplyForAddOrgModal = () => { @@ -895,6 +906,9 @@ class CoursesNew extends Component { > )} + + + {/*(输入内容出现匹配的下拉菜单←同账号管理的单位信息填写)*/} diff --git a/public/react/src/modules/courses/new/Goldsubject.js b/public/react/src/modules/courses/new/Goldsubject.js index 7e4d42418..bb9480178 100644 --- a/public/react/src/modules/courses/new/Goldsubject.js +++ b/public/react/src/modules/courses/new/Goldsubject.js @@ -55,6 +55,7 @@ class Goldsubject extends Component { addonAfteronelentwo:"", Whethertocreateanewclassroom:true, bordebool:false, + smallspinning:false } } // disabledEndDate= endValue => { @@ -570,7 +571,8 @@ class Goldsubject extends Component { // }); this.setState({ fetching: true, - school: value + school: value, + smallspinning:true }) this.getschool(value) } @@ -598,6 +600,7 @@ class Goldsubject extends Component { }; getschool=(value)=>{ + // this.props.form.setFieldsValue({ // school: value // }) @@ -611,17 +614,24 @@ class Goldsubject extends Component { if (result.data.status===0) { this.setState({ searchlistscholl: result.data.school_names, - + smallspinning:false }) if(result.data.school_names.length!=0){ this.setState({ fetching: false }) } + }else{ + this.setState({ + smallspinning:false + }) } } }).catch((error)=>{ console.log(error) + this.setState({ + smallspinning:false + }) }) } showApplyForAddOrgModal = () => { @@ -1036,9 +1046,12 @@ class Goldsubject extends Component { > )} + + + {/*(输入内容出现匹配的下拉菜单←同账号管理的单位信息填写)*/} - +