代码提交
This commit is contained in:
18
api/api.js
18
api/api.js
@ -144,3 +144,21 @@ const request = ['post', 'put', 'patch'].reduce((request, method) => {
|
||||
})
|
||||
|
||||
export default request
|
||||
|
||||
export const upload = (options)=>{
|
||||
const token = cookie.get('accessToken')
|
||||
return new Promise((resolve, reject)=>{
|
||||
uni.showLoading({title:'上传中'})
|
||||
uni.uploadFile({
|
||||
...options,
|
||||
header:{
|
||||
...options.headers,
|
||||
Authorization: 'Bearer ' + token.accessToken,
|
||||
},
|
||||
url:options.url?`${VUE_APP_API_URL}${options.url}`:VUE_APP_API_URL+'/member/user/update-avatar',
|
||||
success:(res)=>resolve(res),
|
||||
fail:(err)=>reject(err),
|
||||
complete:()=>uni.hideLoading()
|
||||
})
|
||||
})
|
||||
}
|
||||
|
Reference in New Issue
Block a user