|
- import{R as d,T as e,U as t}from"./index-dd5fae99.js";const p=(r,n,a,s)=>{if(r.code!==200){e.error("上传失败!");const o=n.findIndex(c=>c.response.code!==200);n.splice(o,1)}a&&n.length>1&&(e.error("只能上传一个文件!"),n.shift()),s&&s()},u=r=>{e.error(r.message?JSON.parse(r.message):"上传失败!")},w=["wps","pdf","doc","docx"],g="pdf、word",F=(r,{types:n,size:a})=>{const s=r.name.substring(r.name.lastIndexOf(".")+1).toLocaleLowerCase(),o=n.indexOf(s)!==-1,c=a?r.size/1024<=a:!0;return o||e.error("上传文件格式错误!"),c||e.error(`上传文件大小不能超过 ${a>=1024?a/1024:a}${a>=1024?"M":"KB"}!`),o&&c},h=r=>{e.warning(`该处只可上传${r.length}个文件`)},i=r=>{var n,a;window.open(`/fileView?id=${(a=(n=r==null?void 0:r.response)==null?void 0:n.data)==null?void 0:a.id}`,"_blank")},x=r=>{var a;let n=[];return r&&(n=((a=r==null?void 0:r.map)==null?void 0:a.call(r,s=>({uid:s==null?void 0:s.id,name:s==null?void 0:s.originalFileName,status:"success",url:s==null?void 0:s.url,response:{data:s}})))||[]),JSON.parse(JSON.stringify(n))},y=r=>{let n=[];return r&&r.length&&(n=r.map(a=>{var s;return a.response?(s=a.response)==null?void 0:s.data:{...a}})),n},O=async r=>{const n=await t({fileId:r});return URL.createObjectURL(n)},S=async r=>{const n=await d({fileId:r});return URL.createObjectURL(n)};export{O as a,w as b,i as c,S as d,g as e,F as f,y as g,p as h,u as i,h as j,x as r};
|