You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
NewEduCoderBuild/p__Problems__OjForm__index....

1 line
32 KiB

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[34994],{64711:function(e,n,t){t.d(n,{Z:function(){return r}});var i=t(5891),s=t(59301),a={icon:{tag:"svg",attrs:{"fill-rule":"evenodd",viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M512 64c247.4 0 448 200.6 448 448S759.4 960 512 960 64 759.4 64 512 264.6 64 512 64zm0 76c-205.4 0-372 166.6-372 372s166.6 372 372 372 372-166.6 372-372-166.6-372-372-372zm128.01 198.83c.03 0 .05.01.09.06l45.02 45.01a.2.2 0 01.05.09.12.12 0 010 .07c0 .02-.01.04-.05.08L557.25 512l127.87 127.86a.27.27 0 01.05.06v.02a.12.12 0 010 .07c0 .03-.01.05-.05.09l-45.02 45.02a.2.2 0 01-.09.05.12.12 0 01-.07 0c-.02 0-.04-.01-.08-.05L512 557.25 384.14 685.12c-.04.04-.06.05-.08.05a.12.12 0 01-.07 0c-.03 0-.05-.01-.09-.05l-45.02-45.02a.2.2 0 01-.05-.09.12.12 0 010-.07c0-.02.01-.04.06-.08L466.75 512 338.88 384.14a.27.27 0 01-.05-.06l-.01-.02a.12.12 0 010-.07c0-.03.01-.05.05-.09l45.02-45.02a.2.2 0 01.09-.05.12.12 0 01.07 0c.02 0 .04.01.08.06L512 466.75l127.86-127.86c.04-.05.06-.06.08-.06a.12.12 0 01.07 0z"}}]},name:"close-circle",theme:"outlined"},l=t(22589),c=function(e,n){return s.createElement(l.Z,(0,i.Z)({},e,{ref:n,icon:a}))};var r=s.forwardRef(c)},35423:function(e,n,t){t.d(n,{Z:function(){return r}});var i=t(5891),s=t(59301),a={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M705.6 124.9a8 8 0 00-11.6 7.2v64.2c0 5.5 2.9 10.6 7.5 13.6a352.2 352.2 0 0162.2 49.8c32.7 32.8 58.4 70.9 76.3 113.3a355 355 0 0127.9 138.7c0 48.1-9.4 94.8-27.9 138.7a355.92 355.92 0 01-76.3 113.3 353.06 353.06 0 01-113.2 76.4c-43.8 18.6-90.5 28-138.5 28s-94.7-9.4-138.5-28a353.06 353.06 0 01-113.2-76.4A355.92 355.92 0 01184 650.4a355 355 0 01-27.9-138.7c0-48.1 9.4-94.8 27.9-138.7 17.9-42.4 43.6-80.5 76.3-113.3 19-19 39.8-35.6 62.2-49.8 4.7-2.9 7.5-8.1 7.5-13.6V132c0-6-6.3-9.8-11.6-7.2C178.5 195.2 82 339.3 80 506.3 77.2 745.1 272.5 943.5 511.2 944c239 .5 432.8-193.3 432.8-432.4 0-169.2-97-315.7-238.4-386.7zM480 560h64c4.4 0 8-3.6 8-8V88c0-4.4-3.6-8-8-8h-64c-4.4 0-8 3.6-8 8v464c0 4.4 3.6 8 8 8z"}}]},name:"poweroff",theme:"outlined"},l=t(22589),c=function(e,n){return s.createElement(l.Z,(0,i.Z)({},e,{ref:n,icon:a}))};var r=s.forwardRef(c)},86994:function(e,n,t){t.d(n,{Z:function(){return k}});var i=t(82242),s=t.n(i),a=t(7557),l=t.n(a),c=t(41498),r=t.n(c),o=t(79800),d=t.n(o),u=t(39647),p=t.n(u),_=t(59301),h=t(38318),f=t(51201),m="customTree___ZhEHU",g="name___RIkn2",x=t(37712),v=["value","onChange","defaultValue","disabled"],k=function(e){var n=e.value,t=e.onChange,i=e.defaultValue,a=e.disabled,c=p()(e,v),o=(0,_.useState)([]),u=d()(o,2),k=u[0],y=u[1],j=(0,_.useState)("1"),b=d()(j,2),Z=b[0],T=b[1];(0,_.useEffect)((function(){I()}),[]);var I=function(){var e=r()(l()().mark((function e(){var n,t;return l()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,f.NZ)({});case 2:null!=(n=e.sent)&&n.data&&(t=[{title:(0,x.jsx)("div",{title:"根目录",className:g,children:"根目录"}),value:0,key:0,icon:(0,x.jsx)("i",{className:"iconfont icon-wenjianjia2 c-light-primary mr10",style:{lineHeight:"19px"}}),children:A(n.data||[])}],y(t),T("2"));case 4:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),A=function(e){function n(e){var t=e.children,i=Array.isArray(t)&&t.length>0,s=null==e?void 0:e.group_id;return{title:(0,x.jsx)("div",{title:null==e?void 0:e.name,className:g,children:null==e?void 0:e.name}),value:s,key:s,icon:(0,x.jsx)("i",{className:"iconfont icon-wenjianjia2 c-light-primary mr10",style:{lineHeight:"19px"}}),children:i?null==t?void 0:t.map((function(e){return n(e)})):[]}}return null==e?void 0:e.map((function(e){return n(e)}))},w=i?{defaultExpandedKeys:[0],defaultSelectedKeys:[0]}:{selectedKeys:n,defaultExpandedKeys:n};return(0,x.jsx)("div",{className:m,children:(0,x.jsx)(h.Z,s()(s()({},w),{},{showIcon:!0,treeData:k,onSelect:t,disabled:a},c),Z)})}},73638:function(e,n,t){t.d(n,{Z:function(){return c}});var i=t(79800),s=t.n(i),a=t(59301),l=t(37712),c=function(e){var n=e.defaultX,t=void 0===n?"40%":n,i=e.leftChild,c=e.rightChild,r=e.className,o=e.hideResize,d=void 0!==o&&o,u=(0,a.useState)(t),p=s()(u,2),_=p[0],h=p[1],f=(0,a.useRef)();(0,a.useEffect)((function(){function e(e){f.current&&h(e.pageX)}function n(){f.current=!1}return window.addEventListener("mousemove",e),window.addEventListener("mouseup",n),function(){window.removeEventListener("mousemove",e),window.removeEventListener("mouseup",n)}}),[]);var m="number"==typeof _&&.01!==_?"".concat(_,"px"):t,g="calc(100% - ".concat(d?"0px":"4px"," - ").concat(m,")");return(0,l.jsxs)("div",{className:"split-panel-container ".concat(r),children:[(0,l.jsx)("section",{style:{width:m,display:.01===_?"none":""},children:i}),(0,l.jsx)("section",{className:"resize-x-bar",onMouseDown:function(){f.current=!0},children:(0,l.jsx)("a",{className:"btn-resize",children:(0,l.jsx)("svg",{width:"16",height:"13",viewBox:"0 0 16 13",children:(0,l.jsx)("path",{d:"M12.245 7.53H5.647v1.882h6.598v2.823L16 8.471l-3.755-3.765V7.53zM10.353 4.706H3.755v2.823L0 3.765 3.755 0v2.824h6.598v1.882z"})})})}),(0,l.jsx)("section",{style:{width:g},children:c})]})}},22280:function(e,n,t){t.r(n),t.d(n,{Types:function(){return ae}});var i=t(70236),s=t.n(i),a=t(91232),l=t.n(a),c=t(37205),r=t.n(c),o=t(7557),d=t.n(o),u=t(41498),p=t.n(u),_=t(79800),h=t.n(_),f=t(82242),m=t.n(f),g=t(59301),x=t(96527),v=t(92832),k=t(43418),y=t(36381),j=t(78241),b=t(8591),Z=t(71418),T=t(3113),I=t(57809),A=t(19842),w=t(94001),S=t(24905),N=t(5112),C=t(81327),E=t(14478),P=t(32226),L=t(3858),F=t(24334),V=t(35423),D=t(64711),q=t(52025),B=t(2929),M=t(37924),R=t(73638),U=t(70441),G=t(72740),K=t(23634),O=t(23756),z=t(97730),H=t(1734),J=t(86994),X=t(80139),Y=t(70257),Q=t(50121),W=t(7723),$=t(37712),ee=v.Z.TextArea,ne=k.Z.confirm,te=y.Z.Panel;function ie(){return(new Date).getTime()}var se={loading:!0,user:null,disciplines:[],dicts:null,status:0,data:void 0,lastedUpdateTime:0},ae=function(e){return e[e.SET_INITAL_DATA=0]="SET_INITAL_DATA",e[e.SET_LOADING=1]="SET_LOADING",e[e.SET_STATUS=2]="SET_STATUS",e}({});function le(e,n){switch(n.type){case ae.SET_INITAL_DATA:return m()(m()({},e),n.payload);case ae.SET_LOADING:return m()(m()({},e),{},{loading:n.payload});case ae.SET_STATUS:return m()(m()({},e),{},{status:n.payload});default:throw new Error}}function ce(e){var n,t,i=e.form,a=e.onAddTestCases,l=e.handleAddKnowledgeFinish,c=e.ischecked,o=(e.MyGroup,e.formValue),d=e.knowledgeOptions,u=e.categorys,p=e.hack,_=e.callback_url,f=e.onChangeAverage,k=e.onChangeScore,b=e.onChangehide,Z=e.onChangeFile,L=e.onAddTestCase,F=e.onRemoveTestCase,V=e.onChangeSubDiscipline,B=e.onChangeLanguage,M=e.uploadData,R=e.setUploadData,U=e.handleUploadRatio,G=e.isshows,K=e.isProgram,O=e.addUploadFnc,z=(null===(n=location)||void 0===n||null===(n=n.search)||void 0===n?void 0:n.includes("select"))||!1,Y=(0,g.useState)(G),Q=h()(Y,2),ne=Q[0],ie=Q[1],se=(0,g.useState)(!1),ae=h()(se,2),le=ae[0],ce=ae[1],re=p.test_set_average,oe=p.test_set_score,de=(0,g.useState)(!1),ue=h()(de,2),pe=ue[0],_e=ue[1];function he(e){e.stopPropagation()}return(0,$.jsxs)("div",{className:x.Z["oj-left-panel"],children:[(0,$.jsxs)("div",{className:x.Z["oj-form-info"],children:[(0,$.jsxs)("div",{className:x.Z.field,children:[(0,$.jsx)(j.Z.Item,{label:"难易度",name:["hack","difficult"],rules:[{required:!0,message:"请选择难易度"}],children:(0,$.jsx)(I.default,{disabled:z,children:(0,P.jw)(P.R8.difficult)})}),(0,$.jsx)(j.Z.Item,{label:"课程(合理的课程分类有利于快速检索)",name:["hack","sub_discipline_id"],rules:[{required:!0,message:"请选择课程"}],children:(0,$.jsx)(A.Z,{disabled:z,allowClear:!1,options:u,placeholder:"请选择",onChange:V})})]}),(0,$.jsxs)("div",{className:x.Z.field,children:[_&&(0,$.jsx)(j.Z.Item,{label:"分数",name:["hack","score"],rules:[{required:!0,message:"请输入分数"}],extra:(0,$.jsx)("span",{style:{position:"absolute",left:100,top:5},children:"分"}),children:(0,$.jsx)(w.Z,{disabled:z,min:1,max:100})}),(0,$.jsx)(j.Z.Item,{label:(0,$.jsx)("div",{children:"单个测试集评测时长限制 "}),name:["hack","time_limit"],rules:[{required:!0,message:"请输入单个测试集评测时长限制"},{type:"number",min:1,message:"最小限制时间是1秒"}],extra:(0,$.jsx)("span",{style:{position:"absolute",left:100,top:5},children:"秒"}),children:(0,$.jsx)(w.Z,{min:1})}),K?(0,$.jsx)(j.Z.Item,{label:"编程语言",style:{paddingBottom:16},name:["hack","languages"],rules:[{required:!0,message:"请选择编程语言"}],children:(0,$.jsxs)(S.Z.Group,{children:[(0,$.jsx)(S.Z,{value:"C",children:"C"}),(0,$.jsx)(S.Z,{value:"C++",children:"C++"}),(0,$.jsx)(S.Z,{value:"Java",children:"Java"}),(0,$.jsx)(S.Z,{value:"Python",children:"Python"})]})}):(0,$.jsx)(j.Z.Item,{label:"编程语言",name:["hack_codes","language"],style:{paddingBottom:16},rules:[{required:!0,message:"请选择编程语言"}],children:(0,$.jsx)(I.default,{onChange:B,children:(0,P.jw)(P.R8.language)})})]}),(0,$.jsx)(j.Z.Item,{label:(0,$.jsxs)("span",{children:["知识点:",(0,$.jsx)("span",{className:"c-grey-999",children:"所有自建知识点仅本人可见被EduCoder平台审核通过为官方知识点后所有用户可见"})]}),name:["hack","tag_discipline_ids"],children:(0,$.jsx)(H.N,{selectvalues:(null==p?void 0:p.tag_discipline_id)||(null==p?void 0:p.tag_discipline_ids),disabled:z,subId:null==o||null===(t=o.hack)||void 0===t||null===(t=t.sub_discipline_id)||void 0===t?void 0:t[1],knowledgeOptions:d,onAddKnowledgeFinish:l})}),(0,$.jsx)(j.Z.Item,{label:"加入文件夹目录",name:["hack","item_banks_group_ids"],labelCol:{span:24},wrapperCol:{span:24},children:(0,$.jsx)(J.Z,{disabled:z})}),(0,$.jsx)(j.Z.Item,{label:"任务名称",name:["hack","name"],rules:[{required:!0,message:"请输入任务名称"}],children:(0,$.jsx)(v.Z,{maxLength:60,placeholder:"请输入任务名称",suffix:(0,$.jsx)("span",{children:60-p.name.length})})}),(0,$.jsx)(j.Z.Item,{name:["hack","description"],valuePropName:"defaultValue",rules:[{required:!0,message:"请输入描述内容"}],children:(0,$.jsx)(q.Z,{miniToolbar:!0,id:"moop_cases_content",noStorage:!0,height:200})}),(0,$.jsx)("div",{onClick:function(){return ce(!0)},children:(0,$.jsx)(j.Z.Item,{label:"题目解析",name:["hack","analysis"],className:"".concat(x.Z.baseLineHeight),children:(0,$.jsx)(W.x,{placeholder:"请编辑题目解析(非必填)",isEdit:le})})}),(0,$.jsxs)("div",{className:"tst-case-info",children:[(0,$.jsxs)("h3",{className:"flex-container",style:{justifyContent:"space-between"},children:[" 测试用例与系统评分规则",!p.is_file&&(0,$.jsx)(T.ZP,{type:"primary",ghost:!0,onClick:L,children:"添加测试用例"})]}),(0,$.jsx)(j.Z.Item,{name:["hack","test_set_score"],children:(0,$.jsxs)(N.ZP.Group,{onChange:k,children:[(0,$.jsxs)(N.ZP,{value:!0,children:["通过全部测试集",(0,$.jsx)("span",{className:"tip",children:" (学员评测,仅当所有测试集都正确时,才获得一次性奖励)"})]}),(0,$.jsxs)(N.ZP,{value:!1,children:["通过部分测试集",(0,$.jsx)("span",{className:"tip",children:" (学员评测,通过测试集即可获得对应奖励)"})]})]})}),(0,$.jsx)(S.Z,{style:{marginBottom:"5px"},checked:c,onChange:b,children:"隐藏实际输出 (选中,则在学生考试过程中无法看到实际输出结果,仅展示是否评测是否通过)"}),(0,$.jsx)(j.Z.Item,{className:x.Z.testJi,name:["hack","is_file"],label:"用例类型:",children:(0,$.jsx)(N.ZP.Group,{onChange:Z,children:(0,$.jsxs)(C.Z,{direction:"horizontal",children:[(0,$.jsx)(N.ZP,{value:!1,children:"文本"}),(0,$.jsx)(N.ZP,{value:!0,children:"文件"})]})})}),(0,$.jsx)(j.Z.Item,{label:"评测时空格处理",name:["hack","submit_rule"],rules:[{required:!0}],children:(0,$.jsxs)(N.ZP.Group,{children:[(0,$.jsx)(N.ZP,{value:0,children:"不忽略空格"}),(0,$.jsx)(N.ZP,{value:1,children:"忽略首尾空格"}),(0,$.jsx)(N.ZP,{value:2,children:"忽略所有空格"})]})}),!p.test_set_score&&(0,$.jsx)(j.Z.Item,{name:["hack","test_set_average"],label:"系统评分占比",children:(0,$.jsxs)(N.ZP.Group,{onChange:f,children:[(0,$.jsx)(N.ZP,{value:!0,children:"均分比例"}),(0,$.jsx)(N.ZP,{value:!1,children:"自定义比例"})]})}),!p.test_set_score&&(0,$.jsxs)("div",{style:{marginBottom:"20px",marginTop:"-10px"},children:[(0,$.jsxs)("div",{style:{display:"flex",height:"30px",marginBottom:"10px"},children:[(0,$.jsx)(S.Z,{checked:ne,style:{display:"flex",alignItems:"center"},className:x.Z.checkboxs,onChange:function(e){ie(e.target.checked),i.setFieldsValue({hack:{code_compile_score:0}}),p.test_set_average&&(p.is_file?U(M):a())},children:"启用编译通过即可得分"}),ne&&(0,$.jsxs)("span",{style:{display:"flex"},children:[(0,$.jsx)(j.Z.Item,{rules:[{required:!0,message:"请输入编译得分"}],name:["hack","code_compile_score"],children:(0,$.jsx)(w.Z,{onChange:function(){p.test_set_average&&(p.is_file?U(M):a())},parser:function(e){return isNaN(parseInt(e))?"":parseInt(e)},min:0,max:100,style:{width:"90px",margin:"5px 0px"}})})," ",(0,$.jsx)("span",{style:{display:"flex",alignItems:"center",marginLeft:"5px"},children:"%"})]})]}),(0,$.jsx)("span",{style:{color:"#999",fontSize:"12px",marginLeft:"-8px"},children:"(请注意该实训题是否有编译过程,若没有则无法获得编译得分)"})]}),(0,$.jsxs)("div",{className:x.Z.upBtn,children:[(0,$.jsx)(T.ZP,{ghost:!0,type:"primary",className:"mb20",onClick:function(){return _e(!0)},children:"批量上传测试用例"}),(null==p?void 0:p.is_file)&&(0,$.jsx)(X.Y2,{disabled:null==p?void 0:p.test_set_average,inputChange:function(e,n){console.log(e,n);var t=M.map((function(t,i){return i===n?m()(m()({},t),{},{score:e.target.value?Number(e.target.value):0}):t}));R(t)},showScore:!p.test_set_score,data:M,onRemove:function(e,n){var t=r()(M);t.splice(n,1),re?U(t):R(t)}})]}),!p.is_file&&(0,$.jsx)(j.Z.List,{name:"hack_sets",children:function(e,n){return s()(n),(0,$.jsx)(y.Z,{accordion:!0,className:x.Z.collapse,children:e.map((function(e,n){return(0,$.jsxs)(te,{header:(0,$.jsxs)("a",{className:x.Z["test-case-name"],children:[(0,$.jsxs)("span",{children:["测试用例",n+1]}),oe?null:(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(j.Z.Item,{name:[e.name,"score"],style:{marginBottom:0},fieldKey:[e.fieldKey,"score"],rules:[{required:!0,message:"请输入测试集".concat(n+1,"评分")}],children:(0,$.jsx)(w.Z,{onClick:he,min:0,max:100,disabled:re})}),(0,$.jsx)("span",{children:"%"})]})]}),extra:n>0?(0,$.jsx)("div",{onClick:he,children:(0,$.jsx)(E.Z,{okText:"确定",cancelText:"取消",title:"确定删除测试集"+(n+1),onConfirm:function(){F(n)},children:(0,$.jsx)(D.Z,{className:x.Z["btn-remove-case"]})})}):null,children:[(0,$.jsx)(j.Z.Item,{label:"输入",name:[e.name,"input"],fieldKey:[e.fieldKey,"input"],children:(0,$.jsx)(ee,{})}),(0,$.jsx)(j.Z.Item,{label:"输出",name:[e.name,"output"],fieldKey:[e.fieldKey,"output"],rules:[{required:!0,message:"请输入输出内容"}],children:(0,$.jsx)(ee,{})})]},"".concat(e.key,"--").concat(n))}))})}})]})]}),(0,$.jsx)(X.ZP,{rootIdentifier:null,visible:pe,onClose:function(){return _e(!1)},onOK:function(e){if(null!=e&&e.length){if(null!=e&&e[0].is_file){O(e,!0)();var n=M.concat(e);p.test_set_average?U(n):R(n)}null!=e&&e[0].is_file||O(e)}},multiple:!0,defaultMultipleValue:null==p?void 0:p.is_file})]})}n.default=function(){var e,n,t=(0,L.useSearchParams)(),i=h()(t,1)[0],s=((0,L.useLocation)(),(0,L.useParams)().id),a=j.Z.useForm(),c=h()(a,1)[0],o=(0,g.useState)(),u=h()(o,2),_=u[0],f=u[1],v=(0,g.useState)([]),y=h()(v,2),I=y[0],A=y[1],w=(0,g.useState)([]),S=h()(w,2),N=S[0],C=S[1],E=(0,g.useReducer)(le,se),D=h()(E,2),q=D[0],H=D[1],J=q.loading,X=q.data,W=q.user,ee=q.disciplines,te=q.dicts,re=q.status,oe=null==X?void 0:X.hack_sets,de=null==X||null===(e=X.hack)||void 0===e?void 0:e.test_set_average,ue=(0,O.oP)(),pe=ue.callback_url,_e=ue.express_id,he=ue.score,fe=ue.question_id,me=ue.type,ge=(0,g.useState)([]),xe=h()(ge,2),ve=xe[0],ke=xe[1],ye=(0,g.useState)(!1),je=h()(ye,2),be=je[0],Ze=je[1],Te=(0,g.useState)(!1),Ie=h()(Te,2),Ae=Ie[0],we=Ie[1],Se="1"===me,Ne=(0,g.useMemo)((function(){var e=[];return ee&&(0,P.D0)(ee,e),e}),[ee]),Ce=(0,g.useCallback)(p()(d()().mark((function e(){var n,t,i,a,l,r,o,u,p,_,g,x,v,k,y,j,b,Z,T,I,A,w,S,N,E,L,V,D,q,M,R,U,G,K,z,J,X,Y,Q,W,$,ne,te,ie,se,le,ce,re,oe,de,ue,pe,_e,fe=arguments;return d()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=fe.length>0&&void 0!==fe[0]?fe[0]:0,0!==(t=ee).length){e.next=7;break}return e.next=5,(0,B.d1)("new_question");case 5:i=e.sent,t=i.disciplines;case 7:if(!s){e.next=15;break}return a={disciplines:t},e.next=11,(0,B.fu)(s);case 11:(l=e.sent).message?"401"===l.status&&(document.location.href="/user/login"):(r=l.category,o=l.user,u=l.code,p=l.language,_=l.hack_sets,g=l.description,x=l.difficult,v=l.name,k=l.open_or_not,y=l.sub_discipline_id,l.tag_discipline_id,j=l.analysis,b=l.time_limit,Z=l.test_set_average,T=l.test_set_score,I=l.status,A=l.tag_discipline_ids,w=l.item_banks_group_id,S=l.is_file,N=void 0!==S&&S,E=l.hide_actual_output,L=l.code_compile_score,V=l.languages,D=l.is_my,q=l.codes,M=l.submit_rule,R=(0,P.y3)(t,y),U=h()(R,2),G=U[0],K=U[1],Ze(E),z=N?[{input:"",output:"",score:100,position:1}]:_,N?(C(_),c.setFieldsValue({hack_sets:z})):C([]),J=(0,O.oP)(),X=J.lastedUpdateTime,Y=null==q?void 0:q.map((function(e){return m()(m()({},e),{},{code:F.Base64.decode(null==e?void 0:e.code)})})),a=m()(m()({},a),{},{loading:!1,user:o,dicts:K,status:I,lastedUpdateTime:n||(X||0),data:{hack_codes:{language:p,code:F.Base64.decode(u)},hack:{category:r,difficult:x,name:v,description:g,open_or_not:k,time_limit:b,test_set_average:Z,test_set_score:T,sub_discipline_id:G,tag_discipline_ids:A,languages:V,score:he||1,item_banks_group_ids:w,is_file:N,is_my:D,code_compile_score:L,analysis:j,submit_rule:M},hack_sets:z,tags:A,codes:Y}}),parseInt(L)>0&&we(!0),H({type:ae.SET_INITAL_DATA,payload:a}),f({hack:{category:r,difficult:x,name:v,description:g,open_or_not:k,time_limit:b,test_set_average:Z,test_set_score:T,sub_discipline_id:G,tag_discipline_ids:A,score:he||1,item_banks_group_ids:w,is_file:N,analysis:j},codes:Y}),Ee(null==G?void 0:G[0],null==G?void 0:G[1],t)),e.next=25;break;case 15:return e.next=17,(0,B.PR)();case 17:$=e.sent,ne=$.user,te=(0,O.oP)(),ie=te.difficult,se=te.sub_discipline_id,le=te.tag_discipline_id,ce=te.tagIds,re=te.banksIds,oe=(0,P.y3)(t,parseInt(se,10)),de=h()(oe,2),ue=de[0],pe=de[1],_e=[Number(re)],H({type:ae.SET_INITAL_DATA,payload:{loading:!1,user:ne,disciplines:t,status:0,dicts:pe,data:{hack_codes:{language:"C",code:""},hack:{category:null,difficult:parseInt(ie,10),time_limit:3,description:"",test_set_score:!0,test_set_average:!0,open_or_not:!0,sub_discipline_id:ue,tag_discipline_id:ce&&(null==ce||null===(Q=ce.split(","))||void 0===Q?void 0:Q.map((function(e){return Number(e)}))),name:"",item_banks_group_ids:_e,is_file:!1},tags:le?null==le?void 0:le.split(",").map((function(e){return parseInt(e,10)})):[],hack_sets:[{input:"",output:"",score:100,position:1}]}}}),f({hack:{category:null,difficult:parseInt(ie,10),time_limit:3,description:"",test_set_average:!0,open_or_not:!0,sub_discipline_id:ue,tag_discipline_id:ce&&(null==ce||null===(W=ce.split(","))||void 0===W?void 0:W.map((function(e){return Number(e)}))),name:"",item_banks_group_id:_e,is_file:!1}}),Ee(null==ue?void 0:ue[0],null==ue?void 0:ue[1],t);case 25:case"end":return e.stop()}}),e)}))),[s,ee]);(0,g.useEffect)((function(){try{Ce()}catch(e){console.log(e,"----")}}),[]),(0,g.useEffect)((function(){function e(){return e=p()(d()().mark((function e(){var n;return d()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,K.U2)("item_banks_groups/mine.json");case 2:n=e.sent,ke(n);case 4:case"end":return e.stop()}}),e)}))),e.apply(this,arguments)}!function(){e.apply(this,arguments)}()}),[]);var Ee=function(e,n,t){var i;null==t||null===(i=t.find((function(n){return n.id===e})))||void 0===i||null===(i=i.sub_disciplines)||void 0===i||null===(i=i.find((function(e){return e.id===n})))||void 0===i||i.tag_disciplines};function Pe(e,n,t){return Le.apply(this,arguments)}function Le(){return Le=p()(d()().mark((function e(n,t,i){var a,c,r,o,u,p,_,h,f,g,x,v,k,y,j,Z,T,I,A,w;return d()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:c=m()({},n),r=c.hack_sets,o=c.hack_codes,u=c.hack,p=c.tags,_=c.codes,u.hide_actual_output=be,h=[],f=[],g=0,x=null!=u&&u.is_file?N.map((function(e,n){return m()(m()({},e),{},{position:n+1})})):r.map((function(e){return m()(m()({},e),{},{is_file:!1})})),v=l()(x);try{for(v.s();!(k=v.n()).done;)y=k.value,g+=y.score,y.id&&y.id>=0?h.push(y):f.push(y)}catch(e){v.e(e)}finally{v.f()}if(null!=x&&x.length){e.next=11;break}return b.ZP.error("测试集不能为空"),e.abrupt("return");case 11:if(100===(g+=parseInt(u.code_compile_score||0))||u.test_set_score){e.next=15;break}return b.ZP.error("测试集的评分占比之和必须等于100"),e.abrupt("return");case 15:if(null==x||!x.some((function(e){return!e.output}))){e.next=18;break}return b.ZP.error("测试集输出不能为空"),e.abrupt("return");case 18:if(j={},Se?null==_||_.forEach((function(e){j[e.language]=null!=e&&e.code?F.Base64.encode(null==e?void 0:e.code):""})):o.code=F.Base64.encode(null==o?void 0:o.code),u.sub_discipline_id=null===(a=u.sub_discipline_id)||void 0===a?void 0:a[1],H({type:ae.SET_LOADING,payload:!0}),pe||(u.score=100*u.difficult),!s){e.next=50;break}return e.next=26,(0,B.l_)(s,{hack:u,hack_codes:o,hack_sets:f,update_hack_sets:h,tags:p,is_cover:i,languages:u.languages,codes:j});case 26:if(!pe){e.next=45;break}return e.next=29,(0,B.j2)(s);case 29:if(!pe.includes("paperlibrary")){e.next=35;break}return e.next=32,(0,Y.oF)({id:_e,question_id:fe,item_type:Q.c.Program,name:u.name,question_score:u.score,difficulty:u.difficult,sub_discipline_id:u.sub_discipline_id,tag_discipline_ids:u.tag_discipline_ids,item_banks_group_ids:u.item_banks_group_ids,analysis:u.analysis});case 32:return 0===e.sent.status&&L.history.replace(pe),e.abrupt("return");case 35:return e.next=37,(0,B.GM)(fe,{question_type:6,question_score:u.score,question_title:u.name,description:u.description,sub_discipline_id:u.sub_discipline_id,tag_discipline_ids:u.tag_discipline_ids,item_banks_group_ids:u.item_banks_group_ids,identifier:s,analysis:u.analysis});case 37:if(Z=e.sent,0!==Z.status){e.next=43;break}if("start"!==t){e.next=42;break}return e.abrupt("return");case 42:L.history.replace(pe);case 43:e.next=47;break;case 45:b.ZP.success("保存成功"),Ce(ie());case 47:H({type:ae.SET_LOADING,payload:!1}),e.next=80;break;case 50:return e.next=52,(0,B.zQ)({hack:u,hack_codes:o,hack_sets:x,tags:p,examination_bank_id:_e||null});case 52:if(T=e.sent,I=T.identifier,A=T.exam_identifier,H({type:ae.SET_LOADING,payload:!1}),"start"!==t){e.next=58;break}return e.abrupt("return");case 58:if(!I){e.next=80;break}if(pe){e.next=63;break}L.history.replace("/problems/".concat(I,"/edit?lastedUpdateTime=").concat(ie())),e.next=80;break;case 63:return e.next=65,(0,B.j2)(I);case 65:if(s){e.next=79;break}if(!pe.includes("paperlibrary")){e.next=72;break}return e.next=69,(0,Y.oF)({id:_e,item_type:Q.c.Program,name:u.name,question_score:u.score,difficulty:u.difficult,sub_discipline_id:u.sub_discipline_id,tag_discipline_ids:u.tag_discipline_ids,identifier:A,analysis:u.analysis});case 69:return 0===e.sent.status&&L.history.replace(pe),e.abrupt("return");case 72:return e.next=74,(0,B.MK)(parseInt(_e,10),{question_type:6,question_score:u.score,question_title:u.name,identifier:I,tag_discipline_ids:u.tag_discipline_ids,analysis:u.analysis});case 74:w=e.sent,0===w.status&&L.history.replace(pe),e.next=80;break;case 79:L.history.replace(pe);case 80:case"end":return e.stop()}}),e)}))),Le.apply(this,arguments)}function Fe(){return(Fe=p()(d()().mark((function e(){var n;return d()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,B.ZS)(s);case 2:0===(n=e.sent).status?(b.ZP.success("撤销发布成功"),H({type:ae.SET_STATUS,payload:0})):b.ZP.info(n.message);case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Ve(){return(Ve=p()(d()().mark((function e(){return d()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.t0=Pe,e.next=3,c.getFieldValue();case 3:e.t1=e.sent,(0,e.t0)(e.t1,"start"),setTimeout(p()(d()().mark((function e(){var n,t;return d()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,B.uE)(s);case 2:n=e.sent,t=n.identifier,window.location.href=Se?"/myproblems/".concat(t,"?type=1"):"/myproblems/".concat(t);case 5:case"end":return e.stop()}}),e)}))),400);case 6:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function De(){if(pe)L.history.replace(pe);else if(Se){var e,n=null===(e=localStorage.getItem("program_homework"))||void 0===e?void 0:e.split(",");L.history.push("/classrooms/".concat(null==n?void 0:n[0],"/program_homework/").concat(null==n?void 0:n[1],"/detail"))}else L.history.replace("/problemset")}var qe=function(e){var n=parseInt(c.getFieldValue("hack").code_compile_score)||0,t=Math.floor((100-n)/e.length),i=t+(100-n)%e.length;e=e.map((function(n,s){return s===e.length-1?m()(m()({},n),{},{score:i}):m()(m()({},n),{},{score:t})})),C(e)};(0,g.useEffect)((function(){if(de){var e=parseInt(c.getFieldValue("hack").code_compile_score)||0,n=null==oe?void 0:oe.length,t=Math.floor((100-e)/n),i=(100-e)%n;null==oe||oe.map((function(e,s){return e.score=t,e.position=s+1,s===n-1&&(e.score=t+i),e})),H({type:ae.SET_INITAL_DATA,payload:{data:m()(m()({},X),{},{hack_sets:oe})}}),c.setFieldsValue({hack_sets:oe})}}),[de]);(0,g.useEffect)((function(){var e,n;null!=X&&null!==(e=X.hack)&&void 0!==e&&null!==(e=e.sub_discipline_id)&&void 0!==e&&e[1]&&Be(null==X||null===(n=X.hack)||void 0===n||null===(n=n.sub_discipline_id)||void 0===n?void 0:n[1])}),[null==X||null===(n=X.hack)||void 0===n?void 0:n.sub_discipline_id]);var Be=function(){var e=p()(d()().mark((function e(n){var t;return d()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,M.YY)({sub_discipline_id:n});case 2:t=e.sent,A(t.tag_disciplines);case 4:case"end":return e.stop()}}),e)})));return function(n){return e.apply(this,arguments)}}();return(0,$.jsx)(Z.Z,{spinning:J,delay:500,children:X?(0,$.jsxs)(g.Fragment,{children:[(0,$.jsxs)("header",{className:x.Z.header,children:[(0,$.jsxs)("div",{children:[(0,$.jsx)("img",{src:"".concat(z.Z.IMG_SERVER,"/images/").concat(null==W?void 0:W.image_url),alt:"user",width:30}),(0,$.jsx)("span",{children:null==W?void 0:W.name})]}),(0,$.jsxs)("h2",{children:[" ",null==X?void 0:X.hack.name," "]}),s?(0,$.jsxs)("a",{className:x.Z.btn_back,onClick:De,children:[" ",(0,$.jsx)(V.Z,{}),"退出"]}):null]}),(0,$.jsxs)(j.Z,{form:c,initialValues:X,layout:"vertical",className:x.Z["oj-form-container"],onValuesChange:function(e){var n;if(null!=e&&null!==(n=e.hack)&&void 0!==n&&n.sub_discipline_id){var t,i,s,a=null==e||null===(t=e.hack)||void 0===t?void 0:t.sub_discipline_id,l=h()(a,2),r=l[0],o=l[1],d=(null==ee||null===(i=ee.find((function(e){return e.id===r})))||void 0===i||null===(i=i.sub_disciplines)||void 0===i||null===(i=i.find((function(e){return e.id===o})))||void 0===i||i.tag_disciplines,m()(m()({},c.getFieldsValue()),{},{hack:m()(m()({},null===(s=c.getFieldsValue())||void 0===s?void 0:s.hack),{},{tag_discipline_ids:[]})}));c.setFieldsValue(d),f(d)}else f(m()({},c.getFieldsValue()))},onFinish:function(e,n){!i.get("exercise")||pe.includes("paperlibrary")?Pe(e,n):k.Z.confirm({title:"保存提示",content:"此题目已存在试题库中,是否将修改后的试题覆盖试题库的原题?",okText:"覆盖原题",cancelText:"不覆盖",onOk:function(){return Pe(e,n,1)},onCancel:function(){return Pe(e,n,0)}})},children:[(0,$.jsx)(R.Z,{leftChild:(0,$.jsx)(ce,{onAddTestCases:function(){var e=c.getFieldValue("hack_sets"),n=parseInt(c.getFieldValue("hack").code_compile_score)||0,t=e.length,i=Math.floor((100-n)/t),s=(100-n)%t;e.map((function(n,t){return de&&(n.score=i,t===e.length-1&&(n.score=i+s)),n.position=t+1,n})),c.setFieldsValue({hack_sets:e}),H({type:ae.SET_INITAL_DATA,payload:{data:m()(m()({},X),{},{hack_sets:e})}})},form:c,handleAddKnowledgeFinish:function(e){A([].concat(r()(I),[m()({},e)]))},MyGroup:ve,formValue:_,knowledgeOptions:I,onChangeLanguage:function(e){H({type:ae.SET_INITAL_DATA,payload:{data:m()(m()({},X),{},{hack_codes:m()(m()({},X.hack_codes),{},{language:e})})}})},onChangeSubDiscipline:function(e){var n=e[1],t=(0,P.y3)(ee,n),i=h()(t,2)[1];c.setFieldsValue({tags:[]}),H({type:ae.SET_INITAL_DATA,payload:{dicts:i,data:m()(m()({},X),{},{hack:m()(m()({},X.hack),{},{sub_discipline_id:e}),tags:[]})}})},onRemoveTestCase:function(e){var n=c.getFieldValue("hack_sets"),t=parseInt(c.getFieldValue("hack").code_compile_score)||0,i=(null==n?void 0:n.length)-1,s=Math.floor((100-t)/i),a=(100-t)%i;n.splice(e,1),null==n||n.map((function(e,n){return de&&(e.score=s,n===i-1&&(e.score=s+a)),e.position=n+1,e})),H({type:ae.SET_INITAL_DATA,payload:{data:m()(m()({},X),{},{hack_sets:n})}}),c.setFieldsValue({hack_sets:n})},onAddTestCase:function(){var e=c.getFieldValue("hack_sets"),n=parseInt(c.getFieldValue("hack").code_compile_score)||0,t=e.length+1,i=Math.floor((100-n)/t),s=(100-n)%t;e.map((function(e,n){return de&&(e.score=i),e.position=n+1,e})),e.push({input:"",output:"",position:t,score:de?i+s:0}),c.setFieldsValue({hack_sets:e}),H({type:ae.SET_INITAL_DATA,payload:{data:m()(m()({},X),{},{hack_sets:e})}})},dicts:te,categorys:Ne,callback_url:pe,hack:X.hack,onChangeScore:function(e){e.target.value||qe(N),H({type:ae.SET_INITAL_DATA,payload:{data:m()(m()({},X),{},{hack:m()(m()({},X.hack),{},{test_set_score:e.target.value})})}})},onChangehide:function(e){Ze(e.target.checked)},onChangeAverage:function(e){var n=e.target.value;n&&qe(N),H({type:ae.SET_INITAL_DATA,payload:{data:m()(m()({},X),{},{hack:m()(m()({},X.hack),{},{test_set_average:n})})}})},onChangeFile:function(e){H({type:ae.SET_INITAL_DATA,payload:{data:m()(m()({},X),{},{hack:m()(m()({},X.hack),{},{is_file:e.target.value})})}})},uploadData:N,setUploadData:C,handleUploadRatio:qe,ischecked:be,isshows:Ae,isProgram:Se,addUploadFnc:function(e){var n,t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(t)return function(){H({type:ae.SET_INITAL_DATA,payload:{data:m()(m()({},X),{},{hack:m()(m()({},X.hack),{},{is_file:!0})})}}),c.setFieldsValue({hack:{is_file:!0}})};var i=null==e?void 0:e.map((function(e){return{input:e.input,output:e.output,score:0,position:1}})),s=null===(n=c.getFieldValue("hack_sets"))||void 0===n||null===(n=n.filter((function(e){return e.input||e.output})))||void 0===n?void 0:n.concat(i),a=parseInt(c.getFieldValue("hack").code_compile_score)||0,l=null==s?void 0:s.length,r=Math.floor((100-a)/l),o=(100-a)%l;null==s||s.map((function(e,n){return de&&(e.score=r,n===l-1&&(e.score=r+o)),e.position=n+1,e})),H({type:ae.SET_INITAL_DATA,payload:{data:m()(m()({},X),{},{hack_sets:s,hack:m()(m()({},X.hack),{},{is_file:!1})})}}),c.setFieldsValue({hack_sets:s,hack:{is_file:!1}})}}),rightChild:Se?(0,$.jsx)(j.Z.Item,{name:"codes",style:{marginBottom:0},children:(0,$.jsx)(G.Z,{})}):(0,$.jsx)(j.Z.Item,{name:["hack_codes","code"],style:{marginBottom:0},children:(0,$.jsx)(U.Z,{language:X.hack_codes.language})})}),(0,$.jsx)("div",{className:x.Z.footer,children:s?(0,$.jsxs)(g.Fragment,{children:[Se&&(0,$.jsx)(T.ZP,{onClick:De,type:"primary",ghost:!0,children:"退出编辑"}),pe||Se?null:(0,$.jsx)(T.ZP,{type:re?"default":"primary",onClick:function(){ne(0===re?{title:"提示",content:(0,$.jsxs)(g.Fragment,{children:[" ",(0,$.jsx)("div",{children:"发布后即可应用到自己管理的课堂"})," ",(0,$.jsx)("div",{children:" 是否确认发布?"})," "]}),okText:"确定",cancelText:"取消",onOk:function(){c.submit(),setTimeout(p()(d()().mark((function e(){var n;return d()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,B.j2)(s);case 2:0===(n=e.sent).status?(b.ZP.success("发布成功"),H({type:ae.SET_STATUS,payload:1})):b.ZP.info(n.message);case 4:case"end":return e.stop()}}),e)}))),400)}}:{title:"提示",content:(0,$.jsx)("p",{children:"是否确认撤销发布?"}),okText:"确定",cancelText:"取消",onOk:function(){!function(){Fe.apply(this,arguments)}()}})},children:re?"撤销发布":"立即发布"}),(0,$.jsx)(T.ZP,{loading:J,type:"primary",htmlType:"submit",children:"保存"}),(0,$.jsx)(T.ZP,{type:"primary",onClick:function(){return Ve.apply(this,arguments)},children:re?"开始挑战":"模拟挑战"})]}):(0,$.jsxs)(g.Fragment,{children:[(0,$.jsx)(T.ZP,{onClick:De,children:"取消"}),(0,$.jsx)(T.ZP,{loading:J,type:"primary",htmlType:"submit",children:"保存"})]})})]})]}):null})}},96527:function(e,n){n.Z={header:"header___HqHSe",checkboxs:"checkboxs___ObBnD",field:"field___w_sM6","oj-form-container":"oj-form-container____odYP","oj-left-panel":"oj-left-panel___emEB2","oj-form-info":"oj-form-info___m00Ag",footer:"footer___O4iSJ",collapse:"collapse___Ltfkj","test-case-name":"test-case-name___miZcb","btn-remove-case":"btn-remove-case___cHap2","icon-tag":"icon-tag___gmyTb",btn_back:"btn_back___tNmX3",testJi:"testJi___L3fHb",upBtn:"upBtn___RGH6X",djs:"djs____TS0n",time:"time___IAdHc"}}}]);