Merge branch 'dev_aliyun' of https://bdgit.educoder.net/Hjqreturn/educoder into topic_bank

topic_bank
杨树林 6 years ago
commit fb8938aed2

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

@ -29,7 +29,7 @@
|| navigator.userAgent.indexOf('MSIE 10') != -1 )
&&
location.pathname.indexOf("/compatibility") == -1) {
debugger;
// location.href = './compatibility'
location.href = '/compatibility.html'
}

@ -296,8 +296,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;
@ -319,10 +320,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);//分享给好友

@ -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 {
>
</AutoComplete>
)}
<span className={"fl ml20 "}>
<Spin size="small" spinning={this.state.smallspinning}/>
</span>
<span className={"newcoursestitle fl"}>
{/*(输入内容出现匹配的下拉菜单←同账号管理的单位信息填写)*/}
</span>

@ -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 {
>
</AutoComplete>
)}
<span className={"fl ml20 "}>
<Spin size="small" spinning={this.state.smallspinning}/>
</span>
<span className={"newcoursestitle fl"}>
{/*(输入内容出现匹配的下拉菜单←同账号管理的单位信息填写)*/}
</span>
</span>
<div id='isschool'></div>
</Form.Item>

Loading…
Cancel
Save