index-legacy.088131da.js 12 KB

123456789101112131415161718192021222324
  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="._colUpload_1er9j_1{line-height:0}._colUpload_1er9j_1 ._uploadFileMusic_1er9j_4{color:#14bc9c;-webkit-text-decoration-line:underline;text-decoration-line:underline}._uploadSection_1er9j_8{width:150px;height:85px;background:#f8faf9;border-radius:10px;border:1px solid rgba(45,199,170,.26);font-size:14px;color:#2dc7aa;line-height:20px}._uploadFile_1er9j_4{width:100%;min-width:300px;height:50px;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_1er9j_4 .el-icon{margin-right:5px}._fileUpload_1er9j_32 .el-upload--text{width:100%}._fileUpload_1er9j_32 .el-loading-spinner{display:flex;align-items:center;height:42px!important;justify-content:center;margin-top:-20px!important}._fileUpload_1er9j_32 .el-loading-spinner svg{width:20px;height:20px;margin-right:5px}._uploadClass_1er9j_47{height:85px;width:100%}._uploadClass_1er9j_47 .el-loading-spinner{margin-top:-33px;height:85px}._uploadClass_1er9j_47 .el-loading-mask{height:50px;border-radius:10px}\n";document.head.appendChild(__vite_style__);System.register(['./vendor-legacy.2ed87b03.js','./index-legacy.262d8ad3.js'],function(exports){'use strict';var defineComponent,ElMessage,ElLoading,createVNode,ElUpload,ElImage,ElIcon,document_default,onOnlyFileUpload,getUploadSign,iconUpload;return{setters:[function(module){defineComponent=module.d;ElMessage=module.f;ElLoading=module.as;createVNode=module.c;ElUpload=module.ar;ElImage=module.J;ElIcon=module.C;document_default=module.at;},function(module){onOnlyFileUpload=module.o;getUploadSign=module.g;iconUpload=module.i;}],execute:function execute(){var colUpload="_colUpload_1er9j_1";var uploadFileMusic="_uploadFileMusic_1er9j_4";var uploadSection="_uploadSection_1er9j_8";var uploadFile="_uploadFile_1er9j_4";var fileUpload="_fileUpload_1er9j_32";var uploadClass="_uploadClass_1er9j_47";var styles={colUpload:colUpload,uploadFileMusic:uploadFileMusic,uploadSection:uploadSection,uploadFile:uploadFile,fileUpload:fileUpload,uploadClass:uploadClass};var iconDocument="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACwAAAAwCAYAAABqkJjhAAAAAXNSR0IArs4c6QAABdZJREFUaEPNmktwU1UYx//n3pt3H/RFk1ZpS4HSloaxRaCCyEZHXcmArlyAMi6ccRx1YUfrOIwKDMowg47o4KOCuhAcXDjiuFBEZ3wgoKQtlDYQoknTtDRJ2zwakhzn3DS1Ja+TJk38lvd+j9/95tzzffc7lyCJmAIjjSRCdlASeYgADRTEAEoVyfQzva5XFEFFJJwYuQgQcouADgO4TihOE0lxcmf1OnMin+T2i33UqUcg8noEZCcoFTMF4dWfB3ybESEIE6AHkti9a+l6x9zb84D7gmMbaCh8ioIaeAMvVC8V8KxPQoaJQLc9oe/8LXZtFliGDYfOUAr1QiEyseMCBkCAAERsjUHLwGwZUD+9kI/Mxh6KF1jWJ2RYkIR2tjyiwH7HBxGKJzPJULa6GQEDEAg+3FXTuZuw3QAUA4v5giV6OL1UBLUg4Qu2S3AIexEFUdFEen3OFyki+zlscqpSKWlRJenwyfDv3H4FoIuY/I4zoLiP2ypHijpBiQZVGb4e64czOMHllRD8SHr9jhuUYhmXRY6VVqgq4AsH8dXoJS7PhMBKTP6RYC4rGFfkGSUNkbBcVQ6zfwxn3QkL23x3rCKafA6aSZBc65aJGhgUxfBGguj3OmAPeOAK+ZKGKTgwI1MSEbWKEuhEZdp8/C+AY5QSBKgECSKJa3Fm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EAAAAASUVORK5CYII=";var ColUpload=exports('C',defineComponent({name:'col-upload',props:{modelValue:{type:String,default:''},/** 当前类型 */type:{type:String,default:''},uploadType:{type:String,default:'image'},disabled:{type:Boolean,default:false},bucket:{type:String,default:'daya'},size:{type:Number,default:5// 默认5M
  2. },accept:{type:String,default:'.png,.jpg,.jpeg'},tips:{type:String,default:'请上传图片'},extraTips:{type:String,default:'图片最大不能超过5MB'},onChange:{type:Function,default:function _default(){return{};}},onRemove:{type:Function,default:function _default(){return{};}},btnText:{type:String,default:'上传文件'}},data:function data(){return{// ossUploadUrl: 'https://ks3-cn-beijing.ksyuncs.com/' + this.bucket,
  3. ossUploadUrl:"https://".concat(this.bucket,".ks3-cn-beijing.ksyuncs.com/"),dataObj:{policy:'',signature:'',key:'',KSSAccessKeyId:'',acl:'public-read',name:''},fileList:[],loading:null};},methods:{handleSuccess:function handleSuccess(info){var _this=this;return _asyncToGenerator(/*#__PURE__*/regeneratorRuntime.mark(function _callee(){var _this$loading;var obj,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;// console.log(url)
  4. _this.$emit('update:modelValue',url);_this.onChange(url);_context.next=11;break;case 9:_context.prev=9;_context.t0=_context["catch"](0);case 11:(_this$loading=_this.loading)===null||_this$loading===void 0?void 0:_this$loading.close();case 12:case"end":return _context.stop();}}},_callee,null,[[0,9]]);}))();},handleRemove:function handleRemove(){console.log('remove');},handleChange:function handleChange(){console.log('handleChange');},handleProgress:function handleProgress(){console.log('handleProgress');},handleError:function handleError(){var _this$loading2;(_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;return regeneratorRuntime.wrap(function _callee2$(_context2){while(1){switch(_context2.prev=_context2.next){case 0:// beforeUpload
  5. console.log(file);// let fileType = true
  6. // if (props.rules.type && props.rules.type.length > 0) {
  7. // const fileExtension = file.name.split('.').pop().toUpperCase()
  8. // console.log(
  9. // props.rules.type,
  10. // fileExtension,
  11. // props.rules.type.indexOf(fileExtension) != -1
  12. // )
  13. // if (props.rules.type.indexOf(fileExtension) != -1) {
  14. // fileType = true
  15. // } else {
  16. // fileType = false
  17. // ElMessage.error('请上传正确的文件!')
  18. // return false
  19. // }
  20. // }
  21. isLt2M=true;if(!_this2.size){_context2.next=7;break;}isLt2M=file.size/1024/1024<_this2.size;if(isLt2M){_context2.next=7;break;}ElMessage.error("\u6587\u4EF6\u5927\u5C0F\u4E0D\u80FD\u8D85\u8FC7".concat(_this2.size,"M!"));return _context2.abrupt("return",false);case 7:_this2.loading=ElLoading.service({target:_this2.$refs.uploadDom,lock:true,fullscreen:false,text:'上传中...',background:'rgba(0, 0, 0, 0.7)'});console.log(_this2.loading);_context2.prev=9;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', {
  22. // data: obj
  23. // })
  24. _context2.next=15;return getUploadSign(obj);case 15:_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};_context2.next=23;break;case 20:_context2.prev=20;_context2.t0=_context2["catch"](9);_this2.loading.close();case 23:case"end":return _context2.stop();}}},_callee2,null,[[9,20]]);}))();},fileName:function fileName(){var name=arguments.length>0&&arguments[0]!==undefined?arguments[0]:'';return name.split('/').pop();},handleExceed:function handleExceed(){}},render:function render(){var _this3=this;return createVNode("div",{"class":[styles.colUpload,'w-full']},[createVNode(ElUpload,{"disabled":this.disabled,"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","class":this.uploadType==='file'?styles.fileUpload:'',"style":{lineHeight:'0'}},{default:function _default(){return[createVNode("div",{"ref":"uploadDom","class":[styles.uploadClass,'w-full'],"style":{height:_this3.uploadType==='image'?'85px':'48px'}},[_this3.modelValue?_this3.uploadType==='image'?createVNode(ElImage,{"src":_this3.modelValue,"fit":"cover","class":styles.uploadSection},null):createVNode("div",{"class":[styles.uploadFile,_this3.disabled&&'cursor-not-allowed']},[createVNode(ElIcon,{"size":20},{default:function _default(){return[_this3.type==='music'?createVNode("img",{"src":iconDocument},null):createVNode(document_default,null,null)];}}),createVNode("span",{"class":"whitespace-nowrap overflow-hidden text-ellipsis flex-1","style":{lineHeight:'1.2'}},[_this3.fileName(_this3.modelValue)]),!_this3.disabled&&createVNode(ElIcon,{"size":18,"style":"margin-right: 0;","class":"ml-1 cursor-pointer"},{default:function _default(){return[createVNode("img",{"src":iconDelete,"onClick":function onClick(e){e.stopPropagation();_this3.$emit('update:modelValue','');_this3.onRemove();}},null)];}})]):_this3.uploadType==='image'?createVNode("div",{"class":[styles.uploadSection,'flex items-center flex-col justify-center']},[createVNode("img",{"src":iconUpload,"class":"w-8 h-7 mb-3"},null),createVNode("p",null,[_this3.tips])]):createVNode("div",{"class":[styles.uploadFile,_this3.type==='music'?styles.uploadFileMusic:'']},[createVNode(ElIcon,{"size":20},{default:function _default(){return[_this3.type==='music'?createVNode("img",{"src":iconDocument},null):createVNode(document_default,null,null)];}}),_this3.btnText])])];}}),createVNode("p",{"class":"text-3 text-[#999999] leading-6 pt-1"},[this.extraTips])]);}}));}};});})();