Merge remote-tracking branch 'origin/dev_aliyun' into dev_aliyun

topic_bank
杨树明 6 years ago
commit 5d4a8c3fe4

@ -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忘记密码

@ -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

@ -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

@ -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

@ -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

@ -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

@ -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

@ -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
# 是否在补交阶段内

@ -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: 'http://pre-newweb.educoder.net',
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);//分享给好友
@ -335,7 +336,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 {

Loading…
Cancel
Save