From 06c679579c00321e3f9ecd39c72bb40acb129bd0 Mon Sep 17 00:00:00 2001 From: yuetsh <517252939@qq.com> Date: Tue, 13 Oct 2026 22:03:49 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E5=89=8D=E5=8F=B0):=20=E5=9C=B0=E5=9D=80?= =?UTF-8?q?=E6=89=93=E9=94=99=E4=B8=8D=E5=86=8D=E6=98=AF=E4=B8=80=E6=95=B4?= =?UTF-8?q?=E9=A1=B5=E7=A9=BA=E7=99=BD=EF=BC=8C=E9=A2=98=E7=9B=AE=E3=80=81?= =?UTF-8?q?=E6=AF=94=E8=B5=9B=E3=80=81=E9=A2=98=E5=8D=95=E4=B8=8D=E5=AD=98?= =?UTF-8?q?=E5=9C=A8=E6=97=B6=E5=86=99=E6=98=8E=E6=98=AF=E5=93=AA=E6=A0=B7?= =?UTF-8?q?=E4=B8=8D=E5=AD=98=E5=9C=A8=E3=80=81=E7=BB=99=E4=B8=80=E4=B8=AA?= =?UTF-8?q?=E5=9B=9E=E5=8E=BB=E7=9A=84=E6=8C=89=E9=92=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Opus 5.5 --- .../announcement/components/TitleWithTag.vue | 14 ---- apps/web/src/oj/contest/detail.vue | 35 +++++++-- apps/web/src/oj/problem/detail.vue | 46 ++++++++++-- apps/web/src/oj/problemset/detail.vue | 16 ++--- apps/web/src/routes.ts | 8 +++ apps/web/src/shared/components/NotFound.vue | 71 +++++++++++++++++++ 6 files changed, 153 insertions(+), 37 deletions(-) delete mode 100644 apps/web/src/oj/announcement/components/TitleWithTag.vue create mode 100644 apps/web/src/shared/components/NotFound.vue diff --git a/apps/web/src/oj/announcement/components/TitleWithTag.vue b/apps/web/src/oj/announcement/components/TitleWithTag.vue deleted file mode 100644 index 0a8a845..0000000 --- a/apps/web/src/oj/announcement/components/TitleWithTag.vue +++ /dev/null @@ -1,14 +0,0 @@ - - diff --git a/apps/web/src/oj/contest/detail.vue b/apps/web/src/oj/contest/detail.vue index 6a1d2dc..be0da74 100644 --- a/apps/web/src/oj/contest/detail.vue +++ b/apps/web/src/oj/contest/detail.vue @@ -3,6 +3,8 @@ import { useThemeVars } from "naive-ui" import { useTone } from "oj/submission/composables/tone" import { ContestStatus } from "utils/constants" import { parseTime, secondsToDuration } from "utils/functions" +import NotFound from "shared/components/NotFound.vue" +import { errorCode } from "utils/api" import { useContestStore } from "../store/contest" import ContestBadge from "./components/ContestBadge.vue" import ContestInfo from "./components/ContestInfo.vue" @@ -34,18 +36,27 @@ async function check() { } } +/** 拉比赛失败:原来没接,链接不对就是一整页空白 */ +const failure = ref(null) + +async function load() { + failure.value = null + try { + await contestStore.init(props.contestID) + } catch (err) { + if (contestStore.contest) return + failure.value = errorCode(err) === "contest-not-found" ? "missing" : "failed" + } +} + watch( () => contestStore.contestStatus, (nv, ov) => { - if (nv === ContestStatus.underway && ov == ContestStatus.not_started) { - contestStore.init(props.contestID) - } + if (nv === ContestStatus.underway && ov == ContestStatus.not_started) load() }, ) -onMounted(() => { - contestStore.init(props.contestID) -}) +onMounted(load) onBeforeUnmount(contestStore.clear) @@ -95,7 +106,17 @@ const to = (name: string) => ({ name, params: { contestID: props.contestID } }) - + + + 再试一次 + +