|
@@ -4,7 +4,7 @@ import { NextLoading } from '/@/utils/loading';
|
|
|
import { setAddRoute, setFilterMenuAndCacheTagsViewRoutes } from '/@/router/index';
|
|
|
import { dynamicRoutes } from '/@/router/route';
|
|
|
import api from '/@/api/system';
|
|
|
-import { getToken } from "/@/utils/auth";
|
|
|
+import { getToken, cacheClear, removeToken } from "/@/utils/auth";
|
|
|
|
|
|
const layouModules: any = import.meta.glob('../layout/routerView/*.{vue,tsx}');
|
|
|
const viewsModules: any = import.meta.glob('../views/**/*.{vue,tsx}');
|
|
@@ -56,6 +56,14 @@ export async function initBackEndControlRoutes() {
|
|
|
*/
|
|
|
export async function getBackEndControlRoutes() {
|
|
|
return api.login.currentUser().then((res: any) => {
|
|
|
+ // 如果没有获取到用户信息,跳转到登录页
|
|
|
+ if (!res) {
|
|
|
+ api.login.logout();
|
|
|
+ cacheClear()
|
|
|
+ removeToken(); // 清除缓存/token等
|
|
|
+ window.location.href = ''; // 去登录页
|
|
|
+ return
|
|
|
+ }
|
|
|
Session.set('userMenu', res.Data || [])
|
|
|
Session.set('userInfo', res.Info);
|
|
|
// Session.set('permissions',res.data.permissions)
|