import{d as y,e as I,o as T,bj as g,g as i,m as v,bv as k,bD as z,bE as c,b8 as U,c as a,a5 as n,F as b}from"./index.5f7ffb46.js";import{I as m}from"./index.276a5d68.js";import{U as A}from"./index.36e5ddaf.js";const C="_singleImgClose_tym2a_24",M="_uploader_tym2a_1",V="_previewImg_tym2a_35",x="_uploadImg_tym2a_41";var l={"uploader-section":"_uploader-section_tym2a_1","img-close":"_img-close_tym2a_8",singleImgClose:C,uploader:M,default:"_default_tym2a_30",previewImg:V,uploadImg:x},L="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMwAAAC8CAMAAAAD3rEBAAABWVBMVEUAAADZ2dna2tra2trZ2dna2trZ2dnb29va2trZ2dnc3Nz5+fn5+fn4+Pj4+Pj5+fnb29v////Z2dn29vbi4uLa2trj4+Pq6ur4+Pjg4OD4+PjZ2dk9PT13d3ff39/29vbj4+Px8fHc3Nzu7u6CgoLs7OzX19fq6url5eW8vLypqan09PTPz8+vr6/w8PDLy8u9vb2ZmZn/o3zHx8eJiYnAwMD/pn98fHz/kGiOjo7/qoJ5eXn/jWWLi4v/oHj/iWGjo6P/mXFGRkbz8/NRUVFBQUHY2NjR0dH61sampqacnJz/kmqurq6WlpaSkpL9p4h/f3//nXX/lWyGhobh4eG0tLRxcXG4uLifn5//lm5ZWVmysrL+tZVdXV3ExMT9uJr47OfJycn9rI9bW1v6z776zbz/rYbn5+f55Nv639PGxsb60MH6zr2zs7P8wKWTk5NnZ2f7x7X8wqd47tpPAAAAGnRSTlMA+Jbr46yHeDcbE7T465dXVwnS69PTl+vTtLW+UnUAAAeQSURBVHja7NpbTyIxGIDh4lk8u5vN7tcJM0BABWOMCgGjEo4L4YIoGxLNGAigkWhc9f9fbFvc4ViRWEI7mfcSufDJlG/aAdTb0uL89qwLdwUs+V5xzW7PLy4hbssLc7iddP8675W5heWhFPeMC2PfbsAb1kGB9LA3sOvD2PXDPWjZ+ObDxgEo1oGB02sb/ZZ18gcvKFgYANZ7KFsroHQrW6iT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yAIlewlCzxJIOUsAZqYAcgaxbj4xB1BFIcxnjlGFi5iLeO+lj7GqkwDujDzUeLOTAOzwbive2+JDI+LxctNN0uDq0HTtIJ4a2DYHfPZELl7OA24hY3yzT8hl9uxh6+YTmezxQx1HZD+enS9Bbhh7Mopr/KbKU16Mshp5NagcaUmmeYU/lUV2fN7c/kL/H9ncPWZFiS9eAXzYxwpg8+k+AAAAAElFTkSuQmCC",F=y({name:"col-upload",props:{modelValue:{type:Array,default:()=>[]},deletable:{type:Boolean,default:!0},maxCount:{type:Number,default:1},native:{type:Boolean,default:!1},uploadSize:{type:Number,default:5},uploadType:{type:String,default:"IMAGE"},accept:{type:String,default:"image/*"},onUploadChange:{type:Function,default:e=>{}},bucket:{type:String,default:"gyt"},path:{type:String,default:""},uploadIcon:{type:String,default:L},size:{type:String,default:"default"},disabled:{type:Boolean,default:!1}},methods:{nativeUpload(){if(this.disabled)return;const e=this.uploadType==="VIDEO"?"video":"img";I({api:"chooseFile",content:{type:e,max:1,bucket:this.bucket,path:this.path}},t=>{console.log(t,"fileUrl"),this.maxCount>1?(this.$emit("update:modelValue",[...this.modelValue,t.fileUrl]),this.onUploadChange([...this.modelValue,t.fileUrl])):(this.$emit("update:modelValue",[t.fileUrl]),this.onUploadChange([t.fileUrl]))})},beforeRead(e){return console.log(e,"beforeRead"),e.size/1024/1024d==t);o>-1&&(s.splice(o,1),this.$emit("update:modelValue",s),this.onUploadChange()),e.stopPropagation()},async getFile(e){try{await this.uploadFile(e)}catch{}},async uploadFile(e){try{i.platformType==="SCHOOL"?i.platformApi="/api-school":i.platformType==="TEACHER"?i.platformApi="/api-teacher":i.platformType==="STUDENT"&&(i.platformApi="/api-student");const t=i.platformApi+"/open/getUploadSign",s=e.name||"",o=this.path+"/"+(s&&s.replace(/ /gi,"_")),d=new Date().getTime()+o;console.log(e);const u=await v.post(t,{data:{filename:o,bucketName:this.bucket,postData:{filename:o,acl:"public-read",key:d,unknowValueField:[]}}});k({message:"\u52A0\u8F7D\u4E2D...",forbidClick:!0,loadingType:"spinner",duration:0});const h={policy:u.data.policy,signature:u.data.signature,key:d,KSSAccessKeyId:u.data.kssAccessKeyId,acl:"public-read",name:o},r=new FormData;for(const f in h)r.append(f,h[f]);r.append("file",e,o),await z(c(this.bucket),{method:"POST",data:r}),console.log(c(this.bucket)+d);const p=c(this.bucket)+d;g(),this.maxCount>1?(this.$emit("update:modelValue",[...this.modelValue,p]),this.onUploadChange([...this.modelValue,p])):(this.$emit("update:modelValue",[p]),this.onUploadChange([p]))}catch(t){console.log(t,"uploadFile")}}},render(){return U(()=>this.modelValue),a("div",{class:l["uploader-section"]},[this.modelValue.length>0&&this.maxCount>1&&this.modelValue.map(e=>a("div",{class:[l.uploader,l[this.size]]},[this.deletable&&!this.disabled&&a(n,{name:"cross",onClick:t=>this.onClose(t,e),class:l["img-close"]},null),a("div",{class:["van-uploader__upload"]},[this.uploadType==="IMAGE"?a(m,{src:e,class:l.previewImg,fit:"cover"},null):a("video",{ref:"videoUpload",style:{backgroundColor:"#F8F8F8"},class:l.previewImg,src:e+"#t=1,4"},null)])])),this.native?this.maxCount>1?a("div",{class:[l.uploader,l[this.size]],onClick:this.nativeUpload},[a(n,{name:this.uploadIcon,class:["van-uploader__upload"],size:"32"},null)]):a("div",{class:[l.uploader,l[this.size]],onClick:this.nativeUpload},[this.modelValue.length>0?a("div",{class:["van-uploader__upload"]},[this.modelValue.map(e=>a(b,null,[this.deletable&&!this.disabled&&a(n,{name:"cross",onClick:t=>this.onClose(t,e),class:[l["img-close"],l.singleImgClose]},null),this.uploadType==="IMAGE"?a(m,{fit:"cover",position:"center",class:l.uploadImg,src:e},null):a("video",{ref:"videoUpload",class:l.uploadImg,style:{backgroundColor:"#F8F8F8"},src:e+"#t=1,4"},null)]))]):a(n,{name:this.uploadIcon,class:["van-uploader__upload"],size:"32"},null)]):this.maxCount>1?a(A,{class:[l.uploader,l[this.size]],afterRead:this.afterRead,beforeRead:this.beforeRead,beforeDelete:this.beforeDelete,uploadIcon:this.uploadIcon,disabled:this.modelValue.length===this.maxCount||this.disabled,accept:this.accept},null):a(A,{class:[l.uploader,l[this.size]],afterRead:this.afterRead,beforeRead:this.beforeRead,beforeDelete:this.beforeDelete,uploadIcon:this.uploadIcon,accept:this.accept,disabled:this.disabled},{default:()=>[this.modelValue.length>0?a("div",{class:["van-uploader__upload"]},[this.modelValue.map(e=>a(b,null,[this.deletable&&!this.disabled&&a(n,{name:"cross",onClick:t=>this.onClose(t,e),class:[l["img-close"],l.singleImgClose]},null),this.uploadType==="IMAGE"?a(m,{fit:"cover",position:"center",class:l.uploadImg,src:e},null):a("video",{ref:"videoUpload",class:l.uploadImg,style:{backgroundColor:"#F8F8F8"},src:e+"#t=1,4"},null)]))]):a(n,{name:this.uploadIcon,class:["van-uploader__upload"],size:"32"},null)]})])}});export{F as O};