|
@@ -108,10 +108,11 @@ const IM_PATH = import.meta.env.VITE_IM_PATH_FIlE;
|
|
|
const walletStore = useWalletStore();
|
|
|
const systemStore = useSystemStore();
|
|
|
const router = useRouter();
|
|
|
+const route = useRoute();
|
|
|
const wsStore = useWebSocketStore();
|
|
|
|
|
|
const loading = ref(false);
|
|
|
-const activeTab = ref(0)
|
|
|
+const activeTab = ref(Number(route.query.tab ?? 0));
|
|
|
const showDot = ref(false)
|
|
|
const showSheet = ref(false);
|
|
|
const list = ref([]);
|
|
@@ -136,6 +137,22 @@ watch(
|
|
|
}
|
|
|
}
|
|
|
);
|
|
|
+// 当切换 tab 时,把 tab 写进 URL(用 replace,不污染历史栈)
|
|
|
+watch(activeTab, (val) => {
|
|
|
+ if (String(route.query.tab) !== String(val)) {
|
|
|
+ router.replace({ query: { ...route.query, tab: val } });
|
|
|
+ }
|
|
|
+});
|
|
|
+
|
|
|
+// 当 URL 变化(比如返回)时,更新 activeTab
|
|
|
+watch(
|
|
|
+ () => route.query.tab,
|
|
|
+ (val) => {
|
|
|
+ const n = Number(val ?? 0);
|
|
|
+ if (n !== activeTab.value) activeTab.value = n;
|
|
|
+ }
|
|
|
+);
|
|
|
+
|
|
|
const getuserList = async (refresh=false) => {
|
|
|
let res
|
|
|
if(refresh || !systemStore.ImsessionList || systemStore.ImsessionList.length == 0){
|