|
|
"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[16845,71950],{10459:function(e,n,t){function i(e){var n=!0;if(e.length>0){for(var t=0;t<e.length;t++)if(0==e[t].compile_success||!e[t].compile_success){n=!1;break}}else n=!1;return n}function s(e){for(var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",t=[],i=0;i<e.length;i++){var s=e[i],a=n?"".concat(n,"/").concat(s.name):"".concat(s.name);t.push({title:s.name,isLeaf:"tree"!==s.type,key:a})}return t}function a(e,n,t){for(var i=0;i<e.length;i++){var s=e[i];if(s.key===n){s.children=t;break}s.children&&a(s.children,n,t)}return e}function l(e,n,t){var i;return function(){var s=this,a=arguments,l=function(){i=null,t||e.apply(s,a)},r=t&&!i;clearTimeout(i),i=setTimeout(l,n),r&&e.apply(s,a)}}t.d(n,{Ax:function(){return a},Ds:function(){return l},KI:function(){return r},SI:function(){return s},f1:function(){return i}});var r=t(71681).Z.API_SERVER},57883:function(e,n,t){t.d(n,{t:function(){return h}});var i=t(82242),s=t.n(i),a=(t(59301),t(3113)),l="buttonFixed___vyq30",r="button___hxmYv",c="buttonWrap___uK8dl",o=t(92310),u=t.n(o),d=t(37712),h=function(e){var n=e.cancelText,t=void 0===n?"取消":n,i=e.okText,o=void 0===i?"确定":i,h=e.loading,p=void 0!==h&&h,m=e.hasOkBtn,v=void 0===m||m,f=e.hasCancelBtn,x=void 0===f||f,g=e.okButtonProps,j=void 0===g?{}:g,_=e.onCancel,y=void 0===_?function(){}:_,b=e.onOk,N=void 0===b?function(){}:b,S=e.className,Z=void 0===S?"":S;return(0,d.jsx)("div",{className:u()(l,Z),children:(0,d.jsxs)("div",{className:c,children:[x&&(0,d.jsx)(a.ZP,{size:"middle",className:"".concat(r," mr20"),onClick:y,children:t}),v&&(0,d.jsx)(a.ZP,s()(s()({size:"middle",type:"primary",className:"".concat(r," mr20"),loading:p,onClick:N},j),{},{children:o}))]})})}},6638:function(e,n,t){var i=t(82242),s=t.n(i),a=(t(59301),t(19779)),l=t(3113),r=t(37712);n.Z=function(e){var n=e.img,t=e.buttonProps,i=void 0===t?{}:t,c=e.styles,o=void 0===c?{}:c,u=e.customText,d=e.ButtonText,h=e.ButtonClick,p=e.Buttonclass,m=e.ButtonTwo,v=e.imgStyles,f=e.loading,x=void 0!==f&&f;return(0,r.jsxs)("section",{className:"tc animated fadeIn",style:s()(s()({},{color:"#999",margin:"100px auto",visibility:x?"hidden":"visible"}),o),children:[(0,r.jsx)("img",{src:n||a,style:s()({width:288,height:200},v)}),(0,r.jsx)("p",{className:"mt20 font14",children:u||"暂时还没有相关数据哦!"}),d&&(0,r.jsx)(l.ZP,s()(s()({className:p,onClick:h},i),{},{children:d})),m&&m]})}},16726:function(e,n,t){t.d(n,{h:function(){return x}});var i=t(82242),s=t.n(i),a=t(79800),l=t.n(a),r=t(59301),c=t(57809),o=t(78241),u=t(3113),d=t(89780),h=t.n(d),p=(t(94527),t(66608),t(37712)),m=c.default.Option,v={labelCol:{span:4},wrapperCol:{span:20}},f={asp:["ASP","vbscript"],actionscript:["ActionScript(3.0)/Flash/Flex","clike"],bash:["Bash/Bat","shell"],css:["CSS","css"],c:["C","clike"],cpp:["C++","clike"],csharp:["C#","clike"],coffeescript:["CoffeeScript","coffeescript"],d:["D","d"],dart:["Dart","dart"],delphi:["Delphi/Pascal","pascal"],erlang:["Erlang","erlang"],go:["Golang","go"],groovy:["Groovy","groovy"],html:["HTML","text/html"],java:["Java","clike"],json:["JSON","text/json"],javascript:["Javascript","javascript"],lua:["Lua","lua"],less:["LESS","css"],markdown:["Markdown","gfm"],"objective-c":["Objective-C","clike"],php:["PHP","php"],perl:["Perl","perl"],python:["Python","python"],r:["R","r"],rst:["reStructedText","rst"],ruby:["Ruby","ruby"],sql:["SQL","sql"],sass:["SASS/SCSS","sass"],shell:["Shell","shell"],scala:["Scala","clike"],swift:["Swift","clike"],vb:["VB/VBScript","vb"],xml:["XML","text/xml"],yaml:["YAML","yaml"]};function x(e){var n=e.value,t=e.onChange,i=e.mode,a=e.options,c=void 0===a?{}:a,o=(0,r.useRef)(),u=(0,r.useState)(),d=l()(u,2),m=d[0],v=d[1];return(0,r.useEffect)((function(){if(m){var e=function(e){var n=e.getValue();t&&t(n)};return m.on("change",e),function(){m.off("change",e)}}}),[m,t]),(0,r.useEffect)((function(){m&&m.setOption("mode",i)}),[m,i]),(0,r.useEffect)((function(){m&&(n===m.getValue()&&""!==n||setTimeout((function(){m.setValue(n||"")}),300))}),[m,n]),(0,r.useEffect)((function(){if(o.current&&!m){var e=h().fromTextArea(o.current,s()({mode:i,lineNumbers:!0,lineWrapping:!0,autoCloseBrackets:!0,tabSize:4,autofocus:!0,autoCloseTags:!0,matchBrackets:!0,styleActiveLine:!0},c));v(e)}}),[o.current,m]),(0,p.jsx)("div",{className:"my-codemirror-container",children:(0,p.jsx)("textarea",{ref:o})})}n.Z=function(e){var n=e.callback,t=e.onCancel,i=(0,r.useState)("python"),a=l()(i,2),d=a[0],h=a[1];return(0,p.jsxs)(o.Z,s()(s()({},v),{},{className:"code-block-panel",initialValues:{language:"python",content:""},onFinish:function(e){n(e)},children:[(0,p.jsx)(o.Z.Item,{label:"代码语言",name:"language",children:(0,p.jsx)(c.default,{getPopupContainer:function(e){return e.parentNode},onChange:function(e){h(f[e][1])},children:Object.keys(f).map((function(e){return(0,p.jsx)(m,{value:e,children:f[e][0]},e)}))})}),(0,p.jsx)(o.Z.Item,{label:"代码内容",name:"content",rules:[{required:!0,message:"请输入代码内容"}],children:(0,p.jsx)(x,{mode:d})}),(0,p.jsxs)("div",{className:"flex-container flex-end",children:[(0,p.jsx)(u.ZP,{type:"primary",htmlType:"submit",style:{marginRight:10},children:"确定"}),(0,p.jsx)(u.ZP,{type:"ghost",onClick:t,children:"取消"})]})]}))}},77036:function(e,n,t){t.d(n,{Z:function(){return ce}});var i=t(91232),s=t.n(i),a=t(7557),l=t.n(a),r=t(41498),c=t.n(r),o=t(79800),u=t.n(o),d=t(85573),h=t.n(d),p=t(59301),m=t(89780),v=t.n(m),f=t(76374),x=(t(94527),t(6313),t(25717),t(99498),t(25419),t(67549),t(4585)),g=t(37712),j=function(e){var n=e.value,t=void 0===n?"":n,i=(e.className,e.showTextOnly,e.showLines,e.style,(0,p.useMemo)((function(){return""}),[t]));return(0,g.jsx)(g.Fragment,{children:(0,g.jsx)("div",{dangerouslySetInnerHTML:{__html:i}})})},_=t(82242),y=t.n(_),b=[{title:"粗体",icon:"icon-bold",actionName:"bold"},{title:"斜体",icon:"icon-italic",actionName:"italic"},"|",{title:"无序列表",icon:"icon-unorder-list",actionName:"list-ul"},{title:"有序列表",icon:"icon-order-list",actionName:"list-ol"},"|",{title:"行内代码",icon:"icon-code",actionName:"code"},{title:"代码块(多语言风格)",icon:"icon-file-code",actionName:"code-block"},{title:"链接",icon:"icon-link",actionName:"link"},"|",{title:"行内公式",icon:"icon-sum",actionName:"inline-latex"},{title:"多行公式",icon:"icon-formula",actionName:"latex"},"|",{title:"添加图片",icon:"icon-picture",actionName:"upload-image"},{title:"表格",icon:"icon-table",actionName:"add-table"},"|",{title:"换行",icon:"icon-minus",actionName:"line-break"},{title:"清空",icon:"icon-eraser",actionName:"eraser"}];function N(e){var n=e.onActionCallback,t=e.title,i=e.icon,s=e.actionName,a=e.className,l=void 0===a?"":a,r=e.children;return(0,g.jsxs)("a",{title:t,className:l,onClick:function(){n(s)},children:[(0,g.jsx)("i",{className:"md-iconfont ".concat(i)}),r]})}var S=function(e){var n=e.watch,t=e.showNullButton,i=e.showNullProgramButton,s=e.onActionCallback,a=e.fullScreen,l=e.insertTemp,r=e.hidetoolBar,c=[].concat(b,[{title:"".concat(n?"关闭实时预览":"开启实时预览"),icon:"".concat(n?"icon-eye-slash":"icon-eye"),actionName:"trigger-watch"}]);return(0,g.jsxs)("ul",{className:"markdown-toolbar-container",children:[!r&&c.map((function(e,n){return(0,g.jsx)("li",{children:e.actionName?(0,g.jsx)(N,y()(y()({},e),{},{onActionCallback:s})):(0,g.jsx)("span",{className:"v-line"})},n)})),t?(0,g.jsx)("li",{children:(0,g.jsx)(N,{icon:"icon-edit insert-blank",className:"btn-null",title:"增加填空",actionName:"add-null-ch",onActionCallback:s,children:(0,g.jsx)("span",{className:"fill-tip",children:"点击插入\b填空项"})})}):null,i?(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)("li",{children:(0,g.jsx)(N,{icon:"icon-edit insert-blank",className:"btn-null",title:"增加填空",actionName:"add-signal",onActionCallback:s,children:(0,g.jsx)("span",{className:"fill-tip",children:"添加单行填空项"})})}),(0,g.jsx)("li",{children:(0,g.jsx)(N,{icon:"icon-uniE900 insert-blank",className:"btn-null",title:"增加填空",actionName:"add-multiple",onActionCallback:s,children:(0,g.jsx)("span",{className:"fill-tip",children:"添加多行填空项"})})})]}):null,l&&(0,g.jsx)("li",{children:(0,g.jsx)(N,{icon:"icon-edit",className:"btn-null",title:"插入模板",actionName:"inster-template-".concat(l),onActionCallback:s,children:(0,g.jsx)("span",{className:"fill-tip",children:"插入模板"})})}),(0,g.jsx)("li",{className:"btn-full-screen",children:(0,g.jsx)(N,{icon:"".concat(a?"icon-shrink":"icon-enlarge"),title:a?"关闭全屏":"开启全屏",actionName:"trigger-full-screen",onActionCallback:s})})]})},Z=t(74063),w=t(78241),k=t(24650),C=t(3113),P={labelCol:{span:4},wrapperCol:{span:20}},T=function(e){var n=e.callback,t=e.onCancel;return(0,g.jsxs)(w.Z,y()(y()({},P),{},{initialValues:{link:"http://",title:""},className:"link-panel",onFinish:function(e){n(e)},children:[(0,g.jsx)(w.Z.Item,{label:"链接地址",name:"link",rules:[{required:!0,message:"请输入链接地址"}],children:(0,g.jsx)(k.Z,{})}),(0,g.jsx)(w.Z.Item,{label:"链接标题",name:"title",rules:[{required:!0,message:"请输入链接标题"}],children:(0,g.jsx)(k.Z,{})}),(0,g.jsxs)("div",{className:"flex-container flex-end",children:[(0,g.jsx)(C.ZP,{type:"primary",htmlType:"submit",style:{marginRight:10},children:"确定"}),(0,g.jsx)(C.ZP,{type:"ghost",onClick:t,children:"取消"})]})]}))},I=t(16726),E=t(8591),D=t(10459),A=w.Z.useForm,O={width:280,marginRight:10},F={labelCol:{span:5},wrapperCol:{span:19}},R=function(e){var n=e.callback,t=e.onCancel,i=A(),s=u()(i,1)[0],a=(0,p.useRef)();function l(e,n){-1!==e.status?s.setFieldsValue({src:"/api/attachments/".concat(e.id),type:n.type}):E.ZP.error(e.message)}return(0,g.jsxs)(w.Z,y()(y()({form:s},F),{},{className:"upload-image-panel",onFinish:function(e){n(y()(y()({},e),{},{name:a.current}))},style:{width:470,overflow:"hidden"},children:[(0,g.jsx)(w.Z.Item,{label:"图片地址",required:!0,children:(0,g.jsxs)("div",{className:"flex-container",children:[(0,g.jsx)(w.Z.Item,{noStyle:!0,name:"src",rules:[{required:!0,message:"请输入文件地址"}],children:(0,g.jsx)(k.Z,{style:O})}),(0,g.jsx)(L,{onFileChange:function(e){var n=e.target.files[0];a.current=n.name,V(n,l)}})]})}),(0,g.jsx)(w.Z.Item,{label:"图片描述",name:"alt",children:(0,g.jsx)(k.Z,{style:{width:264}})}),(0,g.jsxs)(w.Z.Item,{style:{textAlign:"right"},children:[(0,g.jsx)(C.ZP,{type:"primary",htmlType:"submit",style:{marginRight:10},children:"确定"}),(0,g.jsx)(C.ZP,{type:"default",onClick:t,children:"取消"})]})]}))};function L(e){var n=e.onFileChange;return(0,g.jsxs)("label",{className:"upload-button",style:{cursor:"pointer"},children:["本地上传",(0,g.jsx)("input",{type:"file",onChange:n})]})}function V(e,n){if(!e)throw new String("没有文件");var t=new FormData;t.append("editormd-image-file",e),t.append("file_param_name","editormd-image-file"),t.append("byxhr","true");var i=new window.XMLHttpRequest;i.withCredentials=!0,i.addEventListener("load",(function(t){n(JSON.parse(t.target.responseText),e)}),!1),i.addEventListener("error",(function(e){console.error(e)}),!1),i.open("POST","".concat(D.KI,"/api/attachments.json")),i.send(t)}var B=t(5112),q=t(94001),W=B.ZP.Group,M={margin:"0 8px"},H=function(e){var n=e.callback,t=e.onCancel;return(0,g.jsxs)(w.Z,{className:"add-table-panel",initialValues:{row:3,col:2,align:"default"},onFinish:function(e){n(e)},children:[(0,g.jsxs)("div",{className:"flex-container",style:{alignItems:"baseline"},children:[(0,g.jsx)("span",{style:M,children:"单元格数:"}),(0,g.jsx)("span",{style:M,children:"行数"}),(0,g.jsx)(w.Z.Item,{name:"row",rules:[{required:!0,message:"请输入行数"}],children:(0,g.jsx)(q.Z,{})}),(0,g.jsx)("span",{style:M,children:"列数"}),(0,g.jsx)(w.Z.Item,{name:"col",rules:[{required:!0,message:"请输入列数"}],children:(0,g.jsx)(q.Z,{})})]}),(0,g.jsxs)("div",{className:"flex-container",style:{marginTop:12,alignItems:"baseline"},children:[(0,g.jsx)("span",{style:M,children:"对齐方式:"}),(0,g.jsx)(w.Z.Item,{name:"align",children:(0,g.jsxs)(W,{children:[(0,g.jsx)(B.ZP,{value:"default",children:(0,g.jsx)("i",{className:"fa fa-align-justify"})}),(0,g.jsx)(B.ZP,{value:"left",children:(0,g.jsx)("i",{className:"fa fa-align-left"})}),(0,g.jsx)(B.ZP,{value:"center",children:(0,g.jsx)("i",{className:"fa fa-align-center"})}),(0,g.jsx)(B.ZP,{value:"right",children:(0,g.jsx)("i",{className:"fa fa-align-right"})})]})})]}),(0,g.jsxs)("div",{className:"flex-container flex-end",children:[(0,g.jsx)(C.ZP,{type:"primary",htmlType:"submit",style:{marginRight:10},children:"确定"}),(0,g.jsx)(C.ZP,{type:"ghost",onClick:t,children:"取消"})]})]})},J=t(71681),Y=t(49105),z=t(1012),G=t(43418),U="link",K="upload-image",Q="code-block",X="add-table",$="------------",ee={default:$,left:":".concat($),center:":".concat($,":"),right:"".concat($,":")},ne=t(46587);var te="@▁▁@";function ie(e){return/^\d+$/.test(e)?"".concat(e,"px"):e}var se=navigator.platform.toUpperCase().indexOf("MAC")>=0?"Cmd":"Ctrl",ae=["pptm","pptx","ppt","pot","pps","ppa","potx","ppsx","ppam","pptm","potm","ppsm","doc","docx","dot","dotx","docm","dotm","xls","xlsx","csv","xlt","xla","xltx","xlsm","xltm","xlam","xlsb"],le=h()(h()({},se+"-B","bold"),se+"-I","italic"),re=h()(h()(h()(h()({},U,"添加链接"),Q,"添加代码块"),K,"添加文件"),X,"添加表格"),ce=function(e){var n=e.defaultValue,t=void 0===n?"":n,i=e.onChange,a=e.width,r=void 0===a?"100%":a,o=e.height,d=void 0===o?400:o,m=e.miniToolbar,_=void 0!==m&&m,y=e.isFocus,b=void 0!==y&&y,N=e.watch,w=e.insertTemp,k=e.mode,C=void 0===k?"markdown":k,P=e.id,D=void 0===P?"markdown-editor-id":P,A=e.showResizeBar,O=void 0!==A&&A,F=e.noStorage,L=void 0!==F&&F,B=e.showNullButton,q=void 0!==B&&B,W=e.showNullProgramButton,M=void 0!==W&&W,$=e.hidetoolBar,se=void 0!==$&&$,ce=e.fullScreen,oe=void 0!==ce&&ce,ue=e.onBlur,de=e.onCMBeforeChange,he=e.onFullScreen,pe=e.className,me=void 0===pe?"":pe,ve=e.disablePaste,fe=void 0!==ve&&ve,xe=e.disabled,ge=void 0!==xe&&xe,je=e.disabledFill,_e=void 0!==je&&je,ye=e.placeholder,be=void 0===ye?"":ye,Ne=e.values,Se=void 0===Ne?"":Ne,Ze=(0,p.useState)(null),we=u()(Ze,2),ke=we[0],Ce=we[1],Pe=(0,p.useState)(t),Te=u()(Pe,2),Ie=Te[0],Ee=Te[1],De=(0,p.useState)(N),Ae=u()(De,2),Oe=Ae[0],Fe=Ae[1],Re=(0,p.useState)(oe),Le=u()(Re,2),Ve=Le[0],Be=Le[1],qe=(0,p.useState)(""),We=u()(qe,2),Me=We[0],He=We[1],Je=(0,p.useState)(0),Ye=u()(Je,2),ze=Ye[0],Ge=Ye[1],Ue=(0,p.useState)(d),Ke=u()(Ue,2),Qe=Ke[0],Xe=Ke[1],$e=(0,p.useState)(!1),en=u()($e,2),nn=(en[0],en[1]),tn=(0,p.useRef)((0,z.Z)()),sn=(0,p.useRef)(!1),an=(0,p.useRef)(),ln=(0,p.useRef)(),rn=(0,p.useRef)(),cn=(0,p.useRef)(),on=(0,p.useRef)(),un=function(){var e=c()(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,Y.ZP)("/api/attachments/distinct_hash_val.json",{method:"post",body:{hash_val:tn.current}});case 2:null!=(t=e.sent)&&null!==(n=t.attachments)&&void 0!==n&&n.length&&(console.log("cm:",ke,ln),t.attachments.map((function(e){e.content_type.indexOf("image")>-1?ke.replaceSelection(".concat(e.content_type,")")):e.content_type.indexOf("video")>-1?ke.replaceSelection('<video width="100%" controls src="'.concat(J.Z.API_SERVER,"/api/attachments/").concat(data.id,'"></video>')):e.content_type.indexOf("pdf")>-1?ke.replaceSelection('<a href="'.concat(J.Z.API_SERVER,"/api/attachments/").concat(e.id,"?type=").concat(e.content_type,'&disposition=inline" target="_blank">').concat(e.name,"</a>")):ke.replaceSelection("[".concat(e.name,"](").concat(J.Z.API_SERVER,"/api/attachments/").concat(e.id,"?type=").concat(e.content_type,")"))})));case 4:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();(0,p.useEffect)((function(){var e=window.scrollY||window.pageYOffset;Ee(Se),null==ke||ke.setValue(Se),window.scrollTo(0,e)}),[Se]),(0,p.useEffect)((function(){null==he||he(Ve)}),[Ve]),(0,p.useEffect)((function(){if(ln.current){var e=function(e,t){if(!fe){var i=t.clipboardData;if(i){var s=i.types.toString(),a=i.items;if("Files"===s||i.types.indexOf("Files")>-1){if(t.preventDefault(),"stex"==C)return;try{var l,r=a[1];"file"===(null===(l=a[0])||void 0===l?void 0:l.kind)&&(r=a[0]);var c=r.getAsFile(),o=c.name.split(".").pop();V(c,(function(e){var t,i,s;e.id?(null==c||null===(t=c.type)||void 0===t?void 0:t.indexOf("image"))>-1?n.replaceSelection(".concat(e.content_type,")")):(null==c||null===(i=c.type)||void 0===i?void 0:i.indexOf("video"))>-1?n.replaceSelection('<video width="100%" controls src="'.concat(J.Z.API_SERVER,"/api/attachments/").concat(e.id,'"></video>')):(null==c||null===(s=c.type)||void 0===s?void 0:s.indexOf("pdf"))>-1?n.replaceSelection('<a href="'.concat(J.Z.API_SERVER,"/api/attachments/").concat(e.id,"?type=").concat(c.type,'&disposition=inline" target="_blank">').concat(c.name,"</a>")):ae.includes(o)?n.replaceSelection('<a href="'.concat(J.Z.API_SERVER,"/api/attachments/").concat(e.id,'?type=office&disposition=inline" target="_blank">').concat(c.name,"</a>")):n.replaceSelection("[".concat(c.name,"](").concat(J.Z.API_SERVER,"/api/attachments/").concat(e.id,"?type=").concat(e.content_type,")")):401===(null==e?void 0:e.status)&&(document.location.href="/user/login")}))}catch(t){E.ZP.warning("请使用chrome浏览器粘贴")}return!0}return!0}return!0}t.preventDefault()},n=v().fromTextArea(ln.current,{mode:C,lineNumbers:!_,lineWrapping:!0,value:t,autoCloseTags:!M,autoCloseBrackets:!0});return n.on("keyup",(function(e,t){8===t.keyCode&&(""==e.getValue()?n.setOption("placeholder",be):n.setOption("placeholder",null))})),n.on("keydown",(function(e,n){if(8===n.keyCode){var t=function(e,n){var t=e.getDoc(),i=t.getCursor(),s=t.getLine(i.line),a=s.charAt(i.ch-1),l=s.lastIndexOf("@▁@",i.ch),r=s.lastIndexOf("@▁▁@",i.ch),c=l>r?l:r,o=l>r?3:4;if(-1===te.indexOf(a))return null;if(console.log("change1:",n,e,s,i,c,l,r,a),c>=0&&i.ch-c<5){var u=c+o;return t.replaceRange("",{line:i.line,ch:c},{line:i.line,ch:u}),{line:i.line,ch:u}}return null}(e);t&&n.preventDefault()}})),b&&n.focus(),n.on("paste",e),n.on("dragleave",(function(e,n){rn.current.classList.remove("mouse-hover-md")})),n.on("dragover",(function(e,n){rn.current.classList.add("mouse-hover-md")})),n.on("drop",(function(e,t){var i;if(rn.current.classList.add("mouse-hover-md"),(i=t.dataTransfer.files).length>0){t.preventDefault(),t.stopPropagation();for(var s=function(){var e=i[a],t=e.name.split(".").pop();V(e,(function(i){var s,a,l;i.id?(null==e||null===(s=e.type)||void 0===s?void 0:s.indexOf("image"))>-1?n.replaceSelection(".concat(i.content_type,")")):(null==e||null===(a=e.type)||void 0===a?void 0:a.indexOf("video"))>-1?n.replaceSelection('<video width="100%" controls src="'.concat(J.Z.API_SERVER,"/api/attachments/").concat(i.id,'"></video>')):(null==e||null===(l=e.type)||void 0===l?void 0:l.indexOf("pdf"))>-1?n.replaceSelection('<a href="'.concat(J.Z.API_SERVER,"/api/attachments/").concat(i.id,"?type=").concat(e.type,'&disposition=inline" target="_blank">').concat(e.name,"</a>")):ae.includes(t)?n.replaceSelection('<a href="'.concat(J.Z.API_SERVER,"/api/attachments/").concat(i.id,'?type=office&disposition=inline" target="_blank">').concat(e.name,"</a>")):n.replaceSelection("[".concat(e.name,"](").concat(J.Z.API_SERVER,"/api/attachments/").concat(i.id,"?type=").concat(i.content_type,")")):401===(null==i?void 0:i.status)&&(document.location.href="/user/login")}))},a=0;a<i.length;a++)s()}})),ge&&n.on("beforeChange",(function(e,n){"paste"!==n.origin&&"+input"!==n.origin||n.cancel()})),Ce(n),function(){n.off("paste",e)}}}),[]);var dn=(0,p.useCallback)((function(){rn.current}),[Qe,rn,Ve]);(0,p.useEffect)((function(){if(ke){var e=function(){var e=new f.Z((function(e){var n,t=s()(e);try{for(t.s();!(n=t.n()).done;){var i=n.value;(i.target.offsetHeight>0||i.target.offsetWidth>0)&&(dn(),ke.setSize("100%","100%"),ke.refresh())}}catch(e){t.e(e)}finally{t.f()}}));return e.observe(ln.current.parentElement),e}();return function(){var n,t;null!==(n=ln.current)&&void 0!==n&&n.parentElement&&e.unobserve(null===(t=ln.current)||void 0===t?void 0:t.parentElement)}}}),[ke,dn]),(0,p.useEffect)((function(){if(ke){for(var e=[],n=function(){var n=u()(i[t],2),s=n[0],a=n[1],l=h()({},s,(function(){hn(a)}));e.push(l),ke.addKeyMap(l)},t=0,i=Object.entries(le);t<i.length;t++)n();return an.current=setInterval((function(){sn.current&&un()}),4e3),function(){clearInterval(an.current);for(var n=0,t=e;n<t.length;n++){var i=t[n];ke.removeKeyMap(i)}}}}),[ke]),(0,p.useEffect)((function(){oe!==Ve&&Be(oe)}),[oe]),(0,ne.Z)((function(){if(!L&&ze>0){var e=(new Date).getTime(),n=window.sessionStorage.getItem(D);e>=ze+1e4&&(!n||n!==Ie)&&(window.sessionStorage.setItem(D,Ie),nn(!0))}}),1e4),(0,p.useEffect)((function(){Fe(N)}),[ke,N]),(0,p.useEffect)((function(){ke&&b&&ke.focus()}),[ke,b]),(0,p.useEffect)((function(){if(Oe&&ke){var e=function(e){var n=e.target;if(on.current){var t=n.scrollTop/n.scrollHeight;on.current.scrollTop=on.current.scrollHeight*t}},n=ke.getScrollerElement();return n.addEventListener("scroll",e),function(){n.removeEventListener("scroll",e)}}}),[ke,Oe]),(0,p.useEffect)((function(){if(ke&&de){var e=function(e,n){de(e,n)};return ke.on("beforeChange",e),function(){ke.off("beforeChange",e)}}}),[ke,de]),(0,p.useEffect)((function(){if(ke&&ue){var e=function(){ue(ke.getValue())};return ke.on("blur",e),function(){ke.off("blur",e)}}}),[ke,ue]),(0,p.useEffect)((function(){if(ke){var e=function(e,n){var t=e.getValue();Ee(t),Ge((new Date).getTime()),e.getScrollerElement().dispatchEvent(new CustomEvent("scroll")),i&&(M?i(t,xn(t)):i(t))};return ke.on("change",e),function(){ke.off("change",e)}}}),[ke,i]),(0,p.useEffect)((function(){if(ke)if(null==t)ke.setValue(""),Ee("");else{var e=window.scrollY||window.pageYOffset;t!==ke.getValue()&&(ke.setValue(t),Ee(t),ke.setCursor(ge?1:ke.lineCount(),0),window.scrollTo(0,e))}}),[ke,t]);var hn=(0,p.useCallback)((function(e){var n=ke.getCursor(),t=ke.getSelection(),i=t.split("\n");switch(e){case"bold":return ke.replaceSelection("**"+t+"**"),""===t&&ke.setCursor(n.line,n.ch+2),ke.focus();case"italic":return ke.replaceSelection("*"+t+"*"),""===t&&ke.setCursor(n.line,n.ch+1),ke.focus();case"code":return ke.replaceSelection("`"+t+"`"),""===t&&ke.setCursor(n.line,n.ch+1),ke.focus();case"inline-latex":return ke.replaceSelection("`$$"+t+"$$`"),""===t&&ke.setCursor(n.line,n.ch+3),ke.focus();case"latex":return ke.replaceSelection("```latex\n"+t+"\n```"),ke.setCursor(n.line+1,t.length+1),ke.focus();case"line-break":return ke.replaceSelection("<br/>\n"),ke.focus();case"list-ul":return""===t?ke.replaceSelection("- "+t):ke.replaceSelection(i.map((function(e){return""===e?"":"- ".concat(e)})).join("\n")),ke.focus();case"list-ol":return""===t?ke.replaceSelection("1. "+t):ke.replaceSelection(i.map((function(e,n){return""===e?"":"".concat(n+1,". ").concat(e)})).join("\n")),ke.focus();case"add-null-ch":return""===t&&ke.setCursor(n.line,n.ch),ke.replaceSelection("▁"),ke.focus();case"add-signal":return""===t&&ke.setCursor(n.line,n.ch),ke.replaceSelection("@▁@"),ke.focus();case"add-multiple":return""===t&&ke.setCursor(n.line,n.ch),ke.replaceSelection(te),ke.focus();case"inster-template-1":return""===t&&ke.setCursor(n.line,n.ch),ke.replaceSelection("\n**模板标题**\n模板正文内容,可输入文本内容和粘贴图片等操作"),ke.focus();case"eraser":return ke.setValue(""),ke.focus();case"trigger-watch":return Fe(!Oe),ke.focus();case"trigger-full-screen":return Be(!Ve),ke.focus();case U:return void He(U);case Q:return void He(Q);case K:return void He(K);case X:return void He(X);default:throw new Error}}),[ke,Oe,Ve]),pn=(0,p.useCallback)((function(e){switch(He(""),Me){case U:var n=e.title,t=e.link;return ke.replaceSelection("[".concat(n,"](").concat(t,")")),ke.focus();case Q:var i=e.language,s=e.content;return ke.replaceSelection(["```"+i,s,"```"].join("\n")),ke.focus();case K:var a=e.src,l=e.alt;return l?ke.replaceSelection(".concat(a,' "').concat(l,'" )')):ke.replaceSelection("")),ke.focus();case X:for(var r=e.row,c=e.col,o=e.align,u="\n",d=0;d<r;d++){for(var h=[],p=[],m=0;m<c;m++)1===d&&p.push(ee[o]),h.push(" ");1===d&&(u+="| ".concat(p.join(" | ")," |\n")),u+="| ".concat(h.join(1===c?"":" | ")," |\n")}return ke.replaceSelection(u+"\n"),ke.focus();default:throw new Error}}),[ke,Me]),mn=(0,p.useMemo)((function(){switch(Me){case U:return(0,g.jsx)(T,{callback:pn,onCancel:vn});case Q:return(0,g.jsx)(I.Z,{callback:pn,onCancel:vn});case K:return(0,g.jsx)(R,{callback:pn,onCancel:vn});case X:return(0,g.jsx)(H,{callback:pn,onCancel:vn});default:return null}}),[Me]);function vn(){He("")}(0,p.useEffect)((function(){if(cn.current){var e=function(e){s=!0,a=e.pageY},n=function(){s=!1},t=function(e){if(s){var n=e.pageY-a;n<0&&(n=0),n>300&&(n=300),Xe(d+n+"px")}},i=cn.current,s=!1,a=0;return i.addEventListener("mousedown",e),document.addEventListener("mousemove",t),document.addEventListener("mouseup",n),function(){i.removeEventListener("mousedown",e),document.removeEventListener("mousemove",t),document.removeEventListener("mouseup",n)}}}),[ke,cn]),(0,p.useEffect)((function(){Xe(d)}),[d]);var fn={width:ie(r),height:ie(Qe)},xn=((0,p.useMemo)((function(){if(ze){var e=new Date(ze),n=e.getHours(),t=e.getMinutes(),i=e.getSeconds();return t=t<10?"0"+t:t,i=i<10?"0"+i:i,"".concat(n=n<10?"0"+n:n,":").concat(t,":").concat(i)}return 0}),[ze]),function(e){var n=[];if(M){e=e.replace(/(@▁▁@|@▁@)/g,(function(e,t,i){n.push({multiLine:!("@▁@"===e)})}))}return n});return(0,g.jsxs)(p.Fragment,{children:[(0,g.jsx)("div",{className:"markdown-editor-wrapper",ref:rn,children:(0,g.jsxs)("div",{className:"markdown-editor-container ".concat(me," ").concat(Oe?"on-preview":""," ").concat(_?"mini":""," ").concat(Ve?"full-screen":""),style:fn,children:[(0,g.jsx)(S,{insertTemp:w,watch:Oe,fullScreen:Ve,showNullButton:q,showNullProgramButton:M,onActionCallback:hn,hidetoolBar:se,uuid:tn.current,setOpenPhones:function(){sn.current=!0}}),(0,g.jsxs)("div",{className:"markdown-editor-body",children:[(0,g.jsx)("div",{className:"codemirror-container",children:(0,g.jsx)("textarea",{ref:ln,placeholder:be})}),Oe?(0,g.jsxs)("div",{ref:on,className:"preview-container",children:["stex"===C&&(0,g.jsx)(j,{value:Ie}),"stex"!==C&&(0,g.jsx)(x.Z,{disabledFill:_e,showProgramFill:M,value:Ie})]}):null]})]})}),O?(0,g.jsx)("a",{ref:cn,className:"editor-resize"}):null,(0,g.jsx)(Z.Z,{children:re[Me]?(0,g.jsx)(G.Z,{centered:!0,title:re[Me],open:!0,onCancel:vn,footer:null,className:"markdown-popup-form",children:mn}):null})]})}},74063:function(e,n,t){t.d(n,{Z:function(){return p}});var i=t(82100),s=t.n(i),a=t(29186),l=t.n(a),r=t(80619),c=t.n(r),o=t(47074),u=t.n(o),d=t(59301),h=t(4676),p=function(e){c()(t,e);var n=u()(t);function t(e){var i;s()(this,t),i=n.call(this,e);var a=window.document;return i.node=a.createElement("div"),a.body.appendChild(i.node),i}return l()(t,[{key:"render",value:function(){var e=this.props.children;return(0,h.createPortal)(e,this.node)}},{key:"componentWillUnmount",value:function(){window.document.body.removeChild(this.node)}}]),t}(d.Component)},46587:function(e,n,t){t.d(n,{Z:function(){return s}});var i=t(59301);function s(e,n){var t=(0,i.useRef)();(0,i.useEffect)((function(){t.current=e})),(0,i.useEffect)((function(){if(null!==n){var e=setInterval((function(){t.current()}),n);return function(){return clearInterval(e)}}}),[n])}},51936:function(e,n,t){t.r(n),t.d(n,{default:function(){return Je}});var i=t(7557),s=t.n(i),a=t(41498),l=t.n(a),r=t(79800),c=t.n(r),o=t(39647),u=t.n(o),d=t(59301),h=t(80608),p=t(99313),m=t(43418),v=t(8591),f=t(3113),x="bg___NaJC8",g="modal___EBf9Q",j="colorOrange___aQkdN",_="colorYellow___o2XYr",y=t(85573),b=t.n(y),N=t(82242),S=t.n(N),Z=t(38288),w=t(77036),k=t(3148),C=t(57809),P=t(78241),T=t(24650),I=t(24905),E=t(6848),D=t(60324),A={flexRow:"flexRow___XAy1P",flexJustifyCenter:"flexJustifyCenter___tAIMl",flexAlignEnd:"flexAlignEnd___MwOtC",flexAlignCenter:"flexAlignCenter___apJWj",flexColumn:"flexColumn___dMOlW",formWrap:"formWrap___uztcf",titleWrap:"titleWrap___IROk8",fieldWrap:"fieldWrap___gnBO5",button:"button___CNhb1",buttonFixed:"buttonFixed___cTnv0",buttonWrap:"buttonWrap___FmswV",width180:"width180___7EIyX",width100:"width100___O9U5Z",width280:"width280___AilXa",difficultyHint:"difficultyHint___pTB_4",color888:"color888____r280",color0152d9:"color0152d9___r6Hxx",serviceSettingWrap:"serviceSettingWrap___bPOCq",serviceSettingName:"serviceSettingName___bVegk",serviceSetLeft:"serviceSetLeft___AljUO",serviceSetInput:"serviceSetInput___LqfwO",serviceSetMemoryInput:"serviceSetMemoryInput___O_kjF",serviceSetTip:"serviceSetTip___rIsFz",installPackage:"installPackage___vpdVI",popover:"popover___LAz3_"},O=t(97952),F="footerWrap___cjdMK",R=t(37712),L=["shixunsDetail","globalSetting","loading","dispatch","onFinish"],V=T.Z.TextArea,B=(0,h.connect)((function(e){var n=e.shixunsDetail,t=e.loading;return{shixunsDetail:n,globalSetting:e.globalSetting,loading:t}}))((function(e){var n=e.shixunsDetail,t=(e.globalSetting,e.loading),i=e.dispatch,a=e.onFinish,r=void 0===a?function(){}:a,o=(u()(e,L),P.Z.useForm()),d=c()(o,1)[0],h=function(){var e=l()(s()().mark((function e(t){var a,l;return s()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,i({type:"shixunsDetail/getCustomScript",payload:{id:null===(a=n.actionTabs.params)||void 0===a?void 0:a.id,compile:t.execute,excutive:t.compile}});case 2:l=e.sent,p(),l&&r(null==l?void 0:l.shixun_script);case 5:case"end":return e.stop()}}),e)})));return function(n){return e.apply(this,arguments)}}(),p=function(){i({type:"shixunsDetail/setActionTabs",payload:{}})};return(0,R.jsx)(m.Z,{centered:!0,title:"自定义模板",open:"Settings-UseCustomScript"===n.actionTabs.key,okText:"确定",cancelText:"取消",footer:null,onCancel:p,children:(0,R.jsxs)(P.Z,{form:d,scrollToFirstError:!0,layout:"vertical",onFinish:h,children:[(0,R.jsx)(P.Z.Item,{name:"execute",label:"执行命令:",rules:[{required:!0,message:"执行命令不能为空"}],children:(0,R.jsx)(V,{rows:4})}),(0,R.jsx)(P.Z.Item,{name:"compile",label:"编译命令:",children:(0,R.jsx)(V,{rows:4})}),(0,R.jsx)("div",{className:F,children:(0,R.jsxs)(P.Z.Item,{children:[(0,R.jsx)(f.ZP,{className:"mr5",size:"middle",onClick:p,children:"取消"}),(0,R.jsx)(f.ZP,{size:"middle",type:"primary",htmlType:"submit",loading:t.effects["shixunsDetail/getCustomScript"],children:"保存"})]})})]})})})),q=t(57883),W=t(4585),M=t(78802),H=t(50341),J=t(27876),Y=["shixunsDetail","globalSetting","loading","user","dispatch"],z=C.default.Option,G=(0,h.connect)((function(e){var n=e.shixunsDetail,t=e.loading;return{shixunsDetail:n,globalSetting:e.globalSetting,user:e.user,loading:t}}))((function(e){var n,t,i,a,r,o,p,f,x,g,j,_,y,N,F,L,V,G,U=e.shixunsDetail,K=(e.globalSetting,e.loading),Q=e.user,X=e.dispatch,$=(u()(e,Y),(0,h.useLocation)()),ee=(0,d.useRef)(),ne=P.Z.useForm(),te=c()(ne,1)[0],ie=(0,d.useState)({}),se=c()(ie,2),ae=se[0],le=se[1],re=(0,d.useState)(),ce=c()(re,2),oe=ce[0],ue=ce[1],de=(0,d.useState)(),he=c()(de,2),pe=he[0],me=he[1],ve=(0,d.useState)([]),fe=c()(ve,2),xe=fe[0],ge=fe[1],je=(0,d.useState)({}),_e=c()(je,2),ye=_e[0],be=_e[1],Ne=(0,d.useState)([]),Se=c()(Ne,2),Ze=Se[0],we=Se[1],ke=(0,d.useState)(!1),Ce=c()(ke,2),Pe=Ce[0],Te=Ce[1],Ie=null===(n=Q.userInfo)||void 0===n||null===(n=n.shixun)||void 0===n?void 0:n.editable;(0,d.useEffect)((function(){var e;ee.current=null===(e=$.pathname)||void 0===e||null===(e=e.split("/"))||void 0===e?void 0:e[2]}),[]),(0,d.useEffect)((function(){if(U.setting){var e=U.setting.shixun||{},n={name:e.name,description:e.description,trainee:e.trainee,mainType:e.choice_main_type,subType:e.choice_small_type,evaluationScript:e.choice_standard_scripts,jupyter_show_description:e.jupyter_show_description};Ee(),le(n),te.setFieldsValue(n)}}),[U.setting]);var Ee=function(){var e=U.setting.shixun||{},n=e.choice_main_type,t=(e.main_type,e.small_type,e.choice_small_type),i=e.is_secret_repository,s=e.standard_scripts,a=e.evaluate_script,l=e.shixun_service_configs;ue(i),me(a),ge(l),we(s||[]),De(n,t)},De=function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],t=U.setting.shixun||{},i=t.main_type,s=t.small_type,a=null==i?void 0:i.find((function(n){return n.id===e})),l={mainTypeName:null==a?void 0:a.type_name,mainTypeDescription:null==a?void 0:a.description,smallType:[]};n.map((function(e){s.map((function(n){e===n.id&&n.description&&l.smallType.push({name:n.type_name,des:n.description})}))})),be(l)},Ae=function(e,n,t){var i=xe.map((function(i,s){return s===t?S()(S()({},i),{},b()({},n,e)):i}));ge(i)},Oe=function(e){var n;m.Z.confirm({centered:!0,title:"提示",okText:"确定",cancelText:"取消",content:(0,R.jsxs)("div",{className:"tc font16",children:["原有脚本将被新的脚本覆盖,无法撤销",(0,R.jsx)("br",{}),"是否确认执行覆盖操作"]}),onOk:(n=l()(s()().mark((function n(){return s()().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,Le(e);case 2:m.Z.info({centered:!0,title:"提示",okText:"知道啦",content:(0,R.jsx)("div",{className:"tc font16",children:"评测脚本生成成功!"})});case 3:case"end":return n.stop()}}),n)}))),function(){return n.apply(this,arguments)})})},Fe=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],n=[];n.push(xe[0]),e.map((function(e){var t,i=xe.find((function(n){return n.mirror_repository_id===e}));i&&n.push(i);var s=null===(t=U.setting)||void 0===t||null===(t=t.shixun)||void 0===t||null===(t=t.small_type)||void 0===t?void 0:t.find((function(n){return n.id===e}));!i&&s&&n.push({mirror_repository_id:e,name:s.type_name,cpu_limit:1,lower_cpu_limit:.1,memory_limit:1024,request_limit:10})})),ge(n)},Re=function(){var e=l()(s()().mark((function e(n,t){var i,a,l,r,c;return s()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return(l=null===(i=U.setting)||void 0===i||null===(i=i.shixun)||void 0===i?void 0:i.main_type.find((function(e){return e.id===n})))&&(xe[0]={mirror_repository_id:n,name:l.type_name,cpu_limit:1,lower_cpu_limit:.1,memory_limit:1024,request_limit:10},ge(xe)),e.next=4,X({type:"shixunsDetail/getMirrorScript",payload:{mirror_id:n}});case 4:r=e.sent,we(r||[]),c=null===(a=r[0])||void 0===a?void 0:a.id,te.setFieldsValue({evaluationScript:c}),le(S()(S()({},t),{evaluationScript:c})),Le(c);case 10:case"end":return e.stop()}}),e)})));return function(n,t){return e.apply(this,arguments)}}(),Le=function(){var e=l()(s()().mark((function e(n){var t;return s()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,X({type:"shixunsDetail/getScriptContent",payload:{id:ee.current,script_id:n||te.getFieldValue("evaluationScript")}});case 2:(t=e.sent)&&me(t.content);case 4:case"end":return e.stop()}}),e)})));return function(n){return e.apply(this,arguments)}}(),Ve=function(){var e=l()(s()().mark((function e(n){var t,i,a,l,r,c,o,u,d,h,p,m,f;return s()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return a=(i=n||{}).mainType,l=i.subType,r=i.name,c=i.trainee,o=i.description,u=i.evaluationScript,d=i.jupyter_show_description,h=void 0!==d&&d,p=null===(t=U.detail)||void 0===t?void 0:t.is_jupyter,m={id:ee.current,main_type:a,sub_type:l,is_secret_repository:oe,shixun:{name:r,trainee:c,is_jupyter:p,mirror_script_id:p?null:u},shixun_info:{description:o,evaluate_script:p?null:pe},shixun_service_configs:xe.map((function(e){return{mirror_repository_id:e.mirror_repository_id,cpu_limit:e.cpu_limit,lower_cpu_limit:e.lower_cpu_limit,memory_limit:e.memory_limit,request_limit:e.request_limit,resource_limit:e.resource_limit}}))},p&&(m=S()(S()({},m),{},{shixun:S()(S()({},m.shixun),{},{jupyter_show_description:h})})),e.next=6,X({type:"shixunsDetail/updateSettingBasicInfo",payload:m});case 6:(f=e.sent)&&(X({type:"shixunsDetail/getSettingsData",payload:{id:ee.current}}),X({type:"shixunsDetail/getShixunsDetail",payload:{id:ee.current}}),f.shixun_identifier&&v.ZP.info("保存成功"));case 8:case"end":return e.stop()}}),e)})));return function(n){return e.apply(this,arguments)}}();return(0,R.jsxs)("section",{className:A.wrap,children:[(0,R.jsxs)(P.Z,{form:te,className:A.formWrap,scrollToFirstError:!0,layout:"vertical",onValuesChange:function(e,n){le(S()({},n)),"mainType"in e&&(Re(e.mainType,n),De(n.mainType,n.subType)),"subType"in e&&(Fe(e.subType,n),De(n.mainType,n.subType)),"evaluationScript"in e&&Oe(e.evaluationScript)},onFinish:Ve,children:[(0,R.jsxs)("div",{className:A.fieldWrap,children:[(0,R.jsx)(P.Z.Item,{name:"name",label:"名称:",rules:[{required:!0,message:"请输入名称"},{max:60,message:"请输入名称,最大限制60个字符"},{whitespace:!0,message:"请勿输入空格"}],children:(0,R.jsx)(T.Z,{placeholder:"请输入名称,最大限制60个字符",disabled:!Ie,addonAfter:"".concat((null===(t=ae.name)||void 0===t?void 0:t.length)||0,"/60")})}),(0,R.jsx)(P.Z.Item,{name:"description",label:"简介:",children:Ie?(0,R.jsx)(w.Z,{defaultValue:null===(i=U.setting)||void 0===i||null===(i=i.shixun)||void 0===i?void 0:i.description}):(0,R.jsx)(W.Z,{value:null===(a=U.setting)||void 0===a||null===(a=a.shixun)||void 0===a?void 0:a.description})}),(null===(r=U.setting)||void 0===r?void 0:r.shixun.is_jupyter)&&(0,R.jsx)(P.Z.Item,{name:"jupyter_show_description",valuePropName:"checked",children:(0,R.jsx)(I.Z,{children:"显示任务要求(勾选后,将简介作为任务要求显示在实践项目挑战页面)"})}),(0,R.jsx)("div",{className:"".concat(A.flexRow," ").concat(A.flexAlignCenter),children:(0,R.jsx)(E.Z,{title:2===(null===(o=U.setting)||void 0===o||null===(o=o.shixun)||void 0===o?void 0:o.status)?"当前实践项目已经发布,需撤销发布后才能修改该内容":"",children:(0,R.jsx)(P.Z.Item,{className:A.width180,name:"trainee",label:"难易度:",rules:[{required:!0,message:"请选择难易度"}],children:(0,R.jsxs)(C.default,{placeholder:"请选择难易度",disabled:2===(null===(p=U.setting)||void 0===p||null===(p=p.shixun)||void 0===p?void 0:p.status)||!Ie,children:[(0,R.jsx)(z,{value:1,children:"初级"}),(0,R.jsx)(z,{value:2,children:"中级"}),(0,R.jsx)(z,{value:3,children:"中高级"}),(0,R.jsx)(z,{value:4,children:"高级"})]})})})}),(0,R.jsxs)("div",{className:"".concat(A.flexRow," ").concat(A.flexAlignEnd),children:[(0,R.jsx)(E.Z,{title:2===(null===(f=U.setting)||void 0===f||null===(f=f.shixun)||void 0===f?void 0:f.status)?"当前实践项目已经发布,需撤销发布后才能修改该内容":"",children:(0,R.jsx)(P.Z.Item,{className:A.width280,name:"mainType",label:"实验环境:",rules:[{required:!0,message:"请选择主类别"}],children:(0,R.jsx)(C.default,{placeholder:"请选择主类别",disabled:2===(null===(x=U.setting)||void 0===x||null===(x=x.shixun)||void 0===x?void 0:x.status)||!Ie,children:null===(g=U.setting)||void 0===g||null===(g=g.shixun)||void 0===g||null===(g=g.main_type)||void 0===g?void 0:g.map((function(e){var n=e.type_name.toLowerCase().includes("jupyter");return"1"===ae.isJupyter&&n?null:"2"!==ae.isJupyter||n?(0,R.jsx)(z,{value:e.id,name:e.description,children:e.type_name},e.id):null}))})})}),(0,R.jsx)(E.Z,{title:2===(null===(j=U.setting)||void 0===j||null===(j=j.shixun)||void 0===j?void 0:j.status)?"当前实践项目已经发布,需撤销发布后才能修改该内容":"",children:(0,R.jsx)(P.Z.Item,{name:"subType",className:"".concat(A.width280," ml20"),children:(0,R.jsx)(C.default,{placeholder:"请选择小类别",mode:"multiple",disabled:2===(null===(_=U.setting)||void 0===_||null===(_=_.shixun)||void 0===_?void 0:_.status)||!Ie,children:null===(y=U.setting)||void 0===y||null===(y=y.shixun)||void 0===y?void 0:y.small_type.map((function(e){return(0,R.jsx)(z,{value:e.id,name:e.description,children:e.type_name},e.id)}))})})}),(0,R.jsx)("div",{className:A.installPackage,onClick:function(){return Te(!0)},children:"环境介绍"})]}),(0,R.jsxs)("div",{className:"".concat(A.color888," font14 pb10"),children:["没有实验环境?",(0,R.jsxs)("a",{className:"".concat(A.color0152d9," current"),onClick:function(){(0,J.L9)(["实践项目","新建实践项目","申请新建"]),X({type:"newShixuns/setActionTabs",payload:{key:"NewShixuns-Apply"}})},children:[" ","申请新建"]}),(0,R.jsxs)("a",{className:"".concat(A.color0152d9," current"),onClick:function(){(0,J.L9)(["实践项目","新建实践项目","在线创建"]),X({type:"newShixuns/setActionTabs",payload:{key:"Create-Environment"}})},children:[" ","在线创建"]})]}),!(null!==(N=U.detail)&&void 0!==N&&N.is_jupyter)&&(0,R.jsxs)(R.Fragment,{children:[(0,R.jsxs)("div",{className:"".concat(A.flexRow," ").concat(A.flexAlignCenter),children:[(0,R.jsx)(P.Z.Item,{className:A.width180,name:"evaluationScript",label:"评测脚本:",children:(0,R.jsx)(C.default,{placeholder:"请选择评测脚本",children:(Ze||[]).map((function(e,n){return(0,R.jsx)(z,{value:parseInt(e.id),name:e.scptname,children:e.scptname},n)}))})}),(0,R.jsx)("span",{className:"".concat(A.color0152d9," font14 current mt10 ml10"),onClick:function(){X({type:"shixunsDetail/setActionTabs",payload:{key:"Settings-UseCustomScript",params:{id:ee.current}}})},children:"使用自定义脚本"}),(0,R.jsx)(D.Z,{overlayClassName:A.popover,placement:"bottomLeft",content:(0,R.jsxs)("p",{className:"font12",children:["使用自定义模板,平台无法自动更新脚本,请在关卡创建完后手动更新脚本中的必填参",(0,R.jsx)("br",{}),"数和以下2个数组元素:",(0,R.jsx)("br",{}),"challengeProgramNames",(0,R.jsx)("br",{}),"sourceClassNames",(0,R.jsx)("br",{}),(0,R.jsx)("br",{}),"示例:有2个关卡的实训",(0,R.jsx)("br",{}),(0,R.jsx)("br",{}),"各关卡的待编译文件为:",(0,R.jsx)("br",{}),"src/step1/HelloWorld.java",(0,R.jsx)("br",{}),"src/step2/Other.java",(0,R.jsx)("br",{}),(0,R.jsx)("br",{}),"各关卡的编译后生成的执行文件为:",(0,R.jsx)("br",{}),"step1.HelloWorld",(0,R.jsx)("br",{}),"step2.Other",(0,R.jsx)("br",{}),(0,R.jsx)("br",{}),"则数组元素更新如下:",(0,R.jsx)("br",{}),'ff challengeProgramNames=("src/step1/',(0,R.jsx)("br",{}),'HelloWorld.java" "src/step2/Other.java")',(0,R.jsx)("br",{}),'sourceClassNames=("step1.HelloWorld',(0,R.jsx)("br",{}),'" "step2.Other")',(0,R.jsx)("br",{}),(0,R.jsx)("br",{}),"其它参数可按实际需求定制"]}),trigger:"click",children:(0,R.jsx)("span",{className:"mt10 ml10 current font14",children:(0,R.jsx)(k.Z,{})})})]}),(0,R.jsx)(Z.ZP,{width:1150,height:450,style:{border:"1px solid #ccc",background:"#f5f5f5"},language:"shell",theme:"vs-light",value:pe,options:{readOnly:2===(null===(F=U.setting)||void 0===F||null===(F=F.shixun)||void 0===F?void 0:F.status)||!Ie},onChange:function(e){return me(e)}})]}),!(null!==(L=U.detail)&&void 0!==L&&L.is_jupyter)&&(0,R.jsxs)("div",{className:"font14 mt20",children:["私密版本库:",(0,R.jsx)(I.Z,{checked:oe,onChange:function(e){return ue(e.target.checked)},disabled:2===(null===(V=U.setting)||void 0===V||null===(V=V.shixun)||void 0===V?void 0:V.status)||!Ie,children:oe?"已创建的私密版本库及其内容,将在“保存”时被删除":"(若需要对学员隐藏部分版本库内容时,请选中;选中保存后表示启用私密版本库,请将需要对学员隐藏的文件存储在私密版本库)"})]}),(null===(G=U.detail)||void 0===G?void 0:G.identity)<3&&Ie&&(0,R.jsxs)("div",{className:A.serviceSettingWrap,children:[(0,R.jsx)("p",{className:A.serviceSettingName,children:"服务配置"}),xe.map((function(e,n){var t,i,s,a,l,r,c,o;return(0,R.jsxs)("div",{children:[(0,R.jsx)("div",{children:(0,R.jsx)("span",{className:"font16",children:e.name})}),(0,R.jsx)(E.Z,{title:2===(null===(t=U.setting)||void 0===t||null===(t=t.shixun)||void 0===t?void 0:t.status)?"当前实践项目已经发布,需撤销发布后才能修改该内容":"",children:(0,R.jsxs)("div",{className:"mb5",children:[(0,R.jsx)("label",{className:A.serviceSetLeft,children:"CPU(核):"}),(0,R.jsx)(T.Z,{className:A.serviceSetInput,value:e.cpu_limit,disabled:2===(null===(i=U.setting)||void 0===i||null===(i=i.shixun)||void 0===i?void 0:i.status)||!Ie,onChange:function(e){return Ae(e.target.value,"cpu_limit",n)}})]})}),(0,R.jsx)(E.Z,{title:2===(null===(s=U.setting)||void 0===s||null===(s=s.shixun)||void 0===s?void 0:s.status)?"当前实践项目已经发布,需撤销发布后才能修改该内容":"",children:(0,R.jsxs)("div",{className:"mb5",children:[(0,R.jsx)("label",{className:A.serviceSetLeft,children:"最低CPU(核):"}),(0,R.jsx)(T.Z,{className:A.serviceSetInput,value:e.lower_cpu_limit,disabled:2===(null===(a=U.setting)||void 0===a||null===(a=a.shixun)||void 0===a?void 0:a.status)||!Ie,onChange:function(e){return Ae(e.target.value,"lower_cpu_limit",n)}})]})}),(0,R.jsx)(E.Z,{title:2===(null===(l=U.setting)||void 0===l||null===(l=l.shixun)||void 0===l?void 0:l.status)?"当前实践项目已经发布,需撤销发布后才能修改该内容":"",children:(0,R.jsxs)("div",{className:"mb5",children:[(0,R.jsx)("label",{className:A.serviceSetLeft,children:"内存限制(M):"}),(0,R.jsx)(T.Z,{className:A.serviceSetInput,value:e.memory_limit,disabled:2===(null===(r=U.setting)||void 0===r||null===(r=r.shixun)||void 0===r?void 0:r.status)||!Ie,onChange:function(e){return Ae(e.target.value,"memory_limit",n)}})]})}),(0,R.jsx)(E.Z,{title:2===(null===(c=U.setting)||void 0===c||null===(c=c.shixun)||void 0===c?void 0:c.status)?"当前实践项目已经发布,需撤销发布后才能修改该内容":"",children:(0,R.jsxs)("div",{className:"mb5",children:[(0,R.jsx)("label",{className:A.serviceSetLeft,children:"内存要求(M):"}),(0,R.jsx)(T.Z,{className:A.serviceSetMemoryInput,value:e.request_limit,disabled:2===(null===(o=U.setting)||void 0===o||null===(o=o.shixun)||void 0===o?void 0:o.status)||!Ie,onChange:function(e){return Ae(e.target.value,"request_limit",n)}}),(0,R.jsx)("label",{className:"".concat(A.serviceSetTip," ml5"),children:"温馨提示:纯编程类型实训建议使用默认值,对于大数据等建议使用最大内存的30%"})]})}),(0,R.jsxs)("div",{className:A.serviceBox,children:[(0,R.jsx)("label",{className:A.serviceSetLeft,children:"磁盘限制(K):"}),(0,R.jsx)(T.Z,{className:A.serviceSetInput,value:e.resource_limit,style:{width:300},maxLength:8,onChange:function(e){e.target.value.match(/^\d*(\.\d*)?$/)&&Ae(e.target.value,"resource_limit",n)}})]})]},n)}))]})]}),(0,R.jsx)(P.Z.Item,{children:(0,R.jsx)(q.t,{okText:"保存",hasOkBtn:Ie,loading:K.effects["shixunsDetail/updateSettingBasicInfo"],onCancel:function(){return h.history.push("/shixuns/".concat(ee.current,"/challenges"))},okButtonProps:{htmlType:"submit"}})})]}),(0,R.jsx)(O.Z,{}),(0,R.jsx)(M.Z,{installPackage:ye,visible:Pe,setVisible:Te}),(0,R.jsx)(B,{onFinish:function(e){return me(e)}}),(0,R.jsx)(H.Z,{})]})})),U=t(37205),K=t.n(U),Q=t(5112),X=t(88522),$=t(49127),ee=t(30518),ne=t(10527),te=t(61186),ie=t.n(te),se="wrap___gE9H7",ae="labelWrap___NjGrw",le="label___NnvKx",re="labelContent___jIOR4",ce="color999___yY6G2",oe="radio___dA7aF",ue="selectSchool___WxyG6",de="dataPicker___Ocpox",he=["shixunsDetail","globalSetting","loading","user","dispatch"],pe="YYYY-MM-DD HH:mm",me=(0,h.connect)((function(e){var n=e.shixunsDetail,t=e.loading;return{shixunsDetail:n,globalSetting:e.globalSetting,user:e.user,loading:t}}))((function(e){var n,t,i,a,r,o=e.shixunsDetail,p=(e.globalSetting,e.loading),m=e.user,x=e.dispatch,g=(u()(e,he),(0,d.useRef)()),j=(0,d.useState)(),_=c()(j,2),y=_[0],b=_[1],N=(0,d.useState)(),S=c()(N,2),Z=S[0],w=S[1],k=(0,d.useState)([]),C=c()(k,2),P=C[0],T=C[1],E=(0,d.useState)([]),D=c()(E,2),A=D[0],O=D[1],F=(0,d.useState)(""),L=c()(F,2),V=L[0],B=L[1],W=(0,d.useState)(),M=c()(W,2),H=M[0],J=M[1],Y=(0,d.useState)(),z=c()(Y,2),G=z[0],U=z[1],te=null===(n=m.userInfo)||void 0===n||null===(n=n.shixun)||void 0===n?void 0:n.editable;(0,d.useEffect)((function(){var e;g.current=null===(e=location.pathname)||void 0===e||null===(e=e.split("/"))||void 0===e?void 0:e[2],me()}),[]),(0,d.useEffect)((function(){var e,n,t,i,s;o.setting&&(b(null===(e=o.setting)||void 0===e||null===(e=e.shixun)||void 0===e?void 0:e.can_copy),w(null===(n=o.setting)||void 0===n||null===(n=n.shixun)||void 0===n?void 0:n.use_scope),J(!(null===(t=o.setting)||void 0===t||null===(t=t.shixun)||void 0===t||!t.opening_time)),U(null===(i=o.setting)||void 0===i||null===(i=i.shixun)||void 0===i?void 0:i.opening_time),T(null===(s=o.setting)||void 0===s||null===(s=s.shixun)||void 0===s?void 0:s.scope_partment))}),[o.setting]);var me=function(){var e=l()(s()().mark((function e(n){var t;return s()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,x({type:"shixunsDetail/getDepartments",payload:{q:n}});case 2:(t=e.sent)&&O(t.shools_name||[]);case 4:case"end":return e.stop()}}),e)})));return function(n){return e.apply(this,arguments)}}(),ve=function(){var e=l()(s()().mark((function e(){return s()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!H||G){e.next=3;break}return v.ZP.info("请选择开启时间"),e.abrupt("return");case 3:if(1!==Z||P.length){e.next=6;break}return v.ZP.info("请选择指定单位公开"),e.abrupt("return");case 6:return e.next=8,x({type:"shixunsDetail/updatePermissionSetting",payload:{id:g.current,scope_partment:0===Z?null:P,shixun:{can_copy:y,use_scope:Z,opening_time:G}}});case 8:-1!==e.sent.status&&(v.ZP.info("权限配置保存成功!"),x({type:"shixunsDetail/getSettingsData",payload:{id:g.current}}),x({type:"shixunsDetail/getShixunsDetail",payload:{id:g.current}}));case 10:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();return(0,R.jsxs)("section",{className:se,children:[(0,R.jsxs)("div",{className:ae,children:[(0,R.jsx)("label",{className:le,children:"复制:"}),(0,R.jsx)("div",{className:re,children:(0,R.jsxs)("div",{children:[(0,R.jsx)(I.Z,{checked:y,onChange:function(e){return b(e.target.checked)},disabled:!te}),(0,R.jsx)("span",{className:"".concat(ce),children:"(选中则允许已职业认证的教师复制该实训)"})]})})]}),!(((null===(t=o.detail)||void 0===t?void 0:t.shixun_status)>1||2===(null===(i=o.detail)||void 0===i?void 0:i.public))&&0===(null===(a=o.setting)||void 0===a||null===(a=a.shixun)||void 0===a?void 0:a.use_scope)&&(null===(r=o.detail)||void 0===r?void 0:r.identity)>2)&&(0,R.jsxs)("div",{className:ae,children:[(0,R.jsx)("label",{className:le,children:"公开程度:"}),(0,R.jsxs)("div",{className:re,children:[(0,R.jsxs)(Q.ZP.Group,{value:Z,onChange:function(e){return w(e.target.value)},disabled:!te,children:[(0,R.jsxs)(Q.ZP,{className:oe,value:0,children:[(0,R.jsx)("span",{children:"对所有单位公开"}),(0,R.jsx)("span",{className:ce,children:"(实训发布后,所有用户可见)"})]}),(0,R.jsxs)(Q.ZP,{className:oe,value:1,children:[(0,R.jsx)("span",{children:"对指定单位公开"}),(0,R.jsx)("span",{className:ce,children:"(实训发布后,仅对下方指定单位的用户可见)"})]})]}),1===Z&&(0,R.jsxs)(R.Fragment,{children:[(0,R.jsxs)("div",{className:"mt10",children:[(0,R.jsx)(X.Z,{showSearch:!0,className:ue,placeholder:"请输入并选择单位名称",value:V,onChange:function(e){B(e),me(e)},disabled:!te,onSelect:function(e){P.includes(e)?v.ZP.info("请勿指定相同的单位"):(B(null),T([].concat(K()(P),[e])))},options:null==A?void 0:A.map((function(e){return{value:e}}))}),(0,R.jsx)("span",{className:ce,children:"(实训发布后,仅对下方指定单位的用户可见)"})]}),(0,R.jsx)("div",{className:"mt10",children:null==P?void 0:P.map((function(e){return te?(0,R.jsx)($.Z,{count:"x",className:"mr20 current",onClick:function(){return T(P.filter((function(n){return n!==e})))},children:(0,R.jsx)(f.ZP,{type:"primary",ghost:!0,children:e})}):(0,R.jsx)(f.ZP,{type:"primary",ghost:!0,className:"mr20",children:e})}))})]})]})]}),(0,R.jsxs)("div",{className:ae,children:[(0,R.jsx)("label",{className:le,children:"开启时间:"}),(0,R.jsxs)("div",{className:re,children:[(0,R.jsxs)("div",{children:[(0,R.jsx)(I.Z,{checked:H,onChange:function(e){return J(e.target.checked)},disabled:!te}),(0,R.jsx)("span",{className:"".concat(ce," ml10"),children:"(选中则学员在指定的开启时间后,才能开启学习;不选中则学员在实训发布后,能立即开启学习)"})]}),H&&(0,R.jsx)(ee.default,{className:"".concat(de," mt10"),format:pe,locale:ne.Z,disabled:!te,placeholder:"请输入开启时间",showToday:!1,disabledDate:function(e){return e&&e<ie()().endOf("day").subtract(1,"days")},showTime:{minuteStep:30},value:G&&ie()(G,pe),onChange:function(e,n){return U(function(e){if(!e)return e;var n=e.split(":");if("00"==n[1]||"30"==n[1])return e;var t=parseInt(n[1]);if(t<30||60==t)return[n[0],"30"].join(":");if(t<60){var i=[n[0],"00"].join(":"),s="YYYY-MM-DD HH:mm",a=ie()(i,s);return a.add(1,"hours"),a.format(s)}return e}(n))}})]})]}),(0,R.jsx)(q.t,{okText:"保存",hasOkBtn:te,loading:p.effects["shixunsDetail/updatePermissionSetting"],onCancel:function(){return h.history.push("/shixuns/".concat(g.current,"/challenges"))},onOk:ve})]})})),ve=t(36381),fe=t(94001),xe=t(81327),ge="wrap___BgpUe",je="in___VHIfB",_e="se____92Z1",ye="fourPart___w5rMq",be="groupWrap___zAZJm",Ne=t(49105),Se=["shixunsDetail","globalSetting","loading","user","dispatch","active"],Ze=(ve.Z.Panel,T.Z.TextArea),we=(0,h.connect)((function(e){var n=e.shixunsDetail,t=e.loading;return{shixunsDetail:n,globalSetting:e.globalSetting,user:e.user,loading:t}}))((function(e){e.shixunsDetail,e.globalSetting,e.loading;var n,t=e.user,i=(e.dispatch,e.active),a=(u()(e,Se),(0,d.useRef)()),r=P.Z.useForm(),o=c()(r,1)[0],p=(0,d.useState)({}),x=c()(p,2),g=x[0],j=x[1],_=(0,d.useState)(!1),y=c()(_,2),b=y[0],N=y[1],w=(0,d.useState)([]),k=c()(w,2),D=k[0],A=k[1],O=(0,d.useState)([]),F=c()(O,2),L=F[0],V=F[1],B=null===(n=t.userInfo)||void 0===n||null===(n=n.shixun)||void 0===n?void 0:n.editable;(0,d.useEffect)((function(){var e;a.current=null===(e=location.pathname)||void 0===e||null===(e=e.split("/"))||void 0===e?void 0:e[2]}),[]),(0,d.useEffect)((function(){"testCase"===i&&W()}),[i]);var W=function(){var e=l()(s()().mark((function e(){var n,t,i,l,r,c,u,d,h,p,m,v,f,x,g;return s()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=[{hidden:0,input:"",output:"",score:100}],e.next=3,(0,Ne.ZP)("/api/shixuns/".concat(a.current,"/jupyter_evalute_setting.json"),{method:"get"});case 3:0===(null==(t=e.sent)?void 0:t.status)&&(V(null==t||null===(i=t.data)||void 0===i?void 0:i.standard_scripts),g={open_evaluate:null==t||null===(l=t.data)||void 0===l?void 0:l.open_evaluate,exec_time:(null==t||null===(r=t.data)||void 0===r?void 0:r.exec_time)||3,test_set_score:null!==(null==t||null===(c=t.data)||void 0===c?void 0:c.test_set_score)&&(null==t||null===(u=t.data)||void 0===u?void 0:u.test_set_score),test_set_average:null===(null==t||null===(d=t.data)||void 0===d?void 0:d.test_set_average)||(null==t||null===(h=t.data)||void 0===h?void 0:h.test_set_average),choice_standard_scripts:(null==t||null===(p=t.data)||void 0===p?void 0:p.choice_standard_scripts)||null,evaluate_script:(null==t||null===(m=t.data)||void 0===m?void 0:m.evaluate_script)||"",evaluate_method:null==t||null===(v=t.data)||void 0===v?void 0:v.evaluate_method},o.setFieldsValue(g),j(g),A(null!=t&&null!==(f=t.data)&&void 0!==f&&null!==(f=f.test_sets)&&void 0!==f&&f.length?null==t||null===(x=t.data)||void 0===x?void 0:x.test_sets:n));case 5:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),M=function(){var e=l()(s()().mark((function e(n){var t,i;return s()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=D.map((function(e){return e.score})),i=t.reduce((function(e,n){return e+n}),0),!n.test_set_score||100===i||null==D||!D.length){e.next=5;break}return v.ZP.warning("测试用例的评分占比之和必须等于100"),e.abrupt("return");case 5:return N(!0),e.next=8,(0,Ne.ZP)("/api/shixuns/".concat(a.current,"/update_jupyter_evaluate_setting.json"),{method:"post",body:S()(S()({},n),{},{mirror_script_id:null==n?void 0:n.choice_standard_scripts,open_evaluate:null!=n&&n.open_evaluate?1:0,test_set:D.map((function(e){return S()(S()({},e),{},{is_file:!1})}))})});case 8:0===e.sent.status&&v.ZP.success("保存成功"),N(!1);case 11:case"end":return e.stop()}}),e)})));return function(n){return e.apply(this,arguments)}}(),H=function(e){var n=Math.floor(100/e.length),t=n+100%e.length;e=e.map((function(i,s){return s===e.length-1?S()(S()({},i),{},{score:t}):S()(S()({},i),{},{score:n})})),A(e)},J=g.test_set_score,Y=g.test_set_average,z=(g.choice_standard_scripts,g.open_evaluate);return(0,R.jsxs)("section",{className:ge,children:[(0,R.jsxs)(P.Z,{form:o,disabled:!z,layout:"vertical",onValuesChange:function(e){var n;j(S()({},o.getFieldsValue())),"test_set_average"in e&&null!=e&&e.test_set_average&&H(D),"test_set_score"in e&&null!=e&&e.test_set_score&&(o.setFieldsValue({test_set_average:!0}),j(S()(S()({},o.getFieldsValue()),{},{test_set_average:!0})),H(D)),"choice_standard_scripts"in e&&m.Z.confirm({centered:!0,title:"提示",okText:"确定",cancelText:"取消",content:(0,R.jsxs)("div",{className:"tc font16",children:["原有脚本将被新的脚本覆盖,无法撤销",(0,R.jsx)("br",{}),"是否确认执行覆盖操作"]}),onOk:(n=l()(s()().mark((function n(){var t;return s()().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,(0,Ne.ZP)("/api/shixuns/".concat(a.current,"/get_script_contents.json"),{method:"get",params:{id:a.current,script_id:null==e?void 0:e.choice_standard_scripts}});case 2:null!=(t=n.sent)&&t.content&&(m.Z.info({centered:!0,title:"提示",okText:"知道啦",content:(0,R.jsx)("div",{className:"tc font16",children:"评测脚本生成成功!"})}),o.setFieldsValue({evaluate_script:null==t?void 0:t.content}),j(S()(S()({},o.getFieldsValue()),{},{evaluate_script:null==t?void 0:t.content})));case 4:case"end":return n.stop()}}),n)}))),function(){return n.apply(this,arguments)})})},onFinish:M,children:[(0,R.jsx)(P.Z.Item,{name:"open_evaluate",style:{marginTop:10},valuePropName:"checked",children:(0,R.jsx)(I.Z,{disabled:!1,children:"启用Jupyter评测功能"})}),(0,R.jsx)("h4",{className:"font14",children:"评测时长限制"}),(0,R.jsx)(E.Z,{title:!z&&"请启用Jupyter评测功能后,进行编辑",placement:"topLeft",children:(0,R.jsx)(P.Z.Item,{label:"评测时长(秒):",name:"exec_time",style:{flexDirection:"row",marginTop:15},rules:[{required:!0,message:"请输入评测时长限制"},{type:"number",min:3,message:"最小限制时间是3秒"}],children:(0,R.jsx)(fe.Z,{className:je,min:3})})}),(0,R.jsx)("h4",{className:"font14 mb10",children:"系统评分规则"}),(0,R.jsx)(E.Z,{title:!z&&"请启用Jupyter评测功能后,进行编辑",placement:"topLeft",children:(0,R.jsx)(P.Z.Item,{name:"test_set_score",children:(0,R.jsx)(Q.ZP.Group,{children:(0,R.jsxs)(xe.Z,{direction:"vertical",children:[(0,R.jsxs)(Q.ZP,{value:!1,children:["通过全部测试集",(0,R.jsx)("span",{className:"c-grey-999",children:" (学员评测,仅当所有测试集都正确时,才获得一次性奖励)"})]}),(0,R.jsxs)(Q.ZP,{value:!0,children:["通过部分测试集",(0,R.jsx)("span",{className:"c-grey-999",children:" (学员评测,通过测试集即可获得对应奖励)"})]})]})})})}),(0,R.jsxs)("h4",{className:"flex-container font14 mb10",children:[(0,R.jsx)("span",{className:"mr30",children:"测试用例"}),(0,R.jsx)(E.Z,{title:!z&&"请启用Jupyter评测功能后,进行编辑",placement:"topLeft",children:(0,R.jsx)(f.ZP,{style:{height:28,borderRadius:4},type:"primary",onClick:function(){var e=[].concat(K()(D),[{hidden:0,input:"",output:"",score:0}]);o.getFieldValue("test_set_average")?H(e):A(e)},ghost:!0,children:"添加测试用例"})})]}),J&&(0,R.jsx)(P.Z.Item,{name:"test_set_average",children:(0,R.jsxs)(Q.ZP.Group,{children:[(0,R.jsx)(Q.ZP,{value:!0,children:"均分比例"}),(0,R.jsx)(Q.ZP,{value:!1,style:{marginLeft:50},children:"自定义比例"})]})}),(0,R.jsx)(E.Z,{title:!z&&"请启用Jupyter评测功能后,进行编辑",placement:"topLeft",children:(0,R.jsx)("div",{className:ye,children:D.map((function(e,n){return(0,R.jsxs)("div",{className:be,children:[(0,R.jsxs)("div",{className:"font16",children:[(0,R.jsxs)("span",{className:"mr10",children:["组",n+1," : "]}),g.test_set_score&&(0,R.jsxs)("span",{style:{marginRight:100},children:[(0,R.jsx)(T.Z,{style:{width:85},value:e.score,type:"number",disabled:Y,onChange:function(e){var t=D.map((function(t,i){return i===n?S()(S()({},t),{},{score:e.target.value?Number(e.target.value):0}):t})),i={test_set_average:!1};j(S()(S()({},g),i)),o.setFieldsValue(i),A(t)}}),(0,R.jsx)("span",{className:"ml10 mr10",children:"%"})]}),(0,R.jsxs)(I.Z,{className:"font14 ml5",checked:1===e.hidden,onChange:function(e){var t=D.map((function(t,i){return i===n?S()(S()({},t),{},{hidden:e.target.checked?1:0}):t}));A(t)},children:["隐藏",(0,R.jsx)("span",{className:"font12 c-light-black",children:'(隐藏测试集可以防止学生通过"print"等手段直接通关)'})]}),(0,R.jsx)("span",{className:"tr flex1",style:{float:"right"},children:0!==n&&(0,R.jsx)(E.Z,{placement:"bottom",title:"删除",children:(0,R.jsx)("span",{className:"font16 c-red current",onClick:function(){var e=D.filter((function(e,t){return t!==n}));H(e)},children:"删 除"})})})]}),(0,R.jsx)(Ze,{bordered:!1,className:"mt10",rows:5,placeholder:"输入",value:e.input,onChange:function(e){var t=D.map((function(t,i){return i===n?S()(S()({},t),{},{input:e.target.value}):t}));A(t)}}),(0,R.jsx)(Ze,{bordered:!1,className:"mt10",rows:5,placeholder:"预期输出",value:e.output,onChange:function(e){var t=D.map((function(t,i){return i===n?S()(S()({},t),{},{output:e.target.value}):t}));A(t)}}),(0,R.jsxs)("div",{className:"mt10",children:[(0,R.jsx)("span",{className:"font14 mr20",children:"预期输出:"}),(0,R.jsx)(I.Z,{checked:e.is_invisible,onChange:function(e){var t=D.map((function(t,i){return i===n?S()(S()({},t),{},{is_invisible:e.target.checked}):t}));A(t)},children:(0,R.jsxs)("span",{className:"font14",children:["对学员不可见",(0,R.jsx)("span",{className:"font12 c-light-black",children:"(勾选后,预期输出对学员始终不可见)"})]})})]}),(0,R.jsxs)("div",{children:[(0,R.jsx)("span",{className:"font14 mr20",children:"特殊判定:"}),(0,R.jsx)(I.Z,{checked:e.last_match_rule,onChange:function(e){var t=D.map((function(t,i){return i===n?S()(S()({},t),{},{last_match_rule:e.target.checked}):t}));A(t)},children:(0,R.jsxs)("span",{className:"font14",children:["末尾匹配",(0,R.jsx)("span",{className:"font12 c-light-black",children:"(实际输出与预期输出最后一行相同即可通关)"})]})})]})]},n)}))})}),(0,R.jsx)(P.Z.Item,{label:"评测方式",name:"evaluate_method",style:{flexDirection:"row",marginTop:15},rules:[{required:!0,message:"请选择评测方式"}],children:(0,R.jsx)(Q.ZP.Group,{children:(0,R.jsxs)(xe.Z,{direction:"vertical",children:[(0,R.jsxs)(Q.ZP,{value:1,children:["所有代码块评测",(0,R.jsx)("span",{className:"c-grey-999",children:" (对学员任务文件的所有非空代码块进行评测)"})]}),(0,R.jsxs)(Q.ZP,{value:2,children:["末尾代码块评测",(0,R.jsx)("span",{className:"c-grey-999",children:" (对学员任务文件的最后一个非空代码块进行评测)"})]})]})})}),(0,R.jsx)("h4",{className:"font14 mt20 mb10",children:"评测脚本"}),(0,R.jsx)(E.Z,{title:!z&&"请启用Jupyter评测功能后,进行编辑",placement:"topLeft",children:(0,R.jsx)(P.Z.Item,{name:"choice_standard_scripts",children:(0,R.jsx)(C.default,{className:_e,getPopupContainer:function(e){return e.parentNode},placeholder:"请选择评测脚本",children:L.map((function(e,n){return(0,R.jsx)(C.default.Option,{value:e.id,children:e.scptname},n)}))})})}),(0,R.jsx)(E.Z,{title:!z&&"请启用Jupyter评测功能后,进行编辑",placement:"topLeft",children:(0,R.jsx)(P.Z.Item,{name:"evaluate_script",children:(0,R.jsx)(Z.ZP,{height:450,style:{border:"1px solid #ccc"},language:"shell",theme:"vs-light",options:{readOnly:!z}})})})]}),(0,R.jsx)(q.t,{okText:"保存",hasOkBtn:B,loading:b,onCancel:function(){return h.history.push("/shixuns/".concat(a.current,"/challenges"))},onOk:function(){return o.submit()}})]})})),ke="wrap___J9uHL",Ce="labelWrap___kdl0e",Pe="label___RZlBA",Te="labelContent___LJE2G",Ie="color999___r9hUn",Ee="radio___z_jH6",De=["shixunsDetail","globalSetting","loading","user","dispatch"],Ae=(0,h.connect)((function(e){var n=e.shixunsDetail,t=e.loading;return{shixunsDetail:n,globalSetting:e.globalSetting,user:e.user,loading:t}}))((function(e){var n,t=e.shixunsDetail,i=(e.globalSetting,e.loading),a=e.user,r=e.dispatch,o=(u()(e,De),(0,d.useRef)()),p=(0,d.useState)(),m=c()(p,2),f=m[0],x=m[1],g=(0,d.useState)(),j=c()(g,2),_=j[0],y=j[1],b=(0,d.useState)(),N=c()(b,2),S=N[0],Z=N[1],w=(0,d.useState)(),k=c()(w,2),C=k[0],P=k[1],T=(0,d.useState)(),E=c()(T,2),D=E[0],A=E[1],O=(0,d.useState)(),F=c()(O,2),L=F[0],V=F[1],B=(0,d.useState)(),W=c()(B,2),M=W[0],H=W[1],J=(0,d.useState)(),Y=c()(J,2),z=Y[0],G=Y[1],U=(0,d.useState)(),K=c()(U,2),X=K[0],$=K[1],ee=(0,d.useState)(),ne=c()(ee,2),te=ne[0],ie=ne[1],se=(0,d.useState)(),ae=c()(se,2),le=ae[0],re=ae[1],ce=null===(n=a.userInfo)||void 0===n||null===(n=n.shixun)||void 0===n?void 0:n.editable;(0,d.useEffect)((function(){var e;o.current=null===(e=location.pathname)||void 0===e||null===(e=e.split("/"))||void 0===e?void 0:e[2]}),[]),(0,d.useEffect)((function(){var e,n,i,s,a,l,r,c,o,u,d;t.setting&&(x(null===(e=t.setting)||void 0===e||null===(e=e.shixun)||void 0===e?void 0:e.vnc),y(!(null===(n=t.setting)||void 0===n||null===(n=n.shixun)||void 0===n||!n.webssh)),Z(null===(i=t.setting)||void 0===i||null===(i=i.shixun)||void 0===i?void 0:i.webssh),P(null===(s=t.setting)||void 0===s||null===(s=s.shixun)||void 0===s?void 0:s.multi_webssh),A(null===(a=t.setting)||void 0===a||null===(a=a.shixun)||void 0===a?void 0:a.hide_code),V(null===(l=t.setting)||void 0===l||null===(l=l.shixun)||void 0===l?void 0:l.code_edit_permission),H(null===(r=t.setting)||void 0===r||null===(r=r.shixun)||void 0===r?void 0:r.code_hidden),G(null===(c=t.setting)||void 0===c||null===(c=c.shixun)||void 0===c?void 0:c.forbid_copy),$(null===(o=t.setting)||void 0===o||null===(o=o.shixun)||void 0===o?void 0:o.task_pass),ie(null===(u=t.setting)||void 0===u||null===(u=u.shixun)||void 0===u?void 0:u.test_set_permission),re(null===(d=t.setting.shixun)||void 0===d?void 0:d.display_git_address))}),[t.setting]);var oe=function(){var e=l()(s()().mark((function e(){return s()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,r({type:"shixunsDetail/updateLearnSetting",payload:{id:o.current,shixun:{code_hidden:M,forbid_copy:z,hide_code:D,multi_webssh:C,task_pass:X,test_set_permission:te,display_git_address:le,vnc:f,webssh:_?S:0,code_edit_permission:L}}});case 2:-1!==e.sent.status&&(v.ZP.info("学习页面设置保存成功!"),r({type:"shixunsDetail/getSettingsData",payload:{id:o.current}}),r({type:"shixunsDetail/getShixunsDetail",payload:{id:o.current}}));case 4:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();return(0,R.jsxs)("section",{className:ke,children:[(f||!_)&&(0,R.jsxs)("div",{className:Ce,children:[(0,R.jsx)("label",{className:Pe,children:"开启图形化界面:"}),(0,R.jsx)("div",{className:Te,children:(0,R.jsxs)("div",{children:[(0,R.jsx)(I.Z,{checked:f,disabled:!ce,onChange:function(e){var n=e.target.checked;x(n),n&&(A(!1),V(!1),H(!1),G(!1),P(!1),y(!1))}}),(0,R.jsx)("span",{className:"".concat(Ie," ml10"),children:"(选中则给学员的实践任务启动Ubuntu系统的图形化界面)"})]})})]}),!f&&(0,R.jsxs)("div",{className:Ce,children:[(0,R.jsx)("label",{className:Pe,children:"命令行:"}),(0,R.jsxs)("div",{className:Te,children:[(0,R.jsxs)("div",{children:[(0,R.jsx)(I.Z,{checked:_,disabled:!ce,onChange:function(e){var n=e.target.checked;y(n),n?(x(!1),Z(1)):(P(!1),Z(null),A(!1))}}),(0,R.jsx)("span",{className:"".concat(Ie," ml10"),children:"(选中则给学员的实践任务提供命令行窗口)"})]}),_&&(0,R.jsx)("div",{className:"ml40",children:(0,R.jsxs)(Q.ZP.Group,{value:S,disabled:!ce,onChange:function(e){var n=e.target.value;Z(n),1!==n&&P(!1)},children:[(0,R.jsxs)(Q.ZP,{className:Ee,value:1,children:[(0,R.jsx)("span",{children:"命令行练习窗口"}),(0,R.jsx)("span",{className:Ie,children:"(选中则给学员提供用于练习操作的命令行,命令行的操作不会对学生的实验环境造成影响)"})]}),(0,R.jsxs)(Q.ZP,{className:Ee,value:2,children:[(0,R.jsx)("span",{children:"命令行评测窗口"}),(0,R.jsx)("span",{className:Ie,children:"(选中则给学员提供用于评测操作的命令行,命令行的操作可以对学生的实验环境产生影响)"})]})]})}),2===S&&(0,R.jsxs)("div",{className:"ml60",children:[(0,R.jsx)(I.Z,{checked:C,disabled:!ce,onChange:function(e){return P(e.target.checked)}}),(0,R.jsxs)("span",{className:" ml10",children:[(0,R.jsx)("span",{children:"多个命令行窗口:"}),(0,R.jsx)("span",{className:Ie,children:"(选中则允许学员同时开启多个命令行窗口)"})]})]})]})]}),!f&&_&&(0,R.jsxs)("div",{className:Ce,children:[(0,R.jsx)("label",{className:Pe,children:"隐藏代码窗口:"}),(0,R.jsx)("div",{className:Te,children:(0,R.jsxs)("div",{children:[(0,R.jsx)(I.Z,{checked:D,disabled:!ce,onChange:function(e){var n=e.target.checked;A(n),n&&V(!1)}}),(0,R.jsx)("span",{className:"".concat(Ie," ml10"),children:"(选中则学员页面不显示代码窗口)"})]})})]}),!f&&!D&&(0,R.jsxs)("div",{className:Ce,children:[(0,R.jsx)("label",{className:Pe,children:"公开版本库:"}),(0,R.jsx)("div",{className:Te,children:(0,R.jsxs)("div",{children:[(0,R.jsx)(I.Z,{checked:L,disabled:!ce,onChange:function(e){return V(e.target.checked)}}),(0,R.jsx)("span",{className:"".concat(Ie," ml10"),children:"(选中则允许学员查看版本库中的全部文件)"})]})})]}),!D&&(0,R.jsxs)("div",{className:Ce,children:[(0,R.jsx)("label",{className:Pe,children:"显示版本库地址:"}),(0,R.jsx)("div",{className:Te,children:(0,R.jsxs)("div",{children:[(0,R.jsx)(I.Z,{checked:le,disabled:!ce,onChange:function(e){return re(e.target.checked)}}),(0,R.jsx)("span",{className:"".concat(Ie," ml10"),children:" (选中则对学员公开版本库地址,学员可以将所有代码下载到本地)"})]})})]}),!f&&(0,R.jsxs)("div",{className:Ce,children:[(0,R.jsx)("label",{className:Pe,children:"隐藏代码目录:"}),(0,R.jsx)("div",{className:Te,children:(0,R.jsxs)("div",{children:[(0,R.jsx)(I.Z,{checked:M,disabled:!ce,onChange:function(e){return H(e.target.checked)}}),(0,R.jsx)("span",{className:"".concat(Ie," ml10"),children:"(选中则学员页面不显示版本库目录)"})]})})]}),!f&&(0,R.jsxs)("div",{className:Ce,children:[(0,R.jsx)("label",{className:Pe,children:"禁用粘贴:"}),(0,R.jsx)("div",{className:Te,children:(0,R.jsxs)("div",{children:[(0,R.jsx)(I.Z,{checked:z,disabled:!ce,onChange:function(e){return G(e.target.checked)}}),(0,R.jsx)("span",{className:"".concat(Ie," ml10"),children:"(选中则学员页面不允许使用粘贴功能)"})]})})]}),(0,R.jsxs)("div",{className:Ce,children:[(0,R.jsx)("label",{className:Pe,children:"跳关:"}),(0,R.jsx)("div",{className:Te,children:(0,R.jsxs)("div",{children:[(0,R.jsx)(I.Z,{checked:X,disabled:!ce,onChange:function(e){return $(e.target.checked)}}),(0,R.jsx)("span",{className:"".concat(Ie," ml10"),children:"(选中则允许学员跳关学习实训关卡任务)"})]})})]}),(0,R.jsxs)("div",{className:Ce,children:[(0,R.jsx)("label",{className:Pe,children:"测试集解锁:"}),(0,R.jsx)("div",{className:Te,children:(0,R.jsxs)("div",{children:[(0,R.jsx)(I.Z,{checked:te,disabled:!ce,onChange:function(e){return ie(e.target.checked)}}),(0,R.jsx)("span",{className:"".concat(Ie," ml10"),children:"(选中则允许学员通过金币解锁查看隐藏测试集的内容)"})]})})]}),(0,R.jsx)(q.t,{okText:"保存",hasOkBtn:ce,loading:i.effects["shixunsDetail/updateLearnSetting"],onCancel:function(){return h.history.push("/shixuns/".concat(o.current,"/challenges"))},onOk:oe})]})})),Oe=t(10283),Fe=t(66999),Re="formWrap___BgCFo",Le="fieldWrap___dhQNb",Ve="wrap___hoiWC",Be=["shixunsDetail","globalSetting","user","dispatch"],qe=(0,h.connect)((function(e){return{shixunsDetail:e.shixunsDetail,globalSetting:e.globalSetting,user:e.user}}))((function(e){e.shixunsDetail,e.globalSetting;var n,t,i=e.user,a=(e.dispatch,u()(e,Be),(0,h.useLocation)()),r=(0,d.useRef)(null===(n=a.pathname)||void 0===n||null===(n=n.split("/"))||void 0===n?void 0:n[2]),o=P.Z.useForm(),p=c()(o,1)[0],m=(0,d.useState)(""),f=c()(m,2),x=f[0],g=f[1],j=(0,d.useState)(!1),_=c()(j,2),y=_[0],b=_[1],N=null===(t=i.userInfo)||void 0===t||null===(t=t.shixun)||void 0===t?void 0:t.editable;(0,d.useEffect)((function(){r.current&&Z()}),[r.current]);var Z=function(){var e=l()(s()().mark((function e(){var n;return s()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return b(!0),e.next=3,(0,Ne.ZP)("/api/shixuns/".concat(r.current,"/get_standard_answer.json"),{method:"get",params:{from:"edit"}});case 3:0===(n=e.sent).status&&(g((null==n?void 0:n.standard_answer)||""),p.setFieldsValue({hide_answer:null==n?void 0:n.hide_answer,disable_copy:null==n?void 0:n.disable_copy}),b(!1));case 5:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),k=function(){var e=l()(s()().mark((function e(n){return s()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,Ne.ZP)("/api/shixuns/".concat(r.current,"/set_standard_answer.json"),{method:"post",body:S()({},n)});case 2:0===e.sent.status&&v.ZP.success("保存成功");case 4:case"end":return e.stop()}}),e)})));return function(n){return e.apply(this,arguments)}}();return(0,R.jsx)("section",{className:Ve,children:(0,R.jsx)(Fe.Z,{loading:y,children:(0,R.jsxs)(P.Z,{form:p,className:Re,scrollToFirstError:!0,layout:"vertical",onFinish:k,children:[(0,R.jsxs)("div",{className:Le,children:[(0,R.jsx)(P.Z.Item,{name:"hide_answer",valuePropName:"checked",children:(0,R.jsx)(I.Z,{children:"隐藏参考答案模块"})}),(0,R.jsx)(P.Z.Item,{name:"disable_copy",valuePropName:"checked",children:(0,R.jsx)(I.Z,{children:"禁止复制参考答案"})}),(0,R.jsx)(P.Z.Item,{name:"standard_answer",label:"参考答案:",rules:[{required:!0,message:"请输入参考答案"}],children:N?(0,R.jsx)(w.Z,{defaultValue:x}):(0,R.jsx)(W.Z,{value:x})})]}),(0,R.jsx)(P.Z.Item,{children:(0,R.jsx)(q.t,{okText:"保存",hasOkBtn:N,loading:!1,onCancel:function(){return h.history.push("/shixuns/".concat(r.current,"/challenges"))},okButtonProps:{htmlType:"submit"}})})]})})})})),We=["shixunsDetail","globalSetting","loading","user","dispatch"],Me=p.Z.TabPane,He=function(e){return e.BasicInfo="basicInfo",e.Permission="permission",e.Learning="learning",e.TestCase="testCase",e.SuggestedAnswer="suggestedAnswer",e}(He||{}),Je=(0,h.connect)((function(e){var n=e.shixunsDetail,t=e.loading;return{shixunsDetail:n,globalSetting:e.globalSetting,user:e.user,loading:t.models.index}}))((function(e){var n,t,i=e.shixunsDetail,a=(e.globalSetting,e.loading,e.user),r=e.dispatch,o=(u()(e,We),(0,d.useState)()),y=c()(o,2),b=y[0],N=y[1],S=(0,d.useRef)(""),Z=null===(n=a.userInfo)||void 0===n||null===(n=n.shixun)||void 0===n?void 0:n.is_creator;(0,d.useEffect)((function(){return r({type:"globalSetting/footerToggle",payload:!1}),function(){r({type:"globalSetting/footerToggle",payload:!0})}}),[]),(0,d.useEffect)((function(){var e;S.current=null===(e=location.pathname.split("/"))||void 0===e?void 0:e[2],r({type:"shixunsDetail/getSettingsData",payload:{id:S.current}})}),[]);var w,k,C,P=function(){var e=l()(s()().mark((function e(){return s()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:m.Z.confirm({centered:!0,title:"提示",okText:"确定",cancelText:"取消",content:(0,R.jsxs)("div",{className:"tc font14",children:["关闭后,",(0,R.jsx)("br",{}),"用户不能再开始挑战了是否确认关闭 ?"]}),onOk:function(){var e=l()(s()().mark((function e(){return s()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,r({type:"shixunsDetail/permanentClose",payload:{id:S.current}});case 2:1===e.sent.status&&(v.ZP.info("操作成功"),h.history.push("/shixuns/".concat(S.current,"/challenges")));case 4:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}()});case 1:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),T=function(){var e=l()(s()().mark((function e(){var n,t,i,a,c;return s()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,r({type:"shixunsDetail/getShixunQuote",payload:{id:S.current}});case 2:if(e.t0=e.sent,e.t0){e.next=5;break}e.t0={};case 5:c=e.t0,m.Z.confirm({centered:!0,title:"提示",okText:"确定",cancelText:"取消",width:520,content:(0,R.jsxs)("div",{className:"tc font14 ".concat(g),children:[!(null===(n=c.subjects)||void 0===n||!n.length)&&(0,R.jsxs)(R.Fragment,{children:[(0,R.jsxs)("span",{children:["该实践项目已被应用到 ",null===(t=c.subjects)||void 0===t||null===(t=t.splice(0,2))||void 0===t?void 0:t.map((function(e){return"《".concat(e,"》")})),"等",(0,R.jsx)("span",{className:j,children:null==c?void 0:c.subjects_count}),"个实训课程"]}),(0,R.jsx)("br",{})]}),!(null===(i=c.courses)||void 0===i||!i.length)&&(0,R.jsxs)(R.Fragment,{children:[(0,R.jsxs)("span",{children:["该实践项目已被应用到",null===(a=c.courses)||void 0===a||null===(a=a.splice(0,2))||void 0===a?void 0:a.map((function(e){return"《".concat(e,"》")})),"等",(0,R.jsx)("span",{className:j,children:null==c?void 0:c.courses_count}),"个教学课堂"]}),(0,R.jsx)("br",{})]}),(0,R.jsx)("span",{className:"".concat(_," mt30"),children:"删除实践项目将影响课程及课堂对该实践项目的使用!请谨慎操作!"})]}),onOk:function(){var e=l()(s()().mark((function e(){return s()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,r({type:"shixunsDetail/deleteShixun",payload:{id:S.current}});case 2:1===e.sent.status&&(v.ZP.success("操作成功"),h.history.push("/shixuns"));case 4:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}()});case 7:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),I=function(){(0,Oe.gy)(r,"不能进行删除")};return(0,R.jsx)("section",{className:x,children:(0,R.jsxs)(p.Z,{animated:!1,activeKey:b,onChange:function(e){return N(e)},tabBarExtraContent:(0,R.jsxs)("div",{className:"mr20",children:[Z?2!==(null==i||null===(w=i.detail)||void 0===w?void 0:w.shixun_status)?(0,R.jsx)(f.ZP,{type:"primary",className:"mr20",ghost:!0,onClick:T,children:"删除实践项目"}):(0,R.jsx)(f.ZP,{type:"primary",className:"mr20",ghost:!0,onClick:I,children:"删除实践项目"}):null,1===(null===(k=i.detail)||void 0===k?void 0:k.identity)&&2===(null===(C=i.setting)||void 0===C||null===(C=C.shixun)||void 0===C?void 0:C.status)&&(0,R.jsx)(f.ZP,{type:"primary",ghost:!0,onClick:P,children:"永久关闭"})]}),children:[(0,R.jsx)(Me,{tab:"基本信息",children:(0,R.jsx)(G,{})},He.BasicInfo),(0,R.jsx)(Me,{tab:"权限配置",children:(0,R.jsx)(me,{})},He.Permission),(0,R.jsx)(Me,{tab:"评测设置",children:(0,R.jsx)(we,{active:b})},He.TestCase),(0,R.jsx)(Me,{tab:"参考答案",children:(0,R.jsx)(qe,{})},He.SuggestedAnswer),!(null!==(t=i.detail)&&void 0!==t&&t.is_jupyter)&&(0,R.jsx)(Me,{tab:"学习页面设置",children:(0,R.jsx)(Ae,{})},He.Learning)]})})}))},97952:function(e,n,t){t.d(n,{Z:function(){return O}});var i=t(7557),s=t.n(i),a=t(41498),l=t.n(a),r=t(79800),c=t.n(r),o=t(39647),u=t.n(o),d=t(59301),h=t(80608),p=t(24650),m=t(78241),v=t(43418),f=t(8591),x=t(53326),g=t(3113),j=t(71681),_=t(55351),y="formWrap___aNgan",b="upload___yGdLQ",N="color0152d9___zzEpS",S="colorCCC___k4Dxq",Z="footerWrap___WrUZd",w="qrCode___GPwSg",k="a1___R6etl",C="code___fCL_L",P="group___n7tgy",T="groupNumber___tw7hA",I="a2___GGjDE",E=t(37712),D=["newShixuns","globalSetting","loading","dispatch"],A=p.Z.TextArea,O=(0,h.connect)((function(e){var n=e.newShixuns,t=e.loading;return{newShixuns:n,globalSetting:e.globalSetting,loading:t.effects}}))((function(e){var n=e.newShixuns,t=(e.globalSetting,e.loading),i=e.dispatch,a=(u()(e,D),m.Z.useForm()),r=c()(a,1)[0],o=(0,d.useState)([]),h=c()(o,2),p=h[0],O=h[1],F=function(){var e=l()(s()().mark((function e(n){var t,a,l,r,c,o;return s()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return l=(a=n||{}).language,r=a.env,c=a.mode,a.code,e.next=3,i({type:"newShixuns/applyShixunMirror",payload:{language:l,runtime:r,run_method:c,attachment_id:null==p||null===(t=p[0])||void 0===t||null===(t=t.response)||void 0===t?void 0:t.id}});case 3:o=e.sent,i({type:"newShixuns/setActionTabs",payload:{}}),o&&f.ZP.success("新建申请已提交,请等待管理员审核。");case 6:case"end":return e.stop()}}),e)})));return function(n){return e.apply(this,arguments)}}();return(0,E.jsxs)(v.Z,{centered:!0,keyboard:!1,closable:!1,destroyOnClose:!0,open:"NewShixuns-Apply"===n.actionTabs.key,title:"申请新建",width:"1000px",footer:null,afterClose:function(){r.resetFields(),O([])},children:[(0,E.jsxs)("section",{className:w,children:[(0,E.jsxs)("aside",{className:k,children:[(0,E.jsx)("div",{className:C,children:(0,E.jsx)("img",{width:120,height:120,src:_,alt:"二维码"})}),(0,E.jsx)("div",{className:P,children:"实验环境申请QQ群"}),(0,E.jsx)("div",{className:T,children:"群号:740157011"})]}),(0,E.jsxs)("aside",{className:I,children:["尊敬的老师/同学您好,",(0,E.jsx)("br",{}),"如果您想新建实验环境,可以扫描左侧二维码进群,直接向我们的工作人员申请哦~ 也可以提交下面的表单申请,我们的工作人员收到申请信息将会第一时间联系您!"]})]}),(0,E.jsxs)(m.Z,{className:y,form:r,labelCol:{span:4},wrapperCol:{span:20},onFinish:F,children:[(0,E.jsx)(m.Z.Item,{label:"语言:",name:"language",rules:[{required:!0,message:"请填写该镜像语言"}],children:(0,E.jsx)(A,{placeholder:"请填写该镜像是基于什么语言:示例:Python",rows:4})}),(0,E.jsx)(m.Z.Item,{label:"系统环境:",name:"env",rules:[{required:!0,message:"请填写该镜像语言系统环境"}],children:(0,E.jsx)(A,{placeholder:"请填写该镜像是基于什么linux系统环境,代码运行环境",rows:4})}),(0,E.jsx)(m.Z.Item,{label:"测试代码运行方式:",name:"mode",rules:[{required:!0,message:"请填写该镜像测试代码运行方式"}],children:(0,E.jsx)(A,{placeholder:"请填写该镜像中测试代码运行方式",rows:4})}),(0,E.jsx)(m.Z.Item,{label:"测试代码:",name:"code",rules:[{required:!0,message:"请上传附件"}],children:(0,E.jsx)("div",{className:b,children:(0,E.jsxs)(x.Z,{fileList:p,action:"".concat(j.Z.API_SERVER,"/api/attachments.json?client_key=6d57f8c3dd186c5ada392546ace9620a"),onChange:function(e){["uploading","done","removed"].includes(e.file.status)&&O(e.fileList)},onRemove:function(e){if(!e.percent||100==e.percent){var n,t=null===(n=e.response)||void 0===n?void 0:n.id;return v.Z.confirm({centered:!0,title:"确定要删除这个附件吗?",okText:"确定",cancelText:"取消",onOk:(a=l()(s()().mark((function e(){return s()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,i({type:"newShixuns/deleteAttachment",payload:{id:t}});case 2:e.sent&&O(p.filter((function(e){var n;return(null===(n=e.response)||void 0===n?void 0:n.id)!==t})));case 4:case"end":return e.stop()}}),e)}))),function(){return a.apply(this,arguments)})}),!1}var a},beforeUpload:function(e){return!p.length&&(!(e.size/1024/1024>50)||(f.ZP.info("文件大小必须小于50MB"),!1))},withCredentials:!0,children:[(0,E.jsx)("span",{className:"".concat(N," current"),children:"上传附件"}),(0,E.jsx)("span",{className:"".concat(S," ml10"),children:"(单个文件50M以内)"})]})})}),(0,E.jsx)("div",{className:Z,children:(0,E.jsxs)(m.Z.Item,{children:[(0,E.jsx)(g.ZP,{className:"mr5",size:"middle",onClick:function(){i({type:"newShixuns/setActionTabs",payload:{}})},children:"取消"}),(0,E.jsx)(g.ZP,{size:"middle",type:"primary",htmlType:"submit",loading:t["newShixuns/applyShixunMirror"],children:"保存"})]})})]})]})}))},50341:function(e,n,t){var i=t(79800),s=t.n(i),a=t(59301),l=t(80608),r=t(43418),c=t(55351),o=t(37712);n.Z=(0,l.connect)((function(e){var n=e.newShixuns,t=e.user;return{newShixuns:n,globalSetting:e.globalSetting,user:t}}))((function(e){var n,t=e.newShixuns,i=e.dispatch,u=e.user,d=(0,a.useState)(!1),h=s()(d,2),p=h[0],m=h[1];(0,a.useEffect)((function(){"Create-Environment"===t.actionTabs.key&&v()}),[null==t||null===(n=t.actionTabs)||void 0===n?void 0:n.key]);var v=function(){var e,n,t;if(i({type:"newShixuns/setActionTabs",payload:{}}),0===(null===(e=u.userInfo)||void 0===e?void 0:e.mirror_marker_status))m(!0);else if(1===(null===(n=u.userInfo)||void 0===n?void 0:n.mirror_marker_status)){var s;l.history.push("/users/".concat(null===(s=u.userInfo)||void 0===s?void 0:s.login,"/experiment-img/add"))}else 2===(null===(t=u.userInfo)||void 0===t?void 0:t.mirror_marker_status)&&r.Z.confirm({title:"您今日已达到申请上限,是否跳转至云主机列表?",content:"提示:每天最多允许申请一台云主机",okText:"跳转",cancelText:"取消",onOk:function(){var e;l.history.push("/users/".concat(null===(e=u.userInfo)||void 0===e?void 0:e.login,"/experiment-img"))}})};return(0,o.jsxs)(r.Z,{title:"加入qq群提示",open:p,footer:null,onCancel:function(){m(!1)},children:[(0,o.jsxs)("div",{style:{textAlign:"center"},children:[(0,o.jsx)("br",{}),(0,o.jsx)("img",{width:120,height:120,style:{marginTop:"20px"},src:c,alt:"二维码"})]}),(0,o.jsx)("img",{})]})}))},78802:function(e,n,t){t.d(n,{Z:function(){return h}});var i=t(59301),s=t(43418),a=t(4585),l="wrapInstallPackageStyle___AU1GI",r="installPackageStyle___k2iyn",c="title___oN9OA",o="line___PxUeH",u="bodyHeight___QO5he",d=t(37712),h=function(e){var n,t,h=e.installPackage,p=e.visible,m=e.setVisible;return(0,i.useEffect)((function(){return p?document.body.setAttribute("class",u):document.body.removeAttribute("class"),function(){document.body.removeAttribute("class")}}),[p]),(0,d.jsx)(s.Z,{centered:!0,keyboard:!1,destroyOnClose:!0,open:p,title:"环境介绍",width:"1000px",wrapClassName:l,footer:null,onCancel:function(){return m(!1)},children:(0,d.jsxs)("div",{className:r,children:[(0,d.jsxs)("div",{className:"mb30",children:[(0,d.jsx)("div",{className:c,children:h.mainTypeName}),(0,d.jsx)("div",{children:(0,d.jsx)(a.Z,{value:h.mainTypeDescription})})]}),!(null==h||null===(n=h.smallType)||void 0===n||!n.length)&&(0,d.jsx)("div",{className:o}),(0,d.jsx)("div",{children:null==h||null===(t=h.smallType)||void 0===t?void 0:t.map((function(e,n){return(0,d.jsxs)(i.Fragment,{children:[(0,d.jsx)("div",{className:c,style:{marginBottom:14},children:e.name}),(0,d.jsx)("div",{className:"mb30",children:(0,d.jsx)(a.Z,{value:e.des})})]},n)}))})]})})}}}]); |