fix(比赛): 「比赛信息」里老师贴的截图不会被压扁、点一下能放大;弹框改成点开,不再鼠标一挪就收起
Deploy / deploy (push) Canceled after 0s

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
xuyueandClaude Opus 5.5 committed 2026-10-14 08:54:01 +08:00
1 parent f0969f1458
commit dc89184488
1 file changed
+19 -2
@@ -2,16 +2,21 @@
import { useContestStore } from "oj/store/contest"
import { parseTime } from "utils/functions"
import ContestAccessTag from "shared/components/ContestAccessTag.vue"
import Markdown from "shared/components/Markdown.vue"
const contestStore = useContestStore()
</script>
<template>
<n-popover v-if="contestStore.contest" placement="bottom-end" :show-arrow="false">
<!-- 点开而不是悬停:正文里的图点开放大时,放大层盖住了弹框,悬停会当成鼠标离开把弹框连同放大层一起收掉 -->
<n-popover v-if="contestStore.contest" trigger="click" placement="bottom-end" :show-arrow="false">
<template #trigger>
<n-button>比赛信息</n-button>
</template>
<div v-html="contestStore.contest.description"></div>
<!-- 后台富文本存的 HTML,和题面一样走 Markdown:贴进来的截图不会被压扁、点开能放大 -->
<div class="desc">
<Markdown html :content="contestStore.contest.description" />
</div>
<n-descriptions bordered label-placement="left" :column="1">
<n-descriptions-item label="开始时间">
{{ parseTime(contestStore.contest.startTime, "YYYY年M月D日 HH:mm:ss") }}
@@ -28,3 +33,15 @@ const contestStore = useContestStore()
</n-descriptions>
</n-popover>
</template>
<style scoped>
/* 截图按原宽会把弹框撑得和屏幕一样宽 */
.desc {
max-width: min(480px, calc(100vw - 48px));
margin-bottom: 12px;
}
.desc :deep(.oj-markdown) {
font-size: 14px;
}
</style>