From 2c9729f0cecffe6dbb7f8f99ebad72f3e85a7ded Mon Sep 17 00:00:00 2001
From: wujingjing <gersonwu@qq.com>
Date: 星期四, 17 十月 2024 12:06:24 +0800
Subject: [PATCH] 传所有 filter;并更新 filter value

---
 src/router/index.ts |   26 ++++++++++++++++++--------
 1 files changed, 18 insertions(+), 8 deletions(-)

diff --git a/src/router/index.ts b/src/router/index.ts
index 44ff9db..7ce9f91 100644
--- a/src/router/index.ts
+++ b/src/router/index.ts
@@ -1,17 +1,14 @@
-import NProgress from 'nprogress';
 import 'nprogress/nprogress.css';
 import { storeToRefs } from 'pinia';
 import { createRouter, createWebHashHistory } from 'vue-router';
 import { MenuTypeEnum } from '/@/api/menu/type';
-import { initBackEndControlRoutes } from '/@/router/backEnd';
-import { initFrontEndControlRoutes } from '/@/router/frontEnd';
 import { notFoundAndNoPower, staticRoutes } from '/@/router/route';
 import pinia from '/@/stores/index';
 import { useKeepALiveNames } from '/@/stores/keepAliveNames';
-import { useRoutesList } from '/@/stores/routesList';
 import { useThemeConfig } from '/@/stores/themeConfig';
-import { accessSessionKey, clearAccessTokens } from '/@/utils/request';
-import { Local } from '/@/utils/storage';
+import { Local } from '../utils/storage';
+import { accessSessionKey } from '../utils/request';
+import emitter from '../utils/mitt';
 
 /**
  * 1銆佸墠绔帶鍒惰矾鐢辨椂锛歩sRequestRoutes 涓� false锛岄渶瑕佸啓 roles锛岄渶瑕佽蛋 setFilterRoute 鏂规硶銆�
@@ -95,8 +92,21 @@
 }
 
 // 璺敱鍔犺浇鍓�
-
-
+router.beforeEach((to, from, next) => {
+	const accessSession = Local.get(accessSessionKey);
+	if (!accessSession) {
+		emitter.emit('openLoginDlg');
+		if(to.name==='Home'){
+			next();
+		}else{
+			next({
+				name: 'Home',
+			});
+		}
+		
+	}
+	next();
+});
 // 璺敱鍔犺浇鍚�
 
 // 瀵煎嚭璺敱

--
Gitblit v1.9.3