update: 新疆大屏

This commit is contained in:
xf
2025-07-06 15:04:39 +08:00
parent 22c5b89f90
commit 86ed8341e2
30 changed files with 984 additions and 151 deletions
+23 -26
View File
@@ -1,6 +1,7 @@
import { createRouter, createWebHistory, Router, RouteRecordRaw } from 'vue-router';
import { setCurrentPath } from '/@/enum/pageEnum.ts';
import { getAuthCache } from '/@/utils/auth.ts';
import { TOKEN_KEY } from '/@/enum/cacheEnum.ts';
const routes: Array<RouteRecordRaw> = [
{
@@ -25,6 +26,22 @@ const routes: Array<RouteRecordRaw> = [
},
component: () => import('/@/views/indexSun.vue'),
},
{
path: '/indexSon',
name: 'indexSon',
meta: {
title: '心血管监测',
},
component: () => import('/@/views/indexSon.vue'),
},
{
path: '/home1',
name: 'index1',
meta: {
title: '副屏1',
},
component: () => import('/@/views/index.vue'),
},
];
const router: Router = createRouter({
@@ -38,32 +55,12 @@ router.beforeEach((to, from, next) => {
if (to.path !== '/login' && to.path !== '/home') {
setCurrentPath(to.path);
}
let flag1 = getAuthCache('flag1')?.includes('yinchuan');
let flag2 = getAuthCache('flag2')?.includes('xian');
if (to.path == '/yinChuanTest') {
next();
}
if (flag1 && flag2) {
next();
} else {
// 检查是否有权访问目标页面
if (yinchuan.includes(to.path)) {
// 如果在 yinchuan 列表中,并且有权限,则导航到目标页面
if (flag1) {
next();
} else {
next({ path: '/screenLogin' });
}
}
if (xian.includes(to.path)) {
// 如果在 xian 列表中,并且有权限,则导航到目标页面
if (flag2) {
next();
} else {
next({ path: '/login' });
}
}
next();
const flag = getAuthCache('flag3');
const token = getAuthCache(TOKEN_KEY);
if (!flag || !token) {
return next({ path: '/login' });
}
next();
});
export default router;