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/57776.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([[57776],{73457:function(e,n,t){t.d(n,{Z:function(){return Z}});var a=t(17061),l=t.n(a),r=t(17156),s=t.n(r),o=t(42122),i=t.n(o),u=t(27424),c=t.n(u),d=t(70215),p=t.n(d),m=t(67294),f=t(2453),h=t(92421),x=t(71230),v=t(59758),g=t(4340),b=t(82749),j="tip___bHEXo",w=t(85893),C=["ButtonText","ButtonOptions","uploadProps","showTip","showText"],Z=function(e){var n,t,a,r=e.ButtonText,o=e.ButtonOptions,u=e.uploadProps,d=e.showTip,Z=e.showText,_=p()(e,C),y=(0,m.useState)(null),k=c()(y,2),I=k[0],P=k[1],E=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):!(n>2)||(f.ZP.error("".concat(e.name," 图片无法上传。超过图片大小限制(2MB)")),h.Z.LIST_IGNORE)},onChange:function(e){var n,t;(["uploading","done","removed"].includes(e.file.status)&&P(e.file),"done"==e.file.status)&&(null==_||_.onChange(null===(n=e.file)||void 0===n||null===(t=n.response)||void 0===t?void 0:t.id))},action:"".concat(v.Z.API_SERVER,"/api/attachments.json")},u||{}),{},{onRemove:(t=s()(l()().mark((function e(n){return l()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:S(),(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)})}),S=function(){P(null),null==_||_.onChange()};return(0,m.useEffect)((function(){(null==_?void 0:_.value)&&P({response:{id:null==_?void 0:_.value}})}),[null==_?void 0:_.value]),(0,w.jsx)("div",{id:(null==_?void 0:_.scrollId)||"",children:null!=I&&null!==(n=I.response)&&void 0!==n&&n.id?(0,w.jsxs)(x.Z,{align:"middle",justify:"center",style:{position:"relative",width:400,backgroundColor:"#f4f3f4"},children:[(0,w.jsx)("img",{src:v.Z.API_SERVER+"/api/attachments/"+(null==I||null===(a=I.response)||void 0===a?void 0:a.id),alt:"avatar",style:{width:"100%"}}),(0,w.jsx)("div",{style:{position:"absolute",right:"-6px",top:"-6px",cursor:"pointer",width:16,height:16,borderRadius:"50%",backgroundColor:"#fff"},children:(0,w.jsx)(g.Z,{onClick:s()(l()().mark((function e(){return l()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:S();case 1:case"end":return e.stop()}}),e)}))),style:{fontSize:"16px",color:"red"}})})]}):(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(h.Z,i()(i()({},E),{},{children:(0,w.jsx)(b.op,i()(i()({style:i()({borderRadius:"2px"},null==o?void 0:o.style)},o),{},{children:r}))})),d&&(0,w.jsx)("span",{className:j,children:"建议上传尺寸为472*266的图片"}),Z&&(0,w.jsx)("span",{className:j,style:{width:"4rem"},children:"需上传尺寸为200*268的图片大小不超过2MB"})]})})}},70304:function(e,n,t){t.d(n,{Z:function(){return v}});var a=t(42122),l=t.n(a),r=t(17061),s=t.n(r),o=t(17156),i=t.n(o),u=t(27424),c=t.n(u),d=t(67294),p=t(23814),m=t(84519),f=t(88275),h=(t(62592),{editor_css:"editor_css___cm3Z8"}),x=t(85893),v=(0,f.connect)((function(e){return{user:e.user}}))((function(e){var n=e.defaultvalue,t=e.onChange,a=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],w=(0,d.useState)(""),C=c()(w,2),Z=C[0],_=C[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 a,l;return s()().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return(a=new FormData).append("file",e),t.next=4,(0,m.ZP)("/api/attachments.json",{method:"post",body:a},!0);case 4:l=t.sent,n(null==l?void 0:l.url,"","");case 6:case"end":return t.stop()}}),t)})))()}},y.MENU_CONF.uploadVideo={customUpload:function(e,n){return i()(s()().mark((function t(){var a,l,o,i,c,d,p,h,x,v,g,b,j,w;return s()().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return a=e.size,l=Math.ceil(a/u),t.prev=2,t.next=5,(0,m.ZP)("/api/attachments/multipart_upload_start",{method:"POST",body:{fileName:e.name,chunkCount:l,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,l,r,o;return s()().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:t=x*u,l=Math.min(t+u,a),r=e.slice(t,l),(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<l)){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:l,uploadId:d,user_id:null==r||null===(i=r.userInfo)||void 0===i?void 0:i.user_id}});case 33:w=t.sent,n(null==w?void 0:w.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:l()({height:"500px",overflowY:"hidden"},a)})]})})}))},57776:function(e,n,t){t.d(n,{Z:function(){return y}});var a=t(17061),l=t.n(a),r=t(17156),s=t.n(r),o=t(42122),i=t.n(o),u=t(27424),c=t.n(u),d=t(67294),p=t(91773),m=t(2453),f=t(14446),h=t(11486),x=t(49288),v=t(45741),g=t(88275),b=t(27484),j=t.n(b),w="form___EP058",C=t(70304),Z=t(73457),_=t(85893),y=(0,g.connect)((function(e){return{dispatch:e.dispatch,coreCurriculum:e.coreCurriculum}}))((function(e){var n=e.visible,t=e.onOk,a=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),O=(N[0],N[1]),T=(0,d.useState)(!1),F=c()(T,2),R=F[0],L=(F[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}})];O(t),B(null==n?void 0:n.title)}}),[n]);var U=function(){var e=s()(l()().mark((function e(n){var a;return l()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:E(!0),a=i()({},n),t(a);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(){a()},confirmLoading:P,okButtonProps:{disabled:R},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:w,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,a;return-1!==(null==n||null===(t=n.label)||void 0===t||null===(a=t.toUpperCase())||void 0===a?void 0:a.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.Z,{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)(C.Z,{style:{height:"180px"},defaultvalue:null==n?void 0:n.content})})]})})}))}}]);