|
|
"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[25633],{98217:function(e,t,n){n.r(t),n.d(t,{default:function(){return W}});var s=n(7557),l=n.n(s),a=n(41498),o=n.n(a),i=n(79800),r=n.n(i),c=n(39647),u=n.n(c),d=n(59301),p=n(13032),m=n(10249),f=n(78241),h=n(88522),g=n(54580),_=n(3113),x=n(17631),v="wrap___QJEfO",b="bg___YovF4",C="title_style___iKJsJ",N="line___CuDfk",O="text___wgTCa",j="fieldWrap___t32Tn",w="form_item_textarea___xeZJ0",y="textarea_suffix___xFmF9",S="form_item___Qnp71",I="close_style___aXn53",A="xmfm___tSyD6",E="img_content___KFbBT",Z="footer_style___Voi7E",P="backgroundFa___gy_Q2",F="form_item_item___cUboO",U=n(8591),k=n(43899),R=n(58181),M=n(72108),T=n(46906),V=n(38349),D=n(37712),J=["user","newCourse","globalSetting","loading","dispatch"],B=m.Z.TextArea,W=(0,p.connect)((function(e){var t=e.user,n=e.newCourse,s=e.loading;return{user:t,newCourse:n,globalSetting:e.globalSetting,loading:s.effects}}))((function(e){e.user,e.newCourse,e.globalSetting,e.loading;var t,n,s=e.dispatch,a=(u()(e,J),f.Z.useForm()),i=r()(a,1)[0],c=(0,d.useState)({}),W=r()(c,2),G=W[0],H=W[1],q=(0,d.useState)(),K=r()(q,2),Q=K[0],Y=K[1],$=(0,p.useParams)(),L=(0,d.useState)([]),X=r()(L,2),z=X[0],ee=X[1];(0,d.useEffect)((function(){return te(),null!=$&&$.prefaceId&&(0,M.QJ)(null==$?void 0:$.prefaceId).then((function(e){0==(null==e?void 0:e.status)&&(i.setFieldsValue(e),H(e),Y([{id:null==e?void 0:e.attachment_id,test:null==e?void 0:e.attachment_url}]))})),s({type:"globalSetting/footerToggle",payload:!1}),function(){s({type:"globalSetting/footerToggle",payload:!0})}}),[]);var te=function(){var e=o()(l()().mark((function e(){var t;return l()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,V.H8)({is_ai:!1});case 2:0==(t=e.sent).status&&ee(null==t?void 0:t.preface_expansions_types);case 4:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();return(0,D.jsxs)("div",{className:v,children:[(0,D.jsx)("div",{className:b,children:(0,D.jsxs)(f.Z,{labelCol:{flex:"100px"},form:i,scrollToFirstError:!0,colon:!1,onValuesChange:function(){H(i.getFieldsValue())},children:[(0,D.jsxs)("div",{className:C,children:[(0,D.jsx)("div",{className:N}),(0,D.jsxs)("div",{className:O,children:[null!=$&&$.prefaceId?"编辑":"新建","前沿拓展"]})]}),(0,D.jsxs)("div",{className:j,children:[(0,D.jsx)(f.Z.Item,{className:S,label:"标题",colon:!1,name:"title",rules:[{required:!0,message:"必填项:不能为空"},{whitespace:!0,message:"请勿输入空格"}],children:(0,D.jsx)(m.Z,{size:"large",className:F,placeholder:"请输入标题",maxLength:60,showCount:!0})}),(0,D.jsx)(f.Z.Item,{className:S,label:"类型",colon:!1,name:"type_name",rules:[{required:!0,message:"必填项:不能为空"},{whitespace:!0,message:"请勿输入空格"}],children:(0,D.jsx)(h.Z,{size:"large",style:{width:"100%"},options:null==z?void 0:z.map((function(e){return{value:e,label:e}})),filterOption:function(e,t){var n;return-1!==(null==t||null===(n=t.label)||void 0===n||null===(n=n.toUpperCase())||void 0===n?void 0:n.indexOf(null==e?void 0:e.toUpperCase()))},onSearch:function(e){e.length>20&&i.setFieldValue("type_name",e.substring(0,20))}})}),(0,D.jsxs)("div",{className:w,children:[(0,D.jsx)(f.Z.Item,{className:S,label:"简介",colon:!1,name:"description",rules:[{required:!0,message:"必填项:不能为空"},{whitespace:!0,message:"请勿输入空格"}],children:(0,D.jsx)(B,{placeholder:"请输入简介",maxLength:200,rows:7})}),(0,D.jsx)("div",{className:y,children:(0,D.jsxs)("span",{style:{fontSize:"14px"},children:[(null===(t=G.description)||void 0===t?void 0:t.length)||0,(0,D.jsx)("span",{style:{color:"#c5c5c5"},children:"/200"})]})})]}),(0,D.jsx)(f.Z.Item,{className:S,label:"链接",colon:!1,name:"url",rules:[{required:!0,message:"必填项:不能为空"},{whitespace:!0,message:"请勿输入空格"}],children:(0,D.jsx)(m.Z,{className:F,placeholder:"请输入链接",size:"large"})}),(0,D.jsxs)(f.Z.Item,{className:S,label:"项目封面",colon:!1,name:"attachment_id",children:[(0,D.jsx)(g.Z,{action:"",accept:"image/*",withCredentials:!0,showUploadList:!1,beforeUpload:function(e){var t="image/jpeg"===e.type||"image/png"===e.type||"image/jpg"===e.type;return t||(U.ZP.error("您上传的不是JPEG/PNG/JPG类型文件"),Promise.reject())},customRequest:function(e){var t=new FormData;t.append("file",null==e?void 0:e.file),(0,R.ZP)("".concat(x.Z.API_SERVER,"/api/attachments.json"),{method:"post",body:t},!0).then((function(e){Y([e]),i.setFieldsValue({attachment_id:e.id})}))},children:(0,D.jsxs)("div",{style:{height:"40px",display:"flex",alignItems:"center"},children:[(0,D.jsx)(T.op,{style:{borderRadius:"2px"},icon:(0,D.jsx)("i",{className:"iconfont icon-shangchuanfujian"}),children:"上传文件"}),(0,D.jsx)("span",{style:{color:"#999999",pointerEvents:"none",marginLeft:20},children:"封面图片尺寸为581*250px,格式为png、jpeg、jpg大小不能超过100KB"})]})}),(null==Q?void 0:Q.length)>0&&(0,D.jsxs)("div",{className:A,children:[(0,D.jsx)("img",{src:x.Z.API_SERVER+(null===(n=Q[0])||void 0===n?void 0:n.test),className:E}),(0,D.jsx)("img",{src:k,className:I,onClick:function(){Y([]),i.setFieldsValue({attachment_id:""})}})]})]})]})]})}),(0,D.jsx)("div",{className:Z,children:(0,D.jsxs)("div",{className:P,children:[(0,D.jsx)(_.ZP,{className:"canclebtn",onClick:function(){p.history.push("/preface")},children:"取消"}),(0,D.jsx)(_.ZP,{className:"confirmbtn",type:"primary",onClick:function(){(null==Q?void 0:Q.length)>0&&i.setFieldsValue({attachment_id:Q[0].id}),i.validateFields().then((function(){null!=$&&$.prefaceId?(0,M.eb)({id:null==$?void 0:$.prefaceId,preface_expansion:i.getFieldsValue()}).then((function(e){0==(null==e?void 0:e.status)&&(U.ZP.success("编辑成功"),p.history.go(-1))})):(0,M.Ln)({preface_expansion:i.getFieldsValue(),is_ai:!1}).then((function(e){0==(null==e?void 0:e.status)&&(U.ZP.success("新增成功"),p.history.push("/preface"))}))}))},children:null!=$&&$.prefaceId?"保存编辑":"确认新建"})]})})]})}))},88522:function(e,t,n){var s=n(92310),l=n.n(s),a=n(11592),o=n(2738),i=n(59301),r=n(53487),c=n(92343),u=n(36355),d=n(57809);const{Option:p}=d.default;function m(e){return e&&e.type&&(e.type.isSelectOption||e.type.isSelectOptGroup)}const f=(e,t)=>{const{prefixCls:n,className:s,popupClassName:r,dropdownClassName:f,children:h,dataSource:g}=e,_=(0,a.Z)(h);let x;1===_.length&&(0,c.l$)(_[0])&&!m(_[0])&&([x]=_);const v=x?()=>x:void 0;let b;b=_.length&&m(_[0])?h:g?g.map((e=>{if((0,c.l$)(e))return e;switch(typeof e){case"string":return i.createElement(p,{key:e,value:e},e);case"object":{const{value:t}=e;return i.createElement(p,{key:t,value:t},e.text)}default:return}})):[];const{getPrefixCls:C}=i.useContext(u.E_),N=C("select",n);return i.createElement(d.default,Object.assign({ref:t,suffixIcon:null},(0,o.Z)(e,["dataSource","dropdownClassName"]),{prefixCls:N,popupClassName:r||f,className:l()(`${N}-auto-complete`,s),mode:d.default.SECRET_COMBOBOX_MODE_DO_NOT_USE},{getInputElement:v}),b)},h=i.forwardRef(f),g=(0,r.Z)(h);h.Option=p,h._InternalPanelDoNotUseOrYouWillBeFired=g,t.Z=h},57809:function(e,t,n){var s=n(92310),l=n.n(s),a=n(77861),o=n(2738),i=n(59301),r=n(53487),c=n(62892),u=n(19080),d=n(36355),p=n(1684),m=n(93891),f=n(19716),h=n(32441),g=n(33234),_=n(14154),x=n(58582),v=n(84443),b=n(66339),C=function(e,t){var n={};for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&t.indexOf(s)<0&&(n[s]=e[s]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var l=0;for(s=Object.getOwnPropertySymbols(e);l<s.length;l++)t.indexOf(s[l])<0&&Object.prototype.propertyIsEnumerable.call(e,s[l])&&(n[s[l]]=e[s[l]])}return n};const N="SECRET_COMBOBOX_MODE_DO_NOT_USE",O=(e,t)=>{var n,{prefixCls:s,bordered:r=!0,className:O,rootClassName:j,getPopupContainer:w,popupClassName:y,dropdownClassName:S,listHeight:I=256,placement:A,listItemHeight:E=24,size:Z,disabled:P,notFoundContent:F,status:U,builtinPlacements:k,dropdownMatchSelectWidth:R,popupMatchSelectWidth:M,direction:T,style:V,allowClear:D}=e,J=C(e,["prefixCls","bordered","className","rootClassName","getPopupContainer","popupClassName","dropdownClassName","listHeight","placement","listItemHeight","size","disabled","notFoundContent","status","builtinPlacements","dropdownMatchSelectWidth","popupMatchSelectWidth","direction","style","allowClear"]);const{getPopupContainer:B,getPrefixCls:W,renderEmpty:G,direction:H,virtual:q,popupMatchSelectWidth:K,popupOverflow:Q,select:Y}=i.useContext(d.E_),$=W("select",s),L=W(),X=null!=T?T:H,{compactSize:z,compactItemClassnames:ee}=(0,g.ri)($,X),[te,ne]=(0,_.Z)($),se=i.useMemo((()=>{const{mode:e}=J;if("combobox"!==e)return e===N?"combobox":e}),[J.mode]),le="multiple"===se||"tags"===se,ae=(0,v.Z)(J.suffixIcon,J.showArrow),oe=null!==(n=null!=M?M:R)&&void 0!==n?n:K,{status:ie,hasFeedback:re,isFormItemInput:ce,feedbackIcon:ue}=i.useContext(h.aM),de=(0,u.F)(ie,U);let pe;pe=void 0!==F?F:"combobox"===se?null:(null==G?void 0:G("Select"))||i.createElement(m.Z,{componentName:"Select"});const{suffixIcon:me,itemIcon:fe,removeIcon:he,clearIcon:ge}=(0,b.Z)(Object.assign(Object.assign({},J),{multiple:le,hasFeedback:re,feedbackIcon:ue,showSuffixIcon:ae,prefixCls:$,showArrow:J.showArrow,componentName:"Select"})),_e=!0===D?{clearIcon:ge}:D,xe=(0,o.Z)(J,["suffixIcon","itemIcon"]),ve=l()(y||S,{[`${$}-dropdown-${X}`]:"rtl"===X},j,ne),be=(0,f.Z)((e=>{var t;return null!==(t=null!=Z?Z:z)&&void 0!==t?t:e})),Ce=i.useContext(p.Z),Ne=null!=P?P:Ce,Oe=l()({[`${$}-lg`]:"large"===be,[`${$}-sm`]:"small"===be,[`${$}-rtl`]:"rtl"===X,[`${$}-borderless`]:!r,[`${$}-in-form-item`]:ce},(0,u.Z)($,de,re),ee,null==Y?void 0:Y.className,O,j,ne),je=i.useMemo((()=>void 0!==A?A:"rtl"===X?"bottomRight":"bottomLeft"),[A,X]),we=(0,x.Z)(k,Q);return te(i.createElement(a.ZP,Object.assign({ref:t,virtual:q,showSearch:null==Y?void 0:Y.showSearch},xe,{style:Object.assign(Object.assign({},null==Y?void 0:Y.style),V),dropdownMatchSelectWidth:oe,builtinPlacements:we,transitionName:(0,c.m)(L,"slide-up",J.transitionName),listHeight:I,listItemHeight:E,mode:se,prefixCls:$,placement:je,direction:X,suffixIcon:me,menuItemSelectedIcon:fe,removeIcon:he,allowClear:_e,notFoundContent:pe,className:Oe,getPopupContainer:w||B,dropdownClassName:ve,disabled:Ne})))};const j=i.forwardRef(O),w=(0,r.Z)(j);j.SECRET_COMBOBOX_MODE_DO_NOT_USE=N,j.Option=a.Wx,j.OptGroup=a.Xo,j._InternalPanelDoNotUseOrYouWillBeFired=w,t.default=j},43899:function(e){e.exports="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA4AAAAOCAYAAAAfSC3RAAAAAXNSR0IArs4c6QAAAOJJREFUOE+lkrEOAUEQhr+RULmLTqcQvRfxAKJX6o5GcISKTqkXD+BB6OUKNDpZV1Gs7MbKkZA4U83+M/8/f2ZHSEQExRy0NNQEyqakIRJYX2FehpNrF5fsoS6wAPJJsUQea2iWYGUwS3yQlu79gWgNaGgYshh7Wdh9mfSuE9+gIkcYa+i6qjcaoZUins0slA8CxPe59PtPAYGJHGADVB1qGgvTKSoMLeSHIed2+yn06NuaiUqDl/TjDwaWYMIIqOHwxa7AJT3xH6vfl9PpkPE8VK/3upzU35H6AP46OUf+5cjvSj1v2525UKMAAAAASUVORK5CYII="}}]); |