|
|
@@ -22,14 +22,19 @@ import { ref, computed, watch, onMounted } from "vue";
|
|
|
import { useRoute, useRouter } from "vue-router";
|
|
|
import { useGlobalStore } from "@/stores/modules/global";
|
|
|
import { useTabsStore } from "@/stores/modules/tabs";
|
|
|
+import { useKeepAliveStore } from "@/stores/modules/keepAlive";
|
|
|
import { useAuthStore } from "@/stores/modules/auth";
|
|
|
import { TabsPaneContext, TabPaneName } from "element-plus";
|
|
|
import MoreButton from "./components/MoreButton.vue";
|
|
|
import { HOME_URL } from "@/config";
|
|
|
+import { localGet } from "@/utils";
|
|
|
+
|
|
|
+const TABS_OWNER_KEY = "geeker-tabs-owner";
|
|
|
|
|
|
const route = useRoute();
|
|
|
const router = useRouter();
|
|
|
const tabStore = useTabsStore();
|
|
|
+const keepAliveStore = useKeepAliveStore();
|
|
|
const authStore = useAuthStore();
|
|
|
const globalStore = useGlobalStore();
|
|
|
|
|
|
@@ -38,6 +43,14 @@ const tabsMenuList = computed(() => tabStore.tabsMenuList);
|
|
|
const tabsIcon = computed(() => globalStore.tabsIcon);
|
|
|
|
|
|
onMounted(() => {
|
|
|
+ // 若当前用户与持久化标签所属用户不一致,清空标签,避免展示其它系统的标签
|
|
|
+ const currentUserId = String(localGet("geeker-user")?.userInfo?.id ?? "");
|
|
|
+ const storedOwner = window.localStorage.getItem(TABS_OWNER_KEY) ?? "";
|
|
|
+ if (currentUserId && currentUserId !== storedOwner) {
|
|
|
+ tabStore.setTabs([]);
|
|
|
+ keepAliveStore.setKeepAliveName([]);
|
|
|
+ window.localStorage.setItem(TABS_OWNER_KEY, currentUserId);
|
|
|
+ }
|
|
|
tabsDrop();
|
|
|
initTabs();
|
|
|
});
|