chromesetting
cxt 5 years ago
commit b673fa1b1c

@ -68,7 +68,6 @@ class AttachmentsController < ApplicationController
@attachment.author_id = current_user.id @attachment.author_id = current_user.id
@attachment.disk_directory = month_folder @attachment.disk_directory = month_folder
@attachment.cloud_url = remote_path @attachment.cloud_url = remote_path
@attachment.disk_directory = save_path
@attachment.save! @attachment.save!
else else
logger.info "文件已存在id = #{@attachment.id}, filename = #{@attachment.filename}" logger.info "文件已存在id = #{@attachment.id}, filename = #{@attachment.filename}"

@ -67,15 +67,11 @@ class ShixunsController < ApplicationController
## 排序参数 ## 排序参数
bsort = params[:sort] || 'desc' bsort = params[:sort] || 'desc'
case params[:order_by] || 'publish_time' case params[:order_by] || 'new'
when 'new'
@shixuns = @shixuns.order("shixuns.status = 2 desc, shixuns.created_at #{bsort}")
when 'hot' when 'hot'
@shixuns = @shixuns.order("shixuns.status = 2 desc, shixuns.myshixuns_count #{bsort}") @shixuns = @shixuns.order("shixuns.public = 2 desc, shixuns.myshixuns_count #{bsort}")
when 'mine'
@shixuns = @shixuns.order("shixuns.created_at #{bsort}")
else else
@shixuns = @shixuns.order("shixuns.status = 2 desc, shixuns.publish_time #{bsort}") @shixuns = @shixuns.order("shixuns.public = 2 desc, shixuns.publish_time #{bsort}")
end end
# 用id计数会快10+MS左右,对于搜索的内容随着数据的增加,性能会提升一些。 # 用id计数会快10+MS左右,对于搜索的内容随着数据的增加,性能会提升一些。
@ -265,7 +261,12 @@ class ShixunsController < ApplicationController
project_fork(@new_shixun, @repo_path, current_user.login) project_fork(@new_shixun, @repo_path, current_user.login)
ShixunMember.create!(:user_id => User.current.id, :shixun_id => @new_shixun.try(:id), :role => 1) ShixunMember.create!(:user_id => User.current.id, :shixun_id => @new_shixun.try(:id), :role => 1)
# 如果是jupyter先创建一个目录,为了挂载(因为后续数据集开启Pod后环境在没销毁前你上传数据集是挂载不上目录的因此要先创建目录方便中间层挂载)
if @new_shixun.is_jupyter?
folder = EduSetting.get('shixun_folder')
path = "#{folder}/#{@new_shixun.identifier}"
FileUtils.mkdir_p(path, :mode => 0777) unless File.directory?(path)
end
# 同步复制关卡 # 同步复制关卡
if @shixun.challenges.present? if @shixun.challenges.present?
@shixun.challenges.each do |challenge| @shixun.challenges.each do |challenge|
@ -408,7 +409,6 @@ class ShixunsController < ApplicationController
smr.update_attributes(service) smr.update_attributes(service)
end end
# 添加第二仓库(管理员权限) # 添加第二仓库(管理员权限)
if current_user.admin_or_business?
if params[:is_secret_repository] if params[:is_secret_repository]
add_secret_repository if @shixun.shixun_secret_repository.blank? add_secret_repository if @shixun.shixun_secret_repository.blank?
else else
@ -420,7 +420,6 @@ class ShixunsController < ApplicationController
end end
end end
end end
end
rescue => e rescue => e
uid_logger_error(e.message) uid_logger_error(e.message)
tip_exception("基本信息更新失败:#{e.message}") tip_exception("基本信息更新失败:#{e.message}")
@ -463,7 +462,7 @@ class ShixunsController < ApplicationController
limit = params[:limit] || 10 limit = params[:limit] || 10
data_sets = @shixun.data_sets data_sets = @shixun.data_sets
@data_count = data_sets.count @data_count = data_sets.count
@data_sets= data_sets.page(page).per(limit) @data_sets= data_sets.order("created_on desc").page(page).per(limit)
@absolute_folder = edu_setting('shixun_folder') @absolute_folder = edu_setting('shixun_folder')
end end
@ -758,7 +757,7 @@ class ShixunsController < ApplicationController
else else
commit = GitService.commits(repo_path: @repo_path).try(:first) commit = GitService.commits(repo_path: @repo_path).try(:first)
uid_logger("First comit########{commit}") uid_logger("First comit########{commit}")
tip_exception("开启实战前请先在版本库中提交代码") if commit.blank? tip_exception("开启挑战前请先在Jupyter中填写内容") if commit.blank?
commit_id = commit["id"] commit_id = commit["id"]
cloud_bridge = edu_setting('cloud_bridge') cloud_bridge = edu_setting('cloud_bridge')
myshixun_identifier = generate_identifier Myshixun, 10 myshixun_identifier = generate_identifier Myshixun, 10
@ -776,7 +775,7 @@ class ShixunsController < ApplicationController
end end
rescue => e rescue => e
uid_logger_error(e.message) uid_logger_error(e.message)
tip_exception("实训云平台繁忙繁忙等级81") tip_exception("#{e.message}")
end end
end end

@ -21,7 +21,7 @@ module JupyterService
@shixun_jupyter_port = res['port'] @shixun_jupyter_port = res['port']
return "https://#{res['port']}.jupyter.educoder.net/notebooks/data/workspace/myshixun_#{tpiID}/01.ipynb" "#{jupyter_service(res['port'])}/notebooks/data/workspace/myshixun_#{tpiID}/01.ipynb"
end end
end end
@ -48,7 +48,7 @@ module JupyterService
tpiID = myshixun.id tpiID = myshixun.id
mount = myshixun.shixun.data_sets.present? mount = myshixun.shixun.data_sets.present?
params = {tpiID: tpiID, identifier: shixun.identifier, needMount: mount, params = {tpiID: tpiID, identifier: shixun.identifier, myshixunIdentifier: myshixun.identifier, needMount: mount,
:containers => "#{Base64.urlsafe_encode64(shixun_container_limit(shixun))}"} :containers => "#{Base64.urlsafe_encode64(shixun_container_limit(shixun))}"}
res = uri_post uri, params res = uri_post uri, params
@ -62,7 +62,7 @@ module JupyterService
repo_save_path = myshixun.repo_save_path repo_save_path = myshixun.repo_save_path
"https://#{res['port']}.jupyter.educoder.net/notebooks/data/workspace/myshixun_#{tpiID}/#{repo_save_path}/01.ipynb" "#{jupyter_service(res['port'])}/notebooks/data/workspace/myshixun_#{tpiID}/#{repo_save_path}/01.ipynb"
end end
end end
@ -85,8 +85,8 @@ module JupyterService
tpiID = "tpm#{shixun.id}" tpiID = "tpm#{shixun.id}"
#https://47526.jupyter.educoder.net/nbconvert/notebook/data/workspace/myshixun_570461/f2ef5p798r20191210163135/01.ipynb?download=true src_url = "#{jupyter_service(jupyter_port)}/nbconvert/notebook/data/workspace/myshixun_#{tpiID}/01.ipynb?download=true"
src_url = "https://#{jupyter_port}.jupyter.educoder.net/nbconvert/notebook/data/workspace/myshixun_#{tpiID}/01.ipynb?download=true"
response = Faraday.get(src_url) response = Faraday.get(src_url)
if response.status.to_i != 200 if response.status.to_i != 200
@ -113,8 +113,7 @@ module JupyterService
tpiID = myshixun.id tpiID = myshixun.id
repo_save_path = myshixun.repo_save_path repo_save_path = myshixun.repo_save_path
src_url = "#{jupyter_service(jupyter_port)}/nbconvert/notebook/data/workspace/myshixun_#{tpiID}/#{repo_save_path}/01.ipynb?download=true"
src_url = "https://#{jupyter_port}.jupyter.educoder.net/nbconvert/notebook/data/workspace/myshixun_#{tpiID}/#{repo_save_path}/01.ipynb?download=true"
response = Faraday.get(src_url) response = Faraday.get(src_url)
if response.status.to_i != 200 if response.status.to_i != 200
@ -188,5 +187,9 @@ module JupyterService
end end
end end
def jupyter_service jupyter_port
edu_setting('jupyter_service').gsub("PORT", jupyter_port)
end
end end

@ -42,6 +42,12 @@ class CreateShixunService < ApplicationService
if !Laboratory.current.main_site? if !Laboratory.current.main_site?
Laboratory.current.laboratory_shixuns.create!(shixun: shixun, ownership: true) Laboratory.current.laboratory_shixuns.create!(shixun: shixun, ownership: true)
end end
# 如果是jupyter先创建一个目录,为了挂载(因为后续数据集开启Pod后环境在没销毁前你上传数据集是挂载不上目录的因此要先创建目录方便中间层挂载)
if shixun.is_jupyter?
folder = EduSetting.get('shixun_folder')
path = "#{folder}/#{identifier}"
FileUtils.mkdir_p(path, :mode => 0777) unless File.directory?(path)
end
return shixun return shixun
end end
rescue => e rescue => e

@ -608,10 +608,10 @@ class App extends Component {
} }
} }
/> />
<Route {/*<Route*/}
path="/interesse" component={Interestpage} {/* path="/interesse" component={Interestpage}*/}
/> {/*/>*/}
<Route path="/shixuns/new" component={Newshixuns}> <Route path="/shixuns/new" component={Newshixuns}>
</Route> </Route>

@ -893,6 +893,7 @@ class PollNew extends Component {
//保存并继续 //保存并继续
//保存并继续,即提交本题的新建并继续创建一个相同的题(该新题处于编辑模式,题目和选项不要清空) //保存并继续,即提交本题的新建并继续创建一个相同的题(该新题处于编辑模式,题目和选项不要清空)
Deleteadddomtwo = (indexo, object,bool) => { Deleteadddomtwo = (indexo, object,bool) => {
debugger
var thiss = this; var thiss = this;
@ -1449,7 +1450,6 @@ class PollNew extends Component {
//object 单个数组数据 //object 单个数组数据
Deleteadddomthree = (indexo, object,bool) => { Deleteadddomthree = (indexo, object,bool) => {
this.setState({ this.setState({
Newdisplay:false,
newoption: false, newoption: false,
}) })
// console.log("deleteadddom 349") // console.log("deleteadddom 349")
@ -1477,6 +1477,7 @@ class PollNew extends Component {
} }
if (newarr[indexo].question.question_title === "") { if (newarr[indexo].question.question_title === "") {
this.props.showNotification('题目不能为空!'); this.props.showNotification('题目不能为空!');
return return
} }
if (max > 0) { if (max > 0) {
@ -1866,6 +1867,7 @@ class PollNew extends Component {
}; };
question = {"question": questiontwo}; question = {"question": questiontwo};
//插入多选题 //插入多选题
if (uuk !== -1) { if (uuk !== -1) {
// console.log("修改") // console.log("修改")
this.edittotheserver(object, 2, arrc, null, object.question.max_choices, object.question.min_choices,object.question.answers.length); this.edittotheserver(object, 2, arrc, null, object.question.max_choices, object.question.min_choices,object.question.answers.length);
@ -2014,7 +2016,11 @@ class PollNew extends Component {
if (result !== undefined) { if (result !== undefined) {
if (result.data.status === 0) { if (result.data.status === 0) {
this.props.showNotification(`已完成`); this.props.showNotification(`已完成`);
thiss.thisinitializationdatanew(); thiss.thisinitializationdatanew();
this.setState({
Newdisplay:false,
})
// console.log("确认创建问题") // console.log("确认创建问题")
// console.log(result) // console.log(result)
// try { // try {

@ -99,7 +99,6 @@ class Statistics extends Component{
} }
getwork_scoredata=(page,group_ids,sort,key)=>{ getwork_scoredata=(page,group_ids,sort,key)=>{
this.setState({ this.setState({
page:page, page:page,
sort:sort, sort:sort,
@ -189,8 +188,45 @@ class Statistics extends Component{
} }
//计算成绩
setComputeTimet = (homeworkid) => {
let url = `/courses/${homeworkid}/calculate_all_shixun_scores.json`;
try {
this.props.yslslowCheckresults();
} catch (e) {
}
axios.get(url).then((response) => {
if (response) {
if (response.data.status === 0) {
let{page,group_ids,sort}=this.state;
setTimeout(() => {
try {
this.props.showNotification(`${response.data.message}`);
} catch (e) {
}
try {
this.props.yslslowCheckresultsNo();
} catch (e) {
}
this.getwork_scoredata(page,group_ids,sort);
}, 2500);
}
}
}).catch((error) => {
try {
this.props.yslslowCheckresultsNo();
} catch (e) {
}
console.log(error)
});
};
render(){ render(){
let {nd1,nd2,nd3,data,bomdata,course_members}=this.state; let {nd1,nd2,nd3,data,bomdata,course_members,activeKey}=this.state;
const columns = [ const columns = [
{ {
@ -360,12 +396,26 @@ class Statistics extends Component{
const operations = <React.Fragment> const operations = <React.Fragment>
{course_grouptype===false||this.state.course_groups.length===0?"":<Dropdownbox {course_grouptype===false||this.state.course_groups.length===0?"":
this.state.activeKey==="1"?
<Dropdownbox
{...this.props} {...this.props}
{...this.state} {...this.state}
postwork_scoredata={(group_idss)=>this.getwork_scoredata(1,group_idss,'desc')} postwork_scoredata={(group_idss)=>this.getwork_scoredata(1,group_idss,'desc')
/>} }
/>
:""
}
{
this.state.activeKey==="1"?
<a className={"ml20 ant-btn-link"} onClick={()=>this.setComputeTimet(this.props.match.params.coursesId)}>获取最新成绩</a>
:""
}
{
this.state.activeKey==="1"?
<a className={"ml20 ant-btn-link"} onClick={()=>this.derivefun(this.state.activeKey==="1"?`/courses/${this.props.match.params.coursesId}/export_member_scores_excel.xlsx`:`/courses/${this.props.match.params.coursesId}/export_member_act_score.xlsx`)}>导出</a> <a className={"ml20 ant-btn-link"} onClick={()=>this.derivefun(this.state.activeKey==="1"?`/courses/${this.props.match.params.coursesId}/export_member_scores_excel.xlsx`:`/courses/${this.props.match.params.coursesId}/export_member_act_score.xlsx`)}>导出</a>
:""
}
</React.Fragment>; </React.Fragment>;
return( return(
<React.Fragment> <React.Fragment>

@ -554,6 +554,17 @@ class MessagChat extends Component{
{myuserl!==undefined?myuserl.name:""}与你的私信 {myuserl!==undefined?myuserl.name:""}与你的私信
</p> </p>
{/*聊天页面*/} {/*聊天页面*/}
<style>
{
`
.dialogPanel{
padding: 0px 20px;
height: 400px !important;
overflow-y: auto;
}
`
}
</style>
<div className="dialogPanel" <div className="dialogPanel"
onScroll={this.contentViewScrolltop} onScroll={this.contentViewScrolltop}
ref={(div) => { ref={(div) => {
@ -637,6 +648,18 @@ class MessagChat extends Component{
{/*右边头部*/} {/*右边头部*/}
<p className="pt30 pb30 pl30 edu-txt-left font-16 bor-bottom-greyE">私信列表</p> <p className="pt30 pb30 pl30 edu-txt-left font-16 bor-bottom-greyE">私信列表</p>
<Spin size="large" className="myw100baifenbi" spinning={isSpins}> <Spin size="large" className="myw100baifenbi" spinning={isSpins}>
<style>
{
`
.private-list{
min-height: 680px !important;
max-height: 680px !important;
overflow-y: auto;
overflow-x: hidden;
}
`
}
</style>
<div className="private-list" onScroll={this.contentViewScrolledit}> <div className="private-list" onScroll={this.contentViewScrolledit}>
{/*列表数据*/} {/*列表数据*/}
{ {

@ -1294,7 +1294,8 @@ submittojoinclass=(value)=>{
<li><a onClick={(url)=>this.getUser("/courses/new")}>{this.props.user&&this.props.user.main_site===false?"新建课堂":"新建翻转课堂"}</a></li>:"" <li><a onClick={(url)=>this.getUser("/courses/new")}>{this.props.user&&this.props.user.main_site===false?"新建课堂":"新建翻转课堂"}</a></li>:""
} }
{shixuntype===true?"":<li><a onClick={(url)=>this.getUser("/shixuns/new")}>新建实训项目</a></li>} {shixuntype===true?"":<li><a onClick={(url)=>this.getUser("/shixuns/new")}>新建实训项目</a></li>}
{this.props.Headertop===undefined?"": {this.props.user&&this.props.user.main_site===false?"":this.props.Headertop===undefined?"":<li><a onClick={(url)=>this.getUser("/paths/new")} >新建实践课程</a></li>}
{this.props.user&&this.props.user.main_site===true?"":this.props.Headertop===undefined?"":
pathstype===true?"":this.props.user&&this.props.user.admin===true||this.props.user&&this.props.user.is_teacher===true||this.props.user&&this.props.user.business===true?<li><a onClick={(url)=>this.getUser("/paths/new")} >新建实践课程</a></li>:"" pathstype===true?"":this.props.user&&this.props.user.admin===true||this.props.user&&this.props.user.is_teacher===true||this.props.user&&this.props.user.business===true?<li><a onClick={(url)=>this.getUser("/paths/new")} >新建实践课程</a></li>:""
} }
{this.props.user&&this.props.user.main_site===true?<li><a onClick={(url)=>this.getUser("/projects/new","projects")} target="_blank">新建开发项目</a></li>:""} {this.props.user&&this.props.user.main_site===true?<li><a onClick={(url)=>this.getUser("/projects/new","projects")} target="_blank">新建开发项目</a></li>:""}

@ -366,7 +366,7 @@ class TPMBanner extends Component {
Modalstype: true, Modalstype: true,
Modalstopval: "是否确认撤销发布?", Modalstopval: "是否确认撤销发布?",
modalsMidval:"撤销发布后,学员将无法进行练习,若您新增关", modalsMidval:"撤销发布后,学员将无法进行练习,若您新增关",
ModalsBottomval:"卡,学员需要重新体验课程", ModalsBottomval:"卡,学员需要重新体验实训",
ModalCancel: this.ModalCancel, ModalCancel: this.ModalCancel,
ModalSave: this.ModalSave, ModalSave: this.ModalSave,
modalstyles:"848282" modalstyles:"848282"
@ -843,7 +843,7 @@ class TPMBanner extends Component {
<ul className="fl color-grey-c pathInfo"> <ul className="fl color-grey-c pathInfo">
<li> <li>
<span>学习人数</span> <span>学习人数</span>
<span className="mt10">{shixunsDetails.stu_num}</span> <span className="mt3">{shixunsDetails.stu_num}</span>
</li> </li>
{/*<li>*/} {/*<li>*/}
{/*<span>经验值</span>*/} {/*<span>经验值</span>*/}
@ -851,7 +851,7 @@ class TPMBanner extends Component {
{/*</li>*/} {/*</li>*/}
<li> <li>
<span>难度级别</span> <span>难度级别</span>
<span className="shixunsdiffcult mt10">{shixunsDetails.diffcult}</span> <span className="shixunsdiffcult mt3">{shixunsDetails.diffcult}</span>
</li> </li>
</ul> </ul>
@ -1096,8 +1096,8 @@ class TPMBanner extends Component {
<Popover <Popover
content={ content={
<pre className={"bannerpd201"}> <pre className={"bannerpd201"}>
<div>申请公开成功后您的实训将会展示实训列表</div> <div>平台审核完成后您的实训将会录入到平台的公共实训项目列表</div>
<div className={"wechatcenter mt10"}>您将获得关卡<span className={"FF6802"}>对应的经验值和金币</span> </div> <div className={"wechatcenter mt10"}>您将获得实训<span className={"FF6802"}>对应的经验值和金币</span> </div>
<div className={"wechatcenter mt15"}><Button type="primary" onClick={this.openshowpublic} >我知道了</Button></div> <div className={"wechatcenter mt15"}><Button type="primary" onClick={this.openshowpublic} >我知道了</Button></div>
</pre> </pre>
} }
@ -1223,7 +1223,7 @@ class TPMBanner extends Component {
} }
{this.props.identity < 5 && shixunsDetails.shixun_status != -1 && shixunsDetails.shixun_status != 0? {this.props.identity < 8 && shixunsDetails.shixun_status != -1 && shixunsDetails.shixun_status != 0?
<div className="fr kaike kkbth mr20" <div className="fr kaike kkbth mr20"
style={{display: shixunsDetails.can_copy === false || shixunsDetails.can_copy === null ? "none" : "flex"}}> style={{display: shixunsDetails.can_copy === false || shixunsDetails.can_copy === null ? "none" : "flex"}}>
<Tooltip placement="bottom" title={"基于这个实训修改形成新的实训"}> <Tooltip placement="bottom" title={"基于这个实训修改形成新的实训"}>

@ -156,8 +156,10 @@ class TPMDataset extends Component {
selectedRowKeysdata:[], selectedRowKeysdata:[],
selectedRowKeys: [], selectedRowKeys: [],
checked:false, checked:false,
page:1,
}); });
} }
} }
@ -181,7 +183,7 @@ class TPMDataset extends Component {
getdatastwo = (page,limit) => { getdatastwo = (page,limit) => {
let id=this.props.match.params.shixunId; let id=this.props.match.params.shixunId;
let collaborators=`/shixuns/${id}/jupyter_data_sets.json`; let collaborators=`/shixuns/${id}/get_data_sets.json`;
axios.get(collaborators,{params:{ axios.get(collaborators,{params:{
page:page, page:page,
limit:limit, limit:limit,
@ -209,6 +211,7 @@ class TPMDataset extends Component {
selectedRowKeysdata:[], selectedRowKeysdata:[],
selectedRowKeys: [], selectedRowKeys: [],
checked:false, checked:false,
page:page,
}); });
} }
@ -233,7 +236,7 @@ class TPMDataset extends Component {
getdatasthree = (page,limit) => { getdatasthree = (page,limit) => {
let id=this.props.match.params.shixunId; let id=this.props.match.params.shixunId;
let collaborators=`/shixuns/${id}/jupyter_data_sets.json`; let collaborators=`/shixuns/${id}/get_data_sets.json`;
axios.get(collaborators,{params:{ axios.get(collaborators,{params:{
page:page, page:page,
limit:limit, limit:limit,
@ -298,10 +301,19 @@ class TPMDataset extends Component {
this.setState({ this.setState({
fileList: appendFileSizeToUploadFileAll(fileList), fileList: appendFileSizeToUploadFileAll(fileList),
}); });
if(info.file.status === 'done'){ if(info.file.status === 'done'){
//done 成功就会调用这个方法 //done 成功就会调用这个方法
if(info.file.response){
if(info.file.response.status===-1||info.file.response.status==="-1"){
}else{
this.getdatas(); this.getdatas();
}
} }
}
if(info.file.response){ if(info.file.response){
if(info.file.response.status===-1||info.file.response.status==="-1"){ if(info.file.response.status===-1||info.file.response.status==="-1"){
// console.log("准备显示弹框了"); // console.log("准备显示弹框了");
@ -318,6 +330,8 @@ class TPMDataset extends Component {
tittest:info.file.response.message, tittest:info.file.response.message,
itemtypebool:itemtype>-1?true:itemtype<=-1?false:false, itemtypebool:itemtype>-1?true:itemtype<=-1?false:false,
}) })
}else{
} }
} }

@ -72,11 +72,18 @@ export default class Shixuninformation extends Component {
componentDidMount() { componentDidMount() {
if (this.props.data) { if (this.props.data) {
if (this.props.data.shixun) { if (this.props.data.shixun) {
let time =this.props.data && this.props.data.shixun.opening_time;
let timetype=false;
if(!time){
timetype=false;
}else{
timetype=true;
}
this.setState({ this.setState({
can_copy: this.props.data && this.props.data.shixun.can_copy === undefined ? false : this.props.data && this.props.data.shixun.can_copy, can_copy: this.props.data && this.props.data.shixun.can_copy === undefined ? false : this.props.data && this.props.data.shixun.can_copy,
use_scope: this.props.data && this.props.data.shixun.use_scope, use_scope: this.props.data && this.props.data.shixun.use_scope,
opening_time: this.props.data && this.props.data.shixun.opening_time, opening_time: this.props.data && this.props.data.shixun.opening_time,
opentime: !this.props.data && this.props.data.shixun.opening_time ? false : true, opentime: timetype,
oldscope_partment: this.props.data && this.props.data.shixun.scope_partment, oldscope_partment: this.props.data && this.props.data.shixun.scope_partment,
}) })
} }
@ -100,11 +107,18 @@ export default class Shixuninformation extends Component {
if (prevProps.data != this.props.data) { if (prevProps.data != this.props.data) {
if (this.props.data) { if (this.props.data) {
if (this.props.data.shixun) { if (this.props.data.shixun) {
let time =this.props.data && this.props.data.shixun.opening_time;
let timetype=false;
if(!time){
timetype=false;
}else{
timetype=true;
}
this.setState({ this.setState({
can_copy: this.props.data && this.props.data.shixun.can_copy === undefined ? false : this.props.data && this.props.data.shixun.can_copy, can_copy: this.props.data && this.props.data.shixun.can_copy === undefined ? false : this.props.data && this.props.data.shixun.can_copy,
use_scope: this.props.data && this.props.data.shixun.use_scope, use_scope: this.props.data && this.props.data.shixun.use_scope,
opening_time: this.props.data && this.props.data.shixun.opening_time, opening_time: this.props.data && this.props.data.shixun.opening_time,
opentime: !this.props.data && this.props.data.shixun.opening_time ? false : true, opentime: timetype,
oldscope_partment: this.props.data && this.props.data.shixun.scope_partment, oldscope_partment: this.props.data && this.props.data.shixun.scope_partment,
}) })
} }
@ -257,9 +271,15 @@ export default class Shixuninformation extends Component {
} }
setopentime = (e) => { setopentime = (e) => {
if(e.target.checked===false){
this.setState({
opening_time:null
})
}
this.setState({ this.setState({
opentime: e.target.checked opentime: e.target.checked
}) })
} }
render() { render() {

@ -704,9 +704,6 @@ class Shixuninformation extends Component {
}) })
} }
}); });
this.setState({
loading: false
})
} }
Selectthestudent = (value) => { Selectthestudent = (value) => {
@ -1037,7 +1034,7 @@ class Shixuninformation extends Component {
{ this.props.shixunsDetails&&this.props.shixunsDetails.is_jupyter===true?"": <span className="ant-form-text mt20">私密版本库 { this.props.shixunsDetails&&this.props.shixunsDetails.is_jupyter===true?"": <span className="ant-form-text mt20">私密版本库
<Checkbox onChange={this.simionChange} <Checkbox onChange={this.simionChange}
value={this.state.simichecked}> checked={this.state.simichecked}>
{this.state.simichecked===false?"(若需要对学员隐藏部分版本库内容时,请选中;选中保存后表示启用私密版本库,请将需要对学员隐藏的文件存储在私密版本库)":"已创建的私密版本库及其内容,将在“保存”时被删除"}</Checkbox> {this.state.simichecked===false?"(若需要对学员隐藏部分版本库内容时,请选中;选中保存后表示启用私密版本库,请将需要对学员隐藏的文件存储在私密版本库)":"已创建的私密版本库及其内容,将在“保存”时被删除"}</Checkbox>
</span>} </span>}

@ -57,14 +57,14 @@ export default class TPMsettings extends Component {
}); });
if(key==="3"&&this.props.shixunsDetails&&this.props.shixunsDetails.is_jupyter === true){ if(key==="3"&&this.props.shixunsDetails&&this.props.shixunsDetails.is_jupyter === true){
this.props.history.replace(`/shixuns/${this.props.match.params.shixunId}/challenges`); window.location.href =`/shixuns/${this.props.match.params.shixunId}/challenges`;
}else{ }else{
if(key){ if(key){
this.setState({ this.setState({
activeKeys:key activeKeys:key
}) })
}else{ }else{
this.props.history.replace(`/shixuns/${this.props.match.params.shixunId}/challenges`); window.location.href =`/shixuns/${this.props.match.params.shixunId}/challenges`;
} }
} }
@ -96,8 +96,8 @@ export default class TPMsettings extends Component {
operateshixunstype: false, operateshixunstype: false,
}); });
// window.location.href = "/shixuns"; window.location.href = "/shixuns";
this.props.history.replace( "/shixuns/"); // this.props.history.replace( "/shixuns/");
} }
}).catch((error) => { }).catch((error) => {
console.log(error) console.log(error)
@ -114,8 +114,8 @@ export default class TPMsettings extends Component {
operateshixunstype: false, operateshixunstype: false,
}); });
// window.location.href = "/shixuns/" + id + "/challenges"; window.location.href = "/shixuns/" + id + "/challenges";
this.props.history.replace( "/shixuns/" + id + "/challenges"); // this.props.history.replace( "/shixuns/" + id + "/challenges");
} }
}).catch((error) => { }).catch((error) => {
console.log(error) console.log(error)

@ -4,7 +4,7 @@
* @Github: * @Github:
* @Date: 2019-12-12 10:34:03 * @Date: 2019-12-12 10:34:03
* @LastEditors: tangjiang * @LastEditors: tangjiang
* @LastEditTime: 2019-12-13 16:28:33 * @LastEditTime: 2019-12-13 22:46:51
*/ */
import './index.scss'; import './index.scss';
import React, { useState, useEffect } from 'react'; import React, { useState, useEffect } from 'react';

@ -97,6 +97,7 @@ class Newshixuns extends Component {
}) })
const mdContnet = this.contentMdRef.current.getValue().trim(); const mdContnet = this.contentMdRef.current.getValue().trim();
this.props.form.validateFieldsAndScroll((err, values) => { this.props.form.validateFieldsAndScroll((err, values) => {
debugger
if (!err) { if (!err) {
console.log('Received values of form: ', values); console.log('Received values of form: ', values);
@ -117,21 +118,20 @@ class Newshixuns extends Component {
// window.open("/shixuns/"+response.data.shixun_identifier+"/challenges"); // window.open("/shixuns/"+response.data.shixun_identifier+"/challenges");
} else { } else {
this.setState({ this.setState({
loading: true loading: false
}) })
} }
}).catch((error) => { }).catch((error) => {
this.setState({ this.setState({
loading: true loading: false
}) })
}) })
}else{
}
});
this.setState({ this.setState({
loading: false loading: false
}) })
}
});
}; };
Selectthestudent = (value) => { Selectthestudent = (value) => {
this.props.form.setFieldsValue({ this.props.form.setFieldsValue({
@ -456,14 +456,14 @@ class Newshixuns extends Component {
</div> </div>
<div className="padding10-20 color-grey-3 clearfix"> <div className="padding10-20 color-grey-3 clearfix">
<Form> <Form>
{this.props.user&&this.props.user.admin===true||this.props.user&&this.props.user.business===true?<Form.Item label="实训类型"> <Form.Item label="实训类型">
{getFieldDecorator('is_jupyter')( {getFieldDecorator('is_jupyter')(
<Radio.Group onChange={this.RadiovalueonChange}> <Radio.Group onChange={this.RadiovalueonChange} value={this.state.Radiovalue}>
<Radio value="1">普通实训</Radio> <Radio value="1">普通实训</Radio>
<Radio value="2">Jupyter实训</Radio> {this.props.user&&this.props.user.admin===true||this.props.user&&this.props.user.business===true?<Radio value="2" >Jupyter实训</Radio>:""}
</Radio.Group>, </Radio.Group>,
)} )}
</Form.Item>:""} </Form.Item>
<Form.Item <Form.Item
label="名称" label="名称"
className="mt15" className="mt15"

@ -183,9 +183,18 @@ class Challengesjupyter extends Component {
render() { render() {
let{ChallengesDataList,booljupyterurls}=this.state; let{ChallengesDataList,booljupyterurls}=this.state;
let id = this.props.match.params.shixunId; let id = this.props.match.params.shixunId;
//老师
const is_teacher = this.props&&this.props.current_user&&this.props.current_user.is_teacher?this.props.current_user.is_teacher:false; const is_teacher = this.props&&this.props.current_user&&this.props.current_user.is_teacher?this.props.current_user.is_teacher:false;
//运营人员
const business = this.props&&this.props.current_user&&this.props.current_user.business?this.props.current_user.business:false;
//管理员
const admin = this.props&&this.props.current_user&&this.props.current_user.admin?this.props.current_user.admin:false;
let mysidentity =false;
try {
mysidentity =this.props.identity < 5 &&ChallengesDataList&& ChallengesDataList.shixun_status< 3?true:false;
}catch (e) {
}
return ( return (
<React.Fragment> <React.Fragment>
@ -254,7 +263,7 @@ class Challengesjupyter extends Component {
"" ""
: :
( (
is_teacher===true? admin===true||business===true||mysidentity===true?
<div className="sortinxdirection mt60"> <div className="sortinxdirection mt60">
<div className="renwuxiangssi sortinxdirection"> <div className="renwuxiangssi sortinxdirection">
<div><p className="renwuxiangqdiv">任务详情</p></div> <div><p className="renwuxiangqdiv">任务详情</p></div>
@ -297,7 +306,7 @@ class Challengesjupyter extends Component {
} }
</style> </style>
{ {
is_teacher===true? admin===true||business===true||mysidentity===true?
<div className="mt35"> <div className="mt35">
<div className="pb47"> <div className="pb47">
{ {

@ -168,6 +168,8 @@ class InfosPath extends Component{
</Menu> </Menu>
); );
// console.log(this.props.user&&this.props.user.main_site)
return( return(
<div className="educontent"> <div className="educontent">
<Spin size="large" spinning={isSpin}> <Spin size="large" spinning={isSpin}>
@ -327,7 +329,10 @@ class InfosPath extends Component{
<div className="square-list clearfix"> <div className="square-list clearfix">
{/* 295 */} {/* 295 */}
{ {
page == 1 && is_current && !category ? <Create href={"/paths/new"} name={"新建实践课程"} index="3"></Create>:"" this.props.user&&this.props.user.main_site===true?page == 1 && is_current && !category ? <Create href={"/paths/new"} name={"新建实践课程"} index="3"></Create>:"":""
}
{
this.props.user&&this.props.user.main_site===false?this.props.user&&this.props.user.admin===true||this.props.user&&this.props.user.is_teacher===true||this.props.user&&this.props.user.business===true?page == 1 && is_current && !category ? <Create href={"/paths/new"} name={"新建实践课程"} index="3"></Create>:"":"":""
} }
{ {
(!data || (data && data.subjects.length==0)) && category && <NoneData></NoneData> (!data || (data && data.subjects.length==0)) && category && <NoneData></NoneData>

@ -4,7 +4,7 @@
* @Github: * @Github:
* @Date: 2019-12-12 09:01:30 * @Date: 2019-12-12 09:01:30
* @LastEditors: tangjiang * @LastEditors: tangjiang
* @LastEditTime: 2019-12-13 15:27:13 * @LastEditTime: 2019-12-13 23:03:27
*/ */
import types from "./actionTypes"; import types from "./actionTypes";
import { message } from 'antd'; import { message } from 'antd';
@ -25,7 +25,7 @@ export const getJupyterInfo = (id) => {
if (res.data.status === 401) return; if (res.data.status === 401) return;
if (res.status === 200) { if (res.status === 200) {
const { data } = res; const { data } = res;
if (data.status === 0) { // if (data.status === 0) {
dispatch({ dispatch({
type: types.SAVE_JUPYTER_INFO, type: types.SAVE_JUPYTER_INFO,
payload: data payload: data
@ -36,7 +36,7 @@ export const getJupyterInfo = (id) => {
dispatch(getJupyterTpiDataSet(identifier, jupyter_pagination)); dispatch(getJupyterTpiDataSet(identifier, jupyter_pagination));
// 调用获取url接口 // 调用获取url接口
dispatch(getJupyterTpiUrl({identifier: myshixun_identifier})); dispatch(getJupyterTpiUrl({identifier: myshixun_identifier}));
} // }
} }
}) })
} }
@ -100,7 +100,12 @@ export const syncJupyterCode = (identifier, msg) => {
if (res.data.status === 401) return; if (res.data.status === 401) return;
if (res.status === 200) { if (res.status === 200) {
const {status} = res.data const {status} = res.data
if (status === 0) message.success(msg); if (status === 0) {
message.success(msg);
setTimeout(() => {
window.location.reload();
}, 300);
}
} }
}) })
} }

Loading…
Cancel
Save