fix(切换身份联动): 消息角标/消息页/设置中心随身份切换自动重拉——Header 摘要挂 switchRole、msg 页与 Settings pane watch curRoleUid(桌面/应用中心既有机制不变),无需手动刷新
build / build (push) Successful in 41s

This commit is contained in:
chenxing
2026-10-09 15:33:26 +08:00
parent ac67215c78
commit 1b812bc9c9
3 changed files with 42 additions and 1 deletions
+7
View File
@@ -421,9 +421,16 @@ onMounted(async () => {
});
onUnmounted(() => {
mittBus.off("searchReset");
mittBus.off("switchRole", onSwitchRoleRefresh);
window.removeEventListener("keydown", onCmdkKeydown);
closeMsgWs();
});
// 切换身份后角标随新身份学校口径刷新(emit 在 savUserRole 落库之后,服务端 identity/current 已是新校)
function onSwitchRoleRefresh() {
loadSummary();
}
mittBus.on("switchRole", onSwitchRoleRefresh);
// 面板已是模态框,输入只驱动面板自身过滤;
// 不再 emit("searchChange") —— 背景应用网格保持原样(2026-10-08 用户修订 1)
watch(searchAppText, () => {
+28
View File
@@ -1923,6 +1923,34 @@ async function loadStatsList() {
}
}
// ===== 切换身份联动(2026-10-09):设置中心各 pane 的学校维度数据随 curRoleUid 重拉 =====
// 桌面/应用中心等路由页已 watch curRoleUid 联动,此处补齐设置中心;仅刷新当前激活 pane(其余 pane 打开时本就走懒加载)
watch(() => store.curRoleUid, () => reloadActivePane());
function reloadActivePane() {
const pane = curPane.value;
if (pane === "wallpaper") {
if (isAdmin.value) {
loadManageLists();
loadWallDefault();
} else {
loadMyWallpaperList();
}
}
if (pane === "logo" && isAdmin.value) {
loadManageLists();
loadLogoText();
}
if (pane === "theme" && isAdmin.value) loadLayerTheme();
if (pane === "avatar" && isAdmin.value) loadLayerAvatar();
if (pane === "desktop") {
if (isAdmin.value) loadDeskDefault();
else loadMyDesk();
}
if (pane === "sidebar") loadSidebarList();
if (pane === "statset") loadStatsList();
}
function onStatsCheckAll() {
statsForm.roleIds = !statsAllChecked.value ? RoleTypeDict.map(item => item.k as number) : [];
}
+7 -1
View File
@@ -110,7 +110,7 @@
</template>
<script lang="ts" setup>
import { ref, computed, onMounted, onUnmounted } from "vue";
import { ref, computed, onMounted, onUnmounted, watch } from "vue";
import { storeToRefs } from "pinia";
import BaseApi from "@/api/BaseApi";
import MsgApprovalModal from "@/components/MsgApprovalModal.vue";
@@ -392,6 +392,12 @@ onMounted(() => {
loadApps();
mittBus.on("msgCenter:newMessage", onWsNewMessage);
});
// 切换身份后随新身份学校口径重拉(curRoleUid 由 App.vue switchRole 统一 bump,与桌面/应用中心同机制)
watch(() => store.curRoleUid, () => {
loadList(true);
loadSummary();
loadApps();
});
onUnmounted(() => {
mittBus.off("msgCenter:newMessage", onWsNewMessage);
clearTimeout(searchTimer);