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.
NewEduCoderBuild/97642.async.js

1 line
5.6 KiB

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[97642],{97642:function(e,n,l){l.d(n,{Z:function(){return h}});var i=l(17061),o=l.n(i),t=l(17156),s=l.n(t),a=l(27424),r=l.n(a),c=l(67294),u=l(91773),_=l(2453),d=l(14446),f=l(11486),m=l(92421),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(39132),v=l(59758),b=l(4340),g=l(85893),h=function(e){var n,l,i,t,a=e.visible,h=e.onOk,j=e.onCancel,w=e.title,Z=void 0===w?"":w,N=u.Z.useForm(),C=r()(N,1)[0],k=(0,c.useState)(!1),V=r()(k,2),P=V[0],y=V[1],L=(0,c.useState)([]),R=r()(L,2),B=R[0],S=R[1],E=(0,c.useState)([]),F=r()(E,2),I=F[0],z=F[1],q=(0,c.useState)(!1),A=r()(q,2),M=A[0],K=A[1];(0,c.useEffect)((function(){if(null!=a&&a.name){var e,n,l,i;C.setFieldsValue({name:null==a?void 0:a.name});var o=null!=a&&null!==(e=a.cover_url)&&void 0!==e&&e.includes("attachments")?[{response:{id:null==a||null===(n=a.cover_url)||void 0===n?void 0:n.split("/")[3]}}]:[],t=null!=a&&null!==(l=a.backbground_image_url)&&void 0!==l&&l.includes("attachments")?[{response:{id:null==a||null===(i=a.backbground_image_url)||void 0===i?void 0:i.split("/")[3]}}]:[];S(o),z(t)}}),[a]);var O=function(){var e=s()(o()().mark((function e(n){var l,i,t,s,a;return o()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:y(!0),console.log(B,I,3333),a={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==B||null===(l=B[0])||void 0===l||null===(i=l.response)||void 0===i?void 0:i.id)||"",backbground_image_id:(null==I||null===(t=I[0])||void 0===t||null===(s=t.response)||void 0===s?void 0:s.id)||""},h(a,(function(e){-3===(null==e?void 0:e.status)&&C.setFields([{name:"identifier",errors:["该标识已存在,请更换"]}]),y(!1)}));case 4:case"end":return e.stop()}}),e)})));return function(n){return e.apply(this,arguments)}}(),U=function(e,n){["uploading","done","removed"].includes(e.file.status)&&("uploading"===e.file.status&&K(!0),"done"===e.file.status&&K(!1),1===n?S(e.fileList):z(e.fileList))},H=function(e,n){1===n?S([]):z([])},T=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?S([]):z([]),!0)},G=function(e){var n,l,i,o;return(0,g.jsxs)("div",{className:p.img,children:[(0,g.jsx)("img",{src:v.Z.API_SERVER+"/api/attachments/"+(1===e?null==B||null===(n=B[0])||void 0===n||null===(l=n.response)||void 0===l?void 0:l.id:null==I||null===(i=I[0])||void 0===i||null===(o=i.response)||void 0===o?void 0:o.id),alt:"avatar",style:{width:"100%"}}),(0,g.jsx)("div",{children:(0,g.jsx)(b.Z,{onClick:function(){1===e?S([]):z([])},style:{fontSize:"16px",color:"red"}})})]})};return(0,g.jsx)(d.Z,{title:Z,open:a,onOk:function(){C.submit()},centered:!0,onCancel:function(){j()},confirmLoading:P,okButtonProps:{disabled:M},width:694,afterClose:function(){y(!1),S([]),z([]),C.resetFields()},okText:null!=a&&a.name?"确认":"确认新建",cancelText:"取消",wrapClassName:x.Z.CustomCss,children:(0,g.jsxs)(u.Z,{form:C,colon:!1,onFinish:O,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!=B&&null!==(n=B[0])&&void 0!==n&&null!==(l=n.response)&&void 0!==l&&l.id?G(1):(0,g.jsx)(m.Z,{fileList:B,action:"".concat(v.Z.API_SERVER,"/api/attachments.json"),onChange:function(e){return U(e,1)},onRemove:function(e){return H(0,1)},beforeUpload:function(e){return T(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!=I&&null!==(i=I[0])&&void 0!==i&&null!==(t=i.response)&&void 0!==t&&t.id?G(2):(0,g.jsx)(m.Z,{fileList:I,action:"".concat(v.Z.API_SERVER,"/api/attachments.json"),onChange:function(e){return U(e,2)},onRemove:function(e){return H(0,2)},beforeUpload:function(e){return T(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像素如不上传默认使用系统图片。"})]})})}},39132: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"}}}]);