|
|
"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[75952],{25883:function(e,t,s){s.r(t),s.d(t,{default:function(){return D}});var n=s(7557),l=s.n(n),a=s(41498),o=s.n(a),i=s(79800),r=s.n(i),c=s(39647),u=s.n(c),d=s(59301),p=s(49389),m=s(10249),f=s(78241),h=s(88522),g=s(54580),_=s(3113),x=s(91689),v="wrap___Y7LCK",b="bg___EZJAL",C="title_style___wlyTK",N="line___ebz0s",j="text___JAKze",w="fieldWrap___quMwu",I="form_item_textarea___GBwjN",O="textarea_suffix___v_Qr2",S="form_item___j56Sq",y="close_style___uEBuj",A="xmfm___p4gRI",E="img_content___QgGs6",Z="footer_style___IY527",P="backgroundFa___aScge",F="form_item_item___jgI8Q",U=s(8591),R=s(43899),k=s(94171),M=s(54413),T=s(940),V=s(93298),B=s(37712),G=["user","newCourse","globalSetting","loading","dispatch"],q=m.Z.TextArea,D=(0,p.connect)((function(e){var t=e.user,s=e.newCourse,n=e.loading;return{user:t,newCourse:s,globalSetting:e.globalSetting,loading:n.effects}}))((function(e){e.user,e.newCourse,e.globalSetting,e.loading;var t,s,n=e.dispatch,a=(u()(e,G),f.Z.useForm()),i=r()(a,1)[0],c=(0,d.useState)({}),D=r()(c,2),W=D[0],H=D[1],J=(0,d.useState)(),K=r()(J,2),Y=K[0],L=K[1],Q=(0,p.useParams)(),z=(0,d.useState)([]),$=r()(z,2),X=$[0],ee=$[1];(0,d.useEffect)((function(){return te(),null!=Q&&Q.assistantId&&(0,M.QJ)(null==Q?void 0:Q.assistantId).then((function(e){0==(null==e?void 0:e.status)&&(i.setFieldsValue(e),H(e),L([{id:null==e?void 0:e.attachment_id,test:null==e?void 0:e.attachment_url}]))})),n({type:"globalSetting/footerToggle",payload:!1}),function(){n({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:!0});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,B.jsxs)("div",{className:v,children:[(0,B.jsx)("div",{className:b,children:(0,B.jsxs)(f.Z,{labelCol:{flex:"100px"},form:i,scrollToFirstError:!0,colon:!1,onValuesChange:function(){H(i.getFieldsValue())},children:[(0,B.jsxs)("div",{className:C,children:[(0,B.jsx)("div",{className:N}),(0,B.jsxs)("div",{className:j,children:[null!=Q&&Q.assistantId?"编辑":"新建","AI化学助手"]})]}),(0,B.jsxs)("div",{className:w,children:[(0,B.jsx)(f.Z.Item,{className:S,label:"标题",colon:!1,name:"title",rules:[{required:!0,message:"必填项:不能为空"},{whitespace:!0,message:"请勿输入空格"}],children:(0,B.jsx)(m.Z,{size:"large",className:F,placeholder:"请输入标题",maxLength:60,showCount:!0})}),(0,B.jsx)(f.Z.Item,{className:S,label:"类型",colon:!1,name:"type_name",rules:[{required:!0,message:"必填项:不能为空"},{whitespace:!0,message:"请勿输入空格"}],children:(0,B.jsx)(h.Z,{size:"large",style:{width:"100%"},options:null==X?void 0:X.map((function(e){return{value:e,label:e}})),filterOption:function(e,t){var s;return-1!==(null==t||null===(s=t.label)||void 0===s||null===(s=s.toUpperCase())||void 0===s?void 0:s.indexOf(null==e?void 0:e.toUpperCase()))},onSearch:function(e){e.length>20&&i.setFieldValue("type_name",e.substring(0,20))}})}),(0,B.jsxs)("div",{className:I,children:[(0,B.jsx)(f.Z.Item,{className:S,label:"简介",colon:!1,name:"description",rules:[{required:!0,message:"必填项:不能为空"},{whitespace:!0,message:"请勿输入空格"}],children:(0,B.jsx)(q,{placeholder:"请输入简介",maxLength:200,rows:7})}),(0,B.jsx)("div",{className:O,children:(0,B.jsxs)("span",{style:{fontSize:"14px"},children:[(null===(t=W.description)||void 0===t?void 0:t.length)||0,(0,B.jsx)("span",{style:{color:"#c5c5c5"},children:"/200"})]})})]}),(0,B.jsx)(f.Z.Item,{className:S,label:"链接",colon:!1,name:"url",rules:[{required:!0,message:"必填项:不能为空"},{whitespace:!0,message:"请勿输入空格"}],children:(0,B.jsx)(m.Z,{className:F,placeholder:"请输入链接",size:"large"})}),(0,B.jsxs)(f.Z.Item,{className:S,label:"项目封面",colon:!1,name:"attachment_id",children:[(0,B.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,k.ZP)("".concat(x.Z.API_SERVER,"/api/attachments.json"),{method:"post",body:t},!0).then((function(e){L([e]),i.setFieldsValue({attachment_id:e.id})}))},children:(0,B.jsxs)("div",{style:{height:"40px",display:"flex",alignItems:"center"},children:[(0,B.jsx)(T.op,{style:{borderRadius:"2px"},icon:(0,B.jsx)("i",{className:"iconfont icon-shangchuanfujian"}),children:"上传文件"}),(0,B.jsx)("span",{style:{color:"#999999",pointerEvents:"none",marginLeft:20},children:"封面图片尺寸为1200*250px,格式为png、jpeg、jpg大小不能超过100KB"})]})}),(null==Y?void 0:Y.length)>0&&(0,B.jsxs)("div",{className:A,children:[(0,B.jsx)("img",{src:x.Z.API_SERVER+(null===(s=Y[0])||void 0===s?void 0:s.test),className:E}),(0,B.jsx)("img",{src:R,className:y,onClick:function(){L([]),i.setFieldsValue({attachment_id:""})}})]})]})]})]})}),(0,B.jsx)("div",{className:Z,children:(0,B.jsxs)("div",{className:P,children:[(0,B.jsx)(_.ZP,{className:"canclebtn",onClick:function(){p.history.push("/ai_assistant")},children:"取消"}),(0,B.jsx)(_.ZP,{className:"confirmbtn",type:"primary",onClick:function(){(null==Y?void 0:Y.length)>0&&i.setFieldsValue({attachment_id:Y[0].id}),i.validateFields().then((function(){null!=Q&&Q.assistantId?(0,M.eb)({id:null==Q?void 0:Q.assistantId,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:!0}).then((function(e){0==(null==e?void 0:e.status)&&(U.ZP.success("新增成功"),p.history.push("/ai_assistant"))}))}))},children:null!=Q&&Q.assistantId?"保存编辑":"确认新建"})]})})]})}))},88522:function(e,t,s){var n=s(92310),l=s.n(n),a=s(11592),o=s(2738),i=s(59301),r=s(53487),c=s(92343),u=s(36355),d=s(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:s,className:n,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",s);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`,n),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,s){var n=s(92310),l=s.n(n),a=s(77861),o=s(2738),i=s(59301),r=s(53487),c=s(62892),u=s(19080),d=s(36355),p=s(1684),m=s(93891),f=s(19716),h=s(32441),g=s(33234),_=s(14154),x=s(58582),v=s(84443),b=s(66339),C=function(e,t){var s={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(s[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var l=0;for(n=Object.getOwnPropertySymbols(e);l<n.length;l++)t.indexOf(n[l])<0&&Object.prototype.propertyIsEnumerable.call(e,n[l])&&(s[n[l]]=e[n[l]])}return s};const N="SECRET_COMBOBOX_MODE_DO_NOT_USE",j=(e,t)=>{var s,{prefixCls:n,bordered:r=!0,className:j,rootClassName:w,getPopupContainer:I,popupClassName:O,dropdownClassName:S,listHeight:y=256,placement:A,listItemHeight:E=24,size:Z,disabled:P,notFoundContent:F,status:U,builtinPlacements:R,dropdownMatchSelectWidth:k,popupMatchSelectWidth:M,direction:T,style:V,allowClear:B}=e,G=C(e,["prefixCls","bordered","className","rootClassName","getPopupContainer","popupClassName","dropdownClassName","listHeight","placement","listItemHeight","size","disabled","notFoundContent","status","builtinPlacements","dropdownMatchSelectWidth","popupMatchSelectWidth","direction","style","allowClear"]);const{getPopupContainer:q,getPrefixCls:D,renderEmpty:W,direction:H,virtual:J,popupMatchSelectWidth:K,popupOverflow:Y,select:L}=i.useContext(d.E_),Q=D("select",n),z=D(),$=null!=T?T:H,{compactSize:X,compactItemClassnames:ee}=(0,g.ri)(Q,$),[te,se]=(0,_.Z)(Q),ne=i.useMemo((()=>{const{mode:e}=G;if("combobox"!==e)return e===N?"combobox":e}),[G.mode]),le="multiple"===ne||"tags"===ne,ae=(0,v.Z)(G.suffixIcon,G.showArrow),oe=null!==(s=null!=M?M:k)&&void 0!==s?s: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"===ne?null:(null==W?void 0:W("Select"))||i.createElement(m.Z,{componentName:"Select"});const{suffixIcon:me,itemIcon:fe,removeIcon:he,clearIcon:ge}=(0,b.Z)(Object.assign(Object.assign({},G),{multiple:le,hasFeedback:re,feedbackIcon:ue,showSuffixIcon:ae,prefixCls:Q,showArrow:G.showArrow,componentName:"Select"})),_e=!0===B?{clearIcon:ge}:B,xe=(0,o.Z)(G,["suffixIcon","itemIcon"]),ve=l()(O||S,{[`${Q}-dropdown-${$}`]:"rtl"===$},w,se),be=(0,f.Z)((e=>{var t;return null!==(t=null!=Z?Z:X)&&void 0!==t?t:e})),Ce=i.useContext(p.Z),Ne=null!=P?P:Ce,je=l()({[`${Q}-lg`]:"large"===be,[`${Q}-sm`]:"small"===be,[`${Q}-rtl`]:"rtl"===$,[`${Q}-borderless`]:!r,[`${Q}-in-form-item`]:ce},(0,u.Z)(Q,de,re),ee,null==L?void 0:L.className,j,w,se),we=i.useMemo((()=>void 0!==A?A:"rtl"===$?"bottomRight":"bottomLeft"),[A,$]),Ie=(0,x.Z)(R,Y);return te(i.createElement(a.ZP,Object.assign({ref:t,virtual:J,showSearch:null==L?void 0:L.showSearch},xe,{style:Object.assign(Object.assign({},null==L?void 0:L.style),V),dropdownMatchSelectWidth:oe,builtinPlacements:Ie,transitionName:(0,c.m)(z,"slide-up",G.transitionName),listHeight:y,listItemHeight:E,mode:ne,prefixCls:Q,placement:we,direction:$,suffixIcon:me,menuItemSelectedIcon:fe,removeIcon:he,allowClear:_e,notFoundContent:pe,className:je,getPopupContainer:I||q,dropdownClassName:ve,disabled:Ne})))};const w=i.forwardRef(j),I=(0,r.Z)(w);w.SECRET_COMBOBOX_MODE_DO_NOT_USE=N,w.Option=a.Wx,w.OptGroup=a.Xo,w._InternalPanelDoNotUseOrYouWillBeFired=I,t.default=w},43899:function(e){e.exports="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA4AAAAOCAYAAAAfSC3RAAAAAXNSR0IArs4c6QAAAOJJREFUOE+lkrEOAUEQhr+RULmLTqcQvRfxAKJX6o5GcISKTqkXD+BB6OUKNDpZV1Gs7MbKkZA4U83+M/8/f2ZHSEQExRy0NNQEyqakIRJYX2FehpNrF5fsoS6wAPJJsUQea2iWYGUwS3yQlu79gWgNaGgYshh7Wdh9mfSuE9+gIkcYa+i6qjcaoZUins0slA8CxPe59PtPAYGJHGADVB1qGgvTKSoMLeSHIed2+yn06NuaiUqDl/TjDwaWYMIIqOHwxa7AJT3xH6vfl9PpkPE8VK/3upzU35H6AP46OUf+5cjvSj1v2525UKMAAAAASUVORK5CYII="}}]); |