1 |
- import{o as n,g as r}from"./index.58649a4a.js";import{d as p,E as d,ai as u,c as i,ah as h,k as m}from"./vendor.af53403a.js";const q="_uploadSection_1doix_1",A="_uploadFile_1doix_11",g="_fileUpload_1doix_25",f="_uploadClass_1doix_25",b="_disabled_1doix_48";var l={uploadSection:q,uploadFile:A,fileUpload:g,uploadClass:f,disabled:b},y="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",k=p({name:"col-upload-video",props:{modelValue:{type:String,default:""},disabled:{type:Boolean,default:!1},bucket:{type:String,default:"daya"},multiple:{type:Boolean,default:!1},limit:{type:Number,default:1},size:{type:Number,default:800},accept:{type:String,default:".mp4"},tips:{type:String,default:"\u8BF7\u4E0A\u4F20\u89C6\u9891"},extraTips:{type:String,default:"\u89C6\u9891\u6700\u5927\u4E0D\u80FD\u8D85\u8FC7800MB"},multipleModel:{type:Function,default:e=>{}}},data(){return{ossUploadUrl:`https://${this.bucket}.ks3-cn-beijing.ksyuncs.com/`,dataObj:{policy:"",signature:"",key:"",KSSAccessKeyId:"",acl:"public-read",name:""},fileList:[],tempUrls:{},uploadFileLength:0,responseList:[],btnLoading:!1,loading:null}},methods:{async handleSuccess(e,a){var o;try{const t={policy:e.data.policy,signature:e.data.signature,key:e.data.key,KSSAccessKeyId:e.data.kssAccessKeyId,acl:"public-read",name:e.data.key,file:e.file},s=await n(this.ossUploadUrl,t);return this.multiple?(this.responseList.push(s),this.uploadFileLength===this.responseList.length&&(this.btnLoading=!1,this.multipleModel(this.responseList),this.responseList=[],this.fileList=[]),this.responseList):(this.$emit("update:modelValue",s),s)}catch{}if((o=this.loading)==null||o.close(),!this.multiple){const t=this.ossUploadUrl+this.dataObj.key;this.$emit("update:modelValue",t)}},handleRemove(){console.log("remove")},handleChange(e,a){this.uploadFileLength=a.length},handleProgress(e){},handleError(){var e;this.btnLoading=!1,(e=this.loading)==null||e.close()},async beforeUpload(e){var o;let a=!0;if(this.size&&(a=e.size/1024/1024<this.size,!a))return d.error(`\u6587\u4EF6\u5927\u5C0F\u4E0D\u80FD\u8D85\u8FC7${this.size}M!`),!1;this.multiple?this.btnLoading=!0:this.loading=u.service({target:this.$refs.uploadDom,lock:!0,fullscreen:!1,text:"\u4E0A\u4F20\u4E2D...",background:"rgba(0, 0, 0, 0.7)"});try{const t=e.name.replaceAll(" ","_"),s=new Date().getTime()+t,L={filename:s,bucketName:this.bucket,postData:{filename:s,acl:"public-read",key:s}},{data:c}=await r(L);this.dataObj={policy:c.policy,signature:c.signature,key:s,KSSAccessKeyId:c.kssAccessKeyId,acl:"public-read",name:s},this.tempUrls[e.uid]=this.ossUploadUrl+this.dataObj.key}catch{this.btnLoading=!1,(o=this.loading)==null||o.close()}},fileName(e=""){return e.split("/").pop()},handleExceed(e){if(e.length>this.limit)return d.error(`\u4E00\u6B21\u6027\u6700\u591A\u53EA\u80FD\u4E0A\u4F20${this.limit}\u4E2A\u6587\u4EF6`),!1}},render(){return i("div",{class:[l.colUpload,"w-full"]},[i(h,{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:!1,accept:this.accept,beforeUpload:this.beforeUpload,onExceed:this.handleExceed,ref:"uploadRef",multiple:this.multiple,limit:this.limit,class:[this.multiple&&l.fileUpload,this.disabled&&l.disabled],style:{lineHeight:"0"}},{default:()=>[i("div",{ref:"uploadDom",class:[l.uploadClass,"w-full"],style:{height:this.multiple?"40px":"85px"}},[this.modelValue?i("video",{ref:"videoUpload",crossorigin:"anonymous",class:l.uploadSection,src:this.modelValue},null):this.multiple?i(m,{size:"large",type:"primary",loading:this.btnLoading},{default:()=>[this.btnLoading?"\u4E0A\u4F20\u4E2D...":"\u70B9\u51FB\u4E0A\u4F20"]}):i("div",{class:[l.uploadSection,"flex items-center flex-col justify-center"]},[i("img",{src:y,class:"w-8 h-7 mb-3"},null),i("p",null,[this.tips])])])]}),!this.multiple&&i("p",{class:"text-3 text-[#999999] leading-6 pt-1"},[this.extraTips])])}});export{k as C};
|