|
|
"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[39676],{39676:function(e,n,l){l.d(n,{Z:function(){return h}});var i=l(7557),o=l.n(i),t=l(41498),s=l.n(t),a=l(79800),r=l.n(a),c=l(59301),u=l(78241),_=l(8591),d=l(43418),f=l(73782),m=l(59028),p={flex_box_center:"flex_box_center___ze4wf",flex_space_between:"flex_space_between___JpH0B",flex_box_vertical_center:"flex_box_vertical_center___NbRyF",flex_box_center_end:"flex_box_center_end___fUFoB",flex_box_column:"flex_box_column___i2BZL",form:"form____yVeV",btn:"btn___X16NC",img:"img___sQnKq"},x=l(9070),v=l(15309),b=l(58670),g=l(37712),h=function(e){var n,l,i=e.visible,t=e.onOk,a=e.onCancel,h=e.title,j=void 0===h?"":h,w=u.Z.useForm(),Z=r()(w,1)[0],N=(0,c.useState)(!1),C=r()(N,2),k=C[0],V=C[1],P=(0,c.useState)([]),y=r()(P,2),L=y[0],R=y[1],B=(0,c.useState)([]),S=r()(B,2),E=S[0],F=S[1],I=(0,c.useState)(!1),z=r()(I,2),q=z[0],A=z[1];(0,c.useEffect)((function(){if(null!=i&&i.name){var e,n,l,o;Z.setFieldsValue({name:null==i?void 0:i.name});var t=null!=i&&null!==(e=i.cover_url)&&void 0!==e&&e.includes("attachments")?[{response:{id:null==i||null===(n=i.cover_url)||void 0===n?void 0:n.split("/")[3]}}]:[],s=null!=i&&null!==(l=i.backbground_image_url)&&void 0!==l&&l.includes("attachments")?[{response:{id:null==i||null===(o=i.backbground_image_url)||void 0===o?void 0:o.split("/")[3]}}]:[];R(t),F(s)}}),[i]);var M=function(){var e=s()(o()().mark((function e(n){var l,i,s;return o()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:V(!0),console.log(L,E,3333),s={name:null==n?void 0:n.name,vs_type:null==n?void 0:n.vs_type,identifier:null==n?void 0:n.identifier,cover_id:(null==L||null===(l=L[0])||void 0===l||null===(l=l.response)||void 0===l?void 0:l.id)||"",backbground_image_id:(null==E||null===(i=E[0])||void 0===i||null===(i=i.response)||void 0===i?void 0:i.id)||""},t(s,(function(e){-3===(null==e?void 0:e.status)&&Z.setFields([{name:"identifier",errors:["该标识已存在,请更换"]}]),V(!1)}));case 4:case"end":return e.stop()}}),e)})));return function(n){return e.apply(this,arguments)}}(),K=function(e,n){["uploading","done","removed"].includes(e.file.status)&&("uploading"===e.file.status&&A(!0),"done"===e.file.status&&A(!1),1===n?R(e.fileList):F(e.fileList))},O=function(e,n){1===n?R([]):F([])},U=function(e,n){if(!("image/jpeg"===e.type||"image/png"===e.type))return _.ZP.warning("请上传jpg或png的图片!"),!1;var l=e.size/1024>200,i=e.size/1024/1024>1;return l&&1===n?(_.ZP.warning("文件大小必须小于200KB"),!1):i&&2===n?(_.ZP.warning("文件大小必须小于1MB"),!1):(1===n?R([]):F([]),!0)},H=function(e){var n,l;return(0,g.jsxs)("div",{className:p.img,children:[(0,g.jsx)("img",{src:v.Z.API_SERVER+"/api/attachments/"+(1===e?null==L||null===(n=L[0])||void 0===n||null===(n=n.response)||void 0===n?void 0:n.id:null==E||null===(l=E[0])||void 0===l||null===(l=l.response)||void 0===l?void 0:l.id),alt:"avatar",style:{width:"100%"}}),(0,g.jsx)("div",{children:(0,g.jsx)(b.Z,{onClick:function(){1===e?R([]):F([])},style:{fontSize:"16px",color:"red"}})})]})};return(0,g.jsx)(d.Z,{title:j,open:i,onOk:function(){Z.submit()},centered:!0,onCancel:function(){a()},confirmLoading:k,okButtonProps:{disabled:q},width:694,afterClose:function(){V(!1),R([]),F([]),Z.resetFields()},okText:null!=i&&i.name?"确认":"确认新建",cancelText:"取消",wrapClassName:x.Z.CustomCss,children:(0,g.jsxs)(u.Z,{form:Z,colon:!1,onFinish:M,className:p.form,children:[(0,g.jsx)(u.Z.Item,{label:"社区名称",name:"name",rules:[{required:!0,message:"请输入社区名称"},{whitespace:!0,message:"请输入社区名称"},{max:60,message:"只能输入60个字符"}],children:(0,g.jsx)(f.Z,{maxLength:60,placeholder:"请输入社区名称"})}),(0,g.jsx)(u.Z.Item,{name:"cover_id",label:"上传封面图",valuePropName:"fileList",className:"mt30",children:(0,g.jsx)("div",{className:p.upload,children:null!=L&&null!==(n=L[0])&&void 0!==n&&null!==(n=n.response)&&void 0!==n&&n.id?H(1):(0,g.jsx)(m.Z,{fileList:L,action:"".concat(v.Z.API_SERVER,"/api/attachments.json"),onChange:function(e){return K(e,1)},onRemove:function(e){return O(0,1)},beforeUpload:function(e){return U(e,1)},withCredentials:!0,accept:"image/*",children:(0,g.jsxs)("div",{className:p.btn,children:[(0,g.jsx)("i",{className:"iconfont icon-shangchuantupian2"}),"上传图片"]})})})}),(0,g.jsx)("aside",{children:"仅支持上传jpg/png格式文件,文件大小不能超过200KB,建议使用282*228像素;如不上传,默认使用系统图片。"}),(0,g.jsx)(u.Z.Item,{name:"backbground_image_id",label:"详情顶部背景",valuePropName:"fileList",className:"mt30",children:(0,g.jsx)("div",{className:p.upload,children:null!=E&&null!==(l=E[0])&&void 0!==l&&null!==(l=l.response)&&void 0!==l&&l.id?H(2):(0,g.jsx)(m.Z,{fileList:E,action:"".concat(v.Z.API_SERVER,"/api/attachments.json"),onChange:function(e){return K(e,2)},onRemove:function(e){return O(0,2)},beforeUpload:function(e){return U(e,2)},withCredentials:!0,accept:"image/*",children:(0,g.jsxs)("div",{className:p.btn,children:[(0,g.jsx)("i",{className:"iconfont icon-shangchuantupian2"}),"上传图片"]})})})}),(0,g.jsx)("aside",{children:"仅支持上传jpg/png格式文件,文件大小不能超过1MB,建议使用3840*148像素;如不上传,默认使用系统图片。"})]})})}},9070:function(e,n){n.Z={flex_box_center:"flex_box_center___vG4eV",flex_space_between:"flex_space_between___qVVxe",flex_box_vertical_center:"flex_box_vertical_center___P8Z8s",flex_box_center_end:"flex_box_center_end___VMme3",flex_box_column:"flex_box_column___VMHwm",dropdownmenus:"dropdownmenus___oVzoj",popupClassNames:"popupClassNames___OcZq7",selectdown:"selectdown___mmcA8"}}}]); |