chromesetting
杨树林 5 years ago
commit 1d52aeed5b

@ -1,12 +1,13 @@
import React, { Component } from 'react'; import React, { Component } from 'react';
import {getImageUrl} from 'educoder'; import {getImageUrl} from 'educoder';
import {Modal,Input} from 'antd'; import {Modal,Input,Form,Radio} from 'antd';
class Addshixuns extends Component { class Addshixuns extends Component {
constructor(props) { constructor(props) {
super(props); super(props);
this.state = { this.state = {
shixunname:undefined, shixunname:undefined,
shixunzero:false shixunzero:false,
is_jupyter:"1"
} }
} }
@ -52,12 +53,22 @@ class Addshixuns extends Component {
}) })
return return
} }
this.props.Setaddshixuns(shixunname);
let is_jupyter=this.state.is_jupyter==="1"?false:true
this.props.Setaddshixuns(shixunname,is_jupyter);
this.props.modalCancel(); this.props.modalCancel();
} }
GrouponChange = e => {
this.setState({
is_jupyter: e.target.value,
});
};
render() { render() {
const formItemLayout = {
labelCol: { span: 4 },
wrapperCol: { span: 14 },
};
return( return(
<Modal <Modal
className={this.props.className} className={this.props.className}
@ -81,6 +92,14 @@ class Addshixuns extends Component {
</style>:""} </style>:""}
<div className="task-popup-content"> <div className="task-popup-content">
<Form {...formItemLayout}>
<Form.Item label="实训类型">
<Radio.Group value={this.state.is_jupyter} onChange={this.GrouponChange}>
<Radio value="1">普通实训</Radio>
<Radio value="2">jupyter实训</Radio>
</Radio.Group>
</Form.Item>
</Form>
<p className="task-popup-text-center font-16"> <p className="task-popup-text-center font-16">
<span style={{ "line-height":"30px"}}>实训名称</span> <span style={{ "line-height":"30px"}}>实训名称</span>
<span><Input style={{ width:"80%"}} className="yslzxueshisy " placeholder="请输入60字以内的实训名称" onChange={this.handleChange} addonAfter={String(this.state.shixunname===undefined?0:this.state.shixunname.length)+"/60"} maxLength={60} /> <span><Input style={{ width:"80%"}} className="yslzxueshisy " placeholder="请输入60字以内的实训名称" onChange={this.handleChange} addonAfter={String(this.state.shixunname===undefined?0:this.state.shixunname.length)+"/60"} maxLength={60} />

@ -320,7 +320,7 @@ class DetailCardsEditAndAdd extends Component{
}) })
} }
Getaddshixuns=(value)=>{ Getaddshixuns=(value,is_jupyter)=>{
let { let {
shixuns_listeditlist, shixuns_listeditlist,
shixuns_listedit, shixuns_listedit,
@ -329,7 +329,8 @@ class DetailCardsEditAndAdd extends Component{
let list=shixuns_listeditlist let list=shixuns_listeditlist
let url='/paths/add_shixun_to_stage.json'; let url='/paths/add_shixun_to_stage.json';
axios.post(url,{ axios.post(url,{
name:value name:value,
is_jupyter:is_jupyter
}).then((response) => { }).then((response) => {
if(response){ if(response){
if(response.data){ if(response.data){
@ -383,7 +384,7 @@ class DetailCardsEditAndAdd extends Component{
{this.state.Addshixunstype===true?<Addshixuns {this.state.Addshixunstype===true?<Addshixuns
modalCancel={this.cardsModalcancel} modalCancel={this.cardsModalcancel}
Setaddshixuns={(value)=>this.Getaddshixuns(value)} Setaddshixuns={(value,is_jupyter)=>this.Getaddshixuns(value,is_jupyter)}
{...this.props} {...this.props}
{...this.state} {...this.state}
/>:""} />:""}

@ -320,7 +320,7 @@ class DetailCardsEditAndEdit extends Component{
notification.open(data); notification.open(data);
} }
Getaddshixuns=(value)=>{ Getaddshixuns=(value,is_jupyter)=>{
let { let {
shixuns_listeditlist, shixuns_listeditlist,
shixuns_listedit, shixuns_listedit,
@ -329,7 +329,8 @@ class DetailCardsEditAndEdit extends Component{
let list=shixuns_listeditlist let list=shixuns_listeditlist
let url='/paths/add_shixun_to_stage.json'; let url='/paths/add_shixun_to_stage.json';
axios.post(url,{ axios.post(url,{
name:value name:value,
is_jupyter:is_jupyter
}).then((response) => { }).then((response) => {
if(response){ if(response){
if(response.data){ if(response.data){
@ -383,7 +384,7 @@ class DetailCardsEditAndEdit extends Component{
</Modals> </Modals>
{this.state.Addshixunstype===true?<Addshixuns {this.state.Addshixunstype===true?<Addshixuns
modalCancel={this.cardsModalcancel} modalCancel={this.cardsModalcancel}
Setaddshixuns={(value)=>this.Getaddshixuns(value)} Setaddshixuns={(value,is_jupyter)=>this.Getaddshixuns(value,is_jupyter)}
{...this.props} {...this.props}
{...this.state} {...this.state}
/>:""} />:""}
@ -430,7 +431,7 @@ class DetailCardsEditAndEdit extends Component{
</div> </div>
<p className="clearfix mb10"> <p className="clearfix mb10">
<a onClick={this.Addshixuns} clasName="fl defalutGreyBorder color-grey-6 ml37"> <a onClick={this.Addshixuns} className="fl defalutGreyBorder color-grey-6 ml37">
<i className="iconfont icon-tianjiafangda fl mr5"></i> <i className="iconfont icon-tianjiafangda fl mr5"></i>
</a> </a>
</p> </p>

@ -20,7 +20,7 @@ import TPMRepositoryComponent from './TPMRepositoryComponent';
import TPMRepositoryCommits from './shixunchild/Repository/TPMRepositoryCommits'; import TPMRepositoryCommits from './shixunchild/Repository/TPMRepositoryCommits';
import TPMsettings from './TPMsettings/oldTPMsettings'; import TPMsettings from './TPMsettings/TPMsettings';
import TPMChallengeComponent from './TPMChallengeContainer'; import TPMChallengeComponent from './TPMChallengeContainer';
import TPMPropaedeuticsComponent from './TPMPropaedeuticsComponent'; import TPMPropaedeuticsComponent from './TPMPropaedeuticsComponent';

@ -103,9 +103,10 @@ class Shixuninformation extends Component {
return isLt150M; return isLt150M;
}, },
} }
return ( return (
<div> <div>
<Form onSubmit={this.handleSubmit}> <Form>
<Form.Item <Form.Item
label="名称" label="名称"
style={{"borderBottom": 'none'}} style={{"borderBottom": 'none'}}
@ -300,12 +301,12 @@ class Shixuninformation extends Component {
</div> </div>
</div> </div>
</div> </div>
</Form>
<Form.Item label="私密版本库:"> <span className="ant-form-text mt20" >私密版本库
<span className="ant-form-text"><Checkbox>若需要对学员隐藏部分版本库内容时请选中选中即启用私密版本库请将需要对学员隐藏的文件存储在私密版本库</Checkbox></span> <Checkbox>若需要对学员隐藏部分版本库内容时请选中选中即启用私密版本库请将需要对学员隐藏的文件存储在私密版本库</Checkbox>
</Form.Item> </span>
</Form>
{this.props.identity<3?<div className="edu-back-white padding40-20 mb20"> {this.props.identity<3?<div className="edu-back-white padding40-20 mb20">
<p className="color-grey-6 font-16 mb30">服务配置</p> <p className="color-grey-6 font-16 mb30">服务配置</p>

@ -1,20 +1,7 @@
import React, {Component} from 'react'; import React, {Component} from 'react';
import { import {
Input,
Select,
Radio,
Checkbox,
Popconfirm,
message,
Modal,
Icon,
DatePicker,
Breadcrumb,
Upload,
Button, Button,
notification,
Tooltip,
Tabs Tabs
} from 'antd'; } from 'antd';

@ -31,6 +31,7 @@ class Newshixuns extends Component {
runtime: undefined, runtime: undefined,
run_method: undefined, run_method: undefined,
postapplyvisible: undefined, postapplyvisible: undefined,
fileList: [],
} }
} }
@ -96,17 +97,15 @@ class Newshixuns extends Component {
axios.post(Url, { axios.post(Url, {
description: mdContnet, description: mdContnet,
main_type: values.main_type, main_type: values.main_type,
is_jupyter: values.is_jupyter === "2" ? true : false,
sub_type: values.sub_type, sub_type: values.sub_type,
shixun: { shixun: {
name: values.name, name: values.name,
trainee: values.select, trainee: values.select,
task_pass: 1 is_jupyter: values.is_jupyter === "2" ? true : false,
} }
} }
).then((response) => { ).then((response) => {
if (response.status === 200) { if (response.status === 200) {
debugger
window.location.href = "/shixuns/" + response.data.shixun_identifier + "/challenges"; window.location.href = "/shixuns/" + response.data.shixun_identifier + "/challenges";
// window.open("/shixuns/"+response.data.shixun_identifier+"/challenges"); // window.open("/shixuns/"+response.data.shixun_identifier+"/challenges");
} else { } else {
@ -314,6 +313,76 @@ class Newshixuns extends Component {
} }
} }
// 附件相关 START
handleChange = (info) => {
if(info.file.status === 'uploading' || info.file.status === 'done' || info.file.status === 'removed') {
let {fileList} = this.state;
if (info.file.status === 'uploading' || info.file.status === 'done' || info.file.status === 'removed') {
console.log("handleChange1");
// if(fileList.length===0){
let fileLists = info.fileList;
this.setState({
// fileList:appendFileSizeToUploadFileAll(fileList),
fileList: fileLists,
deleteisnot: false
});
// }
}
}
}
onAttachmentRemove = (file) => {
if(!file.percent || file.percent == 100){
confirm({
title: '确定要删除这个附件吗?',
okText: '确定',
cancelText: '取消',
// content: 'Some descriptions',
onOk: () => {
console.log("665")
this.deleteAttachment(file)
},
onCancel() {
console.log('Cancel');
},
});
return false;
}
}
deleteAttachment = (file) => {
console.log(file);
let id=file.response ==undefined ? file.id : file.response.id
const url = `/attachments/${id}.json`
axios.delete(url, {
})
.then((response) => {
if (response.data) {
const { status } = response.data;
if (status == 0) {
// console.log('--- success')
this.setState((state) => {
const index = state.fileList.indexOf(file);
const newFileList = state.fileList.slice();
newFileList.splice(index, 1);
return {
fileList: newFileList,
deleteisnot:true
};
});
}
}
})
.catch(function (error) {
console.log(error);
});
}
render() { render() {
const {getFieldDecorator} = this.props.form; const {getFieldDecorator} = this.props.form;
const {newshixunlist, fileList, postapplytitle, postapplyvisible} = this.state; const {newshixunlist, fileList, postapplytitle, postapplyvisible} = this.state;
@ -523,7 +592,7 @@ class Newshixuns extends Component {
{this.state.mainvalues === undefined && this.state.subvalues === undefined ? "" : {this.state.mainvalues === undefined && this.state.subvalues === undefined ? "" :
<div className={"font-12"} style={{'max-width':'700px'}}> <div className={"font-12"} style={{'max-width':'700px'}}>
{`已安装软件:${this.state.mainvalues===undefined?"":this.state.mainvalues}${this.state.subvalues===undefined?"":this.state.subvalues}`} {`已安装软件:${this.state.mainvalues===undefined?"":this.state.mainvalues}${this.state.subvalues===undefined?"":this.state.subvalues}`}
{`说明:添加了${this.state.mainvalues===undefined?"":this.state.mainvalues}${this.state.subvalues===undefined?"":this.state.subvalues}`} {` 说明:添加了${this.state.mainvalues===undefined?"":this.state.mainvalues}${this.state.subvalues===undefined?"":this.state.subvalues}`}
</div>} </div>}
</div> </div>

Loading…
Cancel
Save