首页提示获取邀请数量和通知数量

This commit is contained in:
付民康
2025-03-27 10:31:44 +08:00
parent fdaad21df0
commit 46f42a3372

View File

@@ -1,13 +1,13 @@
<template>
<router-link to="/personalCenter?status=all&message_type=mr">
<d-badge class="g-notice" :count="accountInfo.noticeUnreadNum" :offset="[-2, 4]" :hidden="!accountInfo.noticeUnreadNum" status="danger">
<d-badge class="g-notice" :count="totalUnreadCount" :offset="[-2, 4]" :hidden="!totalUnreadCount" status="danger">
<d-icon style="font-size: 16px" name="notice" />
</d-badge>
</router-link>
</template>
<script setup lang="ts">
import { ref, onMounted, onBeforeUnmount } from 'vue';
import { ref, onMounted, onBeforeUnmount,computed } from 'vue';
import { getMessageCount } from '@/api/notice';
import { addEventListener, offEvent } from '@/utils/eventBus';
import debounce from 'lodash/debounce';
@@ -23,6 +23,10 @@ const getCounts = () => {
});
};
const totalUnreadCount = computed(() => {
return (accountInfo.value.noticeUnreadNum || 0) + (accountInfo.value.inviteNum || 0)
})
onMounted(() => {
// getCounts();
addEventListener('updateNotice', debounce((count: number) => {