mirror of
https://gitee.com/huangge1199_admin/vue-pro.git
synced 2024-11-27 01:32:03 +08:00
fix: axios bugs
This commit is contained in:
parent
02315804ac
commit
8edce3874a
@ -55,17 +55,26 @@ service.interceptors.request.use(
|
|||||||
config.data = qs.stringify(data)
|
config.data = qs.stringify(data)
|
||||||
}
|
}
|
||||||
// get参数编码
|
// get参数编码
|
||||||
if (config.method?.toUpperCase() === 'GET' && config.params) {
|
if (config.method?.toUpperCase() === 'GET' && params) {
|
||||||
let url = config.url as string
|
let url = config.url + '?'
|
||||||
|
for (const propName of Object.keys(params)) {
|
||||||
|
const value = params[propName]
|
||||||
|
if (value !== void 0 && value !== null && typeof value !== 'undefined') {
|
||||||
|
if (typeof value === 'object') {
|
||||||
|
for (const val of Object.keys(value)) {
|
||||||
|
const params = propName + '[' + val + ']'
|
||||||
|
const subPart = encodeURIComponent(params) + '='
|
||||||
|
url += subPart + encodeURIComponent(value[val]) + '&'
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
url += `${propName}=${encodeURIComponent(value)}&`
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
// 给 get 请求加上时间戳参数,避免从缓存中拿数据
|
// 给 get 请求加上时间戳参数,避免从缓存中拿数据
|
||||||
// const now = new Date().getTime()
|
// const now = new Date().getTime()
|
||||||
// params = params.substring(0, url.length - 1) + `?_t=${now}`
|
// params = params.substring(0, url.length - 1) + `?_t=${now}`
|
||||||
url += '?'
|
url = url.slice(0, -1)
|
||||||
for (const key of Object.keys(params)) {
|
|
||||||
if (params[key] !== void 0 && params[key] !== null) {
|
|
||||||
url += `${key}=${encodeURIComponent(params[key])}&`
|
|
||||||
}
|
|
||||||
}
|
|
||||||
config.params = {}
|
config.params = {}
|
||||||
config.url = url
|
config.url = url
|
||||||
}
|
}
|
||||||
|
@ -269,6 +269,7 @@ const handleFileSuccess = (response: any): void => {
|
|||||||
text += '< ' + username + ': ' + data.failureUsernames[username] + ' >'
|
text += '< ' + username + ': ' + data.failureUsernames[username] + ' >'
|
||||||
}
|
}
|
||||||
message.alert(text)
|
message.alert(text)
|
||||||
|
getList()
|
||||||
}
|
}
|
||||||
// 文件数超出提示
|
// 文件数超出提示
|
||||||
const handleExceed = (): void => {
|
const handleExceed = (): void => {
|
||||||
@ -282,8 +283,8 @@ const excelUploadError = (): void => {
|
|||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
await getTree()
|
await getTree()
|
||||||
await getPostOptions()
|
await getPostOptions()
|
||||||
|
await getList()
|
||||||
})
|
})
|
||||||
getList()
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
Loading…
Reference in New Issue
Block a user