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 } }) - + + + 再试一次 + +