This commit is contained in:
2024-08-30 17:31:35 +08:00
parent 2262031abd
commit 2c952e71a3
15 changed files with 250 additions and 279 deletions

23
service/public.js Normal file
View File

@@ -0,0 +1,23 @@
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);
}
})
})
}