Skip to content

Commit 17225ef

Browse files
🐞 fix:修复退出登录后依旧在轮询消息未读数,导致反复弹窗。
1 parent a31bafb commit 17225ef

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/layout/components/Message/src/Message.vue

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
<script lang="ts" setup>
22
import { formatDate } from '@/utils/formatTime'
33
import * as NotifyMessageApi from '@/api/system/notify/message'
4+
import { useUserStoreWithOut } from '@/store/modules/user'
45
56
defineOptions({ name: 'Message' })
67
78
const { push } = useRouter()
9+
const userStore = useUserStoreWithOut()
810
const activeName = ref('notice')
911
const unreadCount = ref(0) // 未读消息数量
1012
const list = ref<any[]>([]) // 消息列表
@@ -37,7 +39,11 @@ onMounted(() => {
3739
// 轮询刷新小红点
3840
setInterval(
3941
() => {
40-
getUnreadCount()
42+
if (userStore.getIsSetUser) {
43+
getUnreadCount()
44+
} else {
45+
unreadCount.value = 0
46+
}
4147
},
4248
1000 * 60 * 2
4349
)

0 commit comments

Comments
 (0)