Files
zyt/server/public/admin/assets/file-kcFBKWM3.js
T
2026-06-29 09:28:00 +08:00

2 lines
1.4 KiB
JavaScript

import{e as f,p as a,g as c,R as p,r as t}from"./index-C0Kev2hn.js";async function i(e,n="image",o=0){const l=f(),r=new FormData;r.append("file",e),r.append("cid",String(o));const u=`${a.baseUrl}${a.urlPrefix}/upload/${n}`,s=await(await fetch(u,{method:"POST",headers:{token:c()||"",version:l.config.version||""},body:r})).json();if(s.code!==p.SUCCESS)throw new Error(s.msg||"上传失败");return s.data}async function m(e,n="screenshot.jpg"){const o=e instanceof File?e:new File([e],n,{type:e.type||"image/jpeg"});return i(o,"image",0)}async function C(e,n="recording.webm"){const o=e instanceof File?e:new File([e],n,{type:e.type||"video/webm"});return i(o,"video",0)}function b(e){return t.post({url:"/file/addCate",params:e})}function w(e){return t.post({url:"/file/editCate",params:e})}function y(e){return t.post({url:"/file/delCate",params:e})}function j(e){return t.get({url:"/file/listCate",params:e})}function S(e){return t.get({url:"/file/lists",params:e},{ignoreCancelToken:!0,isOpenRetry:!1})}function h(e){return t.post({url:"/file/delete",params:e})}function v(e){return t.post({url:"/file/move",params:e})}function F(e){return t.post({url:"/file/rename",params:e})}function O(e){return t.post({url:"/upload/ossCredentials",params:e})}function k(e){return t.post({url:"/upload/ossConfirm",params:e})}export{i as a,y as b,w as c,b as d,F as e,j as f,v as g,h,S as i,O as j,k,C as l,m as u};