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

1 line
9.9 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([[73495],{40822:function(e,n,t){t.d(n,{Z:function(){return w}});var l=t(7557),r=t.n(l),a=t(41498),s=t.n(a),o=t(82242),i=t.n(o),u=t(79800),c=t.n(u),d=t(39647),p=t.n(d),f=t(59301),m=t(8591),h=t(53326),v=t(95237),x=t(84666),g=t(21884),b=t(11249),j="tip___bHEXo",C=t(37712),_=["ButtonText","ButtonOptions","uploadProps","showTip"],w=function(e){var n,t,l,a=e.ButtonText,o=e.ButtonOptions,u=e.uploadProps,d=e.showTip,w=p()(e,_),Z=(0,f.useState)(null),k=c()(Z,2),y=k[0],I=k[1],E=i()(i()({maxCount:1,accept:"image/*",withCredentials:!0,beforeUpload:function(e){var n=e.size/1024/1024;return 0!=n||(m.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==w||w.onChange(null===(n=e.file)||void 0===n||null===(n=n.response)||void 0===n?void 0:n.id))},action:"".concat(x.Z.API_SERVER,"/api/attachments.json")},u||{}),{},{onRemove:(t=s()(r()().mark((function e(n){return r()().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(){I(null),null==w||w.onChange()};return(0,f.useEffect)((function(){(null==w?void 0:w.value)&&I({response:{id:null==w?void 0:w.value}})}),[null==w?void 0:w.value]),(0,C.jsx)("div",{id:(null==w?void 0:w.scrollId)||"",children:null!=y&&null!==(n=y.response)&&void 0!==n&&n.id?(0,C.jsxs)(v.Z,{align:"middle",justify:"center",style:{position:"relative",width:400,backgroundColor:"#f4f3f4"},children:[(0,C.jsx)("img",{src:x.Z.API_SERVER+"/api/attachments/"+(null==y||null===(l=y.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()(r()().mark((function e(){return r()().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,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(h.Z,i()(i()({},E),{},{children:(0,C.jsx)(b.op,i()(i()({style:i()({borderRadius:"2px"},null==o?void 0:o.style)},o),{},{children:a}))})),d&&(0,C.jsx)("span",{className:j,children:"建议上传尺寸为472*266的图片"})]})})}},59517:function(e,n,t){t.d(n,{Z:function(){return x}});var l=t(82242),r=t.n(l),a=t(7557),s=t.n(a),o=t(41498),i=t.n(o),u=t(79800),c=t.n(u),d=t(59301),p=t(84686),f=t(67444),m=t(33936),h=(t(95275),{editor_css:"editor_css___cm3Z8"}),v=t(37712),x=(0,m.connect)((function(e){return{user:e.user}}))((function(e){var n=e.defaultvalue,t=e.onChange,l=e.style,a=e.user,o=e.placeholder,u=2097152,m=(0,d.useRef)(null),x=(0,d.useState)(null),g=c()(x,2),b=g[0],j=g[1],C=(0,d.useState)(""),_=c()(C,2),w=_[0],Z=_[1];(0,d.useEffect)((function(){Z(n)}),[n]),(0,d.useEffect)((function(){t(w)}),[w]);var k={placeholder:o||"请输入内容...",MENU_CONF:{}};k.MENU_CONF.uploadImage={customUpload:function(e,n){return i()(s()().mark((function t(){var l,r;return s()().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return(l=new FormData).append("file",e),t.next=4,(0,f.ZP)("/api/attachments.json",{method:"post",body:l},!0);case 4:r=t.sent,n(null==r?void 0:r.url,"","");case 6:case"end":return t.stop()}}),t)})))()}},k.MENU_CONF.uploadVideo={customUpload:function(e,n){return i()(s()().mark((function t(){var l,r,o,i,c,d,p,h,v,x,g,b,j,C;return s()().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return l=e.size,r=Math.ceil(l/u),t.prev=2,t.next=5,(0,f.ZP)("/api/attachments/multipart_upload_start",{method:"POST",body:{fileName:e.name,chunkCount:r,user_id:null==a||null===(o=a.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,m.current=new AbortController,p=[],0,h=s()().mark((function n(){var t,r,a,o;return s()().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:t=v*u,r=Math.min(t+u,l),a=e.slice(t,r),(o=new FormData).append("chunk",a),o.append("fileName",e.name),o.append("chunkIndex",(v+1).toString()),o.append("uploadId",d),p.push((function(){return(0,f.ZP)("/api/attachments/multipart_upload",{method:"POST",body:o,signal:m.current.signal},!0).then((function(e){}))}));case 9:case"end":return n.stop()}}),n)})),v=0;case 14:if(!(v<r)){t.next=19;break}return t.delegateYield(h(),"t0",16);case 16:v++,t.next=14;break;case 19:x=0,g=4,console.log(p,"promises");case 22:if(!(x<p.length)){t.next=31;break}if(!((j=null===(b=p.slice(x,x+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,x+=g;case 29:t.next=22;break;case 31:return t.next=33,(0,f.ZP)("/api/attachments/multipart_upload_end",{method:"POST",body:{fileName:e.name,chunkCount:r,uploadId:d,user_id:null==a||null===(i=a.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,v.jsx)(v.Fragment,{children:(0,v.jsxs)("div",{className:null==h?void 0:h.editor_css,style:{border:"1px solid #ccc",zIndex:100},children:[(0,v.jsx)(p.o,{editor:b,defaultConfig:{},mode:"default",style:{borderBottom:"1px solid #ccc"}}),(0,v.jsx)(p.M,{defaultConfig:k,value:w,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,"")))?Z(e.getHtml()):Z("")},mode:"default",style:r()({height:"500px",overflowY:"hidden"},l)})]})})}))},73495:function(e,n,t){t.d(n,{Z:function(){return k}});var l=t(7557),r=t.n(l),a=t(41498),s=t.n(a),o=t(82242),i=t.n(o),u=t(79800),c=t.n(u),d=t(59301),p=t(78241),f=t(8591),m=t(43418),h=t(24650),v=t(88522),x=t(30518),g=t(33936),b=t(61186),j=t.n(b),C="form___EP058",_=t(59517),w=t(40822),Z=t(37712),k=(0,g.connect)((function(e){return{dispatch:e.dispatch,coreCurriculum:e.coreCurriculum}}))((function(e){var n=e.visible,t=e.onOk,l=e.onCancel,a=e.title,o=void 0===a?"":a,u=e.coreCurriculum,g=e.core_subject_tag,b=(e.dispatch,u.CoreSubjects,p.Z.useForm()),k=c()(b,1)[0],y=(0,d.useState)(!1),I=c()(y,2),E=I[0],S=I[1],P=(0,d.useState)([]),N=c()(P,2),F=(N[0],N[1]),O=(0,d.useState)(!1),R=c()(O,2),T=R[0],M=(R[1],(0,d.useState)("")),B=c()(M,2),U=B[0],q=B[1];(0,d.useEffect)((function(){if(null!=n&&n.id){var e;k.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),q(null==n?void 0:n.title)}}),[n]);var L=function(){var e=s()(r()().mark((function e(n){var l;return r()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:S(!0),l=i()({},n),t(l);case 3:case"end":return e.stop()}}),e)})));return function(n){return e.apply(this,arguments)}}();return(0,Z.jsx)(m.Z,{title:"".concat(null!=n&&n.id?"编辑":"新建").concat(o),visible:n,onOk:function(){"<p><br></p>"!=k.getFieldValue("content")?k.submit():f.ZP.error("请输入内容")},centered:!0,onCancel:function(){l()},confirmLoading:E,okButtonProps:{disabled:T},width:1200,afterClose:function(){S(!1),k.resetFields(),q("")},okText:"确认",cancelText:"取消",children:(0,Z.jsxs)(p.Z,{form:k,colon:!1,labelCol:{span:2},onFinish:L,className:C,children:[(0,Z.jsx)(p.Z.Item,{label:"标题",name:"title",rules:[{required:!0,message:"请输入标题"},{whitespace:!0,message:"请输入标题"},{max:100,message:"只能输入100个字符"}],children:(0,Z.jsx)(h.Z,{maxLength:100,placeholder:"请输入标题",suffix:(0,Z.jsxs)("span",{children:[null==U?void 0:U.length,"/100"]}),onChange:function(e){return q(e.target.value)}})}),(0,Z.jsx)(p.Z.Item,{label:"课程",name:"subject",rules:[{required:!0,message:"请选择课程"}],children:(0,Z.jsx)(v.Z,{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&&k.setFieldValue("core_subject_id",e.substring(0,20))}})}),(0,Z.jsx)(p.Z.Item,{label:"学校",name:"school_name",rules:[{required:!0,message:"请输入学校"},{whitespace:!0,message:"请输入学校"},{max:100,message:"只能输入60个字符"}],children:(0,Z.jsx)(h.Z,{maxLength:100,placeholder:"请输入学校"})}),(0,Z.jsxs)("div",{style:{display:"flex",justifyContent:"space-around",marginLeft:"-12px"},children:[(0,Z.jsx)(p.Z.Item,{label:"主讲教师",name:"teacher_name",labelCol:{span:4},rules:[{required:!0,message:"请输入主讲教师"},{whitespace:!0,message:"请输入主讲教师"},{max:50,message:"只能输入50个字符"}],children:(0,Z.jsx)(h.Z,{maxLength:50,placeholder:"请输入主讲教师",style:{width:487}})}),(0,Z.jsx)(p.Z.Item,{label:"时间",name:"time",labelCol:{span:3},rules:[{required:!0,message:"请选择时间"}],children:(0,Z.jsx)(x.default,{style:{width:487},placeholder:"请选择开始时间 - 请选择结束时间",format:"YYYY-MM-DD",allowClear:!1})})]}),(0,Z.jsx)(p.Z.Item,{label:"课程链接",name:"link",rules:[{message:"请输入链接"}],children:(0,Z.jsx)(h.Z,{maxLength:100,placeholder:"请输入链接"})}),(0,Z.jsx)(p.Z.Item,{label:"内容",name:"content",rules:[{required:!0,message:"请输入内容"}],labelCol:{span:2},children:(0,Z.jsx)(_.Z,{style:{height:"300px"},defaultvalue:null==n?void 0:n.content})}),(0,Z.jsx)(p.Z.Item,{name:"cover_id",label:"照片",rules:[{required:!0,message:"请上传照片"}],children:(0,Z.jsx)(w.Z,{ButtonText:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)("i",{className:"iconfont icon-shangchuanfujian r5 font14"}),(0,Z.jsx)("span",{className:"ml5",children:"上传照片"})]})})})]})})}))}}]);