This commit is contained in:
@@ -184,6 +184,7 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { onBeforeUnmount, onMounted } from 'vue'
|
||||
import { MenuTypeEnum, MenuWidth } from '@/enums/appEnum'
|
||||
import { useSettingStore } from '@/store/modules/setting'
|
||||
import { useUserStore } from '@/store/modules/user'
|
||||
@@ -264,9 +265,18 @@
|
||||
initLanguage()
|
||||
if (hasAuth(NOTIFICATION_PERMISSIONS.page)) {
|
||||
void notificationStore.refreshUnreadCount().catch(() => undefined)
|
||||
unreadTimer = window.setInterval(() => {
|
||||
void notificationStore.refreshUnreadCount().catch(() => undefined)
|
||||
}, 30_000)
|
||||
}
|
||||
})
|
||||
|
||||
let unreadTimer: number | undefined
|
||||
|
||||
onBeforeUnmount(() => {
|
||||
if (unreadTimer !== undefined) window.clearInterval(unreadTimer)
|
||||
})
|
||||
|
||||
const { isFullscreen, toggle: toggleFullscreen } = useFullscreen()
|
||||
|
||||
const toggleFullScreen = () => {
|
||||
|
||||
@@ -128,12 +128,12 @@
|
||||
return
|
||||
}
|
||||
try {
|
||||
const targetResponse = await NotificationService.getTarget(item.id)
|
||||
const readResponse = await notificationStore.markRead(item.id)
|
||||
if (readResponse.code !== 0) {
|
||||
ElMessage.error(readResponse.msg || '标记已读失败')
|
||||
return
|
||||
}
|
||||
const targetResponse = await NotificationService.getTarget(item.id)
|
||||
if (targetResponse.code !== 0 || !targetResponse.data) {
|
||||
ElMessage.info(item.body || '该通知暂无可跳转目标')
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user