index-legacy.04d5ae97.js 11 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. ;(function(){function asyncGeneratorStep(gen,resolve,reject,_next,_throw,key,arg){try{var info=gen[key](arg);var value=info.value;}catch(error){reject(error);return;}if(info.done){resolve(value);}else{Promise.resolve(value).then(_next,_throw);}}function _asyncToGenerator(fn){return function(){var self=this,args=arguments;return new Promise(function(resolve,reject){var gen=fn.apply(self,args);function _next(value){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"next",value);}function _throw(err){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"throw",err);}_next(undefined);});};}var __vite_style__=document.createElement('style');__vite_style__.innerHTML="._uploadSection_1doix_1{width:150px;height:85px;background:#f8faf9;border-radius:4px;border:1px solid rgba(45,199,170,.26);font-size:14px;color:#2dc7aa;line-height:20px}._uploadFile_1doix_11{width:100%;min-width:300px;height:40px;border:1px solid rgba(142,142,142,.26);border-radius:10px;display:flex;align-items:center;padding:0 15px;color:var(--el-text-color-regular)}._uploadFile_1doix_11 .el-icon{margin-right:5px}._fileUpload_1doix_25 ._uploadClass_1doix_25{position:relative;display:flex;width:96px}._fileUpload_1doix_25 .el-upload{justify-content:flex-start}._fileUpload_1doix_25 .el-upload--text{width:100%}._fileUpload_1doix_25 .el-loading-spinner{display:flex;align-items:center;height:40px!important;justify-content:center;margin-top:-20px!important}._fileUpload_1doix_25 .el-loading-spinner svg{width:20px;height:20px;margin-right:5px}._disabled_1doix_48 ._uploadClass_1doix_25{cursor:not-allowed!important}._uploadClass_1doix_25{height:85px;width:100%}._uploadClass_1doix_25 .el-loading-spinner{margin-top:-33px;height:85px}\n";document.head.appendChild(__vite_style__);System.register(['./index-legacy.76f0d13f.js','./vendor-legacy.7f609859.js'],function(exports){'use strict';var onOnlyFileUpload,getUploadSign,defineComponent,ElMessage,ElLoading,createVNode,ElUpload,ElButton;return{setters:[function(module){onOnlyFileUpload=module.o;getUploadSign=module.g;},function(module){defineComponent=module.d;ElMessage=module.E;ElLoading=module.ai;createVNode=module.c;ElUpload=module.ah;ElButton=module.k;}],execute:function execute(){var uploadSection="_uploadSection_1doix_1";var uploadFile="_uploadFile_1doix_11";var fileUpload="_fileUpload_1doix_25";var uploadClass="_uploadClass_1doix_25";var disabled="_disabled_1doix_48";var styles={uploadSection:uploadSection,uploadFile:uploadFile,fileUpload:fileUpload,uploadClass:uploadClass,disabled:disabled};var iconVideo="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAD4AAAAyCAMAAAAz3ZgNAAAAAXNSR0IArs4c6QAAAX1QTFRFAAAAAP8AAP//AP+AAP//AKqqVaqqVf+qAL+AJNu2IL+fM8yZM8yzLtG5Kr+qKtWqJ8SxMM+vK8aqKMmuLMixLsmqLcutLMWoK8aqKcisK8iqLsuoLcaqLMisK8moMMqqL8usLMmsL8aqLsesLcmqLcaqK8ipLMaoLMarLcWoLsisLsWqLsiqLsWrLsirLsmrLceqLMaqLserLcisLcaqLMaqLsiqLsaoLsirLcmsLceqLcerLciqLseqLMerLMepLcapLsirLsepLsirLcepLMepLcipLsiqLceqLMepLcerLciqLceqLciqLserLciqLceqLceqLceqLMiqLMaqLcirLceqLsaqLsiqLceqLciqLciqLciqLceqLciqLcepLceqLciqLMeqLMeqLcirLceqLciqLcerLciqLceqLceqLceqLcerLMepLceqLceqLMeqLcaqLceqLceqLceqLcaqLceqLcerLceqLcepLceqLMiqLceqLcirLceqsuDHzwAAAH50Uk5TAAEBAgIDAwMEBwgKCgsMDA0QEhMXISIjJCUqLC0uLzAxNDY3OT9BTExPU1RUWFheYGNka2xvb3BwcXJ2eHt/gIKLkZGSlZiipaepqq6vs7S1tre4ubm6vb6/wcbH1tjZ2dna293e3uPj5Ofp6evt7vHz9fb3+Pj4+fr6/f7+i9OX2AAAAdNJREFUSMft1mdTwkAQBuBVQcVeELvYCxbsir1gF3sBGyr2imBH97cbzmggOZLL+cFxxvfTcrMPuSTLcAD6YvPdrRYCb2pCiHiSEbVWOOF7RNW83aw1x4dbZ8jHhkjteEGWrGQJvW5SdkTobmTMTjKAR84tz6wc+yl8nFnjPIXvMTj/SEmawWCIp/B7be3N++5WcG0dFMbE0t5JckhW5kjd0Zgu8afJ6uzMKidlAMYA7A/ULz4u+OLnlZ+bsZ4qmmrBHIixsXWRP1V+3YxVcX0L1Me6rweRT0oPwynvKYeyWNwn8mqJV8l7egGm6TpkE3m2xDPlTUcmMHYveNzh3JKVg3Dpcc/WAAPHKaPWe1fbPOJmiQZXe3RC3neX5l2uAYknuKK42ouj/WSSMHpoVcaGxhNlXGVolbxTyRmyDLBCilZI5eBegC4yqvlQxMGxFIzC/AXsAMM8fFOYn7I6M0Cen4fjlOnzj2EfuTge9ZZbaseCyMml/PM/xOfOfsRbUvquxfKVhwNkDflJucXHAXJHhZm9KOblAOb2thzg55H5XX6vgzcp+Z4OXqHkOg5ml8lKruNYOEg7JPew6m0T9ZDteGXSGzkxDunaB/LQ1aItjkY/AA/7Wc4JL6xFAAAAAElFTkSuQmCC";var ColUploadVideo=exports('C',defineComponent({name:'col-upload-video',props:{modelValue:{type:String,default:''},disabled:{type:Boolean,default:false},bucket:{type:String,default:'daya'},multiple:{// 是否支持多文件上传
  2. type:Boolean,default:false},limit:{type:Number,default:1},size:{type:Number,default:800// 默认5M
  3. },accept:{type:String,// ,.mov,.avi,.flv,.wmv,.mpg,.mpeg,.mpe,.mp3,.wav,.wma,.aac,.m4a,.m4r,.m4v,.3gp,.3g2,.mkv,.webm,.mov,.qt,.mxf,.asf,.asx,.rm,.ram,.rmvb
  4. default:'.mp4'},tips:{type:String,default:'请上传视频'},extraTips:{type:String,default:'视频最大不能超过800MB'},multipleModel:{type:Function,default:function _default(data){}}},data:function data(){return{// ossUploadUrl: 'https://ks3-cn-beijing.ksyuncs.com/' + this.bucket,
  5. ossUploadUrl:"https://".concat(this.bucket,".ks3-cn-beijing.ksyuncs.com/"),dataObj:{policy:'',signature:'',key:'',KSSAccessKeyId:'',acl:'public-read',name:''},fileList:[],tempUrls:{},uploadFileLength:0,// 上传文件数量
  6. responseList:[],// 请求成功之后的数据
  7. btnLoading:false,loading:null};},methods:{handleSuccess:function handleSuccess(info,uploadFiles){var _this=this;return _asyncToGenerator(/*#__PURE__*/regeneratorRuntime.mark(function _callee(){var _this$loading;var obj,url,_url;return regeneratorRuntime.wrap(function _callee$(_context){while(1){switch(_context.prev=_context.next){case 0:_context.prev=0;obj={policy:info.data.policy,signature:info.data.signature,key:info.data.key,KSSAccessKeyId:info.data.kssAccessKeyId,acl:'public-read',name:info.data.key,file:info.file};_context.next=4;return onOnlyFileUpload(_this.ossUploadUrl,obj);case 4:url=_context.sent;if(!_this.multiple){_context.next=11;break;}_this.responseList.push(url);// if (uploadFile.status === 'success') {
  8. // this.responseList.push(this.tempUrls[uploadFile.uid])
  9. // }
  10. // // 说明已经上传完成
  11. // // console.log(uploadFiles, 'uploadFiles')
  12. // // console.log(this.responseList, 'responseList')
  13. if(_this.uploadFileLength===_this.responseList.length){_this.btnLoading=false;_this.multipleModel(_this.responseList);_this.responseList=[];_this.fileList=[];}return _context.abrupt("return",_this.responseList);case 11:_this.$emit('update:modelValue',url);return _context.abrupt("return",url);case 13:_context.next=17;break;case 15:_context.prev=15;_context.t0=_context["catch"](0);case 17:(_this$loading=_this.loading)===null||_this$loading===void 0?void 0:_this$loading.close();// 多文件上传,每个文件上传成功后,将文件的url添加到fileList
  14. // console.log(this.fileList, 'fileList')
  15. // console.log(response, uploadFile, uploadFiles, 'response')
  16. if(_this.multiple);else{_url=_this.ossUploadUrl+_this.dataObj.key;_this.$emit('update:modelValue',_url);}case 19:case"end":return _context.stop();}}},_callee,null,[[0,15]]);}))();},handleRemove:function handleRemove(){console.log('remove');},handleChange:function handleChange(file,fileList){// console.log('handleChange', file, fileList)
  17. this.uploadFileLength=fileList.length;// this.responseList = []
  18. // this.tempUrls = []
  19. },handleProgress:function handleProgress(e){// console.log('handleProgress', e)
  20. },handleError:function handleError(){var _this$loading2;this.btnLoading=false;(_this$loading2=this.loading)===null||_this$loading2===void 0?void 0:_this$loading2.close();},beforeUpload:function beforeUpload(file){var _this2=this;return _asyncToGenerator(/*#__PURE__*/regeneratorRuntime.mark(function _callee2(){var isLt2M,fileName,key,obj,_yield$getUploadSign,data,_this2$loading;return regeneratorRuntime.wrap(function _callee2$(_context2){while(1){switch(_context2.prev=_context2.next){case 0:// beforeUpload
  21. // console.log(file)
  22. // let fileType = true
  23. // if (props.rules.type && props.rules.type.length > 0) {
  24. // const fileExtension = file.name.split('.').pop().toUpperCase()
  25. // console.log(
  26. // props.rules.type,
  27. // fileExtension,
  28. // props.rules.type.indexOf(fileExtension) != -1
  29. // )
  30. // if (props.rules.type.indexOf(fileExtension) != -1) {
  31. // fileType = true
  32. // } else {
  33. // fileType = false
  34. // ElMessage.error('请上传正确的文件!')
  35. // return false
  36. // }
  37. // }
  38. isLt2M=true;if(!_this2.size){_context2.next=6;break;}isLt2M=file.size/1024/1024<_this2.size;if(isLt2M){_context2.next=6;break;}ElMessage.error("\u6587\u4EF6\u5927\u5C0F\u4E0D\u80FD\u8D85\u8FC7".concat(_this2.size,"M!"));return _context2.abrupt("return",false);case 6:if(_this2.multiple){_this2.btnLoading=true;}else{_this2.loading=ElLoading.service({target:_this2.$refs.uploadDom,lock:true,fullscreen:false,text:'上传中...',background:'rgba(0, 0, 0, 0.7)'});}_context2.prev=7;fileName=file.name.replaceAll(' ','_');key=new Date().getTime()+fileName;obj={filename:key,bucketName:_this2.bucket,postData:{filename:key,acl:'public-read',key:key}};// const { data } = await request.post('/api-website/getUploadSign', {
  39. // data: obj
  40. // })
  41. _context2.next=13;return getUploadSign(obj);case 13:_yield$getUploadSign=_context2.sent;data=_yield$getUploadSign.data;_this2.dataObj={policy:data.policy,signature:data.signature,key:key,KSSAccessKeyId:data.kssAccessKeyId,acl:'public-read',name:key};_this2.tempUrls[file.uid]=_this2.ossUploadUrl+_this2.dataObj.key;_context2.next=23;break;case 19:_context2.prev=19;_context2.t0=_context2["catch"](7);_this2.btnLoading=false;(_this2$loading=_this2.loading)===null||_this2$loading===void 0?void 0:_this2$loading.close();case 23:case"end":return _context2.stop();}}},_callee2,null,[[7,19]]);}))();},fileName:function fileName(){var name=arguments.length>0&&arguments[0]!==undefined?arguments[0]:'';return name.split('/').pop();},handleExceed:function handleExceed(e){if(e.length>this.limit){ElMessage.error("\u4E00\u6B21\u6027\u6700\u591A\u53EA\u80FD\u4E0A\u4F20".concat(this.limit,"\u4E2A\u6587\u4EF6"));return false;}}},render:function render(){var _this3=this;return createVNode("div",{"class":[styles.colUpload,'w-full']},[createVNode(ElUpload,{"disabled":this.disabled||this.btnLoading,"action":this.ossUploadUrl,"data":this.dataObj,"httpRequest":this.handleSuccess,"onRemove":this.handleRemove,"onChange":this.handleChange,"onProgress":this.handleProgress,"onError":this.handleError,"fileList":this.fileList,"showFileList":false,"accept":this.accept,"beforeUpload":this.beforeUpload,"onExceed":this.handleExceed,"ref":"uploadRef","multiple":this.multiple,"limit":this.limit,"class":[this.multiple&&styles.fileUpload,this.disabled&&styles.disabled],"style":{lineHeight:'0'}},{default:function _default(){return[createVNode("div",{"ref":"uploadDom","class":[styles.uploadClass,'w-full'],"style":{height:_this3.multiple?'40px':'85px'}},[_this3.modelValue?createVNode("video",{"ref":"videoUpload","crossorigin":"anonymous","class":styles.uploadSection,"src":_this3.modelValue},null):_this3.multiple?createVNode(ElButton,{"size":"large","type":"primary","loading":_this3.btnLoading},{default:function _default(){return[_this3.btnLoading?'上传中...':'点击上传'];}}):createVNode("div",{"class":[styles.uploadSection,'flex items-center flex-col justify-center']},[createVNode("img",{"src":iconVideo,"class":"w-8 h-7 mb-3"},null),createVNode("p",null,[_this3.tips])])])];}}),!this.multiple&&createVNode("p",{"class":"text-3 text-[#999999] leading-6 pt-1"},[this.extraTips])]);}}));}};});})();