import{d as W,p as s,cr as j,r as T,cq as q,co as M,cp as A,o as t,c as i,i as o,w as X,a as n,W as H,g as p,aF as U,bo as L,F as O,t as f,a2 as r,aO as P,n as R,v as G,_ as J,__tla as K}from"./index-8c6726e5.js";import{c as N,__tla as Q}from"./index-bd7c5832.js";import{u as Y,__tla as Z}from"./useMessage-9f6930df.js";let V,aa=Promise.all([(()=>{try{return K}catch{}})(),(()=>{try{return Q}catch{}})(),(()=>{try{return Z}catch{}})()]).then(async()=>{let _,h,g,y,v,b,k;_={class:"upload-box"},h=["src"],g={key:0},y={key:0},v={key:0},b={key:1,class:"upload-empty"},k={class:"el-upload__tip"},V=J(W({name:"UploadImg",__name:"UploadImg",props:{modelValue:s.string.def(""),updateUrl:s.string.def("https://zxpt.newfeifan.cn/admin-api/infra/file/upload"),drag:s.bool.def(!0),disabled:s.bool.def(!1),fileSize:s.number.def(5),fileType:s.array.def(["image/jpeg","image/png","image/gif"]),height:s.string.def("150px"),width:s.string.def("150px"),borderradius:s.string.def("8px"),showDelete:s.bool.def(!0),showBtnText:s.bool.def(!0)},emits:["update:modelValue"],setup(a,{emit:B}){j(e=>({"57417a1d-width":a.width,"57417a1d-height":a.height,"57417a1d-borderradius":a.borderradius}));const u=a,{t:m}=R(),c=Y(),w=T("id-"+q()),x=B,I=()=>{x("update:modelValue","")},S=T({Authorization:"Bearer "+M(),"tenant-id":A()}),C=()=>{const e=document.querySelector(`#${w.value} .el-upload__input`);e&&e.dispatchEvent(new MouseEvent("click"))},$=e=>{const l=e.size/1024/1024<u.fileSize,d=u.fileType;return d.includes(e.type)||c.notifyWarning("\u4E0A\u4F20\u56FE\u7247\u4E0D\u7B26\u5408\u6240\u9700\u7684\u683C\u5F0F\uFF01"),l||c.notifyWarning(`\u4E0A\u4F20\u56FE\u7247\u5927\u5C0F\u4E0D\u80FD\u8D85\u8FC7 ${u.fileSize}M\uFF01`),d.includes(e.type)&&l},D=e=>{c.success("\u4E0A\u4F20\u6210\u529F"),x("update:modelValue",e.data)},E=()=>{c.notifyError("\u56FE\u7247\u4E0A\u4F20\u5931\u8D25\uFF0C\u8BF7\u60A8\u91CD\u65B0\u4E0A\u4F20\uFF01")};return(e,l)=>{const d=G,F=L;return t(),i("div",_,[o(F,{id:n(w),accept:a.fileType.join(","),action:a.updateUrl,"before-upload":$,class:H(["upload",a.drag?"no-border":""]),drag:a.drag,headers:n(S),multiple:!1,"on-error":E,"on-success":D,"show-file-list":!1},{default:X(()=>[a.modelValue?(t(),i(O,{key:0},[p("img",{src:a.modelValue,class:"upload-image"},null,8,h),p("div",{class:"upload-handle",onClick:l[1]||(l[1]=P(()=>{},["stop"]))},[a.disabled?r("",!0):(t(),i("div",{key:0,class:"handle-icon",onClick:C},[o(d,{icon:"ep:edit"}),a.showBtnText?(t(),i("span",g,f(n(m)("action.edit")),1)):r("",!0)])),p("div",{class:"handle-icon",onClick:l[0]||(l[0]=ea=>{return z=a.modelValue,void N({zIndex:9999999,urlList:[z]});var z})},[o(d,{icon:"ep:zoom-in"}),a.showBtnText?(t(),i("span",y,f(n(m)("action.detail")),1)):r("",!0)]),a.showDelete&&!a.disabled?(t(),i("div",{key:1,class:"handle-icon",onClick:I},[o(d,{icon:"ep:delete"}),a.showBtnText?(t(),i("span",v,f(n(m)("action.del")),1)):r("",!0)])):r("",!0)])],64)):(t(),i("div",b,[U(e.$slots,"empty",{},()=>[o(d,{icon:"ep:plus"})],!0)]))]),_:3},8,["id","accept","action","class","drag","headers"]),p("div",k,[U(e.$slots,"tip",{},void 0,!0)])])}}}),[["__scopeId","data-v-57417a1d"],["__file","/Users/RuHu.Xu/Desktop/mall-newfeifan-zx-admin/src/components/UploadFile/src/UploadImg.vue"]])});export{V as _,aa as __tla};
