main
parent
09292fd46a
commit
ef24583228
|
@ -13,7 +13,7 @@ const handleCode = async (code: number, msg: string) => {
|
|||
ElMessage.error(msg || '登录失效')
|
||||
setTimeout(() => {
|
||||
console.log('登录失效')
|
||||
location.href="/login"
|
||||
location.href = "/login"
|
||||
}, 1500)
|
||||
// 跳转登录
|
||||
break
|
||||
|
@ -52,6 +52,12 @@ service.interceptors.response.use(
|
|||
//response参数是响应对象
|
||||
// 对响应数据做点什么
|
||||
const { data, config } = response
|
||||
if (data.code == 401) {
|
||||
|
||||
ElMessage.error(data.message)
|
||||
}
|
||||
console.log(data);
|
||||
|
||||
return data;
|
||||
},
|
||||
(error: any) => {
|
||||
|
@ -67,6 +73,7 @@ service.interceptors.response.use(
|
|||
let { message } = error
|
||||
if (message === 'Network Error') {
|
||||
message = '后端接口连接异常'
|
||||
location.href = "/login"
|
||||
}
|
||||
if (message.includes('timeout')) {
|
||||
message = '后端接口请求超时'
|
||||
|
|
|
@ -80,6 +80,7 @@ const options = [
|
|||
]
|
||||
|
||||
const handleCurrentChange = (val: number) => {
|
||||
console.log(val);
|
||||
page.value = val
|
||||
getList()
|
||||
}
|
||||
|
@ -89,7 +90,7 @@ const handleCurrentChange = (val: number) => {
|
|||
*/
|
||||
const getList = async () => {
|
||||
const params = {
|
||||
page: 1,
|
||||
page: page.value,
|
||||
size: 20,
|
||||
}
|
||||
if (status.value && status.value != '0') {
|
||||
|
|
Loading…
Reference in New Issue