From fd13b0017518273406ee1a9906c07d079e4a9ac4 Mon Sep 17 00:00:00 2001
From: houzhongjian <houzhongyi@126.com>
Date: 星期三, 27 十一月 2024 17:54:52 +0800
Subject: [PATCH] 租户列表 套餐宽度固定180

---
 src/layout/components/Logo/src/Logo.vue |   25 ++++++++++++++++++++++++-
 1 files changed, 24 insertions(+), 1 deletions(-)

diff --git a/src/layout/components/Logo/src/Logo.vue b/src/layout/components/Logo/src/Logo.vue
index 2d1cfb6..98b17c3 100644
--- a/src/layout/components/Logo/src/Logo.vue
+++ b/src/layout/components/Logo/src/Logo.vue
@@ -1,8 +1,14 @@
 <script lang="ts" setup>
 import { computed, onMounted, ref, unref, watch } from 'vue'
 import { useAppStore } from '@/store/modules/app'
+import { useUserStoreWithOut } from '@/store/modules/user'
+import { usePermissionStoreWithOut } from '@/store/modules/permission'
 import { useDesign } from '@/hooks/web/useDesign'
-import * as authUtil from "@/utils/auth";
+import {isRelogin} from "@/config/axios/service";
+import router from "@/router";
+import type {RouteRecordRaw} from "vue-router";
+import {CACHE_KEY, useCache} from "@/hooks/web/useCache";
+const { wsCache } = useCache()
 
 defineOptions({ name: 'Logo' })
 
@@ -59,6 +65,22 @@
     }
   }
 )
+
+/** 刷新所有菜单权限 */
+const gotoHome = async () => {
+  const userStore = useUserStoreWithOut()
+  const permissionStore = usePermissionStoreWithOut()
+  isRelogin.show = true
+  wsCache.set(CACHE_KEY.USER, null)
+  await userStore.setUserInfoAction()
+  isRelogin.show = false
+  // 后端过滤菜单
+  await permissionStore.generateRoutes()
+  permissionStore.getAddRouters.forEach((route) => {
+    router.addRoute(route as unknown as RouteRecordRaw) // 动态添加可访问路由表
+  })
+}
+
 </script>
 
 <template>
@@ -69,6 +91,7 @@
         layout !== 'classic' ? `${prefixCls}__Top` : '',
         'flex !h-[var(--logo-height)] items-center cursor-pointer pl-8px relative decoration-none overflow-hidden'
       ]"
+      @click="gotoHome"
       :to="homePath"
     >
       <img

--
Gitblit v1.9.3