🐛 fix头像、文章资源上传失败
This commit is contained in:
parent
032d88c996
commit
d95fdf0021
@ -5,7 +5,7 @@ export function upload(data) {
|
|||||||
url: '/common/UploadFile',
|
url: '/common/UploadFile',
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
data: data,
|
data: data,
|
||||||
headers: { "Content-Type": "multipart/form-data" },
|
headers: { 'Content-Type': 'multipart/form-data' }
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -18,6 +18,6 @@ export function sendEmail(data) {
|
|||||||
return request({
|
return request({
|
||||||
url: '/common/SendEmail',
|
url: '/common/SendEmail',
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
data: data,
|
data: data
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@ -116,7 +116,8 @@ export function uploadAvatar(data) {
|
|||||||
return request({
|
return request({
|
||||||
url: '/system/user/profile/avatar',
|
url: '/system/user/profile/avatar',
|
||||||
method: 'post',
|
method: 'post',
|
||||||
data: data
|
data: data,
|
||||||
|
headers: { 'Content-Type': 'multipart/form-data' }
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -29,8 +29,9 @@ service.interceptors.request.use(
|
|||||||
config.headers['userName'] = useUserStore().userName
|
config.headers['userName'] = useUserStore().userName
|
||||||
}
|
}
|
||||||
const method = config?.method || 'get'
|
const method = config?.method || 'get'
|
||||||
|
const header = config?.headers['Content-Type'] ?? ''
|
||||||
|
|
||||||
if (method.toLowerCase() === 'post' || method.toLowerCase() === 'put') {
|
if ((method.toLowerCase() === 'post' || method.toLowerCase() === 'put') && header != 'multipart/form-data') {
|
||||||
config.data = delEmptyQueryNodes(config.data)
|
config.data = delEmptyQueryNodes(config.data)
|
||||||
}
|
}
|
||||||
return config
|
return config
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user