|
|
|
@ -31,6 +31,7 @@ class Newshixuns extends Component {
|
|
|
|
|
runtime: undefined,
|
|
|
|
|
run_method: undefined,
|
|
|
|
|
postapplyvisible: undefined,
|
|
|
|
|
fileList: [],
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -96,17 +97,15 @@ class Newshixuns extends Component {
|
|
|
|
|
axios.post(Url, {
|
|
|
|
|
description: mdContnet,
|
|
|
|
|
main_type: values.main_type,
|
|
|
|
|
is_jupyter: values.is_jupyter === "2" ? true : false,
|
|
|
|
|
sub_type: values.sub_type,
|
|
|
|
|
shixun: {
|
|
|
|
|
name: values.name,
|
|
|
|
|
trainee: values.select,
|
|
|
|
|
task_pass: 1
|
|
|
|
|
is_jupyter: values.is_jupyter === "2" ? true : false,
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
).then((response) => {
|
|
|
|
|
if (response.status === 200) {
|
|
|
|
|
debugger
|
|
|
|
|
window.location.href = "/shixuns/" + response.data.shixun_identifier + "/challenges";
|
|
|
|
|
// window.open("/shixuns/"+response.data.shixun_identifier+"/challenges");
|
|
|
|
|
} 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() {
|
|
|
|
|
const {getFieldDecorator} = this.props.form;
|
|
|
|
|
const {newshixunlist, fileList, postapplytitle, postapplyvisible} = this.state;
|
|
|
|
@ -523,7 +592,7 @@ class Newshixuns extends Component {
|
|
|
|
|
{this.state.mainvalues === undefined && this.state.subvalues === undefined ? "" :
|
|
|
|
|
<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}`}
|
|
|
|
|
</div>}
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|