You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

2 line
1.5KB

  1. import{z as d,E as e,A as t}from"./index.2dada31c.js";const p=(r,n,a,s)=>{if(r.code!==200){e.error("\u4E0A\u4F20\u5931\u8D25!");const o=n.findIndex(c=>c.response.code!==200);n.splice(o,1)}a&&n.length>1&&(e.error("\u53EA\u80FD\u4E0A\u4F20\u4E00\u4E2A\u6587\u4EF6!"),n.shift()),s&&s()},u=r=>{e.error(r.message?JSON.parse(r.message):"\u4E0A\u4F20\u5931\u8D25\uFF01")},w=["wps","pdf","doc","docx"],g="pdf\u3001word",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("\u4E0A\u4F20\u6587\u4EF6\u683C\u5F0F\u9519\u8BEF!"),c||e.error(`\u4E0A\u4F20\u6587\u4EF6\u5927\u5C0F\u4E0D\u80FD\u8D85\u8FC7 ${a>=1024?a/1024:a}${a>=1024?"M":"KB"}!`),o&&c},h=r=>{e.warning(`\u8BE5\u5904\u53EA\u53EF\u4E0A\u4F20${r.length}\u4E2A\u6587\u4EF6`)},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,i as b,w 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};