|
|
webpackJsonp([236],{4035:function(e,t,a){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=a(165),l=(a.n(n),a(164)),D=a.n(l),i=a(292),s=(a.n(i),a(290)),G=a.n(s),r=a(30),c=(a.n(r),a(31)),R=a.n(c),o=a(66),u=(a.n(o),a(67)),q=a.n(u),p=a(168),m=(a.n(p),a(167)),W=a.n(m),h=a(296),d=(a.n(h),a(291)),F=a.n(d),f=a(0),L=a.n(f),$=a(45),v=a(12),x=a.n(v),z=a(5),g=a(341),b=(a.n(g),function(e,t,a){return t&&E(e.prototype,t),a&&E(e,a),e});function E(e,t){for(var a=0;a<t.length;a++){var n=t[a];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function y(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}Object(z.Q)();var _=Object(z.Q)("/editormd/lib/"),N=window.$,J=F.a.Option,U=W.a.Group,B=q.a.TextArea;var k=(function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(w,f.Component),b(w,[{key:"exerciseMD",value:function(e,t){var a=this;this.contentChanged=!1;var n,l,i,s,r,c,o,u=(n=t,l="100%",i=400,s="",r="/api/attachments.json",c=function(){setTimeout(function(){u.resize(),u.cm&&u.cm.refresh()},500),null!=e&&u.setValue(e),u.cm.on("change",function(e,t){console.log("....contentChanged"),a.contentChanged=!0})},o=window.editormd(n,{width:l,height:i,path:_,syncScrolling:"single",tex:!0,tocm:!0,emoji:!0,taskList:!0,codeFold:!0,searchReplace:!0,htmlDecode:"style,script,iframe",sequenceDiagram:!0,autoFocus:!1,toolbarIcons:function(){return["bold","italic","|","list-ul","list-ol","|","code","code-block","|","testIcon","testIcon1","|","image","table","|","watch","clear"]},toolbarCustomIcons:{testIcon:'<a type="inline" class="latex" ><div class=\'zbg\'></div></a>',testIcon1:'<a type="latex" class="latex" ><div class=\'zbg_latex\'></div></a>'},saveHTMLToTextarea:!0,dialogMaskOpacity:.6,placeholder:s,imageUpload:!0,imageFormats:["jpg","jpeg","gif","png","bmp","webp","JPG","JPEG","GIF","PNG","BMP","WEBP"],imageUploadURL:r,onload:function(){N("#"+n+' [type="latex"]').bind("click",function(){o.cm.replaceSelection("```latex"),o.cm.replaceSelection("\n"),o.cm.replaceSelection("\n"),o.cm.replaceSelection("```");var e=o.cm.getDoc().getCursor();o.cm.setCursor(e.line-1,0)}),N("#"+n+' [type="inline"]').bind("click",function(){o.cm.replaceSelection("`$$$$`");var e=o.cm.getDoc().getCursor();o.cm.setCursor(e.line,e.ch-3),o.cm.focus()}),N('[type="inline"]').attr("title","行内公式"),N('[type="latex"]').attr("title","多行公式"),window.md_elocalStorage(o,"exercise__"+n,"Memochallengesnew"),c&&c()}}));this.exercise_editormd=u,window.exercise_editormd=u}},{key:"componentDidMount",value:function(){var l=this,i=this.props.match.params.shixunId,e=this.props.match.params.checkpointId;this.setState({shixunId:i,checkpointId:e});var s="/shixuns/"+i+"/challenges/newquestion",r="/shixuns/"+i+"/challenges/new",c="/shixuns/"+i+"/challenges",t="/shixuns/"+i+"/challenges/"+e+"/edit.json?tab=1";x.a.get(t).then(function(e){var t=e.data.prev_challenge,a=e.data.next_challenge;null!=t&&(t=0===t.st?"/shixuns/"+i+"/challenges/"+t.id+"/editcheckpoint":"/shixuns/"+i+"/challenges/"+t.id+"/editquestion"),null!=a&&(a=0===a.st?"/shixuns/"+i+"/challenges/"+a.id+"/editcheckpoint":"/shixuns/"+i+"/challenges/"+a.id+"/editquestion");var n=[];n=0===e.data.test_sets.length?[{hidden:0,input:"",output:"",score:50},{hidden:0,input:"",output:"",score:50}]:e.data.test_sets,l.setState({power:e.data.power,evaluationlist:n,shixunfilepath:e.data.path,shixunfilepathplay:e.data.exec_path,pathoptionvalue:e.data.show_type,shixunfileexpectpicturepath:e.data.original_picture_path,shixunfilestandardpicturepath:e.data.expect_picture_path,shixunfilepicturepath:e.data.picture_path,prev_challenge:t,next_challenge:a,choice_url:s,practice_url:r,go_back_url:c,position:e.data.position,scorevalue:e.data.test_set_score,markvalue:e.data.test_set_average,web_route:e.data.web_route,has_web_route:e.data.has_web_route}),l.evaluationoninputvalueonload(),!1===e.data.power&&l.props.showSnackbar("你没有权限修改"),void 0===e.data.answer?l.answerMD("","answerMD"):l.answerMD(e.data.answer,"answerMD")}).catch(function(e){console.log(e)})}},{key:"render",value:function(){var a=this,e=this.state,t=e.choice_url,n=e.practice_url,l=e.go_back_url,i=e.position,s=e.evaluationlist,r=e.shixunId,c=e.checkpointId,o=e.power,u=e.shixunfileexpectpicturepath,p=e.shixunfilestandardpicturepath,m=e.shixunfilepicturepath,h=e.shixunfilepath,d=e.evaluationvisible,f=e.trees,v=e.path,g=e.main,b=e.selectpath,x=e.shixunfilepathplay,E=e.pathoptionvalue,y=e.showrepositoryurltiptype,_=e.prev_challenge,N=e.next_challenge,k=e.StudentTaskPapers,w=e.StudentTaskDocs,S=e.web_route,C=e.scorevalue,I=e.markvalue,j=e.scoretype,T=e.has_web_route,M="/shixuns/"+r+"/challenges/"+c+"/editcheckpoint",P="/shixuns/"+r+"/challenges/"+c+"/tab=2",O="/shixuns/"+r+"/challenges/"+c+"/tab=3",H={display:"block",height:"30px",lineHeight:"30px",marginLeft:"20px"};return L.a.createElement(L.a.Fragment,null,L.a.createElement("div",{className:"educontent mt30 mb30"},L.a.createElement("div",{className:"padding10-20 mb10 edu-back-white clearfix"},L.a.createElement("span",{className:"fl ring-blue mr10 mt7"},L.a.createElement("img",{src:Object(z.M)("images/educoder/icon/code.svg"),"data-tip-down":"实训任务",className:"fl mt2 ml2"})),L.a.createElement("span",{className:"font-16 task-hide fl TPMtaskName"},"第",i,"关"),L.a.createElement($.b,{to:void 0===l?"":l,className:"color-grey-6 fr font-15 mt3"},"返回"),void 0===_?"":L.a.createElement("a",{href:_,className:"fr color-blue mr15 mt4"},"上一关"),void 0===N?"":L.a.createElement("a",{href:N,className:"fr color-blue mr15 mt4"},"下一关"),L.a.createElement($.b,{to:void 0===n?"":n,className:"fr color-blue mr15 mt4",style:{display:4<this.props.identity||void 0===this.props.identity||2===this.props.status||1===this.props.status?"none":"block"},"data-tip-down":"新增代码编辑类型的任务"},"+ 实践类型"),L.a.createElement($.b,{to:void 0===t?"":t,className:"fr color-blue mr15 mt4",style:{display:4<this.props.identity||void 0===this.props.identity||2===this.props.status||1===this.props.status?"none":"block"},"data-tip-down":"新增选择题类型的任务"},"+ 选择题类型")),L.a.createElement("div",{className:"challenge_nav clearfix edu-back-white"},L.a.createElement("li",null,L.a.createElement($.b,{to:M},"本关任务")),L.a.createElement("li",{className:"active"},L.a.createElement($.b,{to:P},"评测设置")),L.a.createElement("li",{className:""},L.a.createElement($.b,{to:O},"参考答案"))),L.a.createElement("p",{className:"color-orange-tip font-12 padding20"},"请先上传本关任务的所有代码文件、标准图片等所有必要的文件到",L.a.createElement("a",{href:"/shixuns/"+r+"/repository",className:"color-bule-tip decoration",target:"_blank"},"版本库")),L.a.createElement("div",{className:"edu-back-white mb10 clearfix"},L.a.createElement("div",{className:"padding40-20"},L.a.createElement("p",{className:"color-grey-6 font-16 mb20"},"学员任务文件"),L.a.createElement("div",{className:"df"},L.a.createElement("span",{className:"mr30 color-orange pt10"},"*"),L.a.createElement("div",{className:"flex1 mr20"},L.a.createElement("input",{type:"text",className:"input-100-45 greyInput change",id:"shixun_file_path",name:"challenge[path]",autoComplete:"off",placeholder:"请选择版本库中的代码文件。例: src/step1/HelloWorld.java",value:h,style:{width:!0===k?"100%":""},onInput:function(e){return a.updatepath(e,"shixunfilepath",1)},onClick:function(e){return a.getfilepath(e,"shixunfilepath",1)}}),L.a.createElement("p",{className:"color-grey-9 mt15"},"该文件将直接显示给学生,需要学生在其中填写代码")),L.a.createElement("div",{style:{width:"57px"}},L.a.createElement("span",{className:!0===k?"color-orange mt8 fl":"color-orange mt8 fl none",id:"student_task_name"},L.a.createElement("i",{className:"fa fa-exclamation-circle mr3"}),"必填项"))))),L.a.createElement(R.a,{keyboard:!1,title:"文件路径",visible:d,closable:!1,footer:!1},L.a.createElement("div",{className:"task_popup_con"},L.a.createElement("div",{className:"newupload_conbox clearfix"},L.a.createElement("ul",{id:"directory_file"},0===g.length?"":g.map(function(e,t){return L.a.createElement("a",{className:"f14 fb",onClick:function(){return a.goblakepath(e.path,t,e)}},e.val)}),null==f?"":f.map(function(e,t){return L.a.createElement("li",{className:"entry",key:t},L.a.createElement("div",{className:"filename_no_report hidden"},"tree"===e.type?L.a.createElement("a",{onClick:function(){return a.sendgetfilepath(e.name,e.type,v+e.name)},"data-remote":"true"},L.a.createElement("i",{className:"iconfont icon-wenjianjia color-blue mr2"}),v+e.name):L.a.createElement("a",{"data-remote":"true"},L.a.createElement("i",{className:"iconfont icon-zuoye color-blue mr2"}),L.a.createElement("span",{onClick:function(){return a.savegetfilepath(v+e.name,e.type)}},v+e.name))))})),L.a.createElement("div",{className:"clearfix mt20"},L.a.createElement("label",{className:"fl mt5 directory_filepath"},"选中的文件路径:"),L.a.createElement(q.a,{id:"points_tusi",placeholder:"选中的文件路径",className:"fl input-60-40",style:{width:"400px"},onInput:function(e){return a.saveselectpath(e)},value:b})),L.a.createElement("a",{className:"task-btn task-btn-orange fr",style:{marginTop:"20px",marginLeft:"20px"},id:"add_path",onClick:function(){return a.evaluationenter()}},"确定"),L.a.createElement("a",{className:"pop_close task-btn mb10 fr",style:{marginTop:"20px"},id:"back_page",onClick:function(){return a.evaluationhideModal()}},"取消")))),L.a.createElement("div",{className:"edu-back-white mb10 clearfix"},L.a.createElement("div",{className:"padding40-20"},L.a.createElement("p",{className:"color-grey-6 font-16 mb20"},"评测执行文件"),L.a.createElement("div",{className:"df"},L.a.createElement("span",{className:"mr30 color-orange pt10"},"*"),L.a.createElement("div",{className:"flex1 mr20"},L.a.createElement("input",{type:"text",className:"input-100-45 greyInput",id:"shixun_file_path_play",name:"challenge[exec_path]",autoComplete:"off",placeholder:"请选择版本库中的代码文件。例:src/step1/HelloWorldTest.java",value:x,style:{width:!0===w?"100%":""},onInput:function(e){return a.updatepath(e,"shixunfilepathplay",1)},onClick:function(e){return a.getfilepath(e,"shixunfilepathplay",1)}}),L.a.createElement("p",{className:"color-grey-9 mt15"},"该文件由平台执行,用来测试平台学员代码是否正确")),L.a.createElement("div",{style:{width:"57px"}},L.a.createElement("span",{className:!0===w?"color-orange mt8 fl":"color-orange mt8 fl none",id:"student_task_name"},L.a.createElement("i",{className:"fa fa-exclamation-circle mr3"}),"必填项"))))),L.a.createElement("div",{className:"edu-back-white mb10 clearfix"},L.a.createElement("div",{className:"padding40-20"},L.a.createElement("p",{className:"color-grey-6 font-16 mb20"},"效果展现方式"),L.a.createElement("div",{className:"pr"},L.a.createElement(F.a,{className:"winput-240-40",value:E,onChange:this.handpathoptionvalue},L.a.createElement(J,{value:-1},"请选择效果展现方式"),L.a.createElement(J,{value:1},"图片"),L.a.createElement(J,{value:2},"apk/exe"),L.a.createElement(J,{value:3},"txt"),L.a.createElement(J,{value:4},"html"),L.a.createElement(J,{value:5},"mp3"),L.a.createElement(J,{value:6},"mp4")),L.a.createElement("a",{className:"ml10",onClick:function(){return a.showrepositoryurltip(1)}},L.a.createElement("img",{src:Object(z.M)("images/educoder/problem.png")})),L.a.createElement("div",{className:"invite-tip clearfix repository_url_tippostion",style:{display:!0===y?"block":"none"},id:"repository_url_tip"},L.a.createElement("span",{className:"top-black-trangleft"}),L.a.createElement("div",{className:"padding20 invitecontent clearfix"},L.a.createElement("p",{className:"font-12 edu-txt-left"},"图片:处理或输出图片类型的任务,请选填此项",L.a.createElement("br",null),"可以通过设置图片路径和学员答案文件路径,展示代码对应的图片效果",L.a.createElement("br",null),L.a.createElement("br",null),"apk/exe:写可执行文件的任务,请选填此项",L.a.createElement("br",null),"可以通过设置学员答案文件路径,展示二维码以供扫码下载",L.a.createElement("br",null),L.a.createElement("br",null),"txt:输出txt文档类型的任务,请选填此项",L.a.createElement("br",null),"可以通过学员答案文件路径设置,展示txt文件内容",L.a.createElement("br",null),L.a.createElement("br",null),"html:web类型的任务,请选填此项",L.a.createElement("br",null),"可以通过Web路由设置,展示html效果预览页")),L.a.createElement("p",{className:"inviteTipbtn with100"},L.a.createElement("a",{onClick:function(){return a.showrepositoryurltip(2)}},"知道了")))),L.a.createElement("p",{className:"color-grey-9 mt15"},"该选项用来配置学员评测本关任务时,查看效果页上需要展现的文件类型"))),4===E&&null!=S||4===E&&!0===T?L.a.createElement("div",{className:"edu-back-white mb10 clearfix"},L.a.createElement("div",{className:"padding40-20"},L.a.createElement("p",{className:"color-grey-6 font-16 mb20"},"Web路由"),L.a.createElement("div",{className:"df"},L.a.createElement("div",{className:"flex1 mr20"},L.a.createElement("input",{type:"text",className:"input-100-45 change",autoComplete:"off",id:"shixun_file_picture_path",name:"challenge[picture_path]",value:S,onInput:function(e){return a.updatewebroute(e)},placeholder:"网站类型实训,请填写Web路由地址。例:java/mypage"}))))):"",1===E||5===E||6===E?L.a.createElement("div",{className:"edu-back-white mb10 clearfix"},L.a.createElement("div",{className:"padding40-20"},L.a.createElement("p",{className:"color-grey-6 font-16 mb20"},"待处理文件路径"),L.a.createElement("div",{className:"df"},L.a.createElement("div",{className:"flex1 mr20"},L.a.createElement("input",{type:"text",className:"input-100-45",autoComplete:"off",id:"shixun_file_expect_picture_path",name:"challenge[original_picture_path]",placeholder:"请选择版本库中存储了待处理文件(图片/MP3等)的路径。例:src/step1/sourcefiles",value:u,onInput:function(e){return a.updatepath(e,"shixunfileexpectpicturepath",2)},onClick:function(e){return a.getfilepath(e,"shixunfileexpectpicturepath",2)}}),L.a.createElement("p",{className:"color-grey-9 mt15"},"该路径下的文件将在学员评测本关任务时,作为原始文件显示在查看效果页,供学员参考;任务为文件处理时请指定该路径,并注意与程序文件所在文件夹分开。")),L.a.createElement("div",null)))):"",1===E||5===E||6===E?L.a.createElement("div",{className:"edu-back-white mb10 clearfix"},L.a.createElement("div",{className:"padding40-20"},L.a.createElement("p",{className:"color-grey-6 font-16 mb20"},"标准答案文件路径"),L.a.createElement("div",{className:"df"},L.a.createElement("div",{className:"flex1 mr20"},L.a.createElement("input",{type:"text",className:"input-100-45",autoComplete:"off",id:"shixun_file_standard_picture_path",name:"challenge[expect_picture_path]",placeholder:"请选择版本库中存储了标准答案文件(图片/MP3等)的路径。例:src/step1/expectedfiles",value:p,onInput:function(e){return a.updatepath(e,"shixunfilestandardpicturepath",2)},onClick:function(e){return a.getfilepath(e,"shixunfilestandardpicturepath",2)}}),L.a.createElement("p",{className:"color-grey-9 mt15"},"该路径下的文件将在学员评测本关任务时,作为参考答案显示在查看效果页,供学员参考;任务输出结果为文件时请指定该路径,并注意与程序文件所在文件夹分开。")),L.a.createElement("div",null)))):"",-1===E?"":L.a.createElement("div",{className:"edu-back-white mb10 clearfix"},L.a.createElement("div",{className:"padding40-20"},L.a.createElement("p",{className:"color-grey-6 font-16 mb20"},"学员答案文件路径"),L.a.createElement("div",{className:"df"},L.a.createElement("div",{className:"flex1 mr20"},L.a.createElement("input",{type:"text",className:"input-100-45 change",autoComplete:"off",id:"shixun_file_picture_path",name:"challenge[picture_path]",value:m,onInput:function(e){return a.updatepath(e,"shixunfilepicturepath",2)},onClick:function(e){return a.getfilepath(e,"shixunfilepicturepath",2)},placeholder:"请在版本库中指定用来保存学员代码实际输出结果的路径。例:src/step1/outputfiles"}),L.a.createElement("p",{className:"color-grey-9 mt15"},"学员评测本关任务时生成的文件将保存在该路径下,并作为实际输出显示在查看效果页,供学员确认;任务输出结果为文件时请指定该路径,并注意与程序文件所在文件夹分开。")),L.a.createElement("div",null)))),L.a.createElement("div",{className:"edu-back-white mb10 clearfix"},L.a.createElement("div",{className:"padding40-20"},L.a.createElement("p",{className:"color-grey-6 font-16"},"测试集和系统评分规则"),L.a.createElement("p",{className:"color-grey-9 mt20",style:{width:"100%",height:"60px"}},L.a.createElement("span",{className:"headdfgf color979797"},"得分规范:"),L.a.createElement(U,{className:"fl",value:C,onChange:this.onChangeRadioGroups},L.a.createElement(W.a,{style:H,value:!1},"通过全部测试集",L.a.createElement("span",{className:"color979797"},"(学员评测,仅当所有测试集都正确时,才获得一次性奖励)")),L.a.createElement(W.a,{style:H,value:!0},"通过部分测试集",L.a.createElement("span",{className:"color979797"},"(学员评测,当至少有一组测试集正确时,即可获得其对应比例的奖励)")))),L.a.createElement("p",{className:"color-grey-9 mb20",style:{width:"100%",height:"20px",display:!0===C?"block":"none"}},L.a.createElement("span",{className:"headdfgf color979797",style:{width:"500px"}},"系统评分占比:",L.a.createElement(U,{value:I,onChange:this.onChangemarkvalue},L.a.createElement(W.a,{value:!0},"均分比例"),L.a.createElement(W.a,{value:!1},"自定义比例")))),L.a.createElement("div",null,L.a.createElement("div",{className:"flex1 mr20"},L.a.createElement("div",{id:"test_array_set"},void 0===s?"":0===s.length?"":s.map(function(e,t){return L.a.createElement("div",{className:"test_array_item mt30",key:t},L.a.createElement("p",{className:"clearfix pr mb20"},L.a.createElement("span",{className:"fl mt5 mr10 color-orange"},"*"),L.a.createElement("span",{className:"color-blue font-16 fl",name:"sample_inputs_label"},"组",t+1),L.a.createElement("span",{className:"fl ml20 color-grey-6"},L.a.createElement("input",{className:j===t?"bor-red fl martopf4":"fl martopf4",style:{width:"25%",display:!0===C?"inline-block":"none"},onInput:function(e){return a.editpercentage(e,t)},value:e.score}),L.a.createElement("span",{className:"mr15",style:{display:!0===C?"inline-block":"none"}},"%"),L.a.createElement(G.a,{onChange:function(){return a.evaluationonChange(e.hidden,t)},checked:1===e.hidden},"隐藏")),L.a.createElement(D.a,{placement:"bottom",title:"删除"},L.a.createElement("a",{className:"fr del_array sample_icon_remove mr30",style:{display:0===t?"none":"block"},onClick:function(){return a.del_test_array(t)}},L.a.createElement("i",{className:"fa fa-times-circle color-grey-c font-16 fl"})))),L.a.createElement(B,{className:"textareavalue mb15",name:"test_set[input][]",placeholder:"输入",value:e.input,id:"textareavalue"+t,rows:3,onInput:function(e){return a.evaluationoninputvalue(e,t,"sr")}}),L.a.createElement(B,{className:"textareavalue",name:"test_set[output][]",placeholder:"预期输出",value:e.output,id:t+"textareavalue",rows:5,onInput:function(e){return a.evaluationoninputvalue(e,t,"yq")}}),L.a.createElement("div",{className:"clearfix lineh-30"},L.a.createElement("span",{className:"fl mr10 color-grey-6"},"匹配规则:"),L.a.createElement(U,{className:"fl",value:e.match_rule,onChange:function(e){return a.changeEvaluationRule(e,t)}},L.a.createElement(W.a,{value:"full"},"完全匹配"),L.a.createElement(W.a,{value:"last"},"末尾匹配"))))}))),L.a.createElement("p",{className:"clearfix",onClick:this.addevaluationon},L.a.createElement("a",{className:"fl edu-default-btn edu-greyline-btn mt20 mb20 sample_icon_add"},"新增测试集")),L.a.createElement("p",{className:"color-grey-9"},"温馨提示:建议公开测试集和隐藏测试集结合使用,降低作弊的几率;隐藏测试集,在“提交评测”时也将被自动检测")))),L.a.createElement("div",{className:"clearfix mt30",style:{display:4<this.props.identity||void 0===this.props.identity||!1===o?"none":"block"}},L.a.createElement("a",{className:"defalutSubmitbtn fl mr20",onClick:this.submitarbitrationevaluation},"提交"),L.a.createElement("a",{href:"/shixuns/"+r+"/challenges",className:"defalutCancelbtn fl"},"取消"))))}}]),w);function w(e){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,w);var b=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(w.__proto__||Object.getPrototypeOf(w)).call(this,e));return b.setevaluationlist=function(e){b.setState({evaluationlist:e}),console.log(e)},b.addevaluationon=function(){var e=b.state,t=e.evaluationlist,a=e.markvalue,n=t;n.push({hidden:0,input:"",output:"",score:0}),n=b.oneditevaluationlist(n,a),b.setevaluationlist(n)},b.del_test_array=function(e){var t=b.state,a=t.evaluationlist,n=t.markvalue,l=a;l.splice(e,1),l=b.oneditevaluationlist(l,n),b.setevaluationlist(l)},b.getfilepath=function(e,t,a){b.setState({evaluationvisible:!0,selectpath:e.target.value,selectpatharr:[],pathtype:a});var n="/shixuns/"+b.props.match.params.shixunId+"/repository.json";x.a.post(n,{path:""}).then(function(e){403===e.data.status||401===e.data.status||500===e.data.status||b.setState({trees:e.data.trees,saveshixunfilepath:t,path:"",main:[]})}).catch(function(e){console.log(e)})},b.sendgetfilepath=function(t,e,a){var n=b.props.match.params.shixunId,l=b.state,i=l.path,s=l.main,r=l.pathtype,c=s,o=i;b.setState({selectpatharr:[]}),""===o&&"tree"===e?(t+="/",o="",0===s.length?c.push({val:"根目录/",path:""},{val:t,path:o+t}):c.push({val:t,path:o+t})):""!=o&&"tree"===e&&(t+="/",c.push({val:t,path:o+t}));var u="/shixuns/"+n+"/repository.json";"tree"===e&&x.a.post(u,{path:o+t}).then(function(e){403===e.data.status||401===e.data.status||500===e.data.status||b.setState({trees:e.data.trees,path:o+t,main:c})}).catch(function(e){console.log(e)}),2===r&&b.setState({selectpath:a})},b.goblakepath=function(t,e){for(var a=b.state,n=a.main,l=(a.selectpath,a.pathtype),i=[],s=0;s<=e;s++)i.push(n[s]);var r="/shixuns/"+b.props.match.params.shixunId+"/repository.json";if(x.a.post(r,{path:t}).then(function(e){403===e.data.status||401===e.data.status||500===e.data.status||b.setState({trees:e.data.trees,path:t,main:i})}).catch(function(e){console.log(e)}),2===l){var c=t.substring(0,t.length-1);console.log(c),b.setState({selectpath:c})}},b.savegetfilepath=function(e){var t=b.state,a=t.selectpath,n=t.saveshixunfilepath;if(1===t.pathtype){var l=void 0;if("shixunfilepathplay"===n)l=e;else{for(var i=a.split(";"),s=!1,r=0;r<i.length;r++)if(i[r]===e)return void(s=!0);l=!1===s?a+e+";":a}b.setState({selectpath:l})}},b.evaluationenter=function(){var e=b.state,t=e.saveshixunfilepath,a=e.selectpath;b.setState(y({evaluationvisible:!1},t,a))},b.evaluationhideModal=function(){b.setState({evaluationvisible:!1})},b.handpathoptionvalue=function(e){b.setState({pathoptionvalue:e,shixunfileexpectpicturepath:void 0,shixunfilestandardpicturepath:void 0,shixunfilepicturepath:void 0})},b.showrepositoryurltip=function(e){1===e?b.setState({showrepositoryurltiptype:!0}):b.setState({showrepositoryurltiptype:!1})},b.evaluationonChange=function(e,t){var a=b.state.evaluationlist,n=void 0;n=1===e?0:1,a[t].hidden=n,b.setState({evaluationlist:a}),b.setevaluationlist(a)},b.editpercentage=function(e,t){var a=b.state,n=a.evaluationlist;a.scoretype===t&&b.setState({scoretype:void 0});var l=n,i=parseInt(e.target.value);isNaN(i)&&(i=0),l[t].score=i,b.setState({evaluationlist:l,markvalue:!1}),b.setevaluationlist(l)},b.changeEvaluationRule=function(e,t){var a=b.state.evaluationlist;a[t].match_rule=e.target.value,b.setevaluationlist(a)},b.evaluationoninputvalue=function(e,t,a){N.fn.autoHeight=function(){function e(e){e.style.height="auto",e.style.maxHeight="140px",e.scrollTop=0,e.style.height=e.scrollHeight+"px"}this.each(function(){e(this),N(this).on("keyup",function(){e(this)})})},N("textarea[autoHeight]").autoHeight();var n=b.state.evaluationlist;"sr"===a?n[t].input=e.target.value:"yq"===a&&(n[t].output=e.target.value?e.target.value.replace(/\r?\n/g,"\r\n"):e.target.value),b.setevaluationlist(n)},b.evaluationoninputvalueonload=function(){N.fn.autoHeight=function(){function e(e){e.style.height="auto",e.style.maxHeight="140px",e.scrollTop=0,e.style.height=e.scrollHeight+"px"}this.each(function(){e(this),N(this).on("keyup",function(){e(this)})})},N("textarea[autoHeight]").autoHeight()},b.submitarbitrationevaluation=function(){var e=b.state,t=e.evaluationlist,a=e.shixunfilepath,n=e.shixunfilepathplay,l=e.shixunfileexpectpicturepath,i=e.shixunfilestandardpicturepath,s=e.shixunfilepicturepath,r=e.pathoptionvalue,c=e.scorevalue,o=e.markvalue,u=e.web_route,p=void 0;if(!1===c)p=!1;else{p=!0;for(var m=0,h=0;h<t.length;h++){if(100<t[h].score)return b.props.showSnackbar("测试集的评分占比不能大于100"),void b.setState({scoretype:h});m+=t[h].score}if(100<m||m<100)return void b.props.showSnackbar("测试集的评分占比之和必须等于100")}if(void 0===a||""===a||null===a)return b.props.showSnackbar("学员任务文件路径为空"),b.setState({StudentTaskPapers:!0}),void N("html").animate({scrollTop:120},1e3);if(void 0===n||""===n||null===n)return b.props.showSnackbar("评测执行文件路径为空"),b.setState({StudentTaskDocs:!0}),void N("html").animate({scrollTop:130},1e3);if(0!==t.length){var d=b.props.match.params.shixunId,f=b.state.checkpointId,v="/shixuns/"+d+"/challenges/"+f+".json",g={path:a,exec_path:n,show_type:r,original_picture_path:-1===r?void 0:void 0===l?null:l,expect_picture_path:-1===r?void 0:void 0===i?null:i,picture_path:-1===r?void 0:void 0===s?null:s,test_set_score:p,test_set_average:o,web_route:null===u?void 0:u};x.a.put(v,{tab:1,challenge:g,test_set:t}).then(function(e){b.props.showSnackbar(e.data.messages),window.location.href="/shixuns/"+d+"/challenges/"+e.data.challenge_id+"/tab=3"}).catch(function(e){console.log(e)})}else b.props.showSnackbar("测试集不能为空")},b.handpathoptionvalues=function(){b.setState({handpathopt:!0})},b.handpathoptionvaluess=function(){b.setState({handpathopt:!1})},b.saveselectpath=function(e){b.setState({selectpath:e.target.value})},b.updatepath=function(e,t,a){var n;b.setState((y(n={},t,e.target.value),y(n,"pathtype",a),n))},b.oneditevaluationlist=function(e,t){if(!0===t)if(100%e.length==0)for(var a=100/e.length,n=0;n<e.length;n++)e[n].score=a;else{var l=parseInt(100/e.length);for(n=0;n<e.length;n++)n+1!=e.length?e[n].score=l:e[n].score=l+100%e.length}return e},b.onChangeRadioGroups=function(e){var t=b.state,a=t.markvalue,n=t.evaluationlist;!0===e.target.value&&(n=b.oneditevaluationlist(n,a)),b.setState({scorevalue:e.target.value,evaluationlist:n}),b.setevaluationlist(n)},b.onChangemarkvalue=function(e){var t=b.state.evaluationlist;if(!0===e.target.value){var a=t;a=b.oneditevaluationlist(a,e.target.value),b.setevaluationlist(a)}b.setState({markvalue:e.target.value})},b.updatewebroute=function(e){b.setState({web_route:e.target.value})},b.state={choice_url:void 0,practice_url:void 0,go_back_url:void 0,task_pass_default:void 0,submit_url:void 0,value:1,evaluationlist:[],shixunId:void 0,power:!1,shixunfilepath:void 0,evaluationvisible:!1,trees:void 0,path:"",main:[],saveshixunfilepath:void 0,selectpath:void 0,shixunfilepathplay:void 0,shixunfileexpectpicturepath:void 0,shixunfilestandardpicturepath:void 0,shixunfilepicturepath:void 0,pathoptionvalue:-1,showrepositoryurltiptype:!1,prev_challenge:void 0,next_challenge:void 0,StudentTaskPapers:!1,StudentTaskDocs:!1,selectpatharr:[],handpathopt:!1,scorevalue:!1,markvalue:!0,scoretype:void 0,web_route:null},b}t.default=k}}); |