electricity_bill_calc_wx/service/public.js
2024-08-30 17:31:35 +08:00

23 lines
648 B
JavaScript

import apis from '../utils/request';
import { getConfigByEnv } from "../utils/index"
const { GET, POST, PUT, DELETE } = apis
export const uploadFile = (filePath) => {
const { api } = getConfigByEnv();
return new Promise((resolve, reject) => {
wx.uploadFile({
filePath: filePath,
name: 'file',
url: `${api}/file/upload`,
header: {
authorization: 'Bearer ' + wx.getStorageSync("token")
},
success: (res) => {
resolve(res);
},
fail: (err) => {
reject(err);
}
})
})
}