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