From 039a4e7f672e840c9bbf9f8b25b8268900d1bc07 Mon Sep 17 00:00:00 2001 From: hjm <63528605@qq.com> Date: Fri, 6 Sep 2019 13:48:06 +0800 Subject: [PATCH 1/5] event --- public/react/src/App.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/react/src/App.js b/public/react/src/App.js index 520855519..00f07ecbc 100644 --- a/public/react/src/App.js +++ b/public/react/src/App.js @@ -335,7 +335,7 @@ class App extends Component { } } disableVideoContextMenu = () => { - window.$( "body" ).on( "mousedown", "video", function() { + window.$( "body" ).on( "mousedown", "video", function(event) { if(event.which === 3) { window.$('video').bind('contextmenu',function () { return false; }); } else { From b95c8c4f2e9d2fce676574813faafe77164992be Mon Sep 17 00:00:00 2001 From: hjm <63528605@qq.com> Date: Fri, 6 Sep 2019 13:59:22 +0800 Subject: [PATCH 2/5] href --- public/react/src/App.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/react/src/App.js b/public/react/src/App.js index 00f07ecbc..087323521 100644 --- a/public/react/src/App.js +++ b/public/react/src/App.js @@ -286,7 +286,7 @@ class App extends Component { const wx = window.wx const url = '/wechats/js_sdk_signature.json' axios.post(url, { - url: 'http://pre-newweb.educoder.net', + url: window.location.href.split('#')[0], }).then((response) => { console.log('got res') const data = response.data; From 0170247b4a85705e0d744ef7401e1d86a9f2a866 Mon Sep 17 00:00:00 2001 From: hjm <63528605@qq.com> Date: Fri, 6 Sep 2019 14:09:23 +0800 Subject: [PATCH 3/5] currentUrl --- public/react/src/App.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/public/react/src/App.js b/public/react/src/App.js index 087323521..3013eca7b 100644 --- a/public/react/src/App.js +++ b/public/react/src/App.js @@ -285,8 +285,9 @@ class App extends Component { if (window.wx) { const wx = window.wx const url = '/wechats/js_sdk_signature.json' + const currentUrl = window.location.href.split('#')[0] axios.post(url, { - url: window.location.href.split('#')[0], + url: currentUrl, }).then((response) => { console.log('got res') const data = response.data; @@ -308,10 +309,10 @@ class App extends Component { wx.ready(function () { console.log('wx is ready') var shareData = { - title: '这是是分享标题', - desc: '这是是摘要', - link: 'http://pre-newweb.educoder.net', - imgUrl: 'http://pre-newweb.educoder.net/images/educoder/index/subject/subject15.jpg' + title: 'EduCoder', + desc: '创新源于实践', + link: currentUrl, + imgUrl: currentUrl + '/images/educoder/index/subject/subject15.jpg' }; wx.onMenuShareAppMessage(shareData);//分享给好友 From 73ce37baeee76ec565444598dd5b32a5e1c2c50c Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Fri, 6 Sep 2019 14:14:59 +0800 Subject: [PATCH 4/5] =?UTF-8?q?=E8=AF=BE=E5=A0=82=E5=AD=A6=E7=94=9F?= =?UTF-8?q?=E8=BF=9B=E4=BD=9C=E5=93=81=E5=88=97=E8=A1=A8=E6=8A=A5=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/graduation_task.rb | 2 +- app/models/homework_common.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/models/graduation_task.rb b/app/models/graduation_task.rb index e247f2b6e..17309101d 100644 --- a/app/models/graduation_task.rb +++ b/app/models/graduation_task.rb @@ -37,7 +37,7 @@ class GraduationTask < ApplicationRecord def user_work user_id - work = self.graduation_works.find_by(user_id: user_id) + work = self.graduation_works.find_by(user_id: user_id) || GraduationWork.create!(graduation_task_id: id, user_id: user_id) end def task_type_name diff --git a/app/models/homework_common.rb b/app/models/homework_common.rb index c33bbca0d..4c8f94a42 100644 --- a/app/models/homework_common.rb +++ b/app/models/homework_common.rb @@ -102,7 +102,7 @@ class HomeworkCommon < ApplicationRecord end def user_work user_id - work = self.student_works.find_by_user_id(user_id) + work = self.student_works.find_by_user_id(user_id) || StudentWork.create!(homework_common_id: id, user_id: user_id) end # 是否在补交阶段内 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 5/5] =?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