import{d as y,r,a0 as j,e as x,o as C,c as k,i as g,v as p,h as d,n as u,g as B,w as F,Y as A,a6 as I,_ as S}from"./index-17740f03-1778929502341v=1.0.0.js";const D={class:"upload-container"},L={class:"image_container"},M=["src"],O=y({__name:"CoverImage",props:{images:String,checkStrictly:{type:Boolean,default:!1},placeholder:{type:String,required:!0},value:{type:Array,default:()=>[]}},emits:["update:images","change"],setup(U,{emit:m}){const i=r(!0),_=r("https://qmjs.ynsport.cn/zwapi/img/upload"),s=r({}),l=r("");j(()=>l.value,a=>{a?(i.value=!1,v("update:images",a)):i.value=!0});const v=m,f=a=>{if(!(a.size/1024/1024<2))return A.confirm("\u56FE\u7247\u5927\u5C0F\u4E0D\u80FD\u5927\u4E8E2M","\u9519\u8BEF",{confirmButtonText:"\u786E\u5B9A",draggable:!0}),!1;const t=a.uid,e=new Image;e.src=window.URL.createObjectURL(a),e.onload=()=>{s.value[t]={hasSuccess:!1,uid:a.uid,url:"",width:e.width,height:e.height}}},h=(a,o)=>{const t=o.uid,e=Object.keys(s.value);for(let n=0,b=e.length;n<b;n++)if(s.value[e[n]].uid===t){s.value[e[n]].url=a.data.imgUrl,s.value[e[n]].hasSuccess=!0;break}const c=Object.values(s.value);l.value=c.length>0?c[0].url:""},w=a=>{const o=a.uid,t=Object.keys(s.value);for(let e=0,c=t.length;e<c;e++)if(s.value[t[e]].uid===o){delete s.value[t[e]];return}},E=()=>{I(()=>{l.value="",s.value={}})};return(a,o)=>{const t=x("el-upload");return C(),k("div",D,[g(u("div",L,[u("img",{src:d(l),draggable:"false"},null,8,M),u("i",{class:"icon_container el-icon-close",onClick:E})],512),[[p,!d(i)]]),g(B(t,{name:"image",accept:"image/x-png,image/gif,image/jpeg,image/png,image/jpg","show-file-list":!1,"on-remove":w,"on-success":h,"before-upload":f,action:d(_),class:"editor-slide-upload"},{default:F(()=>o[0]||(o[0]=[u("div",{class:"upload_image"},[u("i",{class:"el-icon-plus"}),u("p",null,"\u53EA\u80FD\u4E0A\u4F20jpg/png/gif\u6587\u4EF6 \u4E14\u4E0D\u8D85\u8FC72M")],-1)])),_:1},8,["action"]),[[p,d(i)]])])}}});const R=S(O,[["__scopeId","data-v-7562d13d"]]);export{R as default};
