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

dev_hss
caicai8 6 years ago
commit e3cc889db8

@ -47,7 +47,7 @@ class ApplicationController < ActionController::Base
# 题库的访问权限 # 题库的访问权限
def bank_visit_auth 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(-2,"未通过职业认证") 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? || tip_exception(403, "无权限") unless @bank.user_id == current_user.id || current_user.admin? ||
(current_user.certification_teacher? && @bank.is_public) (current_user.certification_teacher? && @bank.is_public)
end end

@ -65,7 +65,7 @@ class Users::QuestionBanksController < Users::BaseController
def check_user_permission! def check_user_permission!
if params[:type] == 'publicly' if params[:type] == 'publicly'
render_error("未通过职业认证") unless User.current.admin? || User.current.certification_teacher? normal_status(-2,"未通过职业认证") unless User.current.admin? || User.current.certification_teacher?
else else
render_forbidden unless User.current.admin? || User.current.is_teacher? render_forbidden unless User.current.admin? || User.current.is_teacher?
end end

@ -21,16 +21,16 @@ let hashTimeout
// TODO 开发期多个身份切换 // TODO 开发期多个身份切换
let debugType ="" let debugType =""
if (isDev) { // if (isDev) {
const _search = window.location.search; // const _search = window.location.search;
let parsed = {}; // let parsed = {};
if (_search) { // if (_search) {
parsed = queryString.parse(_search); // parsed = queryString.parse(_search);
} // }
debugType = window.location.search.indexOf('debug=t') != -1 ? 'teacher' : // debugType = window.location.search.indexOf('debug=t') != -1 ? 'teacher' :
window.location.search.indexOf('debug=s') != -1 ? 'student' : // window.location.search.indexOf('debug=s') != -1 ? 'student' :
window.location.search.indexOf('debug=a') != -1 ? 'admin' : parsed.debug || 'admin' // window.location.search.indexOf('debug=a') != -1 ? 'admin' : parsed.debug || 'admin'
} // }
window._debugType = debugType; window._debugType = debugType;
export function initAxiosInterceptors(props) { export function initAxiosInterceptors(props) {

@ -70,20 +70,22 @@ class InfosTopics extends Component{
// }else{ // }else{
// //
// } // }
this.setState({ this.setState({
isSpin:true isSpin:true
}) })
let types=this.props.match.params.topicstype; let types=this.props.match.params.topicstype;
let user_id=undefined; let user_id="";
if(types==="publicly"){ if(types==="publicly"){
user_id=this.props.current_user&&this.props.current_user.login; user_id=this.props.current_user&&this.props.current_user.login;
}else{ }else{
user_id=this.props.match.params&&this.props.match.params.username; user_id=this.props.match.params&&this.props.match.params.username;
} }
if(user_id!=undefined){
if(user_id===undefined){
user_id=this.props.match.params&&this.props.match.params.username;
}
let {per_page}=this.state; let {per_page}=this.state;
let url=`/users/${user_id}/question_banks.json`; let url=`/users/${user_id}/question_banks.json`;
@ -107,11 +109,7 @@ class InfosTopics extends Component{
isSpin:false isSpin:false
}) })
}); });
}else{
this.setState({
isSpin:false
})
}
} }
searchCategory=(type)=>{ searchCategory=(type)=>{

Loading…
Cancel
Save