From d6a0a50b43f69e4ff3d4a11eef519a20a3743ea5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com> Date: Fri, 26 Jul 2019 12:26:56 +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 --- .../src/modules/courses/new/CoursesNew.js | 12 +- .../tpm/challengesnew/TPMevaluation.js | 114 +++++++++++------- .../src/modules/tpm/newshixuns/Newshixuns.js | 10 +- 3 files changed, 86 insertions(+), 50 deletions(-) diff --git a/public/react/src/modules/courses/new/CoursesNew.js b/public/react/src/modules/courses/new/CoursesNew.js index 0df9a540a..3134a6b58 100644 --- a/public/react/src/modules/courses/new/CoursesNew.js +++ b/public/react/src/modules/courses/new/CoursesNew.js @@ -325,7 +325,8 @@ class CoursesNew extends Component { // fetching: true, // }); this.setState({ - fetching: true + fetching: true, + school: value }) this.getschool(value) } @@ -365,9 +366,14 @@ class CoursesNew extends Component { if (result.data.status===0) { this.setState({ searchlistscholl: result.data.school_names, - fetching: false - }) + }) + if(searchlistscholl.length!=0){ + this.setState({ + searchlistscholl: result.data.school_names, + fetching: false + }) + } } }).catch((error)=>{ console.log(error) diff --git a/public/react/src/modules/tpm/challengesnew/TPMevaluation.js b/public/react/src/modules/tpm/challengesnew/TPMevaluation.js index 396358708..5d66829c3 100644 --- a/public/react/src/modules/tpm/challengesnew/TPMevaluation.js +++ b/public/react/src/modules/tpm/challengesnew/TPMevaluation.js @@ -256,11 +256,12 @@ export default class TPMevaluation extends Component { this.setevaluationlist(newevaluationlist); } - getfilepath=(e,shixunfilepath)=>{ + getfilepath=(e,shixunfilepath,type)=>{ this.setState({ evaluationvisible: true, selectpath:e.target.value, selectpatharr:[], + pathtype:type }); let id = this.props.match.params.shixunId; let url ="/shixuns/"+id+"/repository.json"; @@ -283,9 +284,9 @@ export default class TPMevaluation extends Component { }); } - sendgetfilepath=(newpath,type)=>{ + sendgetfilepath=(newpath,type,newpathtype)=>{ let id = this.props.match.params.shixunId; - let{path,main}=this.state; + let{path,main,pathtype}=this.state; let ary=main; let paths=path; @@ -329,10 +330,18 @@ export default class TPMevaluation extends Component { }); } + if(pathtype===2){ + this.setState({ + selectpath: newpathtype, + }) + } } goblakepath=(path,key)=>{ - let {main,selectpath} =this.state; + let {main,selectpath,pathtype} =this.state; + + + let newmain=[] for(var i=0;i<=key;i++){ newmain.push(main[i]) @@ -355,6 +364,17 @@ export default class TPMevaluation extends Component { }).catch((error) => { console.log(error) }); + + if(pathtype===2){ + // var str=path; + // str.slice(0,str.length-1) + // debugger + // console.log(str) + this.setState({ + selectpath: path, + }) + } + } // delesavegetfilepath=(value)=>{ // let {selectpatharr} = this.state @@ -381,7 +401,36 @@ export default class TPMevaluation extends Component { // }) // } savegetfilepath=(value)=>{ - let {selectpath,saveshixunfilepath} = this.state + let {selectpath,saveshixunfilepath,pathtype} = this.state + + if(pathtype===1){ + let newselectpath; + + if(saveshixunfilepath==="shixunfilepathplay"){ + newselectpath=value + }else{ + const type = selectpath.split(';'); + let types=false; + for(var i=0; i{ @@ -650,9 +675,10 @@ export default class TPMevaluation extends Component { selectpath:e.target.value }) } - updatepath=(e,name)=>{ + updatepath=(e,name,type)=>{ this.setState({ - [name]:e.target.value + [name]:e.target.value, + pathtype:type }) } @@ -818,8 +844,8 @@ export default class TPMevaluation extends Component { placeholder="请选择版本库中的代码文件。例: src/step1/HelloWorld.java" value={shixunfilepath} style={{ width:StudentTaskPapers===true?'100%':""}} - onInput={(e)=>this.updatepath(e,"shixunfilepath")} - onClick={(e)=>this.getfilepath(e,"shixunfilepath")} + onInput={(e)=>this.updatepath(e,"shixunfilepath",1)} + onClick={(e)=>this.getfilepath(e,"shixunfilepath",1)} />

该文件将直接显示给学生,需要学生在其中填写代码

@@ -844,7 +870,7 @@ export default class TPMevaluation extends Component { { main.length===0?"":main.map((item,key)=>{ return( - this.goblakepath(item.path,key)}>{item.val} + this.goblakepath(item.path,key,item)}>{item.val} ) }) } @@ -853,7 +879,7 @@ export default class TPMevaluation extends Component { return(
  • { - item.type==="tree"?this.sendgetfilepath(item.name,item.type)} data-remote="true"> + item.type==="tree"?this.sendgetfilepath(item.name,item.type,path+item.name)} data-remote="true"> {path+item.name}: @@ -873,7 +899,7 @@ export default class TPMevaluation extends Component {
    this.saveselectpath(e)} value={selectpath}/>
    @@ -897,8 +923,8 @@ export default class TPMevaluation extends Component { placeholder="请选择版本库中的代码文件。例:src/step1/HelloWorldTest.java" value={shixunfilepathplay} style={{width:StudentTaskDocs===true?'100%':""}} - onInput={(e)=>this.updatepath(e,"shixunfilepathplay")} - onClick={(e)=>this.getfilepath(e,"shixunfilepathplay")} + onInput={(e)=>this.updatepath(e,"shixunfilepathplay",1)} + onClick={(e)=>this.getfilepath(e,"shixunfilepathplay",1)} />

    该文件由平台执行,用来测试平台学员代码是否正确

    @@ -958,8 +984,8 @@ export default class TPMevaluation extends Component { id="shixun_file_expect_picture_path" name="challenge[original_picture_path]" placeholder="请选择版本库中存储了待处理图片的路径。例:src/step1/expectedimages" value={shixunfileexpectpicturepath} - onInput={(e)=>this.updatepath(e,"shixunfileexpectpicturepath")} - onClick={(e)=>this.getfilepath(e,"shixunfileexpectpicturepath")} + onInput={(e)=>this.updatepath(e,"shixunfileexpectpicturepath",2)} + onClick={(e)=>this.getfilepath(e,"shixunfileexpectpicturepath",2)} />

    该路径下的文件将在学员评测本关任务时,作为原始图片显示在查看效果页,供学员参考,任务为图片处理时请指定该路径,并注意与程序文件所在文件夹分开 @@ -980,8 +1006,8 @@ export default class TPMevaluation extends Component { id="shixun_file_standard_picture_path" name="challenge[expect_picture_path]" placeholder="请选择版本库中存储了标准答案代码输出文件的路径。例:src/step1/expectedimages" value={shixunfilestandardpicturepath} - onInput={(e)=>this.updatepath(e,"shixunfilestandardpicturepath")} - onClick={(e)=>this.getfilepath(e,"shixunfilestandardpicturepath")} + onInput={(e)=>this.updatepath(e,"shixunfilestandardpicturepath",2)} + onClick={(e)=>this.getfilepath(e,"shixunfilestandardpicturepath",2)} />

    该路径下的文件将在学员评测本关任务时,作为参考答案显示在查看效果页,供学员参考任务输出结果为文件时请指定该路径,并注意与程序文件所在文件夹分开 @@ -1001,8 +1027,8 @@ export default class TPMevaluation extends Component { this.updatepath(e,"shixunfilepicturepath")} - onClick={(e)=>this.getfilepath(e,"shixunfilepicturepath")} + onInput={(e)=>this.updatepath(e,"shixunfilepicturepath",2)} + onClick={(e)=>this.getfilepath(e,"shixunfilepicturepath",2)} placeholder="请在版本库中指定用来保存学员代码实际输出结果的路径。例:src/step1/outputimages"/>

    学员评测本关任务时生成的文件将保存在该路径下,并作为实际输出显示在查看效果页,供学员确认任务输出结果为文件时请指定该路径,并注意与程序文件所在文件夹分开 diff --git a/public/react/src/modules/tpm/newshixuns/Newshixuns.js b/public/react/src/modules/tpm/newshixuns/Newshixuns.js index 346be3351..282ab1e43 100644 --- a/public/react/src/modules/tpm/newshixuns/Newshixuns.js +++ b/public/react/src/modules/tpm/newshixuns/Newshixuns.js @@ -742,11 +742,14 @@ class Newshixuns extends Component { // } onChangeTimePicker = (value, dateString) => { + debugger this.setState({ - TimePickervalue: handleDateStrings(dateString) + TimePickervalue: moment(handleDateStrings(dateString)) }) } - // 附件相关 START + + + // 附件相关 START handleChange = (info) => { console.log("handleChange1"); let fileList = info.fileList; @@ -1279,13 +1282,14 @@ class Newshixuns extends Component {