chore(依赖): 前后端依赖升到最新,补上机房 Chrome 105 缺的两个 polyfill
几处随升级改的: - VueUse 15 的 useNow 不再收 interval,不传 scheduler 默认逐帧刷新。比赛列表(1 秒) 和后台建比赛(15 秒)改成用 useIntervalFn 当调度器,频率不变。 - 重新探测 modernPolyfills:mermaid 12 用了 Object.groupBy(Chrome 117),core-js 新数据 把 URL.parse(Chrome 126)也算进来了,不补的话机房老机器上静默报 TypeError。清单 52 项。 - vue-router 5.4 弃用了导航守卫里的 next(),全局守卫改成返回值。 - web-tree-sitter 0.27:AST 规则在 dev 和编译后的二进制里各跑过一遍,判过、判不过都对; jieba 2.0.4 原生模块在仓库外起二进制能正常分词。 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
6f47ad8358
commit
e6c02dce33
7 files changed
+242
-199
No files matched your search
+8
-15
@@ -26,13 +26,13 @@ import { useUserStore } from "./shared/store/user"
|
||||
|
||||
const authStore = useAuthModalStore()
|
||||
|
||||
router.beforeEach(async (to, _from, next) => {
|
||||
// vue-router 5.4 起 next() 回调已弃用,改成返回值:返回 "/" 就是跳回首页,什么都不返回就是放行
|
||||
router.beforeEach(async (to) => {
|
||||
// 检查是否需要认证
|
||||
if (to.matched.some((record) => record.meta.requiresAuth)) {
|
||||
if (!storage.get(STORAGE_KEY.AUTHED)) {
|
||||
authStore.openLoginModal()
|
||||
next("/")
|
||||
return
|
||||
return "/"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -47,8 +47,7 @@ router.beforeEach(async (to, _from, next) => {
|
||||
) {
|
||||
if (!storage.get(STORAGE_KEY.AUTHED)) {
|
||||
authStore.openLoginModal()
|
||||
next("/")
|
||||
return
|
||||
return "/"
|
||||
}
|
||||
|
||||
const userStore = useUserStore()
|
||||
@@ -56,29 +55,23 @@ router.beforeEach(async (to, _from, next) => {
|
||||
try {
|
||||
await userStore.getMyProfile()
|
||||
} catch {
|
||||
next("/")
|
||||
return
|
||||
return "/"
|
||||
}
|
||||
}
|
||||
if (to.matched.some((record) => record.meta.requiresSuperAdmin)) {
|
||||
if (!userStore.isSuperAdmin) {
|
||||
next("/")
|
||||
return
|
||||
return "/"
|
||||
}
|
||||
} else if (to.matched.some((record) => record.meta.requiresTeacherAdmin)) {
|
||||
if (!userStore.isTeacherOrAbove) {
|
||||
next("/")
|
||||
return
|
||||
return "/"
|
||||
}
|
||||
} else if (to.matched.some((record) => record.meta.requiresProblemPermission)) {
|
||||
if (!userStore.hasProblemPermission) {
|
||||
next("/")
|
||||
return
|
||||
return "/"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
next()
|
||||
})
|
||||
|
||||
app.mount("#app")
|
||||
|
||||
Reference in new issue
Block a user