Commit 17225ef3 by preschooler

🐞 fix:修复退出登录后依旧在轮询消息未读数,导致反复弹窗。

parent a31bafbb
<script lang="ts" setup> <script lang="ts" setup>
import { formatDate } from '@/utils/formatTime' import { formatDate } from '@/utils/formatTime'
import * as NotifyMessageApi from '@/api/system/notify/message' import * as NotifyMessageApi from '@/api/system/notify/message'
import { useUserStoreWithOut } from '@/store/modules/user'
defineOptions({ name: 'Message' }) defineOptions({ name: 'Message' })
const { push } = useRouter() const { push } = useRouter()
const userStore = useUserStoreWithOut()
const activeName = ref('notice') const activeName = ref('notice')
const unreadCount = ref(0) // 未读消息数量 const unreadCount = ref(0) // 未读消息数量
const list = ref<any[]>([]) // 消息列表 const list = ref<any[]>([]) // 消息列表
...@@ -37,7 +39,11 @@ onMounted(() => { ...@@ -37,7 +39,11 @@ onMounted(() => {
// 轮询刷新小红点 // 轮询刷新小红点
setInterval( setInterval(
() => { () => {
if (userStore.getIsSetUser) {
getUnreadCount() getUnreadCount()
} else {
unreadCount.value = 0
}
}, },
1000 * 60 * 2 1000 * 60 * 2
) )
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment