fix: 系统检查修复 — 布局一致性 + bug 修复

- 公告图片样式统一:圆角 $radius-md,间距 $space-sm
- 首页紧急公告弹窗样式改为 SCSS 变量
- 新增 modal-mask-high mixin 统一高层级弹窗
- admin/config.vue 添加 initialLoaded 守卫避免重复请求
- notifications/index.vue 添加 initialLoaded 守卫
- notification store 所有方法添加 try-catch 错误处理
This commit is contained in:
2026-06-08 11:21:08 +08:00
parent ecfb67872d
commit 24166aeb62
6 changed files with 70 additions and 58 deletions

View File

@@ -8,26 +8,42 @@ export const useNotificationStore = defineStore('notification', () => {
const urgentNotifications = ref<Notification[]>([])
async function fetchUnreadCount() {
const data = await api.getUnreadCount()
unreadCount.value = data.count
try {
const data = await api.getUnreadCount()
unreadCount.value = data.count
} catch {
// 静默失败,不影响页面
}
}
/** 获取未读的强提醒公告(首页弹窗用) */
async function fetchUrgentNotifications() {
urgentNotifications.value = await api.getPinnedNotifications()
try {
urgentNotifications.value = await api.getPinnedNotifications()
} catch {
// 静默失败
}
}
async function markRead(id: number) {
await api.markRead(id)
if (unreadCount.value > 0) unreadCount.value--
// 从强提醒列表中移除
urgentNotifications.value = urgentNotifications.value.filter(n => n.id !== id)
try {
await api.markRead(id)
if (unreadCount.value > 0) unreadCount.value--
// 从强提醒列表中移除
urgentNotifications.value = urgentNotifications.value.filter(n => n.id !== id)
} catch {
// 静默失败
}
}
async function markAllRead() {
await api.markAllRead()
unreadCount.value = 0
urgentNotifications.value = []
try {
await api.markAllRead()
unreadCount.value = 0
urgentNotifications.value = []
} catch {
// 静默失败
}
}
return { unreadCount, urgentNotifications, fetchUnreadCount, fetchUrgentNotifications, markRead, markAllRead }