fix: 移除500报错跳转500缺省页面的逻辑和相关组件,500报错直接走消息提示就行,不用跳转专属缺省页面
This commit is contained in:
parent
184aa12094
commit
0a3b557436
@ -12,4 +12,4 @@ export const COLLAPSE_THRESHOLD: number = 600;
|
|||||||
export const SIDE_BAR_WIDTH: number = 280;
|
export const SIDE_BAR_WIDTH: number = 280;
|
||||||
|
|
||||||
// 路由白名单地址[本地存在的路由 staticRouter.ts 中]
|
// 路由白名单地址[本地存在的路由 staticRouter.ts 中]
|
||||||
export const ROUTER_WHITE_LIST: string[] = ['/chat', '/chat/not_login', '/500', '/403', '/404'];
|
export const ROUTER_WHITE_LIST: string[] = ['/chat', '/chat/not_login', '/403', '/404'];
|
||||||
|
|||||||
@ -1,60 +0,0 @@
|
|||||||
<script setup lang="ts">
|
|
||||||
import { useRouter } from 'vue-router';
|
|
||||||
import { HOME_URL } from '@/config/index.ts';
|
|
||||||
|
|
||||||
// 路由跳转
|
|
||||||
const router = useRouter();
|
|
||||||
|
|
||||||
function handleHomePage() {
|
|
||||||
router.push({ path: HOME_URL });
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<template>
|
|
||||||
<div id="box">
|
|
||||||
<div id="banner" class="elx-top" />
|
|
||||||
<div class="elx-bottom">
|
|
||||||
<div class="elx-text1">
|
|
||||||
500
|
|
||||||
</div>
|
|
||||||
<div class="elx-text2">
|
|
||||||
服务器好像开小差了!请稍后试试...
|
|
||||||
</div>
|
|
||||||
<div class="h-20px" />
|
|
||||||
<el-button type="primary" plain @click="handleHomePage">
|
|
||||||
返回首页
|
|
||||||
</el-button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
|
||||||
#box {
|
|
||||||
overflow: hidden;
|
|
||||||
}
|
|
||||||
#banner {
|
|
||||||
margin-top: 60px;
|
|
||||||
background: url("@/assets/images/error/500.png") no-repeat;
|
|
||||||
background-size: 100%;
|
|
||||||
}
|
|
||||||
.elx-top {
|
|
||||||
width: 600px;
|
|
||||||
height: 400px;
|
|
||||||
margin: 0 auto;
|
|
||||||
}
|
|
||||||
.elx-bottom {
|
|
||||||
height: 300px;
|
|
||||||
margin-top: 20px;
|
|
||||||
text-align: center;
|
|
||||||
}
|
|
||||||
.elx-text1 {
|
|
||||||
font-size: 46px;
|
|
||||||
font-weight: bold;
|
|
||||||
}
|
|
||||||
.elx-text2 {
|
|
||||||
padding-top: 30px;
|
|
||||||
font-family: YouYuan;
|
|
||||||
font-size: 24px;
|
|
||||||
font-weight: 600;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
@ -43,7 +43,7 @@ router.beforeEach(
|
|||||||
// return next(from.fullPath);
|
// return next(from.fullPath);
|
||||||
// }
|
// }
|
||||||
// else {
|
// else {
|
||||||
// ElMessage.error('账号身份已过期,请重新登录🌻');
|
// ElMessage.error('账号身份已过期,请重新登录');
|
||||||
// }
|
// }
|
||||||
// // 没有Token重置路由到登陆页。
|
// // 没有Token重置路由到登陆页。
|
||||||
// // resetRouter(); // 预留
|
// // resetRouter(); // 预留
|
||||||
|
|||||||
@ -12,7 +12,7 @@ export async function initDynamicRouter() {
|
|||||||
await authStore.requestAuthMenuList();
|
await authStore.requestAuthMenuList();
|
||||||
|
|
||||||
// 2、判断当前用户是否拥有菜单权限
|
// 2、判断当前用户是否拥有菜单权限
|
||||||
console.log('authStore.authMenuList', authStore.authMenuList);
|
// console.log('authStore.authMenuList', authStore.authMenuList);
|
||||||
|
|
||||||
if (authStore.authMenuList == null || authStore.authMenuList.length === 0) {
|
if (authStore.authMenuList == null || authStore.authMenuList.length === 0) {
|
||||||
userStore.logout();
|
userStore.logout();
|
||||||
|
|||||||
@ -70,21 +70,6 @@ export const errorRouter = [
|
|||||||
isAffix: '1', // 是否缓存固定路由[0是,1否]
|
isAffix: '1', // 是否缓存固定路由[0是,1否]
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
|
||||||
path: '/500',
|
|
||||||
name: '500',
|
|
||||||
component: () => import('@/pages/error/500.vue'),
|
|
||||||
meta: {
|
|
||||||
title: '500页面',
|
|
||||||
enName: '500 Page', // 英文名称
|
|
||||||
icon: 'WarningFilled', // 图标
|
|
||||||
isHide: '1', // 代表路由在菜单中是否隐藏,是否隐藏[0隐藏,1显示]
|
|
||||||
isLink: '1', // 是否外链[有值则是外链]
|
|
||||||
isKeepAlive: '0', // 是否缓存路由数据[0是,1否]
|
|
||||||
isFull: '1', // 是否缓存全屏[0是,1否]
|
|
||||||
isAffix: '1', // 是否缓存固定路由[0是,1否]
|
|
||||||
},
|
|
||||||
},
|
|
||||||
// 找不到path将跳转404页面
|
// 找不到path将跳转404页面
|
||||||
{
|
{
|
||||||
path: '/:pathMatch(.*)*',
|
path: '/:pathMatch(.*)*',
|
||||||
|
|||||||
@ -34,14 +34,6 @@ function jwtPlugin(): HookFetchPlugin<BaseResponse> {
|
|||||||
if (response.result?.code === 200) {
|
if (response.result?.code === 200) {
|
||||||
return response;
|
return response;
|
||||||
}
|
}
|
||||||
// 处理500逻辑
|
|
||||||
if (response.result?.code === 500) {
|
|
||||||
router.replace({
|
|
||||||
name: '500',
|
|
||||||
});
|
|
||||||
ElMessage.error(response.result?.msg);
|
|
||||||
return Promise.reject(response);
|
|
||||||
}
|
|
||||||
// 处理403逻辑
|
// 处理403逻辑
|
||||||
if (response.result?.code === 403) {
|
if (response.result?.code === 403) {
|
||||||
// 跳转到403页面(确保路由已配置)
|
// 跳转到403页面(确保路由已配置)
|
||||||
|
|||||||
1
types/import_meta.d.ts
vendored
1
types/import_meta.d.ts
vendored
@ -5,6 +5,7 @@ interface ImportMetaEnv {
|
|||||||
readonly VITE_WEB_TITLE_EN: string;
|
readonly VITE_WEB_TITLE_EN: string;
|
||||||
readonly VITE_WEB_ENV: string;
|
readonly VITE_WEB_ENV: string;
|
||||||
readonly VITE_WEB_BASE_API: string;
|
readonly VITE_WEB_BASE_API: string;
|
||||||
|
readonly VITE_BUILD_COMPRESS: string;
|
||||||
readonly VITE_API_URL: string;
|
readonly VITE_API_URL: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user