feat: 轮询查询未读消息

This commit is contained in:
rd
2025-07-18 17:10:12 +08:00
parent 5063cd50f8
commit 4ef74174ca
6 changed files with 81 additions and 26 deletions

View File

@ -5,14 +5,16 @@
</a-config-provider>
</template>
<script setup lang="ts">
<script setup>
import { useUserStore } from '@/stores';
import { getUserEnterpriseInfo } from '@/utils/user';
import { useSidebarStore } from '@/stores/modules/side-bar';
import zhCN from '@arco-design/web-vue/es/locale/lang/zh-cn';
const userStore = useUserStore();
const sidebarStore = useSidebarStore();
const redTheme = {
token: {
@ -20,7 +22,6 @@ const redTheme = {
colorLink: '#f5222d', // 链接色
},
};
// 初始化企业信息
const init = async () => {
const { isLogin, getUserInfo } = userStore;
@ -28,6 +29,10 @@ const init = async () => {
if (isLogin) {
await getUserInfo(); // 初始化用户信息
await getUserEnterpriseInfo();
sidebarStore.startUnreadInfoPolling();
} else {
sidebarStore.stopUnreadInfoPolling();
}
};
@ -40,6 +45,9 @@ onMounted(() => {
console.error(`发现catch报错${event.reason}`);
});
});
onUnmounted(() => {
sideBarStore.stopUnreadInfoPolling();
});
</script>
<style lang="scss">