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 1/9] =?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 (
@@ -179,17 +320,26 @@ class Shixuninformation extends Component { })(
- @@ -319,16 +438,9 @@ class Shixuninformation extends Component { rules: [{required: true, message: '请选择主类别'}], })(
- - { - newshixunlist === undefined ? "" : newshixunlist.small_type.map((item, key) => { - return ( + this.props.data === undefined ? "" : this.props.data.shixun.small_type.map((item, key) => { + return( @@ -408,7 +523,7 @@ class Shixuninformation extends Component { style={{"borderBottom": 'none'}} className="chooseDes pr" > - {getFieldDecorator('select', { + {getFieldDecorator('select123', { rules: [{required: true, message: '请选择评测脚本'}], })(
@@ -638,7 +753,7 @@ class Shixuninformation extends Component { {/**/} - +
- +
); diff --git a/public/react/src/modules/tpm/newshixuns/Newshixuns.js b/public/react/src/modules/tpm/newshixuns/Newshixuns.js index 6d5e3fd4f..c09a3cece 100644 --- a/public/react/src/modules/tpm/newshixuns/Newshixuns.js +++ b/public/react/src/modules/tpm/newshixuns/Newshixuns.js @@ -589,10 +589,10 @@ class Newshixuns extends Component { )}
- {this.state.mainvalues === undefined && this.state.subvalues === undefined ? "" : + {this.state.mainvalues === undefined && this.state.subvalues === undefined||this.state.mainvalues === "" && 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.mainvalues}${this.state.subvalues===undefined||this.state.subvalues===""?"":this.state.subvalues}`} + {` 说明:添加了${this.state.mainvalues===undefined||this.state.mainvalues===""?"":this.state.mainvalues}${this.state.subvalues===undefined||this.state.subvalues===""?"":this.state.subvalues}`}
}
From 7f885da98deb9ebf7e0f21260c855ae4d5b65103 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Wed, 11 Dec 2019 21:01:22 +0800 Subject: [PATCH 6/9] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tpm/shixunchild/Challenges/Challengesjupyter.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/public/react/src/modules/tpm/shixunchild/Challenges/Challengesjupyter.js b/public/react/src/modules/tpm/shixunchild/Challenges/Challengesjupyter.js index dc70ee1ca..cf7243bf1 100644 --- a/public/react/src/modules/tpm/shixunchild/Challenges/Challengesjupyter.js +++ b/public/react/src/modules/tpm/shixunchild/Challenges/Challengesjupyter.js @@ -125,15 +125,21 @@ class Challengesjupyter extends Component { console.log("propsysl"); console.log(propsysl); let id=this.props.match.params.shixunId; + var jupyter_port=""; + try{ + jupyter_port= parseInt(propsysl.shixunsDetails.jupyter_port); + }catch (e) { + jupyter_port=propsysl.shixunsDetails.jupyter_port; + } const url=`/shixuns/${id}/update_jupyter.json`; const data={ identifier:id, - jupyter_port:propsysl.shixunsDetails.jupyter_port + jupyter_port:jupyter_port, } axios.post(url, data) .then((result) => { - if (result.data.status == 0) { + if (result.data.status === 0) { this.props.showNotification(`应用成功`); } }).catch((error) => { From 038a25a45e1bf1947ad5383f20d0fcce1200c3f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com> Date: Thu, 12 Dec 2019 00:12:03 +0800 Subject: [PATCH 7/9] =?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 | 4 ++- .../tpm/TPMsettings/Shixuninformation.js | 2 +- .../src/modules/tpm/newshixuns/Newshixuns.js | 29 ++++--------------- 3 files changed, 9 insertions(+), 26 deletions(-) diff --git a/public/react/src/modules/tpm/TPMIndex.js b/public/react/src/modules/tpm/TPMIndex.js index e8730defc..2e28d800e 100644 --- a/public/react/src/modules/tpm/TPMIndex.js +++ b/public/react/src/modules/tpm/TPMIndex.js @@ -20,7 +20,9 @@ import TPMRepositoryComponent from './TPMRepositoryComponent'; import TPMRepositoryCommits from './shixunchild/Repository/TPMRepositoryCommits'; -import TPMsettings from './TPMsettings/oldTPMsettings'; +import TPMsettings from './TPMsettings/TPMsettings'; + +//import TPMsettings from './TPMsettings/oldTPMsettings'; 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 acd73541b..b274b018f 100644 --- a/public/react/src/modules/tpm/TPMsettings/Shixuninformation.js +++ b/public/react/src/modules/tpm/TPMsettings/Shixuninformation.js @@ -593,7 +593,7 @@ class Shixuninformation extends Component {
{this.state.mainvalues === undefined && this.state.subvalues === undefined||this.state.mainvalues === "" && this.state.subvalues === "" ? "" :
- {`已安装软件:${this.state.mainvalues===undefined||this.state.mainvalues===""?"":this.state.mainvalues}${this.state.subvalues===undefined||this.state.subvalues===""?"":this.state.subvalues}`} - {` 说明:添加了${this.state.mainvalues===undefined||this.state.mainvalues===""?"":this.state.mainvalues}${this.state.subvalues===undefined||this.state.subvalues===""?"":this.state.subvalues}`} + {`${this.state.mainvalues===undefined||this.state.mainvalues=== ""?"":`已安装软件:`+this.state.mainvalues}`} + {`${this.state.subvalues===undefined||this.state.subvalues=== ""?"":this.state.mainvalues===undefined||this.state.mainvalues=== ""?`已安装软件:`+this.state.subvalues:this.state.subvalues}`} + {`${this.state.mainvalues===undefined||this.state.mainvalues=== ""?"":`说明:添加了`+this.state.mainvalues}${this.state.subvalues===undefined||this.state.subvalues=== ""?"": + this.state.mainvalues===undefined||this.state.mainvalues=== ""?`说明:添加了`+this.state.subvalues:this.state.subvalues}`}
}
@@ -697,27 +699,6 @@ class Newshixuns extends Component { {/**/} - - -
-

新建申请已提交,请等待管理员的审核

-
  • 我们将在1-2个工作日内与您联系 -
  • -
    -
    - 知道啦 -
    -
    -
    From f1e8ef30369b3ab7be16cff1308ca84310e54cfc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com> Date: Thu, 12 Dec 2019 09:39:03 +0800 Subject: [PATCH 8/9] =?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 | 4 +- .../modules/tpm/TPMsettings/Configuration.js | 2 +- .../tpm/TPMsettings/LearningSettings.js | 2 +- .../tpm/TPMsettings/Shixuninformation.js | 635 +++++++++--------- .../modules/tpm/TPMsettings/TPMsettings.js | 19 +- 5 files changed, 329 insertions(+), 333 deletions(-) diff --git a/public/react/src/modules/tpm/TPMIndex.js b/public/react/src/modules/tpm/TPMIndex.js index 2e28d800e..0fe17be2e 100644 --- a/public/react/src/modules/tpm/TPMIndex.js +++ b/public/react/src/modules/tpm/TPMIndex.js @@ -20,9 +20,9 @@ import TPMRepositoryComponent from './TPMRepositoryComponent'; import TPMRepositoryCommits from './shixunchild/Repository/TPMRepositoryCommits'; -import TPMsettings from './TPMsettings/TPMsettings'; +//import TPMsettings from './TPMsettings/TPMsettings'; -//import TPMsettings from './TPMsettings/oldTPMsettings'; +import TPMsettings from './TPMsettings/oldTPMsettings'; import TPMChallengeComponent from './TPMChallengeContainer'; import TPMPropaedeuticsComponent from './TPMPropaedeuticsComponent'; diff --git a/public/react/src/modules/tpm/TPMsettings/Configuration.js b/public/react/src/modules/tpm/TPMsettings/Configuration.js index 299f4eb64..2089d1939 100644 --- a/public/react/src/modules/tpm/TPMsettings/Configuration.js +++ b/public/react/src/modules/tpm/TPMsettings/Configuration.js @@ -80,7 +80,7 @@ export default class Shixuninformation extends Component { }) } return ( -
    +
    复制: diff --git a/public/react/src/modules/tpm/TPMsettings/LearningSettings.js b/public/react/src/modules/tpm/TPMsettings/LearningSettings.js index 393e0659c..9f99ea5a0 100644 --- a/public/react/src/modules/tpm/TPMsettings/LearningSettings.js +++ b/public/react/src/modules/tpm/TPMsettings/LearningSettings.js @@ -23,7 +23,7 @@ export default class Shixuninformation extends Component { render() { return ( -
    +
    1111
    ); diff --git a/public/react/src/modules/tpm/TPMsettings/Shixuninformation.js b/public/react/src/modules/tpm/TPMsettings/Shixuninformation.js index b274b018f..1e6980216 100644 --- a/public/react/src/modules/tpm/TPMsettings/Shixuninformation.js +++ b/public/react/src/modules/tpm/TPMsettings/Shixuninformation.js @@ -62,7 +62,8 @@ class Shixuninformation extends Component { shixunName:this.props.data.shixun.name, trainee:this.props.data.shixun.trainee, choice_main_type:this.props.data.shixun.choice_main_type, - choice_small_type:this.props.data.shixun.choice_small_type + choice_small_type:this.props.data.shixun.choice_small_type, + choice_standard_scripts:this.props.data.shixun.choice_standard_scripts, }) this.props.form.setFieldsValue({ @@ -315,7 +316,7 @@ class Shixuninformation extends Component { let operateauthority=this.props.identity===1?true:this.props.identity<5&&this.props.data.shixun.status==0?true:false; console.log(operateauthority) const {getFieldDecorator} = this.props.form; - const {newshixunlist, languagewrite, systemenvironment, testcoderunmode, fileList, postapplytitle, postapplyvisible, shixunmemoMDvalue} = this.state; + const {newshixunlist, languagewrite, systemenvironment, testcoderunmode, fileList, choice_standard_scripts, postapplyvisible, shixunmemoMDvalue} = this.state; const {shixun_service_configs}=this.props; const uploadProps = { width: 600, @@ -366,139 +367,140 @@ class Shixuninformation extends Component { return (
    -
    - - {getFieldDecorator('name', { - rules: [{ - required: true, message: '请输入选题名称', - }, { - max: 60, message: '请输入名称,最大限制60个字符', - }, { - whitespace: true, message: '请勿输入空格' - }], - })( - - )} - - - - - - - - - {getFieldDecorator('trainee', { - rules: [{required: true, message: '请选择难易度'}], - })( -
    - - -
    - )} - (实训的难易程度) -
    - - -
    - - {getFieldDecorator('selectleft', { - rules: [{required: true, message: '请选择主类别'}], +
    + + + {getFieldDecorator('name', { + rules: [{ + required: true, message: '请输入选题名称', + }, { + max: 60, message: '请输入名称,最大限制60个字符', + }, { + whitespace: true, message: '请勿输入空格' + }], + })( + + )} + + + + + + + + + {getFieldDecorator('trainee', { + rules: [{required: true, message: '请选择难易度'}], })( -
    - - option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0 - } + onChange={this.Selectthestudent} + value={this.state.trainee} > - - { - this.props.data === undefined ? "" : this.props.data.shixun.main_type.map((item, key) => { - return ( - - ) - }) - } + + + +
    )} -
    - - + (实训的难易程度) + + + +
    + + {getFieldDecorator('selectleft', { + rules: [{required: true, message: '请选择主类别'}], + })( +
    + - -
    - {getFieldDecorator('selectright', { - rules: [{required: true, message: '请选择小类别'}], - })( -
    - -
    - )} - +
    + )} +
    + + + + +
    + {getFieldDecorator('selectright', { + rules: [{required: true, message: '请选择小类别'}], + })( +
    + +
    + )} +
    已安装软件:hadoop3.1.0、jdk1.8; @@ -508,44 +510,49 @@ class Shixuninformation extends Component {
    -
    -
    +
    +
    -
    -
    - 没有实验环境? - 申请新建 -
    +
    +
    + 没有实验环境? + 申请新建 +
    - - {getFieldDecorator('select123', { - rules: [{required: true, message: '请选择评测脚本'}], - })( -
    - + + {getFieldDecorator('select123', { + rules: [{required: true, message: '请选择评测脚本'}], + })( +
    + +
    + )} + 使用自定义脚本 this.testscripttip(0)}>
    + style={{top: '33px', left: '-15px',width: '450px',zIndex: '10',display: this.state.testscripttiptype===true?'block':"none"}}> : ""} - - -
    -
  • - - -
  • -
    {this.state.languagewritetype === true ? "请填写该镜像语言" : ""}
    -
  • - - -
  • -
    {this.state.systemenvironmenttype === true ? "请填写该镜像语言系统环境" : ""}
    -
  • - - - -
  • -
    {this.state.testcoderunmodetype === true ? "请填写该镜像测试代码运行方式" : ""}
    -
  • - -
    - - - 上传附件 - (单个文件50M以内) - - -
    - -
  • -
    - {this.state.attachmentidstype === true ? "请上传附件" : ""} -
    -
  • - this.sendhideModaly()} - >取消 - -
  • -
    -
    - {/**/} -
    + } + : ""} + + +
    +
  • + + +
  • +
    {this.state.languagewritetype === true ? "请填写该镜像语言" : ""}
    +
  • + + +
  • +
    {this.state.systemenvironmenttype === true ? "请填写该镜像语言系统环境" : ""}
    +
  • + + + +
  • +
    {this.state.testcoderunmodetype === true ? "请填写该镜像测试代码运行方式" : ""}
    +
  • + +
    + + + 上传附件 + (单个文件50M以内) + + +
    - - -
    -

    新建申请已提交,请等待管理员的审核

    -
  • 我们将在1-2个工作日内与您联系
  • +
    + {this.state.attachmentidstype === true ? "请上传附件" : ""} +
    +
  • + this.sendhideModaly()} + >取消 + +
  • +
    -
    - 知道啦 -
    -
    - - + {/**/} + +
    +
    + ); } } diff --git a/public/react/src/modules/tpm/TPMsettings/TPMsettings.js b/public/react/src/modules/tpm/TPMsettings/TPMsettings.js index 224339998..c405e3e9f 100644 --- a/public/react/src/modules/tpm/TPMsettings/TPMsettings.js +++ b/public/react/src/modules/tpm/TPMsettings/TPMsettings.js @@ -83,9 +83,21 @@ export default class TPMsettings extends Component { render() { return ( -
    -
    +
    +
    - - -
    ); } } From 5977fa4a24947d9678ab363ce832f53904eb8616 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Thu, 12 Dec 2019 09:40:27 +0800 Subject: [PATCH 9/9] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/modules/tpm/TPMChallengeContainer.js | 4 ++-- public/react/src/modules/tpm/TPMDataset.js | 8 ++++--- .../Challenges/Challengesjupyter.js | 23 +++++++++++++++---- 3 files changed, 26 insertions(+), 9 deletions(-) diff --git a/public/react/src/modules/tpm/TPMChallengeContainer.js b/public/react/src/modules/tpm/TPMChallengeContainer.js index d58a17e55..9fc1f44f4 100644 --- a/public/react/src/modules/tpm/TPMChallengeContainer.js +++ b/public/react/src/modules/tpm/TPMChallengeContainer.js @@ -15,8 +15,8 @@ class TPMChallengeContainer extends Component { render() { const { tpmLoading } = this.props; const user = this.props.current_user; - console.log("TPMChallengeContainerTPMChallengeContainer"); - console.log(this.props); + // console.log("TPMChallengeContainerTPMChallengeContainer"); + // console.log(this.props); return ( diff --git a/public/react/src/modules/tpm/TPMDataset.js b/public/react/src/modules/tpm/TPMDataset.js index d7f14b84e..897fbe221 100644 --- a/public/react/src/modules/tpm/TPMDataset.js +++ b/public/react/src/modules/tpm/TPMDataset.js @@ -103,8 +103,8 @@ class TPMDataset extends Component { selectedRowKeysdata:mydata, selectedRowKeys: datas, }) - console.log(mydata); - console.log(datas); + // console.log(mydata); + // console.log(datas); } else { @@ -237,6 +237,7 @@ class TPMDataset extends Component { // 附件相关 START handleChange = (info) => { + debugger if(info.file.status === 'uploading' || info.file.status === 'done' || info.file.status === 'removed') { let {fileList} = this.state; @@ -256,6 +257,7 @@ class TPMDataset extends Component { } onAttachmentRemove = (file) => { + debugger if(!file.percent || file.percent == 100){ confirm({ title: '确定要删除这个附件吗?', @@ -357,7 +359,7 @@ class TPMDataset extends Component { onChange: this.handleChange, onRemove: this.onAttachmentRemove, beforeUpload: (file, fileList) => { - + debugger if (this.state.fileList.length >= 1) { return false } diff --git a/public/react/src/modules/tpm/shixunchild/Challenges/Challengesjupyter.js b/public/react/src/modules/tpm/shixunchild/Challenges/Challengesjupyter.js index cf7243bf1..86e7f2c04 100644 --- a/public/react/src/modules/tpm/shixunchild/Challenges/Challengesjupyter.js +++ b/public/react/src/modules/tpm/shixunchild/Challenges/Challengesjupyter.js @@ -60,11 +60,26 @@ class Challengesjupyter extends Component { componentDidMount() { setTimeout(this.ChallengesList(), 1000); + // console.log("componentDidMount"); + // console.log("Challengesjupyter"); + // console.log(this.props); + let id = this.props.match.params.shixunId; + let ChallengesURL = `/jupyters/get_info_with_tpm.json`; + let datas={ + identifier:id, + } + axios.get(ChallengesURL, {params: datas}).then((response) => { + if (response.status === 200) { + if (response.data.status === 403||response.data.status === 401||response.data.status === 500) { - console.log("componentDidMount"); - console.log("Challengesjupyter"); - console.log(this.props); - + }else{ + console.log("componentDidMountChallengesjupyter"); + console.log(response.data); + } + } + }).catch((error) => { + console.log(error) + });