"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[64496],{81590:function(e,t,n){n.r(t),n.d(t,{default:function(){return S}});var o=n(7557),r=n.n(o),i=n(82242),a=n.n(i),s=n(41498),l=n.n(s),u=n(79800),c=n.n(u),d=n(59301),p=n(15754),f=n(8591),m=n(92832),h=n(3113),v=n(52774),g=n(37712);var x=function(e){var t=e.setIscreate,n=e.init,o=e.UpdateItem,i=(0,d.useState)(""),a=c()(i,2),s=a[0],u=a[1],x=(0,d.useState)(""),b=c()(x,2),w=b[0],C=b[1];function y(){return(y=l()(r()().mark((function e(){return r()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(s){e.next=3;break}return f.ZP.info("标题不能为空"),e.abrupt("return");case 3:if(w){e.next=6;break}return f.ZP.info("内容不能为空"),e.abrupt("return");case 6:if(!o){e.next=9;break}return I(),e.abrupt("return");case 9:return e.next=11,(0,v.ZP)("/api/hpc_courses.json",{method:"post",body:{name:s,description:w,container_type:window.location.pathname.split("/")[1]}});case 11:e.sent&&(f.ZP.info("创建成功"),t(!1),n("add"));case 13:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function I(){return S.apply(this,arguments)}function S(){return(S=l()(r()().mark((function e(){return r()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,v.ZP)("/api/hpc_courses/".concat(o.id,".json"),{method:"put",body:{name:s,description:w,container_type:window.location.pathname.split("/")[1]}});case 2:e.sent&&(f.ZP.info("编辑成功"),t(!1),n(""));case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}return(0,d.useEffect)((function(){o&&(u(o&&o.name),C(o&&o.description))}),[o]),(0,g.jsxs)("div",{children:[(0,g.jsx)(m.Z,{style:{marginBottom:"20px"},placeholder:"请输入标题",value:s,maxLength:60,addonAfter:String(s.length)+"/60",onChange:function(e){return u(e.target.value)}}),(0,g.jsx)(p.Z,{id:"courseContentMD",defaultValue:w,onChange:function(e){return C(e)}}),(0,g.jsxs)("div",{className:"clearfix mt30 mb30",children:[(0,g.jsx)(h.ZP,{type:"primary",onClick:function(){return function(){return y.apply(this,arguments)}()},className:"defalutSubmitbtn fl mr20",children:"提交"}),(0,g.jsx)("a",{className:"defalutCancelbtn fl",onClick:function(){return t(!1)},children:"取消"})]})]})},b=n(40848);var w=function(e){var t=e.CourseItem,n=e.userId,o=e.init,i=e.ItemUpdate,a=e.setSee,s=e.UserInfo;function u(){return(u=l()(r()().mark((function e(){return r()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,v.ZP)("/api/hpc_courses/".concat(t.id,".json"),{method:"delete"});case 2:e.sent&&(f.ZP.info("删除成功"),o("delete"),a(!1));case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}return(0,g.jsxs)("div",{children:[299635===n||301458===n||null!=s&&s.admin||null!=s&&s.business?(0,g.jsxs)("div",{style:{textAlign:"right"},children:[(0,g.jsx)(h.ZP,{onClick:function(){i(t)},children:"编辑"}),(0,g.jsx)(h.ZP,{onClick:function(){return function(){return u.apply(this,arguments)}()},style:{marginLeft:"30px"},children:"删除"})]}):null,(0,g.jsx)("h1",{children:null==t?void 0:t.name}),(0,g.jsx)(b.Z,{value:null==t?void 0:t.description})]})},C=n(24645),y=n(19219),I=n(97682);var S=(0,I.connect)((function(e){return{user:e.user}}))((function(e){var t,n,o,i,s,u,p,m,b,S=e.user,O=e.dispatch,Z=(0,d.useState)(1),_=c()(Z,2),j=_[0],k=(_[1],(0,d.useState)(100)),P=c()(k,2),N=P[0],E=(P[1],(0,d.useState)([])),M=c()(E,2),R=M[0],L=M[1],$=(0,d.useState)(!1),A=c()($,2),F=A[0],D=A[1],T=(0,d.useState)(!1),W=c()(T,2),U=W[0],B=W[1],V=(0,d.useState)(""),H=c()(V,2),z=H[0],X=H[1],Y=(0,d.useState)(""),G=c()(Y,2),Q=G[0],q=G[1],J=(0,d.useState)(""),K=c()(J,2),ee=K[0],te=K[1],ne=(0,I.useParams)().itemname,oe=(0,d.useState)(""),re=c()(oe,2),ie=re[0],ae=re[1];function se(e){return le.apply(this,arguments)}function le(){return(le=l()(r()().mark((function e(t){var n,o,i,a;return r()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,v.ZP)("/api/hpc_courses.json",{method:"get",params:{page:j,per_page:N,container_type:window.location.pathname.split("/")[1]}});case 2:if(!(n=e.sent)){e.next=24;break}if(o=n.data.hpc_courses.length,L(n.data.hpc_courses),te(n.data.file_url),q(""),o){e.next=10;break}return e.abrupt("return");case 10:if(ie){e.next=14;break}ne?(a=0,null==n||null===(i=n.data)||void 0===i||null===(i=i.hpc_courses)||void 0===i||i.map((function(e,t){var n;(null==ne?void 0:ne.toLocaleLowerCase())===(null==e||null===(n=e.name)||void 0===n?void 0:n.toLocaleLowerCase())&&(a=t)})),X(n.data.hpc_courses[a]),B(!0),ae(n.data.hpc_courses[a].id),"resources"===(null==ne?void 0:ne.toLocaleLowerCase())&&(X(n.data.hpc_courses.filter((function(e){return 15===e.id}))[0]),B(!0),ae(15))):(X(n.data.hpc_courses[0]),B(!0),ae(n.data.hpc_courses[0].id)),e.next=24;break;case 14:if("delete"!==t){e.next=23;break}if(0!==o){e.next=18;break}return B(!1),e.abrupt("return");case 18:X(n.data.hpc_courses[0]),B(!0),ae(n.data.hpc_courses[0].id),e.next=24;break;case 23:"add"===t?(X(n.data.hpc_courses[o-1]),B(!0),ae(n.data.hpc_courses[o-1].id)):(X(n.data.hpc_courses.filter((function(e){return e.id===ie}))[0]),B(!0),ae(ie));case 24:case"end":return e.stop()}}),e)})))).apply(this,arguments)}(0,d.useEffect)((function(){O({type:"globalSetting/headerToggle",payload:!1}),j&&se("")}),[j]);var ue={name:"file",multiple:!0,action:"https://www.educoder.net/api/hpc_courses/upload_file.json",data:{container_type:window.location.pathname.split("/")[1]},onChange:function(e){var t=e.file.status;"done"===t?(f.ZP.success("".concat(e.file.name," 文件上传成功")),se("")):"error"===t&&f.ZP.error("".concat(e.file.name," 文件上传失败"))},beforeUpload:function(e){var t=e.size/1024/1024<150;return t||f.ZP.info("文件大小必须小于150MB"),t}};return(0,g.jsxs)("div",{style:{marginBottom:"40px"},children:[(0,g.jsx)("div",{className:"bannterdiv",style:{background:"url(".concat(y.Z.IMG_SERVER+"/".concat(ee),")")}}),(0,g.jsx)("img",{style:{width:"100%"},src:y.Z.IMG_SERVER+"/".concat(ee)}),(0,g.jsxs)("div",{className:"edu-container minH500",style:{display:"flex",width:"1200px"},children:[(0,g.jsxs)("div",{style:{flex:"1",marginTop:"17px"},children:[R&&R.map((function(e,t){return(0,g.jsx)("p",{onClick:function(){return function(e){D(!1),B(!0),X(e),ae(e.id)}(e)},className:ie===e.id?"menuitemselect":"menuitem task-hide",children:e.name},t)})),299635===(null==S||null===(t=S.userInfo)||void 0===t?void 0:t.user_id)||301458===(null==S||null===(n=S.userInfo)||void 0===n?void 0:n.user_id)||null!=S&&null!==(o=S.userInfo)&&void 0!==o&&o.admin||null!=S&&null!==(i=S.userInfo)&&void 0!==i&&i.business?(0,g.jsx)("p",{onClick:function(){return q(""),D(!0),void B(!1)},className:"menuadd",style:{fontSize:"24px",paddingLeft:"10px"},children:(0,g.jsx)("span",{style:{fontSize:"16px",marginLeft:"5px"},children:"Last updated"})}):null]}),(0,g.jsxs)("div",{className:"rightcount",style:{flex:"6",background:"#ffffff",padding:"20px",marginLeft:"30px",marginTop:"24px"},children:[F?(0,g.jsx)(x,{UpdateItem:Q,setIscreate:D,init:se}):null,U?(0,g.jsx)(w,{UserInfo:null==S?void 0:S.userInfo,setSee:B,userId:null==S||null===(s=S.userInfo)||void 0===s?void 0:s.user_id,ItemUpdate:function(e){q(e),D(!0),B(!1)},CourseItem:z,init:se}):null]})]}),299635===(null==S||null===(u=S.userInfo)||void 0===u?void 0:u.user_id)||301458===(null==S||null===(p=S.userInfo)||void 0===p?void 0:p.user_id)||null!=S&&null!==(m=S.userInfo)&&void 0!==m&&m.admin||null!=S&&null!==(b=S.userInfo)&&void 0!==b&&b.business?(0,g.jsx)(C.Z,a()(a()({},ue),{},{children:(0,g.jsx)(h.ZP,{className:"menuadd",style:{paddingLeft:"10px",marginLeft:"20px"},children:"上传首页图片"})})):null]})}))},56762:function(e,t,n){n.d(t,{Z:function(){return r}});var o=n(59301);function r(){const[,e]=o.useReducer((e=>e+1),0);return e}},57809:function(e,t,n){var o=n(92310),r=n.n(o),i=n(77861),a=n(55405),s=n(59301),l=n(53487),u=n(62892),c=n(19080),d=n(36355),p=n(1684),f=n(93891),m=n(19716),h=n(32441),v=n(33234),g=n(14154),x=n(58582),b=n(84443),w=n(66339),C=function(e,t){var n={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(n[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(o=Object.getOwnPropertySymbols(e);r{var n,{prefixCls:o,bordered:l=!0,className:I,rootClassName:S,getPopupContainer:O,popupClassName:Z,dropdownClassName:_,listHeight:j=256,placement:k,listItemHeight:P=24,size:N,disabled:E,notFoundContent:M,status:R,builtinPlacements:L,dropdownMatchSelectWidth:$,popupMatchSelectWidth:A,direction:F,style:D,allowClear:T}=e,W=C(e,["prefixCls","bordered","className","rootClassName","getPopupContainer","popupClassName","dropdownClassName","listHeight","placement","listItemHeight","size","disabled","notFoundContent","status","builtinPlacements","dropdownMatchSelectWidth","popupMatchSelectWidth","direction","style","allowClear"]);const{getPopupContainer:U,getPrefixCls:B,renderEmpty:V,direction:H,virtual:z,popupMatchSelectWidth:X,popupOverflow:Y,select:G}=s.useContext(d.E_),Q=B("select",o),q=B(),J=null!=F?F:H,{compactSize:K,compactItemClassnames:ee}=(0,v.ri)(Q,J),[te,ne]=(0,g.Z)(Q),oe=s.useMemo((()=>{const{mode:e}=W;if("combobox"!==e)return e===y?"combobox":e}),[W.mode]),re="multiple"===oe||"tags"===oe,ie=(0,b.Z)(W.suffixIcon,W.showArrow),ae=null!==(n=null!=A?A:$)&&void 0!==n?n:X,{status:se,hasFeedback:le,isFormItemInput:ue,feedbackIcon:ce}=s.useContext(h.aM),de=(0,c.F)(se,R);let pe;pe=void 0!==M?M:"combobox"===oe?null:(null==V?void 0:V("Select"))||s.createElement(f.Z,{componentName:"Select"});const{suffixIcon:fe,itemIcon:me,removeIcon:he,clearIcon:ve}=(0,w.Z)(Object.assign(Object.assign({},W),{multiple:re,hasFeedback:le,feedbackIcon:ce,showSuffixIcon:ie,prefixCls:Q,showArrow:W.showArrow,componentName:"Select"})),ge=!0===T?{clearIcon:ve}:T,xe=(0,a.Z)(W,["suffixIcon","itemIcon"]),be=r()(Z||_,{[`${Q}-dropdown-${J}`]:"rtl"===J},S,ne),we=(0,m.Z)((e=>{var t;return null!==(t=null!=N?N:K)&&void 0!==t?t:e})),Ce=s.useContext(p.Z),ye=null!=E?E:Ce,Ie=r()({[`${Q}-lg`]:"large"===we,[`${Q}-sm`]:"small"===we,[`${Q}-rtl`]:"rtl"===J,[`${Q}-borderless`]:!l,[`${Q}-in-form-item`]:ue},(0,c.Z)(Q,de,le),ee,null==G?void 0:G.className,I,S,ne),Se=s.useMemo((()=>void 0!==k?k:"rtl"===J?"bottomRight":"bottomLeft"),[k,J]),Oe=(0,x.Z)(L,Y);return te(s.createElement(i.ZP,Object.assign({ref:t,virtual:z,showSearch:null==G?void 0:G.showSearch},xe,{style:Object.assign(Object.assign({},null==G?void 0:G.style),D),dropdownMatchSelectWidth:ae,builtinPlacements:Oe,transitionName:(0,u.m)(q,"slide-up",W.transitionName),listHeight:j,listItemHeight:P,mode:oe,prefixCls:Q,placement:Se,direction:J,suffixIcon:fe,menuItemSelectedIcon:me,removeIcon:he,allowClear:ge,notFoundContent:pe,className:Ie,getPopupContainer:O||U,dropdownClassName:be,disabled:ye})))};const S=s.forwardRef(I),O=(0,l.Z)(S);S.SECRET_COMBOBOX_MODE_DO_NOT_USE=y,S.Option=i.Wx,S.OptGroup=i.Xo,S._InternalPanelDoNotUseOrYouWillBeFired=O,t.default=S},8378:function(e,t){t.Z=e=>({[e.componentCls]:{[`${e.antCls}-motion-collapse-legacy`]:{overflow:"hidden","&-active":{transition:`height ${e.motionDurationMid} ${e.motionEaseInOut},\n opacity ${e.motionDurationMid} ${e.motionEaseInOut} !important`}},[`${e.antCls}-motion-collapse`]:{overflow:"hidden",transition:`height ${e.motionDurationMid} ${e.motionEaseInOut},\n opacity ${e.motionDurationMid} ${e.motionEaseInOut} !important`}}})},31561:function(e,t,n){n.d(t,{Z:function(){return y}});var o=n(5891),r=n(80962),i=n(29043),a=n(19149),s=n(35593),l=n(92310),u=n.n(l),c=n(25629),d=n(59301),p=n(20287),f=n(71783),m=p.Z.ESC,h=p.Z.TAB;var v=(0,d.forwardRef)((function(e,t){var n=e.overlay,o=e.arrow,r=e.prefixCls,i=(0,d.useMemo)((function(){return"function"==typeof n?n():n}),[n]),a=(0,c.sQ)(t,null==i?void 0:i.ref);return d.createElement(d.Fragment,null,o&&d.createElement("div",{className:"".concat(r,"-arrow")}),d.cloneElement(i,{ref:(0,c.Yr)(i)?a:void 0}))})),g={adjustX:1,adjustY:1},x=[0,0],b={topLeft:{points:["bl","tl"],overflow:g,offset:[0,-4],targetOffset:x},top:{points:["bc","tc"],overflow:g,offset:[0,-4],targetOffset:x},topRight:{points:["br","tr"],overflow:g,offset:[0,-4],targetOffset:x},bottomLeft:{points:["tl","bl"],overflow:g,offset:[0,4],targetOffset:x},bottom:{points:["tc","bc"],overflow:g,offset:[0,4],targetOffset:x},bottomRight:{points:["tr","br"],overflow:g,offset:[0,4],targetOffset:x}},w=["arrow","prefixCls","transitionName","animation","align","placement","placements","getPopupContainer","showAction","hideAction","overlayClassName","overlayStyle","visible","trigger","autoFocus","overlay","children","onVisibleChange"];function C(e,t){var n,l=e.arrow,p=void 0!==l&&l,g=e.prefixCls,x=void 0===g?"rc-dropdown":g,C=e.transitionName,y=e.animation,I=e.align,S=e.placement,O=void 0===S?"bottomLeft":S,Z=e.placements,_=void 0===Z?b:Z,j=e.getPopupContainer,k=e.showAction,P=e.hideAction,N=e.overlayClassName,E=e.overlayStyle,M=e.visible,R=e.trigger,L=void 0===R?["hover"]:R,$=e.autoFocus,A=e.overlay,F=e.children,D=e.onVisibleChange,T=(0,a.Z)(e,w),W=d.useState(),U=(0,i.Z)(W,2),B=U[0],V=U[1],H="visible"in e?M:B,z=d.useRef(null),X=d.useRef(null),Y=d.useRef(null);d.useImperativeHandle(t,(function(){return z.current}));var G=function(e){V(e),null==D||D(e)};!function(e){var t=e.visible,n=e.triggerRef,o=e.onVisibleChange,r=e.autoFocus,i=e.overlayRef,a=d.useRef(!1),s=function(){var e,r;t&&(null===(e=n.current)||void 0===e||null===(r=e.focus)||void 0===r||r.call(e),null==o||o(!1))},l=function(){var e;return!(null===(e=i.current)||void 0===e||!e.focus||(i.current.focus(),a.current=!0,0))},u=function(e){switch(e.keyCode){case m:s();break;case h:var t=!1;a.current||(t=l()),t?e.preventDefault():s()}};d.useEffect((function(){return t?(window.addEventListener("keydown",u),r&&(0,f.Z)(l,3),function(){window.removeEventListener("keydown",u),a.current=!1}):function(){a.current=!1}}),[t])}({visible:H,triggerRef:Y,onVisibleChange:G,autoFocus:$,overlayRef:X});var Q,q,J,K=function(){return d.createElement(v,{ref:X,overlay:A,prefixCls:x,arrow:p})},ee=d.cloneElement(F,{className:u()(null===(n=F.props)||void 0===n?void 0:n.className,H&&(Q=e.openClassName,void 0!==Q?Q:"".concat(x,"-open"))),ref:(0,c.Yr)(F)?(0,c.sQ)(Y,F.ref):void 0}),te=P;return te||-1===L.indexOf("contextMenu")||(te=["click"]),d.createElement(s.Z,(0,o.Z)({builtinPlacements:_},T,{prefixCls:x,ref:z,popupClassName:u()(N,(0,r.Z)({},"".concat(x,"-show-arrow"),p)),popupStyle:E,action:L,showAction:k,hideAction:te,popupPlacement:O,popupAlign:I,popupTransitionName:C,popupAnimation:y,popupVisible:H,stretch:(q=e.minOverlayWidthMatchTrigger,J=e.alignPoint,("minOverlayWidthMatchTrigger"in e?q:!J)?"minWidth":""),popup:"function"==typeof A?K:K(),onPopupVisibleChange:G,onPopupClick:function(t){var n=e.onOverlayClick;V(!1),n&&n(t)},getPopupContainer:j}),ee)}var y=d.forwardRef(C)}}]);