filesbox/web/dist/46221.e688d92d.async.js
2024-07-26 14:10:54 +08:00

2 lines
13 KiB
JavaScript

(self.webpackChunkant_design_pro=self.webpackChunkant_design_pro||[]).push([[46221],{51695:function(x){x.exports={upLoadBox:"upLoadBox___3dYrI"}},55462:function(x){x.exports={root:"root___1saff",colorWeak:"colorWeak___RnDog","ant-layout":"ant-layout___2uVwk",globalSpin:"globalSpin___3pVwv","ant-table":"ant-table___25eIk","ant-table-thead":"ant-table-thead___i1WvX","ant-table-tbody":"ant-table-tbody___Encg9",formBox:"formBox___2RqtD",videoModal:"videoModal___2VWaM"}},99267:function(x,T,t){"use strict";t.d(T,{Z:function(){return O}});var Q=t(34792),m=t(48086),C=t(11849),W=t(67294),k=t(80129),K=t.n(k),Z=t(51695),A=t.n(Z),z=t(94301),b=t.n(z),D=t(85893),j=y=>{var a=parseInt(y),i=1024*1024*1024*1024,u=1024*1024*1024,r=1024*1024,v=1024;if(a>i)return(a/i).toFixed(2)+"T";if(a>u)return(a/u).toFixed(2)+"G";if(a>r)return(a/r).toFixed(2)+"M";if(a>v)return(a/v).toFixed(2)+"kb"};function F(y){for(var a=document.cookie,i=a.split("; "),u=0;u<i.length;u++){var r=i[u].split("=");if(r[0]==y)return r[1]}return""}var R=F("stoken")||F("token");class O extends W.Component{constructor(){super(...arguments);this.uloadRegister=()=>{WebUploader.Uploader.register({"before-send":"beforeSend"},{beforeSend:function(i){var u=WebUploader.Deferred(),r=i.file.chunkList||[],v={};r.forEach(P=>{v[P+""]=!0});var I=i.chunk,M=i.chunks;return v[I+""]?u.reject():u.resolve(),u.promise()}})},this.uploadCheckFile=(a,i)=>{var u=this.props,r=u.busType,v=u.directoryId,I=v===void 0?void 0:v,M=u.userId,P=M===void 0?void 0:M,B=u.directoryName,d=B===void 0?void 0:B,S={busType:r,directoryId:I,userId:P,checksum:a.checksum,fileName:a.name,size:a.size};b()("/api/disk/upload/checkFile?".concat((0,k.stringify)(S)),{credentials:"include",headers:{token:R}}).then(E=>E.status==200?E.json():{success:!1}).then(E=>{i(E,I,P,d)})},this.uploadInit=()=>{var a=this,i=this.props,u=i.options,r=i.events,v=i.busType,I=i.cancelFile,M=i.isreplace,P=i.directoryId,B=P===void 0?void 0:P,d=i.userId,S=d===void 0?void 0:d,E=i.directoryName,G=E===void 0?void 0:E,X=i.coursewareType,H=1,L="jpg,doc,docx,ppt,flv,mp4,mp3,jpeg,png,gif,xls,xlsx,pdf,pptx,avi,swf,mov,pps,wmv,mpg,rmvb,doc, docx, ppt, pptx, pdf, xls, xlsx, pps, wps, txt, rar, zip, arj, gz, z, ta";u.pick&&(u.pick=(0,C.Z)((0,C.Z)({},u.pick),{},{id:".picker"}));var h=(0,C.Z)((0,C.Z)({},{auto:!1,swf:"/design/designstatic/aroom/common/js/Uploader.swf",server:"/api/disk/upload?projectid=45",pick:{id:".picker",multiple:!1},resize:!1,disableGlobalDnd:!0,compress:!1,prepareNextFile:!0,timeout:6e4*5,chunked:!0,chunkSize:2*1024*1024,chunkRetry:3,threads:5,formData:{},fileNumLimit:20,fileSizeLimit:200*1024*1024*1024,fileSingleSizeLimit:2*1024*1024*1024,duplicate:!1,accept:{title:"\u5927\u6587\u4EF6\u4E0A\u4F20",extensions:L}}),u);L=h.accept.extensions;var s=WebUploader.create(h);s.option("accept",[this.props.accept]),this.uploader=s;var c="\u8BF7\u9009\u62E9\u6B63\u786E\u6587\u4EF6\u7C7B\u578B:".concat(L);s.on("error",function(e,o){switch(e){case"Q_EXCEED_NUM_LIMIT":m.ZP.error("\u53EA\u5141\u8BB8\u4E0A\u4F20".concat(h.fileNumLimit,"\u4E2A\u6587\u4EF6"));break;case"Q_EXCEED_SIZE_LIMIT":m.ZP.error("\u6587\u4EF6\u5927\u5C0F\u4E0D\u80FD\u8D85\u8FC7".concat(j(h.fileSizeLimit)));break;case"Q_TYPE_DENIED":m.ZP.error(c);break;case"F_EXCEED_SIZE":m.ZP.error("\u6587\u4EF6\u603B\u5927\u5C0F\u4E0D\u80FD\u8D85\u8FC7".concat(j(h.fileSingleSizeLimit)));break;default:m.ZP.error("\u6587\u4EF6\u5DF2\u5B58\u5728\uFF0C\u8BF7\u91CD\u65B0\u9009\u62E9\u3002");break}}),s.on("beforeFileQueued",function(e){if(M&&(e.name=e.name.replace(/\^/g,"")),a.props.accept){var o=a.props.accept.extensions;if(o.indexOf(e.ext)<0)return m.ZP.error("\u8BF7\u9009\u62E9\u6B63\u786E\u6587\u4EF6\u7C7B\u578B:".concat(o)),!1}if(r&&r.beforeFileQueued)return r.beforeFileQueued(e);if(e.type.indexOf("image")>-1&&e.size>2*1024*1024)return m.ZP.error("\u5355\u4E2A\u56FE\u7247\u6700\u5927\u4E0D\u8D85\u8FC72MB"),!1;if(e.size>2*1024*1024*1024)return m.ZP.error("\u5355\u4E2A\u8BFE\u4EF6\u6700\u5927\u4E0D\u8D85\u8FC72G"),!1}),s.on("fileQueued",function(e){r&&r.fileQueued&&s.makeThumb(e,function(o,l){if(o){r.fileQueued(e);return}e.imgUrl=l,r.fileQueued(e)},1,1),e.uploadStatus=0,e.extImg=a.extImg(e.type.split("/")[1]),a.getFiles(),s.md5File(e).progress(function(o){e.md5Progress=o,a.getFiles()}).then(function(o){e.checksum=o,a.uploadCheckFile(e,(l,g,f,p)=>{if(e.uploadStatus==4)return!1;e.userId=f,e.directoryId=g,e.directoryName=p||"",l.success?l.data.fileExists?(e.uploadStatus=2,e.uploadProgress=1,e.sourceId=l.data.sourceId,r&&r.uploadSuccess&&r.uploadSuccess(e,l,s),s.skipFile(e)):(e.chunkList=l.data.chunkList,e.uploadStatus=0,s.upload(e)):(m.ZP.warning("\u79D2\u4F20\u9A8C\u8BC1\u63A5\u53E3\u5F02\u5E38, \u5DF2\u5207\u6362\u5230\u6B63\u5E38\u4E0A\u4F20\u901A\u9053"),s.upload(e)),a.getFiles()}),a.getFiles()})}),s.on("uploadStart",function(e,o){e.uploadStatus=1,a.getFiles()}),s.on("uploadBeforeSend",function(e,o,l){var g=e.file||{};l.token=R,o.busType=v,o.directoryId=g.directoryId,o.userId=g.userId,o.checksum=e.file.checksum,o.chunk=e.chunk,o.chunkSize=e.end-e.start,o.chunks=e.chunks}),s.on("uploadProgress",function(e,o){e.uploadProgress=o,a.getFiles()}),s.on("uploadSuccess",function(e,o){e.uploadStatus=2,o.success?e.sourceId=o.data.commonSourceId:(e.uploadStatus=3,m.ZP.error("\u4E0A\u4F20\u5931\u8D25\uFF0C\u8BF7\u91CD\u65B0\u4E0A\u4F20")),r&&r.uploadSuccess&&r.uploadSuccess(e,o,s),a.getFiles()}),s.on("uploadError",function(e){e.uploadStatus=3,a.getFiles()}),s.on("fileDequeued",function(e){e.uploadStatus=4,a.getFiles()})},this.getFiles=()=>{var a=this.props.onChange,i=this.uploader.getFiles();a&&a(i,this.uploader)},this.extImg=a=>{switch(a.toLowerCase()){case"avi":return"/design/designstatic/chatroom/img/dialog_avi.png";case"bmp":return"/design/designstatic/chatroom/img/dialog_bmp.png";case"bt":return"/design/designstatic/chatroom/img/dialog_bt.png";case"camera":return"/design/designstatic/chatroom/img/dialog_camera.png";case"course":return"/design/designstatic/chatroom/img/dialog_course.png";case"doc":return"/design/designstatic/chatroom/img/dialog_doc.png";case"docx":return"/design/designstatic/chatroom/img/dialog_doc.png";case"exam":return"/design/designstatic/chatroom/img/dialog_exam.png";case"flv":return"/design/designstatic/chatroom/img/dialog_flv.png";case"gif":return"/design/designstatic/chatroom/img/dialog_gif.png";case"html":return"/design/designstatic/chatroom/img/dialog_html.png";case"jpeg":return"/design/designstatic/chatroom/img/dialog_jpeg.png";case"jpg":return"/design/designstatic/chatroom/img/dialog_jpg.png";case"mov":return"/design/designstatic/chatroom/img/dialog_mov.png";case"mp3":return"/design/designstatic/chatroom/img/dialog_mp3.png";case"mp4":return"/design/designstatic/chatroom/img/dialog_mp4.png";case"mpg":return"/design/designstatic/chatroom/img/dialog_mpg.png";case"pdf":return"/design/designstatic/chatroom/img/dialog_pdf.png";case"png":return"/design/designstatic/chatroom/img/dialog_png.png";case"ppt":return"/design/designstatic/chatroom/img/dialog_ppt.png";case"pptx":return"/design/designstatic/chatroom/img/dialog_ppt.png";case"pps":return"/design/designstatic/chatroom/img/dialog_ppt.png";case"rar":return"/design/designstatic/chatroom/img/dialog_rar.png";case"rmvb":return"/design/designstatic/chatroom/img/dialog_rmvb.png";case"survey":return"/design/designstatic/chatroom/img/dialog_survey.png";case"swf":return"/design/designstatic/chatroom/img/dialog_swf.png";case"txt":return"/design/designstatic/chatroom/img/dialog_txt.png";case"wmv":return"/design/designstatic/chatroom/img/dialog_wmv.png";case"xls":return"/design/designstatic/chatroom/img/dialog_xls.png";case"xlsx":return"/design/designstatic/chatroom/img/dialog_xls.png";case"zip":return"/design/designstatic/chatroom/img/dialog_zip.png"}}}componentDidMount(){this.uloadRegister(),this.uploadInit()}componentWillUnmount(){var a=this.props.dispatch}render(){var a=this.props,i=a.children,u=a.disabled,r=u===void 0?!1:u;return(0,D.jsxs)("div",{style:{display:"inline-block"},children:[(0,D.jsx)("div",{style:{display:r?"inline-block":"none",opacity:.5,cursor:"not-allowed"},children:i}),(0,D.jsx)("div",{style:{display:r?"none":"inline-block"},className:A().upLoadBox+" picker",children:i})]})}}O.defaultProps={options:{},events:{},busType:"doc",isreplace:!1,onChange:()=>{}}},11194:function(x,T,t){"use strict";t.r(T),t.d(T,{default:function(){return L}});var Q=t(30887),m=t(28682),C=t(34669),W=t(54458),k=t(20228),K=t(11382),Z=t(57663),A=t(71577),z=t(34792),b=t(48086),D=t(11849),j=t(14781),F=t(23492),R=t(13254),O=t(14277),y=t(71194),a=t(50146),i=t(18106),u=t(95562),r=t(67294),v=t(28216),I=t(55462),M=t.n(I),P=t(99267),B=t(49101),d=t(85893),S,E,G=u.Z.TabPane,X=a.Z.confirm;function H(h){for(var s=document.cookie,c=s.split("; "),e=0;e<c.length;e++){var o=c[e].split("=");if(o[0]==h)return o[1]}return""}var L=(S=(0,v.$j)(h=>{var s=h.commondesign,c=h.page;return{commondesign:s,page:c}}),S(E=class extends r.PureComponent{constructor(){super(...arguments);this.state={visible:!1,activeKey:"self",type:"false",value:"",itemValue:{},upload:!0,loading:!1,md5Progress:0,uploadProgress:0,videoList:[],videoTotal:0},this.show=function(){var s=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1},this.current=1,this.pageSize=50,this.getIndexVideos=()=>{var s=this,c=this.props.dispatch;c({type:"globaldesign/indexVideos",payload:{currentPage:s.current,pageSize:s.pageSize},callback:e=>{if(e.success){var o=e.data;s.setState({videoList:o.list,videoTotal:o.total})}}})}}componentDidMount(){var s=this.props,c=s.visible,e=s.callback;this.setState({visible:c,callback:e}),this.getIndexVideos(),this.show()}renderContent(){var s=this,c=s.state,e=c.videoList,o=c.videoTotal,l=c.value,g=n=>{s.setState({value:n.commonSourceId,itemValue:n})},f=n=>{var _=$("#video".concat(n.commonSourceId))[0];_.paused?(_.play(),$("#poster".concat(n.commonSourceId)).hide()):(_.pause(),$("#poster".concat(n.commonSourceId)).show())},p={current:s.currentPage,pageSize:s.pageSize,total:o,onChange:n=>{s.current=n,s.getIndexVideos()},hideOnSinglePage:!0,showSizeChanger:!1};return(0,d.jsxs)("div",{className:"tabsContent",children:[e.map(n=>(0,d.jsxs)("div",{className:"videoCardBox ".concat(l==n.commonSourceId?"on":""),onClick:()=>g(n),children:[(0,d.jsxs)("div",{className:"videoCover",children:[(0,d.jsx)("div",{id:"poster".concat(n.commonSourceId),className:"poster",style:{backgroundImage:"url(".concat(""+n.thumb,")")},onMouseOver:()=>f(n)}),(0,d.jsx)("video",{id:"video".concat(n.commonSourceId),src:""+n.sourcePath,loop:!0,muted:!0,onMouseOut:()=>f(n)})]}),(0,d.jsx)("div",{className:"sourceName",children:n.sourceName})]},n.commonSourceId)),e.length<1&&(0,d.jsx)(O.Z,{image:O.Z.PRESENTED_IMAGE_SIMPLE}),(0,d.jsx)(F.Z,(0,D.Z)({},p))]})}renderUploadButton(){var s=this,c=this.props,e=c.dispatch,o=c.page,l=s.state.loading,g={extensions:"mp4",mimeTypes:".mp4"},f={domId:"videoUpload",busType:"index_video",options:{chunkSize:2*1024*1024,pick:{multiple:!1},accept:g,fileNumLimit:100},events:{beforeFileQueued:p=>{var n=g.extensions;if(p.size>50*1024*1024)return b.ZP.error("\u8BF7\u4E0A\u4F20\u5C0F\u4E8E50M\u7684\u89C6\u9891"),!1},fileQueued:p=>{s.setState({loading:!0})},uploadSuccess:p=>{console.log("file, success",p),s.setState({loading:!1}),s.getIndexVideos()}},onChange:(p,n)=>{var _=p[0]||{},U=_.md5Progress,N=_.uploadProgress;s.setState({md5Progress:U,uploadProgress:N})},accept:g};return(0,d.jsx)("div",{className:"btnBox",style:{pointerEvents:l?"none":"auto"},children:(0,d.jsx)(K.Z,{spinning:l,size:"small",children:(0,d.jsx)("div",{style:{height:32},children:(0,d.jsx)(P.Z,(0,D.Z)((0,D.Z)({},f),{},{children:(0,d.jsx)(A.Z,{icon:(0,d.jsx)(B.Z,{}),style:{width:110,marginBottom:5},loading:l,children:"\u4E0A\u4F20"})}))})})})}renderProgress(){var s=this,c=s.state,e=c.md5Progress,o=e===void 0?0:e,l=c.uploadProgress,g=l===void 0?0:l,f=c.loading;if(!f)return"";var p=parseInt(o*100),n=parseInt(g*100),_=n||p,U=n?"success ":"active";return(0,d.jsx)("div",{className:"progressBox",children:(0,d.jsx)(W.Z,{percent:_,success:{percent:30},showInfo:!1,size:"small",strokeWidth:3,status:U,trailColor:n?"#40a9ff":void 0})})}render(){var s=this,c=this.props,e=c.commondesign,o=c.dispatch,l=e.Video,g=l.visible,f=l.callback,p=l.callClose,n=p===void 0?()=>{}:p,_=this.state,U=_.activeKey,N=_.type,Y=_.value,ee=_.upload,J=_.itemValue,V=q=>{this.setState({value:""},()=>{o({type:"commondesign/setState",payload:{Video:{visible:!1}}}),n()})},w=q=>{Y?(f(J),V()):b.ZP.info("\u8BF7\u9009\u62E9\u89C6\u9891")};return(0,d.jsxs)(a.Z,{title:"\u89C6\u9891",visible:g,onOk:w,width:880,onCancel:V,maskClosable:!1,className:M().videoModal,zIndex:1001,children:[(0,d.jsxs)("div",{className:"left",children:[(0,d.jsx)(m.Z,{style:{width:170},defaultSelectedKeys:["self"],mode:"inline",children:(0,d.jsx)(m.Z.Item,{children:"\u6211\u7684\u89C6\u9891"},"self")}),s.renderUploadButton()]}),(0,d.jsx)("div",{className:"right",ref:"imgbox",children:s.renderContent()}),s.renderProgress()]})}})||E)}}]);