index-legacy.d0336e78.js 9.9 KB

1234567891011121314151617181920212223242526272829
  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.0dcd49ba.js','./vendor-legacy.9ba3db9d.js'],function(exports){'use strict';var request,defineComponent,ElMessage,ElLoading,createVNode,ElUpload,ElButton;return{setters:[function(module){request=module.r;},function(module){defineComponent=module.d;ElMessage=module.E;ElLoading=module.ah;createVNode=module.c;ElUpload=module.ag;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:{},responseList:[],// 请求成功之后的数据
  6. btnLoading:false,loading:null};},methods:{handleSuccess:function handleSuccess(response,uploadFile,uploadFiles){var _this$loading;(_this$loading=this.loading)===null||_this$loading===void 0?void 0:_this$loading.close();// 多文件上传,每个文件上传成功后,将文件的url添加到fileList
  7. console.log(this.fileList,'fileList');console.log(response,uploadFile,uploadFiles,'response');if(this.multiple){if(uploadFile.status==='success'){this.responseList.push(this.tempUrls[uploadFile.uid]);}// 说明已经上传完成
  8. // console.log(uploadFiles, 'uploadFiles')
  9. // console.log(this.responseList, 'responseList')
  10. if(uploadFiles.length===this.responseList.length){this.btnLoading=false;this.multipleModel(this.responseList);this.responseList=[];this.fileList=[];}}else{var url=this.ossUploadUrl+this.dataObj.key;this.$emit('update:modelValue',url);}},handleRemove:function handleRemove(){console.log('remove');},handleChange:function handleChange(){console.log('handleChange');// this.responseList = []
  11. // this.tempUrls = []
  12. },handleProgress:function handleProgress(e){console.log('handleProgress',e);},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 _this=this;return _asyncToGenerator(/*#__PURE__*/regeneratorRuntime.mark(function _callee(){var isLt2M,fileName,key,obj,_yield$request$post,data,_this$loading3;return regeneratorRuntime.wrap(function _callee$(_context){while(1){switch(_context.prev=_context.next){case 0:// beforeUpload
  13. console.log(file);// let fileType = true
  14. // if (props.rules.type && props.rules.type.length > 0) {
  15. // const fileExtension = file.name.split('.').pop().toUpperCase()
  16. // console.log(
  17. // props.rules.type,
  18. // fileExtension,
  19. // props.rules.type.indexOf(fileExtension) != -1
  20. // )
  21. // if (props.rules.type.indexOf(fileExtension) != -1) {
  22. // fileType = true
  23. // } else {
  24. // fileType = false
  25. // ElMessage.error('请上传正确的文件!')
  26. // return false
  27. // }
  28. // }
  29. isLt2M=true;if(!_this.size){_context.next=7;break;}isLt2M=file.size/1024/1024<_this.size;if(isLt2M){_context.next=7;break;}ElMessage.error("\u6587\u4EF6\u5927\u5C0F\u4E0D\u80FD\u8D85\u8FC7".concat(_this.size,"M!"));return _context.abrupt("return",false);case 7:if(_this.multiple){_this.btnLoading=true;}else{_this.loading=ElLoading.service({target:_this.$refs.uploadDom,lock:true,fullscreen:false,text:'上传中...',background:'rgba(0, 0, 0, 0.7)'});}_context.prev=8;fileName=file.name.replaceAll(' ','_');key=new Date().getTime()+fileName;obj={filename:fileName,bucketName:_this.bucket,postData:{filename:fileName,acl:'public-read',key:key,unknowValueField:[]}};_context.next=14;return request.post('/api-website/getUploadSign',{data:obj});case 14:_yield$request$post=_context.sent;data=_yield$request$post.data;_this.dataObj={policy:data.policy,signature:data.signature,key:key,KSSAccessKeyId:data.kssAccessKeyId,acl:'public-read',name:fileName};_this.tempUrls[file.uid]=_this.ossUploadUrl+_this.dataObj.key;_context.next=24;break;case 20:_context.prev=20;_context.t0=_context["catch"](8);_this.btnLoading=false;(_this$loading3=_this.loading)===null||_this$loading3===void 0?void 0:_this$loading3.close();case 24:case"end":return _context.stop();}}},_callee,null,[[8,20]]);}))();},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 _this2=this;return createVNode("div",{"class":[styles.colUpload,'w-full']},[createVNode(ElUpload,{"disabled":this.disabled||this.btnLoading,"action":this.ossUploadUrl,"data":this.dataObj,"onSuccess":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:_this2.multiple?'40px':'85px'}},[_this2.modelValue?createVNode("video",{"ref":"videoUpload","crossorigin":"anonymous","class":styles.uploadSection,"src":_this2.modelValue},null):_this2.multiple?createVNode(ElButton,{"size":"large","type":"primary","loading":_this2.btnLoading},{default:function _default(){return[_this2.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,[_this2.tips])])])];}}),!this.multiple&&createVNode("p",{"class":"text-3 text-[#999999] leading-6 pt-1"},[this.extraTips])]);}}));}};});})();