feat: 顶部通知铃铛与站内通知中心
All checks were successful
构建并部署前端到测试环境 / build-and-deploy (push) Successful in 4m7s

This commit is contained in:
luo
2026-07-24 17:12:29 +08:00
parent 4c6d871c35
commit d1ff4d5f6c
18 changed files with 1101 additions and 519 deletions

View File

@@ -0,0 +1,31 @@
import type { Router } from 'vue-router'
import type { NotificationTarget } from '@/types/api'
export const navigateNotificationTarget = (router: Router, target?: NotificationTarget | null) => {
if (!target || target.available === false) return false
const query = target.query
? Object.fromEntries(Object.entries(target.query).map(([key, value]) => [key, String(value)]))
: undefined
if (target.route_name) {
if (!router.hasRoute(target.route_name)) return false
void router.push({
name: target.route_name,
params: target.route_params || undefined,
query
})
return true
}
const path = target.route_path || ''
if (!path.startsWith('/') || path.startsWith('//') || /^https?:\/\//i.test(path)) return false
const resolved = router.resolve({
path,
query
})
if (!resolved.matched.length || resolved.name === 'Exception404') return false
void router.push(resolved)
return true
}