|
|
"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[34994],{2377:function(e,n,t){t.d(n,{Z:function(){return r}});var s=t(5891),i=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(88853),c=function(e,n){return i.createElement(l.Z,(0,s.Z)({},e,{ref:n,icon:a}))};var r=i.forwardRef(c)},15962:function(e,n,t){t.d(n,{Z:function(){return r}});var s=t(5891),i=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(88853),c=function(e,n){return i.createElement(l.Z,(0,s.Z)({},e,{ref:n,icon:a}))};var r=i.forwardRef(c)},98240:function(e,n,t){t.d(n,{Z:function(){return y}});var s=t(82242),i=t.n(s),a=t(7557),l=t.n(a),c=t(41498),r=t.n(c),o=t(79800),d=t.n(o),u=t(39647),_=t.n(u),p=t(59301),h=t(86914),m=t(2982),f="customTree___ZhEHU",g="name___RIkn2",x=t(37712),v=["value","onChange","defaultValue","disabled"],y=function(e){var n=e.value,t=e.onChange,s=e.defaultValue,a=e.disabled,c=_()(e,v),o=(0,p.useState)([]),u=d()(o,2),y=u[0],k=u[1],j=(0,p.useState)("1"),b=d()(j,2),Z=b[0],T=b[1];(0,p.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,m.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:S(n.data||[])}],k(t),T("2"));case 4:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),S=function(e){function n(e){var t=e.children,s=Array.isArray(t)&&t.length>0,i=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:i,key:i,icon:(0,x.jsx)("i",{className:"iconfont icon-wenjianjia2 c-light-primary mr10",style:{lineHeight:"19px"}}),children:s?null==t?void 0:t.map((function(e){return n(e)})):[]}}return null==e?void 0:e.map((function(e){return n(e)}))},w=s?{defaultExpandedKeys:[0],defaultSelectedKeys:[0]}:{selectedKeys:n,defaultExpandedKeys:n};return(0,x.jsx)("div",{className:f,children:(0,x.jsx)(h.Z,i()(i()({},w),{},{showIcon:!0,treeData:y,onSelect:t,disabled:a},c),Z)})}},69830:function(e,n,t){t.d(n,{Z:function(){return r}});var s=t(79800),i=t.n(s),a=t(59301),l=t(87569),c=t(37712),r=function(e){var n=e.defaultX,t=void 0===n?"40%":n,s=e.leftChild,r=e.rightChild,o=e.className,d=e.hideResize,u=void 0!==d&&d,_=(0,a.useState)(t),p=i()(_,2),h=p[0],m=p[1],f=(0,a.useRef)();(0,a.useEffect)((function(){function e(e){f.current&&(l.Z.publish("resize-move-bar",e),m(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 g="number"==typeof h&&.01!==h?"".concat(h,"px"):t,x="calc(100% - ".concat(u?"0px":"4px"," - ").concat(g,")");return(0,c.jsxs)("div",{className:"split-panel-container ".concat(o),children:[(0,c.jsx)("section",{style:{width:g,display:.01===h?"none":""},children:s}),(0,c.jsx)("section",{className:"resize-x-bar",onMouseDown:function(){f.current=!0},children:(0,c.jsx)("a",{className:"btn-resize",children:(0,c.jsx)("svg",{width:"16",height:"13",viewBox:"0 0 16 13",children:(0,c.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,c.jsx)("section",{style:{width:x},children:r})]})}},31451:function(e,n,t){t.r(n),t.d(n,{Types:function(){return fe},default:function(){return xe}});var s=t(70236),i=t.n(s),a=t(91232),l=t.n(a),c=t(37205),r=t.n(c),o=t(7557),d=t.n(o),u=t(41498),_=t.n(u),p=t(79800),h=t.n(p),m=t(82242),f=t.n(m),g=t(59301),x=t(1446),v=t(92832),y=t(43418),k=t(36381),j=t(78241),b=t(8591),Z=t(71418),T=t(3113),I=t(57809),S=t(19842),w=t(400),A=t(24905),C=t(5112),N=t(81327),E=t(14478),P=t(88833),F=t(18196),L=t(24334),V=t(15962),D=t(2377),z=t(88330),q=t(90384),M=t(72582),B=t(69830),G=t(43428),R=t(26694),U=t(20129),K=t(8859),O=t(58899),H="code-panel-container___rlI_l",J="action-oj-bar___WLV9q",X="active___CLsJG",Y=t(37712),W={theme:(0,K.G)("cmCodeMode","vs-dark"),fontSize:(0,K.G)("cmFontSize",14),showEditorSetting:!1,tabToSpace:(0,K.G)("cmTabToSpace",!0)},Q=function(e){return e[e.set_font_size=0]="set_font_size",e[e.set_theme=1]="set_theme",e[e.on_tab_to_space=2]="on_tab_to_space",e[e.set_show_editor_setting=3]="set_show_editor_setting",e}(Q||{});function $(e,n){switch(n.type){case Q.set_show_editor_setting:return f()(f()({},e),{},{showEditorSetting:n.payload});case Q.set_theme:return f()(f()({},e),{},{theme:n.payload});case Q.set_font_size:return f()(f()({},e),{},{fontSize:n.payload});case Q.on_tab_to_space:return f()(f()({},e),{},{tabToSpace:n.payload});default:throw new Error}}var ee=function(e){var n,t=e.isLoading,s=e.value,i=e.onChange,a=e.language,l=e.onUpdateCode,c=e.form,r=(0,g.useReducer)($,W),o=h()(r,2),d=o[0],u=o[1],_=d.theme,p=d.fontSize,m=d.showEditorSetting,x=d.tabToSpace,v=(0,g.useRef)(),y=(0,g.useRef)(),k=j.Z.useWatch(["hack_codes","language"],c),b={onFontSizeChange:function(e){u({type:Q.set_font_size,payload:e}),(0,K.t)("cmFontSize",e)},tabToSpace:x,cmFontSize:p,className:"oj",cmCodeMode:_,onTabToSpace:function(e){u({type:Q.on_tab_to_space,payload:e}),(0,K.t)("cmTabToSpace",e)},onCodeModeChange:function(e){u({type:Q.set_theme,payload:e}),(0,K.t)("cmCodeMode",e)}};var Z={value:s,language:a,theme:"vs",height:"calc(100% - 56px)",options:{fontSize:p,insertSpaces:x},onChange:function(e){i(e),y.current=e,clearTimeout(v.current),v.current=setTimeout((function(){l(y.current)}),1e4)},onEditBlur:function(e){y.current&&l(y.current)}};return(0,Y.jsxs)(g.Fragment,{children:[(0,Y.jsxs)("div",{className:H,children:[(0,Y.jsx)("div",{className:J,children:null===(n=[k])||void 0===n?void 0:n.map((function(e){return(0,Y.jsxs)("aside",{className:X,children:[(0,Y.jsx)("i",{className:"iconfont icon-bianchengyuyan1"}),(0,Y.jsx)("span",{children:e})]},e)}))}),!t&&(0,Y.jsx)(R.ZP,f()({},Z))]}),(0,Y.jsx)(U.Z,{children:(0,Y.jsx)(G.Z,{rootClassName:"oj",title:null,placement:"right",closable:!1,open:m,onClose:function(){u({type:Q.set_show_editor_setting,payload:!1})},children:(0,Y.jsx)(O.Z,f()({},b))})})]})},ne=t(35903),te=t(93969),se=t(34458),ie=t(4023),ae=t(56215),le=t(98240),ce=t(43142),re=t(39298),oe=t(65199),de=t(21613),ue=v.Z.TextArea,_e=y.Z.confirm,pe=k.Z.Panel;function he(){return(new Date).getTime()}var me={loading:!0,user:null,disciplines:[],dicts:null,status:0,data:void 0,lastedUpdateTime:0},fe=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 ge(e,n){switch(n.type){case fe.SET_INITAL_DATA:return f()(f()({},e),n.payload);case fe.SET_LOADING:return f()(f()({},e),{},{loading:n.payload});case fe.SET_STATUS:return f()(f()({},e),{},{status:n.payload});default:throw new Error}}var xe=function(){var e,n,t=(0,F.useSearchParams)(),s=h()(t,1)[0],i=((0,F.useLocation)(),(0,F.useParams)().id),a=j.Z.useForm(),c=h()(a,1)[0],o=(0,g.useState)(),u=h()(o,2),p=u[0],m=u[1],v=(0,g.useState)([]),k=h()(v,2),I=k[0],S=k[1],w=(0,g.useState)([]),A=h()(w,2),C=A[0],N=A[1],E=(0,g.useReducer)(ge,me),D=h()(E,2),z=D[0],G=D[1],R=z.loading,U=z.data,K=z.user,O=z.disciplines,H=z.dicts,J=z.status,X=null==U?void 0:U.hack_sets,W=null==U||null===(e=U.hack)||void 0===e?void 0:e.test_set_average,Q=(0,se.oP)(),$=Q.callback_url,ae=Q.express_id,le=Q.score,ce=Q.question_id,de=Q.type,ue=(0,g.useState)([]),pe=h()(ue,2),xe=pe[0],ye=pe[1],ke=(0,g.useState)(!1),je=h()(ke,2),be=je[0],Ze=je[1],Te=(0,g.useState)(!1),Ie=h()(Te,2),Se=Ie[0],we=Ie[1],Ae="1"===de,Ce=(0,g.useMemo)((function(){var e=[];return O&&(0,P.D0)(O,e),e}),[O]),Ne=(0,g.useCallback)(_()(d()().mark((function e(){var n,t,s,a,l,r,o,u,_,p,g,x,v,y,k,j,b,Z,T,I,S,w,A,C,E,F,V,D,z,M,B,R,U,K,H,J,X,Y,W,Q,$,ee,ne,te,ie,ae,ce,re,oe,de,ue,_e,pe,he=arguments;return d()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=he.length>0&&void 0!==he[0]?he[0]:0,0!==(t=O).length){e.next=7;break}return e.next=5,(0,q.d1)("new_question");case 5:s=e.sent,t=s.disciplines;case 7:if(!i){e.next=15;break}return a={disciplines:t},e.next=11,(0,q.fu)(i);case 11:(l=e.sent).message?"401"===l.status&&(document.location.href="/user/login"):(r=l.category,o=l.user,u=l.code,_=l.language,p=l.hack_sets,g=l.description,x=l.difficult,v=l.name,y=l.open_or_not,k=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,S=l.tag_discipline_ids,w=l.item_banks_group_id,A=l.is_file,C=void 0!==A&&A,E=l.hide_actual_output,F=l.code_compile_score,V=l.languages,D=l.is_my,z=l.codes,M=l.submit_rule,B=(0,P.y3)(t,k),R=h()(B,2),U=R[0],K=R[1],Ze(E),H=C?[{input:"",output:"",score:100,position:1}]:p,C?(N(p),c.setFieldsValue({hack_sets:H})):N([]),J=(0,se.oP)(),X=J.lastedUpdateTime,Y=null==z?void 0:z.map((function(e){return f()(f()({},e),{},{code:L.Base64.decode(null==e?void 0:e.code)})})),a=f()(f()({},a),{},{loading:!1,user:o,dicts:K,status:I,lastedUpdateTime:n||(X||0),data:{hack_codes:{language:_,code:L.Base64.decode(u)},hack:{category:r,difficult:x,name:v,description:g,open_or_not:y,time_limit:b,test_set_average:Z,test_set_score:T,sub_discipline_id:U,tag_discipline_ids:S,languages:V,score:le||1,item_banks_group_ids:w,is_file:C,is_my:D,code_compile_score:F,analysis:j,submit_rule:M},hack_sets:H,tags:S,codes:Y}}),parseInt(F)>0&&we(!0),G({type:fe.SET_INITAL_DATA,payload:a}),m({hack:{category:r,difficult:x,name:v,description:g,open_or_not:y,time_limit:b,test_set_average:Z,test_set_score:T,sub_discipline_id:U,tag_discipline_ids:S,score:le||1,item_banks_group_ids:w,is_file:C,analysis:j},codes:Y}),Ee(null==U?void 0:U[0],null==U?void 0:U[1],t)),e.next=25;break;case 15:return e.next=17,(0,q.PR)();case 17:$=e.sent,ee=$.user,ne=(0,se.oP)(),te=ne.difficult,ie=ne.sub_discipline_id,ae=ne.tag_discipline_id,ce=ne.tagIds,re=ne.banksIds,oe=(0,P.y3)(t,parseInt(ie,10)),de=h()(oe,2),ue=de[0],_e=de[1],pe=[Number(re)],G({type:fe.SET_INITAL_DATA,payload:{loading:!1,user:ee,disciplines:t,status:0,dicts:_e,data:{hack_codes:{language:"C",code:""},hack:{category:null,difficult:parseInt(te,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===(W=ce.split(","))||void 0===W?void 0:W.map((function(e){return Number(e)}))),name:"",item_banks_group_ids:pe,is_file:!1},tags:ae?null==ae?void 0:ae.split(",").map((function(e){return parseInt(e,10)})):[],hack_sets:[{input:"",output:"",score:100,position:1}]}}}),m({hack:{category:null,difficult:parseInt(te,10),time_limit:3,description:"",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_id:pe,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)}))),[i,O]);(0,g.useEffect)((function(){try{Ne()}catch(e){console.log(e,"----")}}),[]),(0,g.useEffect)((function(){function e(){return e=_()(d()().mark((function e(){var n;return d()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,te.U2)("item_banks_groups/mine.json");case 2:n=e.sent,ye(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 s;null==t||null===(s=t.find((function(n){return n.id===e})))||void 0===s||null===(s=s.sub_disciplines)||void 0===s||null===(s=s.find((function(e){return e.id===n})))||void 0===s||s.tag_disciplines};function Pe(e,n,t){return Fe.apply(this,arguments)}function Fe(){return Fe=_()(d()().mark((function e(n,t,s){var a,c,r,o,u,_,p,h,m,g,x,v,y,k,j,Z,T,I,S,w;return d()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:c=f()({},n),r=c.hack_sets,o=c.hack_codes,u=c.hack,_=c.tags,p=c.codes,u.hide_actual_output=be,h=[],m=[],g=0,x=null!=u&&u.is_file?C.map((function(e,n){return f()(f()({},e),{},{position:n+1})})):r.map((function(e){return f()(f()({},e),{},{is_file:!1})})),v=l()(x);try{for(v.s();!(y=v.n()).done;)k=y.value,g+=k.score,k.id&&k.id>=0?h.push(k):m.push(k)}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={},Ae?null==p||p.forEach((function(e){j[e.language]=null!=e&&e.code?L.Base64.encode(null==e?void 0:e.code):""})):o.code=L.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],G({type:fe.SET_LOADING,payload:!0}),$||(u.score=100*u.difficult),!i){e.next=50;break}return e.next=26,(0,q.l_)(i,{hack:u,hack_codes:o,hack_sets:m,update_hack_sets:h,tags:_,is_cover:s,languages:u.languages,codes:j});case 26:if(!$){e.next=45;break}return e.next=29,(0,q.j2)(i);case 29:if(!$.includes("paperlibrary")){e.next=35;break}return e.next=32,(0,re.oF)({id:ae,question_id:ce,item_type:oe.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&&F.history.replace($),e.abrupt("return");case 35:return e.next=37,(0,q.GM)(ce,{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:i,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:F.history.replace($);case 43:e.next=47;break;case 45:b.ZP.success("保存成功"),Ne(he());case 47:G({type:fe.SET_LOADING,payload:!1}),e.next=80;break;case 50:return e.next=52,(0,q.zQ)({hack:u,hack_codes:o,hack_sets:x,tags:_,examination_bank_id:ae||null});case 52:if(T=e.sent,I=T.identifier,S=T.exam_identifier,G({type:fe.SET_LOADING,payload:!1}),"start"!==t){e.next=58;break}return e.abrupt("return");case 58:if(!I){e.next=80;break}if($){e.next=63;break}F.history.replace("/problems/".concat(I,"/edit?lastedUpdateTime=").concat(he())),e.next=80;break;case 63:return e.next=65,(0,q.j2)(I);case 65:if(i){e.next=79;break}if(!$.includes("paperlibrary")){e.next=72;break}return e.next=69,(0,re.oF)({id:ae,item_type:oe.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:S,analysis:u.analysis});case 69:return 0===e.sent.status&&F.history.replace($),e.abrupt("return");case 72:return e.next=74,(0,q.MK)(parseInt(ae,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&&F.history.replace($),e.next=80;break;case 79:F.history.replace($);case 80:case"end":return e.stop()}}),e)}))),Fe.apply(this,arguments)}function Le(){return(Le=_()(d()().mark((function e(){var n;return d()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,q.ZS)(i);case 2:0===(n=e.sent).status?(b.ZP.success("撤销发布成功"),G({type:fe.SET_STATUS,payload:0})):b.ZP.info(n.message);case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Ve(){return(Ve=_()(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(_()(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,q.uE)(i);case 2:n=e.sent,t=n.identifier,window.location.href=Ae?"/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($)F.history.replace($);else if(Ae){var e,n=null===(e=localStorage.getItem("program_homework"))||void 0===e?void 0:e.split(",");F.history.push("/classrooms/".concat(null==n?void 0:n[0],"/program_homework/").concat(null==n?void 0:n[1],"/detail"))}else F.history.replace("/problemset")}var ze=function(e){var n=parseInt(c.getFieldValue("hack").code_compile_score)||0,t=Math.floor((100-n)/e.length),s=t+(100-n)%e.length;e=e.map((function(n,i){return i===e.length-1?f()(f()({},n),{},{score:s}):f()(f()({},n),{},{score:t})})),N(e)};(0,g.useEffect)((function(){if(W){var e=parseInt(c.getFieldValue("hack").code_compile_score)||0,n=null==X?void 0:X.length,t=Math.floor((100-e)/n),s=(100-e)%n;null==X||X.map((function(e,i){return e.score=t,e.position=i+1,i===n-1&&(e.score=t+s),e})),G({type:fe.SET_INITAL_DATA,payload:{data:f()(f()({},U),{},{hack_sets:X})}}),c.setFieldsValue({hack_sets:X})}}),[W]);(0,g.useEffect)((function(){var e,n;null!=U&&null!==(e=U.hack)&&void 0!==e&&null!==(e=e.sub_discipline_id)&&void 0!==e&&e[1]&&qe(null==U||null===(n=U.hack)||void 0===n||null===(n=n.sub_discipline_id)||void 0===n?void 0:n[1])}),[null==U||null===(n=U.hack)||void 0===n?void 0:n.sub_discipline_id]);var qe=function(){var e=_()(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,S(t.tag_disciplines);case 4:case"end":return e.stop()}}),e)})));return function(n){return e.apply(this,arguments)}}();return(0,Y.jsx)(Z.Z,{spinning:R,delay:500,children:U?(0,Y.jsxs)(g.Fragment,{children:[(0,Y.jsxs)("header",{className:x.Z.header,children:[(0,Y.jsxs)("div",{children:[(0,Y.jsx)("img",{src:"".concat(ie.Z.IMG_SERVER,"/images/").concat(null==K?void 0:K.image_url),alt:"user",width:30}),(0,Y.jsx)("span",{children:null==K?void 0:K.name})]}),(0,Y.jsxs)("h2",{children:[" ",null==U?void 0:U.hack.name," "]}),i?(0,Y.jsxs)("a",{className:x.Z.btn_back,onClick:De,children:[" ",(0,Y.jsx)(V.Z,{}),"退出"]}):null]}),(0,Y.jsxs)(j.Z,{form:c,initialValues:U,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,s,i,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==O||null===(s=O.find((function(e){return e.id===r})))||void 0===s||null===(s=s.sub_disciplines)||void 0===s||null===(s=s.find((function(e){return e.id===o})))||void 0===s||s.tag_disciplines,f()(f()({},c.getFieldsValue()),{},{hack:f()(f()({},null===(i=c.getFieldsValue())||void 0===i?void 0:i.hack),{},{tag_discipline_ids:[]})}));c.setFieldsValue(d),m(d)}else m(f()({},c.getFieldsValue()))},onFinish:function(e,n){!s.get("exercise")||$.includes("paperlibrary")?Pe(e,n):y.Z.confirm({title:"保存提示",content:"此题目已存在试题库中,是否将修改后的试题覆盖试题库的原题?",okText:"覆盖原题",cancelText:"不覆盖",onOk:function(){return Pe(e,n,1)},onCancel:function(){return Pe(e,n,0)}})},children:[(0,Y.jsx)(B.Z,{leftChild:(0,Y.jsx)(ve,{onAddTestCases:function(){var e=c.getFieldValue("hack_sets"),n=parseInt(c.getFieldValue("hack").code_compile_score)||0,t=e.length,s=Math.floor((100-n)/t),i=(100-n)%t;e.map((function(n,t){return W&&(n.score=s,t===e.length-1&&(n.score=s+i)),n.position=t+1,n})),c.setFieldsValue({hack_sets:e}),G({type:fe.SET_INITAL_DATA,payload:{data:f()(f()({},U),{},{hack_sets:e})}})},form:c,handleAddKnowledgeFinish:function(e){S([].concat(r()(I),[f()({},e)]))},MyGroup:xe,formValue:p,knowledgeOptions:I,onChangeLanguage:function(e){G({type:fe.SET_INITAL_DATA,payload:{data:f()(f()({},U),{},{hack_codes:f()(f()({},U.hack_codes),{},{language:e})})}})},onChangeSubDiscipline:function(e){var n=e[1],t=(0,P.y3)(O,n),s=h()(t,2)[1];c.setFieldsValue({tags:[]}),G({type:fe.SET_INITAL_DATA,payload:{dicts:s,data:f()(f()({},U),{},{hack:f()(f()({},U.hack),{},{sub_discipline_id:e}),tags:[]})}})},onRemoveTestCase:function(e){var n=c.getFieldValue("hack_sets"),t=parseInt(c.getFieldValue("hack").code_compile_score)||0,s=(null==n?void 0:n.length)-1,i=Math.floor((100-t)/s),a=(100-t)%s;n.splice(e,1),null==n||n.map((function(e,n){return W&&(e.score=i,n===s-1&&(e.score=i+a)),e.position=n+1,e})),G({type:fe.SET_INITAL_DATA,payload:{data:f()(f()({},U),{},{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,s=Math.floor((100-n)/t),i=(100-n)%t;e.map((function(e,n){return W&&(e.score=s),e.position=n+1,e})),e.push({input:"",output:"",position:t,score:W?s+i:0}),c.setFieldsValue({hack_sets:e}),G({type:fe.SET_INITAL_DATA,payload:{data:f()(f()({},U),{},{hack_sets:e})}})},dicts:H,categorys:Ce,callback_url:$,hack:U.hack,onChangeScore:function(e){e.target.value||ze(C),G({type:fe.SET_INITAL_DATA,payload:{data:f()(f()({},U),{},{hack:f()(f()({},U.hack),{},{test_set_score:e.target.value})})}})},onChangehide:function(e){Ze(e.target.checked)},onChangeAverage:function(e){var n=e.target.value;n&&ze(C),G({type:fe.SET_INITAL_DATA,payload:{data:f()(f()({},U),{},{hack:f()(f()({},U.hack),{},{test_set_average:n})})}})},onChangeFile:function(e){G({type:fe.SET_INITAL_DATA,payload:{data:f()(f()({},U),{},{hack:f()(f()({},U.hack),{},{is_file:e.target.value})})}})},uploadData:C,setUploadData:N,handleUploadRatio:ze,ischecked:be,isshows:Se,isProgram:Ae,addUploadFnc:function(e){var n,t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(t)return function(){G({type:fe.SET_INITAL_DATA,payload:{data:f()(f()({},U),{},{hack:f()(f()({},U.hack),{},{is_file:!0})})}}),c.setFieldsValue({hack:{is_file:!0}})};var s=null==e?void 0:e.map((function(e){return{input:e.input,output:e.output,score:0,position:1}})),i=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(s),a=parseInt(c.getFieldValue("hack").code_compile_score)||0,l=null==i?void 0:i.length,r=Math.floor((100-a)/l),o=(100-a)%l;null==i||i.map((function(e,n){return W&&(e.score=r,n===l-1&&(e.score=r+o)),e.position=n+1,e})),G({type:fe.SET_INITAL_DATA,payload:{data:f()(f()({},U),{},{hack_sets:i,hack:f()(f()({},U.hack),{},{is_file:!1})})}}),c.setFieldsValue({hack_sets:i,hack:{is_file:!1}})}}),rightChild:Ae?(0,Y.jsx)(j.Z.Item,{name:"codes",style:{marginBottom:0},children:(0,Y.jsx)(ne.Z,{})}):(0,Y.jsx)(j.Z.Item,{name:["hack_codes","code"],style:{marginBottom:0},children:(0,Y.jsx)(ee,{language:U.hack_codes.language})})}),(0,Y.jsx)("div",{className:x.Z.footer,children:i?(0,Y.jsxs)(g.Fragment,{children:[Ae&&(0,Y.jsx)(T.ZP,{onClick:De,type:"primary",ghost:!0,children:"退出编辑"}),$||Ae?null:(0,Y.jsx)(T.ZP,{type:J?"default":"primary",onClick:function(){_e(0===J?{title:"提示",content:(0,Y.jsxs)(g.Fragment,{children:[" ",(0,Y.jsx)("div",{children:"发布后即可应用到自己管理的课堂"})," ",(0,Y.jsx)("div",{children:" 是否确认发布?"})," "]}),okText:"确定",cancelText:"取消",onOk:function(){c.submit(),setTimeout(_()(d()().mark((function e(){var n;return d()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,q.j2)(i);case 2:0===(n=e.sent).status?(b.ZP.success("发布成功"),G({type:fe.SET_STATUS,payload:1})):b.ZP.info(n.message);case 4:case"end":return e.stop()}}),e)}))),400)}}:{title:"提示",content:(0,Y.jsx)("p",{children:"是否确认撤销发布?"}),okText:"确定",cancelText:"取消",onOk:function(){!function(){Le.apply(this,arguments)}()}})},children:J?"撤销发布":"立即发布"}),(0,Y.jsx)(T.ZP,{loading:R,type:"primary",htmlType:"submit",children:"保存"}),(0,Y.jsx)(T.ZP,{type:"primary",onClick:function(){return Ve.apply(this,arguments)},children:J?"开始挑战":"模拟挑战"})]}):(0,Y.jsxs)(g.Fragment,{children:[(0,Y.jsx)(T.ZP,{onClick:De,children:"取消"}),(0,Y.jsx)(T.ZP,{loading:R,type:"primary",htmlType:"submit",children:"保存"})]})})]})]}):null})};function ve(e){var n,t,s=e.form,a=e.onAddTestCases,l=e.handleAddKnowledgeFinish,c=e.ischecked,o=(e.MyGroup,e.formValue),d=e.knowledgeOptions,u=e.categorys,_=e.hack,p=e.callback_url,m=e.onChangeAverage,y=e.onChangeScore,b=e.onChangehide,Z=e.onChangeFile,F=e.onAddTestCase,L=e.onRemoveTestCase,V=e.onChangeSubDiscipline,q=e.onChangeLanguage,M=e.uploadData,B=e.setUploadData,G=e.handleUploadRatio,R=e.isshows,U=e.isProgram,K=e.addUploadFnc,O=(null===(n=location)||void 0===n||null===(n=n.search)||void 0===n?void 0:n.includes("select"))||!1,H=(0,g.useState)(R),J=h()(H,2),X=J[0],W=J[1],Q=(0,g.useState)(!1),$=h()(Q,2),ee=$[0],ne=$[1],te=_.test_set_average,se=_.test_set_score,ie=(0,g.useState)(!1),re=h()(ie,2),oe=re[0],_e=re[1];function he(e){e.stopPropagation()}return(0,Y.jsxs)("div",{className:x.Z["oj-left-panel"],children:[(0,Y.jsxs)("div",{className:x.Z["oj-form-info"],children:[(0,Y.jsxs)("div",{className:x.Z.field,children:[(0,Y.jsx)(j.Z.Item,{label:"难易度",name:["hack","difficult"],rules:[{required:!0,message:"请选择难易度"}],children:(0,Y.jsx)(I.default,{disabled:O,children:(0,P.jw)(P.R8.difficult)})}),(0,Y.jsx)(j.Z.Item,{label:"课程(合理的课程分类有利于快速检索)",name:["hack","sub_discipline_id"],rules:[{required:!0,message:"请选择课程"}],children:(0,Y.jsx)(S.Z,{disabled:O,allowClear:!1,options:u,placeholder:"请选择",onChange:V})})]}),(0,Y.jsxs)("div",{className:x.Z.field,children:[p&&(0,Y.jsx)(j.Z.Item,{label:"分数",name:["hack","score"],rules:[{required:!0,message:"请输入分数"}],extra:(0,Y.jsx)("span",{style:{position:"absolute",left:100,top:5},children:"分"}),children:(0,Y.jsx)(w.Z,{disabled:O,min:1,max:100})}),(0,Y.jsx)(j.Z.Item,{label:(0,Y.jsx)("div",{children:"单个测试集评测时长限制 "}),name:["hack","time_limit"],rules:[{required:!0,message:"请输入单个测试集评测时长限制"},{type:"number",min:1,message:"最小限制时间是1秒"}],extra:(0,Y.jsx)("span",{style:{position:"absolute",left:100,top:5},children:"秒"}),children:(0,Y.jsx)(w.Z,{min:1})}),U?(0,Y.jsx)(j.Z.Item,{label:"编程语言",style:{paddingBottom:16},name:["hack","languages"],rules:[{required:!0,message:"请选择编程语言"}],children:(0,Y.jsxs)(A.Z.Group,{children:[(0,Y.jsx)(A.Z,{value:"C",children:"C"}),(0,Y.jsx)(A.Z,{value:"C++",children:"C++"}),(0,Y.jsx)(A.Z,{value:"Java",children:"Java"}),(0,Y.jsx)(A.Z,{value:"Python",children:"Python"})]})}):(0,Y.jsx)(j.Z.Item,{label:"编程语言",name:["hack_codes","language"],style:{paddingBottom:16},rules:[{required:!0,message:"请选择编程语言"}],children:(0,Y.jsx)(I.default,{onChange:q,children:(0,P.jw)(P.R8.language)})})]}),(0,Y.jsx)(j.Z.Item,{label:(0,Y.jsxs)("span",{children:["知识点:",(0,Y.jsx)("span",{className:"c-grey-999",children:"(所有自建知识点仅本人可见,被EduCoder平台审核通过为官方知识点后所有用户可见)"})]}),name:["hack","tag_discipline_ids"],children:(0,Y.jsx)(ae.N,{selectvalues:(null==_?void 0:_.tag_discipline_id)||(null==_?void 0:_.tag_discipline_ids),disabled:O,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,Y.jsx)(j.Z.Item,{label:"加入文件夹目录",name:["hack","item_banks_group_ids"],labelCol:{span:24},wrapperCol:{span:24},children:(0,Y.jsx)(le.Z,{disabled:O})}),(0,Y.jsx)(j.Z.Item,{label:"任务名称",name:["hack","name"],rules:[{required:!0,message:"请输入任务名称"}],children:(0,Y.jsx)(v.Z,{maxLength:60,placeholder:"请输入任务名称",suffix:(0,Y.jsx)("span",{children:60-_.name.length})})}),(0,Y.jsx)(j.Z.Item,{name:["hack","description"],valuePropName:"defaultValue",rules:[{required:!0,message:"请输入描述内容"}],children:(0,Y.jsx)(z.Z,{miniToolbar:!0,id:"moop_cases_content",noStorage:!0,height:200})}),(0,Y.jsx)("div",{onClick:function(){return ne(!0)},children:(0,Y.jsx)(j.Z.Item,{label:"题目解析",name:["hack","analysis"],className:"".concat(x.Z.baseLineHeight),children:(0,Y.jsx)(de.x,{placeholder:"请编辑题目解析(非必填)",isEdit:ee})})}),(0,Y.jsxs)("div",{className:"tst-case-info",children:[(0,Y.jsxs)("h3",{className:"flex-container",style:{justifyContent:"space-between"},children:[" 测试用例与系统评分规则",!_.is_file&&(0,Y.jsx)(T.ZP,{type:"primary",ghost:!0,onClick:F,children:"添加测试用例"})]}),(0,Y.jsx)(j.Z.Item,{name:["hack","test_set_score"],children:(0,Y.jsxs)(C.ZP.Group,{onChange:y,children:[(0,Y.jsxs)(C.ZP,{value:!0,children:["通过全部测试集",(0,Y.jsx)("span",{className:"tip",children:" (学员评测,仅当所有测试集都正确时,才获得一次性奖励)"})]}),(0,Y.jsxs)(C.ZP,{value:!1,children:["通过部分测试集",(0,Y.jsx)("span",{className:"tip",children:" (学员评测,通过测试集即可获得对应奖励)"})]})]})}),(0,Y.jsx)(A.Z,{style:{marginBottom:"5px"},checked:c,onChange:b,children:"隐藏实际输出 (选中,则在学生考试过程中无法看到实际输出结果,仅展示是否评测是否通过)"}),(0,Y.jsx)(j.Z.Item,{className:x.Z.testJi,name:["hack","is_file"],label:"用例类型:",children:(0,Y.jsx)(C.ZP.Group,{onChange:Z,children:(0,Y.jsxs)(N.Z,{direction:"horizontal",children:[(0,Y.jsx)(C.ZP,{value:!1,children:"文本"}),(0,Y.jsx)(C.ZP,{value:!0,children:"文件"})]})})}),(0,Y.jsx)(j.Z.Item,{label:"评测时空格处理",name:["hack","submit_rule"],rules:[{required:!0}],children:(0,Y.jsxs)(C.ZP.Group,{children:[(0,Y.jsx)(C.ZP,{value:0,children:"不忽略空格"}),(0,Y.jsx)(C.ZP,{value:1,children:"忽略首尾空格"}),(0,Y.jsx)(C.ZP,{value:2,children:"忽略所有空格"})]})}),!_.test_set_score&&(0,Y.jsx)(j.Z.Item,{name:["hack","test_set_average"],label:"系统评分占比",children:(0,Y.jsxs)(C.ZP.Group,{onChange:m,children:[(0,Y.jsx)(C.ZP,{value:!0,children:"均分比例"}),(0,Y.jsx)(C.ZP,{value:!1,children:"自定义比例"})]})}),!_.test_set_score&&(0,Y.jsxs)("div",{style:{marginBottom:"20px",marginTop:"-10px"},children:[(0,Y.jsxs)("div",{style:{display:"flex",height:"30px",marginBottom:"10px"},children:[(0,Y.jsx)(A.Z,{checked:X,style:{display:"flex",alignItems:"center"},className:x.Z.checkboxs,onChange:function(e){W(e.target.checked),s.setFieldsValue({hack:{code_compile_score:0}}),_.test_set_average&&(_.is_file?G(M):a())},children:"启用编译通过即可得分"}),X&&(0,Y.jsxs)("span",{style:{display:"flex"},children:[(0,Y.jsx)(j.Z.Item,{rules:[{required:!0,message:"请输入编译得分"}],name:["hack","code_compile_score"],children:(0,Y.jsx)(w.Z,{onChange:function(){_.test_set_average&&(_.is_file?G(M):a())},parser:function(e){return isNaN(parseInt(e))?"":parseInt(e)},min:0,max:100,style:{width:"90px",margin:"5px 0px"}})})," ",(0,Y.jsx)("span",{style:{display:"flex",alignItems:"center",marginLeft:"5px"},children:"%"})]})]}),(0,Y.jsx)("span",{style:{color:"#999",fontSize:"12px",marginLeft:"-8px"},children:"(请注意该实训题是否有编译过程,若没有则无法获得编译得分)"})]}),(0,Y.jsxs)("div",{className:x.Z.upBtn,children:[(0,Y.jsx)(T.ZP,{ghost:!0,type:"primary",className:"mb20",onClick:function(){return _e(!0)},children:"批量上传测试用例"}),(null==_?void 0:_.is_file)&&(0,Y.jsx)(ce.Y2,{disabled:null==_?void 0:_.test_set_average,inputChange:function(e,n){console.log(e,n);var t=M.map((function(t,s){return s===n?f()(f()({},t),{},{score:e.target.value?Number(e.target.value):0}):t}));B(t)},showScore:!_.test_set_score,data:M,onRemove:function(e,n){var t=r()(M);t.splice(n,1),te?G(t):B(t)}})]}),!_.is_file&&(0,Y.jsx)(j.Z.List,{name:"hack_sets",children:function(e,n){return i()(n),(0,Y.jsx)(k.Z,{accordion:!0,className:x.Z.collapse,children:e.map((function(e,n){return(0,Y.jsxs)(pe,{header:(0,Y.jsxs)("a",{className:x.Z["test-case-name"],children:[(0,Y.jsxs)("span",{children:["测试用例",n+1]}),se?null:(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(j.Z.Item,{name:[e.name,"score"],style:{marginBottom:0},fieldKey:[e.fieldKey,"score"],rules:[{required:!0,message:"请输入测试集".concat(n+1,"评分")}],children:(0,Y.jsx)(w.Z,{onClick:he,min:0,max:100,disabled:te})}),(0,Y.jsx)("span",{children:"%"})]})]}),extra:n>0?(0,Y.jsx)("div",{onClick:he,children:(0,Y.jsx)(E.Z,{okText:"确定",cancelText:"取消",title:"确定删除测试集"+(n+1),onConfirm:function(){L(n)},children:(0,Y.jsx)(D.Z,{className:x.Z["btn-remove-case"]})})}):null,children:[(0,Y.jsx)(j.Z.Item,{label:"输入",name:[e.name,"input"],fieldKey:[e.fieldKey,"input"],children:(0,Y.jsx)(ue,{})}),(0,Y.jsx)(j.Z.Item,{label:"输出",name:[e.name,"output"],fieldKey:[e.fieldKey,"output"],rules:[{required:!0,message:"请输入输出内容"}],children:(0,Y.jsx)(ue,{})})]},"".concat(e.key,"--").concat(n))}))})}})]})]}),(0,Y.jsx)(ce.ZP,{rootIdentifier:null,visible:oe,onClose:function(){return _e(!1)},onOK:function(e){if(null!=e&&e.length){if(null!=e&&e[0].is_file){K(e,!0)();var n=M.concat(e);_.test_set_average?G(n):B(n)}null!=e&&e[0].is_file||K(e)}},multiple:!0,defaultMultipleValue:null==_?void 0:_.is_file})]})}},1446: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"}}}]); |