暂存
This commit is contained in:
23
service/public.js
Normal file
23
service/public.js
Normal 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);
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
Reference in New Issue
Block a user