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); } }) }) } export const uploadPublicFile = (filePath) => { const { api } = getConfigByEnv(); return new Promise((resolve, reject) => { wx.uploadFile({ filePath: filePath, name: 'file', url: `${api}/wx/public/upload`, header: { authorization: wx.getStorageSync("token") }, success: (res) => { resolve(res); }, fail: (err) => { reject(err); } }) }) }