"use strict";const e=require("../../../common/vendor.js"),i=require("../../config/index.js");require("../../request/index.js");const o={uploadFile:o=>(e.index.getStorageSync("token"),e.index.showLoading({title:"上传中"}),new Promise(((t,n)=>{e.index.uploadFile({url:i.baseUrl+i.apiPath+"/infra/file/upload",filePath:o,name:"file",header:{Accept:"*/*","tenant-id":"1"},success:i=>{let o=JSON.parse(i.data);if(1!==o.error)return t(o);e.index.showToast({icon:"none",title:o.msg})},fail:e=>(console.log("上传失败:",e),t(!1)),complete:()=>{e.index.hideLoading()}})}))),getFileIO:async e=>{const i=await fetch("http://192.168.0.110:8000/app-api/infra/file/downloadByUrl?fileUrl="+e,{method:"GET"});if(!i.ok)throw new Error("网络响应不是OK状态");return await i.blob()}};exports.FileApi=o;