| | |
| | | }, |
| | | (error) => { |
| | | let msg = '请求发生错误'; |
| | | if (error.response && error.response.status == 401) { |
| | | if ((error.response && error.response.status == 401) || error.code == "ERR_NETWORK") { |
| | | localStorage.clear() |
| | | router.replace({ |
| | | path: '/login' |
| | |
| | | history: createWebHashHistory(import.meta.env.BASE_URL), |
| | | routes: [ |
| | | { |
| | | path: '/login', |
| | | name: 'login', |
| | | component: Login |
| | | }, |
| | | { |
| | | path: '/', |
| | | component: Layout, |
| | | children: [ |
| | |
| | | path: '/dictionary', |
| | | name: 'dictionary', |
| | | meta: { auth: true }, |
| | | component: () =>import('@/views/components/dictionary.vue') |
| | | component: () => import('@/views/components/dictionary.vue') |
| | | } |
| | | ] |
| | | }, |
| | | { |
| | | path: '/login', |
| | | name: 'login', |
| | | component: Login |
| | | } |
| | | ] |
| | | }) |
| | |
| | | if (route.query.redirect) { |
| | | router.push(route.query.redirect) |
| | | } else { |
| | | router.push('/') |
| | | router.push('/home') |
| | | } |
| | | } else if (res.data.isError) { |
| | | ElMessage.error(res.data.errorDescription) |