"use strict"; const common_vendor = require("../../../../../common/vendor.js"); const modules_mall_sheep_config_index = require("../../config/index.js"); const FileApi = { // 上传文件 uploadFile: (file) => { common_vendor.index.getStorageSync("token"); common_vendor.index.showLoading({ title: "上传中" }); return new Promise((resolve, reject) => { common_vendor.index.uploadFile({ url: modules_mall_sheep_config_index.baseUrl + modules_mall_sheep_config_index.apiPath + "/infra/file/upload", filePath: file, name: "file", header: { // Accept: 'text/json', Accept: "*/*", "tenant-id": modules_mall_sheep_config_index.tenantId // Authorization: 'Bearer test247', }, success: (uploadFileRes) => { const result = JSON.parse(uploadFileRes.data); if (result.error === 1) { common_vendor.index.showToast({ icon: "none", title: result.msg }); } else { return resolve(result); } }, fail: (error) => { console.log("上传失败:", error); return resolve(false); }, complete: () => { common_vendor.index.hideLoading(); } }); }); } }; exports.FileApi = FileApi;