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

chromesetting
daiao 5 years ago
commit d7e9da54e7

@ -299,7 +299,7 @@ class ApplicationController < ActionController::Base
# and starts a session if needed
def find_current_user
uid_logger("user setup start: session[:user_id] is #{session[:user_id]}")
uid_logger("0000000000000user setup start: session[:user_id] is #{session[:"#{default_yun_session}"]}")
uid_logger("0000000000000user setup start: default_yun_session is #{default_yun_session}, session[:current_user_id] is #{session[:"#{default_yun_session}"]}")
current_domain_session = session[:"#{default_yun_session}"]
if current_domain_session
# existing session

@ -6,7 +6,6 @@ module LaboratoryHelper
helper_method :current_laboratory
helper_method :default_setting
helper_method :default_yun_session
end
def current_laboratory
@ -26,7 +25,7 @@ module LaboratoryHelper
end
def default_yun_session
@_default_yun_session = "#{request.subdomain.split('.').first}_user_id"
# @_default_yun_session = "#{current_laboratory.try(:identifier).split('.').first}_user_id"
laboratory ||= (Laboratory.find_by_subdomain(request.subdomain) || Laboratory.find(1))
@_default_yun_session = "#{laboratory.try(:identifier).split('.').first}_user_id"
end
end

@ -47,12 +47,16 @@ module LoginHelper
User.current.delete_session_token(session[:tk])
self.logged_user = nil
end
# 云上实验室退出清理当前session
laboratory ||= (Laboratory.find_by_subdomain(request.subdomain) || Laboratory.find(1))
default_yun_session = "#{laboratory.try(:identifier).split('.').first}_user_id"
# end
session[:"#{default_yun_session}"] = nil
end
# Sets the logged in user
def logged_user=(user)
reset_session
# reset_session
if user && user.is_a?(User)
User.current = user
start_user_session(user)

@ -329,7 +329,7 @@ class User < ApplicationRecord
# 实训路径合作者、admin
def manager_of_subject?(subject)
subject.subject_members.exists?(user_id: id, role: [1,2]) || admin?
subject.subject_members.exists?(user_id: id, role: [1,2]) || admin? || business?
end
# 实训管理员实训合作者、admin

@ -30,8 +30,22 @@ class Addshixuns extends Component {
this.props.modalCancel()
}
//判断是否为空
getshixunname( str ){
if ( str == "" ) return true;
var regu = "^[ ]+$";
var re = new RegExp(regu);
return re.test(str);
}
modalSave=()=>{
let {shixunname}=this.state;
if(this.getshixunname(shixunname)===true){
this.setState({
shixunzero:true
})
return
}
if(shixunname===undefined||shixunname.length===0){
this.setState({
shixunzero:true

@ -420,7 +420,35 @@ class DetailCards extends Component{
{
idsum===key&&pathCardsedittype===true?'':
this.props.detailInfoList===undefined?"":this.props.detailInfoList.allow_statistics===true?
this.props.detailInfoList===undefined?"":
this.props.current_user&&this.props.current_user.admin===true||this.props.current_user&&this.props.current_user.business===true?
<a>
<a className="fr mtf3">
{ editbuttomtype===true?'':
<Tooltip placement="bottom" title="编辑"
onClick={() => this.pathCardsedit(key, item.stage_id)}>
<i className="iconfont icon-bianjidaibeijing font-22 color-green"></i>
</Tooltip>
}
</a>
{
pathCardsList.length=== key+1?"":<a className="fr ring-op-green mr20" onClick={()=>this.operations(item.down_path)}>
<Tooltip placement="bottom" title="向下移动">
<img src={getImageUrl("images/educoder/icon/movedown.svg")} className="fl mt2 ml4"/>
</Tooltip>
</a>
}
{key===0?"":
<a className="fr ring-op-green mr20" onClick={()=>this.operations(item.up_path)}>
<Tooltip placement="bottom" title="向上移动">
<img src={getImageUrl("images/educoder/icon/moveup.svg")} className="fl mt2 ml4"/>
</Tooltip>
</a>}
</a>:
this.props.detailInfoList.allow_statistics===true?
<a>
<a className="fr mtf3">
{ editbuttomtype===true?'':
@ -453,7 +481,14 @@ class DetailCards extends Component{
{
idsum === key && pathCardsedittype === true ?
this.props.detailInfoList===undefined?"":this.props.detailInfoList.allow_statistics===true?
this.props.detailInfoList===undefined?"":
this.props.current_user&&this.props.current_user.admin===true||this.props.current_user&&this.props.current_user.business===true?
<a className="fr" onClick={()=>this.delectpathCardsedit(item.stage_id)}>
<Tooltip placement="bottom" title="删除">
<i className="iconfont icon-shanchu color-grey-c font-14 font-n"></i>
</Tooltip>
</a>:
this.props.detailInfoList.allow_statistics===true?
<a className="fr" onClick={()=>this.delectpathCardsedit(item.stage_id)}>
<Tooltip placement="bottom" title="删除">
<i className="iconfont icon-shanchu color-grey-c font-14 font-n"></i>
@ -471,8 +506,36 @@ class DetailCards extends Component{
<div>
{
item.shixuns_list && item.shixuns_list.map((line,index)=>{
{this.props.current_user&&this.props.current_user.admin===true||this.props.current_user&&this.props.current_user.business===true?
item.shixuns_list && item.shixuns_list.map((line,index)=>{
return(
<div className="clearfix paragraph lineh-30" onMouseEnter={()=>this.showparagraph(key,index)} onMouseLeave={this.hideparagraph}>
<li className="fl li-width63">
<span className="progressRing mr10">
{
line.complete_status === 1 ?<i className="iconfont icon-wancheng progressRing-over font-18 mt10"></i>
:<i className="iconfont icon-bofang progressRing-part font-18 mt10"></i>
}
</span>
<span className={"paragraph_name color-grey3"}>
<span className="subject_stage_shixun_index">{key+1}</span>-{index+1}&nbsp;&nbsp;{line.shixun_name}
</span>
</li>
<li className={showparagraph===false?"none":"fr status_li"}>
{
showparagraphkey===key&&showparagraphindex===index?<div>
<Link to={'/shixuns/'+line.identifier+'/challenges'} className="mr30 color-blue_4C shixun_detail pointer fl" target="_blank">查看详情</Link>
</div>:""
}
</li>
</div>)
}):item.shixuns_list && item.shixuns_list.map((line,index)=>{
return(
<div className="clearfix paragraph lineh-30" onMouseEnter={()=>this.showparagraph(key,index)} onMouseLeave={this.hideparagraph}>

Loading…
Cancel
Save