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

1 line
11 KiB

This file contains ambiguous Unicode characters!

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

"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[94498],{75530:function(e,t,n){n.d(t,{t:function(){return h}});var a=n(26801),i=n.n(a),s=(n(59301),n(3113)),r="buttonFixed___vyq30",c="button___hxmYv",l="buttonWrap___uK8dl",u=n(73287),o=n.n(u),d=n(37712),h=function(e){var t=e.cancelText,n=void 0===t?"取消":t,a=e.okText,u=void 0===a?"确定":a,h=e.loading,f=void 0!==h&&h,m=e.hasOkBtn,p=void 0===m||m,x=e.hasCancelBtn,v=void 0===x||x,g=e.okButtonProps,_=void 0===g?{}:g,j=e.onCancel,b=void 0===j?function(){}:j,y=e.onOk,k=void 0===y?function(){}:y,Z=e.className,S=void 0===Z?"":Z;return(0,d.jsx)("div",{className:o()(r,S),children:(0,d.jsxs)("div",{className:l,children:[v&&(0,d.jsx)(s.ZP,{size:"middle",className:"".concat(c," mr20"),onClick:b,children:n}),p&&(0,d.jsx)(s.ZP,i()(i()({size:"middle",type:"primary",className:"".concat(c," mr20"),loading:f,onClick:k},_),{},{children:u}))]})})}},69461:function(e,t,n){n.r(t),n.d(t,{default:function(){return D}});var a=n(10574),i=n.n(a),s=n(39343),r=n.n(s),c=n(26801),l=n.n(c),u=n(11006),o=n.n(u),d=n(59301),h=n(22211),f=n(78241),m=n(8591),p=n(43418),x=n(1056),v=n(5112),g=n(95237),_=n(43604),j=n(57809),b=n(22387),y=n(49185),k="bg___Y4VEx",Z="formWrap___JY9de",S=n(89392),N=n(75530),w=n(89048),I=n(95667),P=n(9241),T=n(93923),C=n.n(T),B=n(27161),L=n.n(B),F=n(49127),V=n(3113),E=n(37712),q=["InputRight","value","onChange"],O=function(e){var t=e.InputRight,n=e.value,a=void 0===n?[]:n,i=e.onChange,s=void 0===i?function(){}:i,r=L()(e,q),c=(0,d.useState)(),u=o()(c,2),h=u[0],f=u[1],m=function(e){e.preventDefault(),h&&(s([].concat(C()(a),[h])),f(null))};return(0,E.jsxs)("div",{children:[(0,E.jsx)(x.Z,l()(l()({},r),{},{value:h,onChange:function(e){return f(e.target.value)},onPressEnter:m,onBlur:m})),t,(0,E.jsx)("div",{className:"mt20",children:null==a?void 0:a.map((function(e,t){return(0,E.jsx)(F.Z,{className:"ml10 mr10",count:"x",onClick:function(){return function(e){var t=a.filter((function(t,n){return n!==e}));s(t)}(t)},children:(0,E.jsx)(V.ZP,{type:"primary",ghost:!0,children:e})})}))})]})},R={1:[100,200],2:[300,400,500,600],3:[700,800,900,1e3]},D=(0,h.connect)((function(e){return{shixunsDetail:e.shixunsDetail,newCourse:e.newCourse,globalSetting:e.globalSetting,practiceSetting:e.practiceSetting}}))((function(e){var t,n,a,s,c,u=e.shixunsDetail,T=e.dispatch,C=e.practiceSetting,B=(0,h.useParams)(),L=f.Z.useForm(),F=o()(L,1)[0],V=(0,d.useState)({}),q=o()(V,2),D=q[0],Q=q[1],W=(0,d.useState)([100,200]),Y=o()(W,2),z=Y[0],G=Y[1],U=u.challengesNew,H=(0,d.useState)(),J=o()(H,2),K=J[0],M=J[1],A=(0,d.useState)(),X=o()(A,2),$=X[0],ee=X[1],te=(0,d.useState)(!0),ne=o()(te,2),ae=ne[0],ie=ne[1],se=(0,d.useState)(1),re=o()(se,2),ce=re[0],le=(re[1],(0,d.useRef)({subject:"",difficulty:1,hide_task_pass:!1,score:100,hide_width_rate:40,task_pass:(0,P.S)(U.task_pass_default)})),ue=(0,d.useRef)(null),oe=(C.selectQuestionParams,C.id),de=C.newQuestion;(0,d.useEffect)((function(){B.challengesId?(ee(!0),he()):(ie(!0),ee(!1),T({type:"shixunsDetail/getChallengesNew",payload:l()({},B)}),ie(!1)),setTimeout((function(){var e;null===(e=document.getElementById("practice-scroll"))||void 0===e||e.scrollTo(0,0)}),300)}),[B]),(0,d.useEffect)((function(){return pe(),function(){clearTimeout(ue.current)}}),[D]);var he=function(){var e=r()(i()().mark((function e(){var t,n;return i()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return ie(!0),e.next=3,(0,y.ii)({id:B.id,challengeId:B.challengesId,tab:0});case 3:(t=e.sent)&&(n=l()(l()({},t),{},{task_pass:(0,P.S)(t.task_pass)}),M(n),fe(n),ie(!1),le.current={subject:n.subject,difficulty:n.difficulty,score:n.score,task_pass:n.task_pass,hide_task_pass:n.hide_task_pass,hide_width_rate:n.hide_width_rate});case 5:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),fe=function(e){var t={subject:e.name,difficulty:e.difficulty,score:e.score,challenge_tag:e.tags,task_pass:e.task_pass,hide_task_pass:e.hide_task_pass,hide_width_rate:e.hide_width_rate},n=R[e.difficulty];G(n),F.setFieldsValue(l()({},t)),Q(l()({},t))},me=function(){var e=r()(i()().mark((function e(){var t,n,a,s,r=arguments;return i()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=r.length>0&&void 0!==r[0]?r[0]:{},$||2!==(null===(t=u.detail)||void 0===t?void 0:t.shixun_status)){e.next=4;break}return m.ZP.info("该实训已经发布不能新建"),e.abrupt("return");case 4:if(!$){e.next=10;break}return e.next=7,(0,y.Rs)(l()(l()({},B),{},{tab:0,challenge:l()({},n),challenge_tag:n.challenge_tag}));case 7:return e.sent&&(T({type:"practiceSetting/setUpdateIndex"}),h.history.replace("/shixuns/".concat(B.id,"/edit/").concat(B.challengesId,"/tab=2"))),e.abrupt("return");case 10:return(a=l()({},D)).identifier=B.id,a.st=0,e.next=15,(0,y.al)(l()({},a));case 15:1===(s=e.sent).status&&(h.history.replace("/shixuns/".concat(B.id,"/edit/").concat(s.challenge_id,"/tab=2")),setTimeout((function(){T({type:"practiceSetting/setParams",payload:{newQuestion:null}}),T({type:"practiceSetting/setUpdateIndex"})}),200));case 17:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),pe=function(){clearTimeout(ue.current),ue.current=setTimeout(xe,500)},xe=function(){"subject"in D&&de&&T({type:"practiceSetting/setParams",payload:{newQuestion:{st:0,name:null==D?void 0:D.subject}}});var e=["subject","difficulty","score","task_pass"].some((function(e){var t=(0,S.isNumber)(D[e])?String(D[e]):D[e],n=(0,S.isNumber)(le.current[e])?String(le.current[e]):le.current[e];return!(0,S.isEqual)(t,n)}));T(e?{type:"practiceSetting/setSideBarTabs",payload:{confirmLeave:!0}}:{type:"practiceSetting/setSideBarTabs",payload:{confirmLeave:!1}})},ve=function(){var e,t=function(){h.history.push("/shixuns/".concat(oe,"/challenges")),T({type:"practiceSetting/setSideBarTabs",payload:{confirmLeave:!1}})};null!=C&&null!==(e=C.sideBar)&&void 0!==e&&e.confirmLeave?p.Z.confirm({title:"离开此页提示",content:"系统可能不会保存您所做的更改。",okText:"离开",cancelText:"取消",onOk:function(){t()}}):t()};return(0,E.jsxs)(d.Fragment,{children:[(0,E.jsx)("section",{className:k,id:"practice-scroll",children:(0,E.jsxs)(f.Z,{form:F,className:Z,scrollToFirstError:!0,layout:"vertical",onValuesChange:function(e,t){var n,a,i;Q(l()({},F.getFieldsValue())),"difficulty"in e&&(n=e.difficulty,i=null==(a=R[n])?void 0:a[0],G(a),F.setFieldsValue({score:i}),Q(l()(l()({},F.getFieldsValue()),{score:i})))},onFinish:me,children:[(0,E.jsx)(I.Z,{activeIndex:0,isEdit:$}),(0,E.jsx)(f.Z.Item,{initialValue:"",name:"subject",label:"任务名称:",rules:[{required:!0,message:"请输入任务名称"}],children:(0,E.jsx)(x.Z,{bordered:!1,maxLength:60,suffix:"".concat((null===(t=D.subject)||void 0===t?void 0:t.length)||0,"/60"),placeholder:"例如从Python程序设计-入门精通"})}),(0,E.jsx)(f.Z.Item,{name:"task_pass",label:"任务要求:",rules:[{required:!0,message:"请输入作业的简介"},{max:35e3,message:"过关任务简介最大限制35000个字符"}],children:(0,E.jsx)(b.Z,{watch:!0,defaultValue:$?null==K?void 0:K.task_pass:U.task_pass_default},B.challengesId||"3")}),(0,E.jsx)(f.Z.Item,{initialValue:40,name:"hide_width_rate",label:"任务要求默认展示宽度:",children:(0,E.jsxs)(v.ZP.Group,{children:[(0,E.jsx)(v.ZP,{value:0,children:"0%"}),(0,E.jsx)(v.ZP,{style:{marginLeft:70},value:30,children:"30%"}),(0,E.jsx)(v.ZP,{style:{marginLeft:70},value:40,children:"40%"}),(0,E.jsx)(v.ZP,{style:{marginLeft:70},value:50,children:"50%"})]})}),D.unity_3d&&(null===(n=u.detail)||void 0===n?void 0:n.identity)<3&&(0,E.jsx)(f.Z.Item,{name:"unity_3d_routes",label:"路径:",rules:[{required:!0,message:"必填项:不能为空"}],children:(0,E.jsx)(x.Z,{bordered:!1,disabled:2===(null===(a=u.detail)||void 0===a?void 0:a.shixun_status),placeholder:"请选择版本库中的代码文件。例: src/step1/HelloWorld.java"})}),(0,E.jsx)(f.Z.Item,{initialValue:1,name:"difficulty",label:"难度系数:",rules:[{required:!0,message:"请选择难度系数"}],children:(0,E.jsxs)(v.ZP.Group,{disabled:2===(null===(s=u.detail)||void 0===s?void 0:s.shixun_status),children:[(0,E.jsx)(v.ZP,{value:1,children:"简单"}),(0,E.jsx)(v.ZP,{style:{marginLeft:70},value:2,children:"中等"}),(0,E.jsx)(v.ZP,{style:{marginLeft:70},value:3,children:"困难"})]})}),(0,E.jsx)(f.Z.Item,{name:"challenge_tag",label:(0,E.jsxs)("div",{children:["技能标签 ",(0,E.jsx)("span",{className:"pl20 font12 c-light-black",children:"学员答题正确将获得技能,否则不能获得技能(回车添加标签)"})]}),rules:[{required:!0,message:"请输入技能标签"}],children:(0,E.jsx)(O,{placeholder:"添加标签",style:{width:"260px"},InputRight:(0,E.jsx)("span",{className:"ml5",children:"(回车添加标签)"})})}),(0,E.jsxs)(g.Z,{className:"customItemSelect",children:[(0,E.jsx)(_.Z,{children:(0,E.jsx)(f.Z.Item,{name:"score",initialValue:100,label:"奖励金币:",rules:[{required:!0,message:"请选择奖励经验值"}],children:(0,E.jsx)(j.default,{disabled:2===(null===(c=u.detail)||void 0===c?void 0:c.shixun_status),bordered:!1,getPopupContainer:function(e){return e.parentNode},style:{width:260},children:null==z?void 0:z.map((function(e,t){return(0,E.jsx)(j.default.Option,{value:e,children:e},t)}))})})}),(0,E.jsx)(_.Z,{flex:1,children:(0,E.jsx)("div",{style:{marginTop:88},className:"font12 c-light-black ml10",children:" 学员正确答题时获得金币,并且获得等量的经验值。如:+100金币、+100经验值"})})]})]},ce)},1),(0,E.jsx)(N.t,{onOk:function(){return F.submit()},className:"customFixedButton",onCancel:function(){ve()}},2),(0,E.jsx)(w.Z,{loading:ae})]})}))},95667:function(e,t,n){n.d(t,{Z:function(){return c}});var a=n(59301),i=n(43418),s=n(22211),r=n(37712),c=(0,s.connect)((function(e){return{globalSetting:e.globalSetting,practiceSetting:e.practiceSetting}}))((function(e){var t=e.activeIndex,n=e.isEdit,c=void 0===n||n,l=e.dispatch,u=e.practiceSetting,o=(0,s.useParams)(),d=o.id,h=o.challengesId,f=(0,a.useMemo)((function(){return[{name:"本关任务",url:"/shixuns/".concat(d,"/edit/").concat(h,"/editcheckpoint")},{name:"评测设置",url:"/shixuns/".concat(d,"/edit/").concat(h,"/tab=2")},{name:"参考答案",url:"/shixuns/".concat(d,"/edit/").concat(h,"/tab=3")},{name:"关卡排行榜",url:"/shixuns/".concat(d,"/edit/").concat(h,"/tab=4")}]}),[d,h]);return(0,r.jsx)("ul",{className:"challenge-nav",children:c?f.map((function(e,n){return t===n?(0,r.jsxs)("li",{children:[" ",(0,r.jsx)("a",{className:"active",children:e.name})," "]},e.url):(0,r.jsxs)("li",{children:[" ",(0,r.jsx)("a",{onClick:function(){return t=e.url,a=function(){s.history.push(t),l({type:"practiceSetting/setSideBarTabs",payload:{confirmLeave:!1}})},void(null!=u&&null!==(n=u.sideBar)&&void 0!==n&&n.confirmLeave?i.Z.confirm({title:"离开此页提示",content:"系统可能不会保存您所做的更改。",okText:"离开",cancelText:"取消",onOk:function(){a()}}):a());var t,n,a},children:e.name})," "]},e.url)})):(0,r.jsxs)("li",{children:[" ",(0,r.jsx)("a",{className:"active",children:f[0].name})," "]},f[0].url)})}))},89048:function(e,t,n){n.d(t,{Z:function(){return r}});n(59301);var a=n(71418),i="loading___lueiN",s=n(37712),r=function(e){return e.loading?(0,s.jsx)("div",{className:i,children:(0,s.jsx)(a.Z,{})}):(0,s.jsx)(s.Fragment,{})}},9241:function(e,t,n){n.d(t,{S:function(){return a}});var a=function(e){var t=document.createElement("textarea");return t.value=e,t.value}}}]);