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

1 line
10 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([[51918],{70997:function(e,n,t){t.d(n,{Z:function(){return Z}});var l=t(7557),a=t.n(l),r=t(41498),s=t.n(r),o=t(82242),i=t.n(o),u=t(79800),c=t.n(u),d=t(39647),p=t.n(d),m=t(59301),f=t(8591),h=t(53326),x=t(95237),v=t(20817),g=t(21884),b=t(89257),j="tip___bHEXo",C=t(37712),w=["ButtonText","ButtonOptions","uploadProps","showTip"],Z=function(e){var n,t,l,r=e.ButtonText,o=e.ButtonOptions,u=e.uploadProps,d=e.showTip,Z=p()(e,w),_=(0,m.useState)(null),y=c()(_,2),k=y[0],I=y[1],P=i()(i()({maxCount:1,accept:"image/*",withCredentials:!0,beforeUpload:function(e){if(!("image/jpeg"===e.type||"image/png"===e.type||"image/jpg"===e.type))return f.ZP.error("您上传的不是JPEG/PNG/JPG类型文件"),h.Z.LIST_IGNORE;var n=e.size/1024/1024;return 0!=n||(f.ZP.error("".concat(e.name," 图片无法上传。").concat(0==n?"文件内容不能为空":"超过图片大小限制(2MB)")),h.Z.LIST_IGNORE)},onChange:function(e){var n;(["uploading","done","removed"].includes(e.file.status)&&I(e.file),"done"==e.file.status)&&(null==Z||Z.onChange(null===(n=e.file)||void 0===n||null===(n=n.response)||void 0===n?void 0:n.id))},action:"".concat(v.Z.API_SERVER,"/api/attachments.json")},u||{}),{},{onRemove:(t=s()(a()().mark((function e(n){return a()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:E(),(null==u?void 0:u.onRemove)&&(null==u||u.onRemove(n));case 2:case"end":return e.stop()}}),e)}))),function(e){return t.apply(this,arguments)})}),E=function(){I(null),null==Z||Z.onChange()};return(0,m.useEffect)((function(){(null==Z?void 0:Z.value)&&I({response:{id:null==Z?void 0:Z.value}})}),[null==Z?void 0:Z.value]),(0,C.jsx)("div",{id:(null==Z?void 0:Z.scrollId)||"",children:null!=k&&null!==(n=k.response)&&void 0!==n&&n.id?(0,C.jsxs)(x.Z,{align:"middle",justify:"center",style:{position:"relative",width:400,backgroundColor:"#f4f3f4"},children:[(0,C.jsx)("img",{src:v.Z.API_SERVER+"/api/attachments/"+(null==k||null===(l=k.response)||void 0===l?void 0:l.id),alt:"avatar",style:{width:"100%"}}),(0,C.jsx)("div",{style:{position:"absolute",right:"-6px",top:"-6px",cursor:"pointer",width:16,height:16,borderRadius:"50%",backgroundColor:"#fff"},children:(0,C.jsx)(g.Z,{onClick:s()(a()().mark((function e(){return a()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:E();case 1:case"end":return e.stop()}}),e)}))),style:{fontSize:"16px",color:"red"}})})]}):(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(h.Z,i()(i()({},P),{},{children:(0,C.jsx)(b.op,i()(i()({style:i()({borderRadius:"2px"},null==o?void 0:o.style)},o),{},{children:r}))})),d&&(0,C.jsx)("span",{className:j,children:"建议上传尺寸为472*266的图片"})]})})}},89984:function(e,n,t){t.d(n,{Z:function(){return v}});var l=t(82242),a=t.n(l),r=t(7557),s=t.n(r),o=t(41498),i=t.n(o),u=t(79800),c=t.n(u),d=t(59301),p=t(84686),m=t(85750),f=t(75936),h=(t(41707),{editor_css:"editor_css___cm3Z8"}),x=t(37712),v=(0,f.connect)((function(e){return{user:e.user}}))((function(e){var n=e.defaultvalue,t=e.onChange,l=e.style,r=e.user,o=e.placeholder,u=2097152,f=(0,d.useRef)(null),v=(0,d.useState)(null),g=c()(v,2),b=g[0],j=g[1],C=(0,d.useState)(""),w=c()(C,2),Z=w[0],_=w[1];(0,d.useEffect)((function(){_(n)}),[n]),(0,d.useEffect)((function(){t(Z)}),[Z]);var y={placeholder:o||"请输入内容...",MENU_CONF:{}};y.MENU_CONF.uploadImage={customUpload:function(e,n){return i()(s()().mark((function t(){var l,a;return s()().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return(l=new FormData).append("file",e),t.next=4,(0,m.ZP)("/api/attachments.json",{method:"post",body:l},!0);case 4:a=t.sent,n(null==a?void 0:a.url,"","");case 6:case"end":return t.stop()}}),t)})))()}},y.MENU_CONF.uploadVideo={customUpload:function(e,n){return i()(s()().mark((function t(){var l,a,o,i,c,d,p,h,x,v,g,b,j,C;return s()().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return l=e.size,a=Math.ceil(l/u),t.prev=2,t.next=5,(0,m.ZP)("/api/attachments/multipart_upload_start",{method:"POST",body:{fileName:e.name,chunkCount:a,user_id:null==r||null===(o=r.userInfo)||void 0===o?void 0:o.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,f.current=new AbortController,p=[],0,h=s()().mark((function n(){var t,a,r,o;return s()().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:t=x*u,a=Math.min(t+u,l),r=e.slice(t,a),(o=new FormData).append("chunk",r),o.append("fileName",e.name),o.append("chunkIndex",(x+1).toString()),o.append("uploadId",d),p.push((function(){return(0,m.ZP)("/api/attachments/multipart_upload",{method:"POST",body:o,signal:f.current.signal},!0).then((function(e){}))}));case 9:case"end":return n.stop()}}),n)})),x=0;case 14:if(!(x<a)){t.next=19;break}return t.delegateYield(h(),"t0",16);case 16:x++,t.next=14;break;case 19:v=0,g=4,console.log(p,"promises");case 22:if(!(v<p.length)){t.next=31;break}if(!((j=null===(b=p.slice(v,v+g))||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,v+=g;case 29:t.next=22;break;case 31:return t.next=33,(0,m.ZP)("/api/attachments/multipart_upload_end",{method:"POST",body:{fileName:e.name,chunkCount:a,uploadId:d,user_id:null==r||null===(i=r.userInfo)||void 0===i?void 0:i.user_id}});case 33:C=t.sent,n(null==C?void 0:C.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]])})))()}};return(0,d.useEffect)((function(){return function(){null!=b&&(b.destroy(),j(null))}}),[b]),(0,x.jsx)(x.Fragment,{children:(0,x.jsxs)("div",{className:null==h?void 0:h.editor_css,style:{border:"1px solid #ccc",zIndex:100},children:[(0,x.jsx)(p.o,{editor:b,defaultConfig:{},mode:"default",style:{borderBottom:"1px solid #ccc"}}),(0,x.jsx)(p.M,{defaultConfig:y,value:Z,onCreated:j,onChange:function(e){var n;!function(e){return""==e||new RegExp("^[ ]+$").test(e)}((n=e.getHtml(),n.replace(/<[^<p>]+>/g,"").replace(/<[</p>$]+>/g,"").replace(/&nbsp;/gi,"").replace(/<[^<br/>]+>/g,"")))?_(e.getHtml()):_("")},mode:"default",style:a()({height:"500px",overflowY:"hidden"},l)})]})})}))},51918:function(e,n,t){t.d(n,{Z:function(){return y}});var l=t(7557),a=t.n(l),r=t(41498),s=t.n(r),o=t(82242),i=t.n(o),u=t(79800),c=t.n(u),d=t(59301),p=t(78241),m=t(8591),f=t(43418),h=t(24650),x=t(88522),v=t(30518),g=t(75936),b=t(61186),j=t.n(b),C="form___EP058",w=t(89984),Z=t(70997),_=t(37712),y=(0,g.connect)((function(e){return{dispatch:e.dispatch,coreCurriculum:e.coreCurriculum}}))((function(e){var n=e.visible,t=e.onOk,l=e.onCancel,r=e.title,o=void 0===r?"":r,u=e.coreCurriculum,g=e.core_subject_tag,b=(e.dispatch,u.CoreSubjects,p.Z.useForm()),y=c()(b,1)[0],k=(0,d.useState)(!1),I=c()(k,2),P=I[0],E=I[1],S=(0,d.useState)([]),N=c()(S,2),F=(N[0],N[1]),O=(0,d.useState)(!1),R=c()(O,2),T=R[0],L=(R[1],(0,d.useState)("")),M=c()(L,2),B=(M[0],M[1]);(0,d.useEffect)((function(){if(null!=n&&n.id){var e;y.setFieldsValue(i()(i()({},n),{},{time:j()(null==n?void 0:n.time)}));var t=[i()(i()({},null==n?void 0:n.attachment),{},{response:{id:null==n||null===(e=n.attachment)||void 0===e?void 0:e.id}})];F(t),B(null==n?void 0:n.title)}}),[n]);var U=function(){var e=s()(a()().mark((function e(n){var l;return a()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:E(!0),l=i()({},n),t(l);case 3:case"end":return e.stop()}}),e)})));return function(n){return e.apply(this,arguments)}}();return(0,_.jsx)(f.Z,{title:"".concat(null!=n&&n.id?"编辑":"新建").concat(o),visible:n,onOk:function(){"<p><br></p>"!=y.getFieldValue("content")?y.submit():m.ZP.error("请输入内容")},centered:!0,onCancel:function(){l()},confirmLoading:P,okButtonProps:{disabled:T},width:1200,bodyStyle:{maxHeight:530},afterClose:function(){E(!1),y.resetFields(),B("")},okText:"确认",cancelText:"取消",children:(0,_.jsxs)(p.Z,{form:y,colon:!1,labelCol:{span:2},onFinish:U,className:C,children:[(0,_.jsx)(p.Z.Item,{label:"标题",name:"title",rules:[{required:!0,message:"请输入标题"},{whitespace:!0,message:"请输入标题"},{max:100,message:"只能输入100个字符"}],children:(0,_.jsx)(h.Z,{maxLength:100,placeholder:"请输入标题",showCount:!0})}),(0,_.jsxs)("div",{style:{display:"flex",justifyContent:"space-around",marginLeft:"13px"},children:[(0,_.jsx)(p.Z.Item,{label:"课程",name:"subject",rules:[{required:!0,message:"请选择课程"}],labelCol:{span:3},children:(0,_.jsx)(x.Z,{maxLength:20,style:{width:487},options:null==g?void 0:g.map((function(e){return{value:e,label:e}})),filterOption:function(e,n){var t;return-1!==(null==n||null===(t=n.label)||void 0===t||null===(t=t.toUpperCase())||void 0===t?void 0:t.indexOf(null==e?void 0:e.toUpperCase()))},onSearch:function(e){e.length>20&&y.setFieldValue("core_subject_id",e.substring(0,20))}})}),(0,_.jsx)(p.Z.Item,{label:"学校",name:"school_name",labelCol:{span:3},rules:[{required:!0,message:"请输入学校"},{whitespace:!0,message:"请输入学校"},{max:50,message:"只能输入50个字符"}],children:(0,_.jsx)(h.Z,{maxLength:50,placeholder:"请输入学校",showCount:!0,style:{width:485}})})]}),(0,_.jsxs)("div",{style:{display:"flex",justifyContent:"space-around",marginLeft:"-12px"},children:[(0,_.jsx)(p.Z.Item,{label:"主讲教师",name:"teacher_name",labelCol:{span:4},rules:[{required:!0,message:"请输入主讲教师"},{whitespace:!0,message:"请输入主讲教师"},{max:50,message:"只能输入50个字符"}],children:(0,_.jsx)(h.Z,{maxLength:50,showCount:!0,placeholder:"请输入主讲教师",style:{width:487}})}),(0,_.jsx)(p.Z.Item,{label:"时间",name:"time",labelCol:{span:3},rules:[{required:!0,message:"请选择时间"}],children:(0,_.jsx)(v.default,{style:{width:487},placeholder:"请选择开始时间 - 请选择结束时间",format:"YYYY-MM-DD",allowClear:!1})})]}),(0,_.jsx)(p.Z.Item,{name:"cover_id",label:"照片",rules:[{required:!1,message:"请上传照片"}],children:(0,_.jsx)(Z.Z,{ButtonText:(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)("i",{className:"iconfont icon-shangchuanfujian r5 font14"}),(0,_.jsx)("span",{className:"ml5",children:"上传照片"})]})})}),(0,_.jsx)(p.Z.Item,{label:"课程链接",name:"link",rules:[{message:"请输入链接"}],children:(0,_.jsx)(h.Z,{maxLength:100,placeholder:"请输入链接"})}),(0,_.jsx)(p.Z.Item,{label:"内容",name:"content",rules:[{required:!0,message:"请输入内容"}],labelCol:{span:2},children:(0,_.jsx)(w.Z,{style:{height:"180px"},defaultvalue:null==n?void 0:n.content})})]})})}))}}]);