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.
1 line
8.0 KiB
1 line
8.0 KiB
"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[20944],{25637:function(e,n,t){var a=t(26801),s=t.n(a),l=t(10574),r=t.n(l),i=t(39343),o=t.n(i),u=t(11006),c=t.n(u),d=t(59301),p=t(84686),h=t(15830),m=t(22211),f=(t(72690),t(37712));n.Z=(0,m.connect)((function(e){return{user:e.user}}))((function(e){var n=e.defaultvalue,t=e.onChange,a=e.style,l=e.user,i=e.placeholder,u=2097152,m=(0,d.useRef)(null),g=(0,d.useState)(null),x=c()(g,2),v=x[0],b=x[1],j=(0,d.useState)(""),y=c()(j,2),Z=y[0],_=y[1];(0,d.useEffect)((function(){_(n)}),[n]),(0,d.useEffect)((function(){t(Z)}),[Z]);var C={placeholder:i||"请输入内容...",MENU_CONF:{}};return C.MENU_CONF.uploadImage={customUpload:function(e,n){return o()(r()().mark((function t(){var a,s;return r()().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return(a=new FormData).append("file",e),t.next=4,(0,h.ZP)("/api/attachments.json",{method:"post",body:a},!0);case 4:s=t.sent,n(null==s?void 0:s.url,"","");case 6:case"end":return t.stop()}}),t)})))()}},C.MENU_CONF.uploadVideo={customUpload:function(e,n){return o()(r()().mark((function t(){var a,s,i,o,c,d,p,f,g,x,v,b,j,y;return r()().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return a=e.size,s=Math.ceil(a/u),t.prev=2,t.next=5,(0,h.ZP)("/api/attachments/multipart_upload_start",{method:"POST",body:{fileName:e.name,chunkCount:s,user_id:null==l||null===(i=l.userInfo)||void 0===i?void 0:i.user_id}});case 5:if(0===(null==(c=t.sent)?void 0:c.status)){t.next=8;break}throw new Error;case 8:d=c.upload_id,m.current=new AbortController,p=[],0,f=r()().mark((function n(){var t,s,l,i;return r()().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:t=g*u,s=Math.min(t+u,a),l=e.slice(t,s),(i=new FormData).append("chunk",l),i.append("fileName",e.name),i.append("chunkIndex",(g+1).toString()),i.append("uploadId",d),p.push((function(){return(0,h.ZP)("/api/attachments/multipart_upload",{method:"POST",body:i,signal:m.current.signal},!0).then((function(e){}))}));case 9:case"end":return n.stop()}}),n)})),g=0;case 14:if(!(g<s)){t.next=19;break}return t.delegateYield(f(),"t0",16);case 16:g++,t.next=14;break;case 19:x=0,v=4,console.log(p,"promises");case 22:if(!(x<p.length)){t.next=31;break}if(!((j=null===(b=p.slice(x,x+v))||void 0===b?void 0:b.map((function(e){return e()}))).length>0)){t.next=29;break}return t.next=27,Promise.all(j);case 27:t.sent,x+=v;case 29:t.next=22;break;case 31:return t.next=33,(0,h.ZP)("/api/attachments/multipart_upload_end",{method:"POST",body:{fileName:e.name,chunkCount:s,uploadId:d,user_id:null==l||null===(o=l.userInfo)||void 0===o?void 0:o.user_id}});case 33:y=t.sent,n(null==y?void 0:y.object,""),t.next=39;break;case 37:t.prev=37,t.t1=t.catch(2);case 39:case"end":return t.stop()}}),t,null,[[2,37]])})))()}},(0,d.useEffect)((function(){return function(){null!=v&&(v.destroy(),b(null))}}),[v]),(0,f.jsx)(f.Fragment,{children:(0,f.jsxs)("div",{style:{border:"1px solid #ccc",zIndex:100},children:[(0,f.jsx)(p.o,{editor:v,defaultConfig:{},mode:"default",style:{borderBottom:"1px solid #ccc"}}),(0,f.jsx)(p.M,{defaultConfig:C,value:Z,onCreated:b,onChange:function(e){return _(e.getHtml())},mode:"default",style:s()({height:"500px",overflowY:"hidden"},a)})]})})}))},86088:function(e,n,t){t.r(n),t.d(n,{default:function(){return A}});var a=t(93923),s=t.n(a),l=t(10574),r=t.n(l),i=t(26801),o=t.n(i),u=t(39343),c=t.n(u),d=t(11006),p=t.n(d),h=t(59301),m=t(78241),f=t(8591),g=t(1056),x=t(95237),v=t(43604),b=t(52409),j=t(78673),y=t(48826),Z=t(3113),_=t(96402),C=t(22211),k="ContentWarp___dEP9T",w="footst___jjaL9",P="tags___GAiAz",F="hidden___gQNeb",I=t(25637),S=(t(15039),t(15830)),N=t(67871),E=t(37712),A=(0,C.connect)((function(e){var n=e.homePage,t=e.loading,a=e.globalSetting,s=e.user;return{homePage:n,globalSetting:a,loading:t.models.homePage,user:s}}))((function(e){e.homePage,e.globalSetting,e.user,e.loading;var n=e.dispatch,t=(0,h.useState)(),a=p()(t,2),l=(a[0],a[1],(0,h.useState)([{name:"全部"}])),i=p()(l,2),u=(i[0],i[1],m.Z.useForm()),d=p()(u,1)[0],C=(0,h.useState)([]),A=p()(C,2),T=A[0],L=A[1],z=(0,h.useState)({page:1,limit:10,setag:"全部"}),R=p()(z,2);R[0],R[1];(0,h.useEffect)((function(){return n({type:"globalSetting/headerFooterToggle",payload:!1}),function(){n({type:"globalSetting/headerFooterToggle",payload:!0})}}),[]);return(0,E.jsxs)("section",{style:{background:"#fff",paddingBottom:60},children:[(0,E.jsxs)("div",{style:{width:1200,margin:"0px auto"},children:[(0,E.jsxs)("div",{style:{paddingTop:40,display:"flex",alignItems:"center"},children:[(0,E.jsx)("div",{style:{background:"#666666",height:14,width:4,marginRight:8}}),(0,E.jsx)("span",{style:{color:"#232B40",fontWeight:500},children:"新闻动态"})]}),(0,E.jsx)("div",{className:k,children:(0,E.jsxs)(m.Z,{size:"large",colon:!1,form:d,onFinish:function(){var e=c()(r()().mark((function e(n){var t,a;return r()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,S.ZP)("/api/news_events.json",{method:"post",body:o()(o()({},n),{},{attachment_ids:null==n||null===(t=n.attachment_ids)||void 0===t?void 0:t.map((function(e){var n;return null==e||null===(n=e.response)||void 0===n?void 0:n.id})),news_event_tags:T})});case 2:0===(null==(a=e.sent)?void 0:a.status)&&(f.ZP.info("新增成功"),history.back());case 4:case"end":return e.stop()}}),e)})));return function(n){return e.apply(this,arguments)}}(),children:[(0,E.jsx)(m.Z.Item,{label:"标题",name:"title",labelCol:{span:2},rules:[{required:!0,message:"标题不能为空"}],children:(0,E.jsx)(g.Z,{maxLength:200,showCount:!0})}),(0,E.jsx)(m.Z.Item,{label:"标签",name:"tags",labelCol:{span:2},children:(0,E.jsx)(g.Z,{onPressEnter:function(e){5!==(null==T?void 0:T.length)?(T.push({id:null,name:e.target.value}),L(s()(T)),d.setFieldsValue({tags:""})):f.ZP.info("最多新增5个标签")},maxLength:10,addonAfter:"回车添加标签"})}),(0,E.jsxs)(x.Z,{children:[(0,E.jsx)(v.Z,{span:2}),null==T?void 0:T.map((function(e,n){return(0,E.jsxs)("div",{className:P,style:{position:"relative"},children:[(0,E.jsx)("span",{style:{display:"inline-flex",justifyContent:"center",padding:"0px 14px",background:"#F6F7F9",borderRadius:16,height:32,lineHeight:"32px",color:"#AC651A",marginRight:20,marginBottom:16},children:null==e?void 0:e.name}),(0,E.jsx)("span",{onClick:function(){T.splice(n,1),L(s()(T))},className:F,style:{position:"absolute",right:15,top:-5,width:14,height:14,background:"#E30000",color:"#FFFFFF",alignItems:"center",justifyContent:"center",borderRadius:"50%",fontSize:10,cursor:"pointer"},children:"x"})]})}))]}),(0,E.jsxs)(x.Z,{children:[(0,E.jsx)(v.Z,{span:12,children:(0,E.jsx)(m.Z.Item,{label:"发布人",labelCol:{span:4},rules:[{required:!0,message:"发布人不能为空"}],name:"publisher",children:(0,E.jsx)(g.Z,{maxLength:10})})}),(0,E.jsx)(v.Z,{span:11,style:{marginLeft:46},children:(0,E.jsx)(m.Z.Item,{label:"发布时间",rules:[{required:!0,message:"发布时间不能为空"}],name:"publish_time",children:(0,E.jsx)(b.default,{style:{width:"100%"},showTime:!0})})})]}),(0,E.jsx)(m.Z.Item,{label:"链接",name:"url",labelCol:{span:2},children:(0,E.jsx)(g.Z,{})}),(0,E.jsx)(m.Z.Item,{label:"内容",name:"content",rules:[{required:!0,message:"请输入内容"}],labelCol:{span:2},children:(0,E.jsx)(I.Z,{})}),(0,E.jsx)(m.Z.Item,{label:"置顶",name:"is_top",labelCol:{span:2},children:(0,E.jsx)(j.Z,{})}),(0,E.jsx)(m.Z.Item,{name:"attachment_ids",label:"附件",labelCol:{span:2},valuePropName:"fileList",getValueFromEvent:function(e){return console.log("Upload event:",e),Array.isArray(e)?e:null==e?void 0:e.fileList},children:(0,E.jsx)(y.Z,{action:"".concat(N.Z.API_SERVER,"/api/attachments.json"),withCredentials:!0,listType:"picture",children:(0,E.jsx)(Z.ZP,{icon:(0,E.jsx)(_.Z,{}),children:"上传文件"})})})]})})]}),(0,E.jsx)("div",{className:w,children:(0,E.jsxs)("div",{style:{width:1200,margin:"0px auto",display:"flex",alignItems:"center",justifyContent:"space-between",height:"100%"},children:[(0,E.jsx)(Z.ZP,{onClick:function(){history.back()},size:"large",children:"返回"}),(0,E.jsx)(Z.ZP,{onClick:function(){d.submit()},style:{marginLeft:10},type:"primary",size:"large",children:"确认新建"})]})})]})}))}}]); |