From 2fa673229794f6b57cdad67955d5415fc0e8e8a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com> Date: Wed, 11 Dec 2019 17:27:42 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/react/src/modules/tpm/TPMIndex.js | 2 +- .../tpm/TPMsettings/Shixuninformation.js | 204 +++++++++++++++++- 2 files changed, 197 insertions(+), 9 deletions(-) diff --git a/public/react/src/modules/tpm/TPMIndex.js b/public/react/src/modules/tpm/TPMIndex.js index f80691d56..9c82e987d 100644 --- a/public/react/src/modules/tpm/TPMIndex.js +++ b/public/react/src/modules/tpm/TPMIndex.js @@ -20,7 +20,7 @@ import TPMRepositoryComponent from './TPMRepositoryComponent'; import TPMRepositoryCommits from './shixunchild/Repository/TPMRepositoryCommits'; -import TPMsettings from './TPMsettings/oldTPMsettings'; +import TPMsettings from './TPMsettings/TPMsettings'; import TPMChallengeComponent from './TPMChallengeContainer'; import TPMPropaedeuticsComponent from './TPMPropaedeuticsComponent'; diff --git a/public/react/src/modules/tpm/TPMsettings/Shixuninformation.js b/public/react/src/modules/tpm/TPMsettings/Shixuninformation.js index aa874d8fe..cb18f8b7a 100644 --- a/public/react/src/modules/tpm/TPMsettings/Shixuninformation.js +++ b/public/react/src/modules/tpm/TPMsettings/Shixuninformation.js @@ -43,6 +43,7 @@ class Shixuninformation extends Component { NAME_COUNT: 60, shixunmemoMDvalue: "", language: "java", + testscripttiptype:false } } @@ -54,7 +55,145 @@ class Shixuninformation extends Component { }) } + testscripttip=(val)=>{ + if(val===0){ + this.setState({ + testscripttiptype:true + }) + }else if(val===1){ + this.setState({ + testscripttiptype:false + }) + } + } + + post_apply = () => { + this.setState({ + postapplyvisible: true + }) + } + + + sendhideModaly = () => { + this.setState({ + postapplyvisible: false, + }) + if (this.state.file !== undefined) { + // this.deleteAttachment(this.state.file); + this.setState({ + file: undefined, + deleteisnot: true, + language: "", + runtime: "", + run_method: "", + fileList: [] + }) + } else { + this.setState({ + file: undefined, + deleteisnot: true, + language: "", + runtime: "", + run_method: "", + fileList: [] + }) + } + } + + + sendsure_apply = () => { + let {language, runtime, run_method} = this.state; + + if (!language || language === "") { + // this.props.showNotification(`请填写该镜像是基于什么语言`); + this.setState({ + languagewritetype: true + }) + return + } + if (!runtime || runtime === "") { + // this.props.showNotification(`请填写该镜像是基于什么语言系统环境`); + this.setState({ + systemenvironmenttype: true + }) + return; + + } + if (!run_method || run_method === "") { + // this.props.showNotification(`请填写该镜像中测试代码运行方式`); + this.setState({ + testcoderunmodetype: true + }) + return; + } + + var attachment_ids = undefined; + if (this.state.fileList) { + attachment_ids = this.state.fileList.map(item => { + return item.response ? item.response.id : item.id + }) + } + + if (attachment_ids === undefined || attachment_ids.length === 0) { + this.setState({ + attachmentidstype: true + }) + return; + } + + var data = { + language: language, + runtime: runtime, + run_method: run_method, + attachment_id: attachment_ids[0], + } + var url = `/shixuns/apply_shixun_mirror.json`; + axios.post(url, data + ).then((response) => { + + try { + if (response.data) { + + if (this.state.file !== undefined) { + this.setState({ + file: undefined, + deleteisnot: true, + language: "", + runtime: "", + run_method: "", + fileList: [] + }) + } else { + this.setState({ + file: undefined, + deleteisnot: true, + language: "", + runtime: "", + run_method: "", + fileList: [] + }) + } + notification.open( + { + message: '提示', + description: + '提交成功!', + + } + ) + this.sendhideModaly() + + } + } catch (e) { + + } + + }) + + } + + render() { console.log(this.props.data) const {getFieldDecorator} = this.props.form; @@ -105,6 +244,8 @@ class Shixuninformation extends Component { }, } + + return (