From 77aca640ac89d45912d09bbee409a90876116158 Mon Sep 17 00:00:00 2001 From: yuetsh <517252939@qq.com> Date: Wed, 6 May 2026 06:28:49 -0600 Subject: [PATCH] add challenge author --- src/components/task/ChallengeList.vue | 8 ++++++ src/pages/ChallengeDetail.vue | 36 +++++++++++++++++++++------ src/pages/ChallengeEditor.vue | 8 ++++++ src/utils/type.ts | 1 + 4 files changed, 46 insertions(+), 7 deletions(-) diff --git a/src/components/task/ChallengeList.vue b/src/components/task/ChallengeList.vue index ad8817a..95f6941 100644 --- a/src/components/task/ChallengeList.vue +++ b/src/components/task/ChallengeList.vue @@ -25,6 +25,9 @@ > + + 出题人:{{ item.author_name || "未设置" }} + @@ -72,4 +75,9 @@ onMounted(async () => { .submitted-title { color: #888; } + +.challenge-author { + display: block; + font-size: 13px; +} diff --git a/src/pages/ChallengeDetail.vue b/src/pages/ChallengeDetail.vue index 8437b43..88e1e21 100644 --- a/src/pages/ChallengeDetail.vue +++ b/src/pages/ChallengeDetail.vue @@ -34,12 +34,19 @@ - + + + + 出题人:{{ challengeAuthor || "未设置" }} + + + + @@ -156,6 +163,7 @@ function setupCodeCopy() { const activeTab = ref("desc") const challengeContent = ref("") +const challengeAuthor = ref("") const $desc = useTemplateRef("$desc") const showCode = ref(false) const showStats = ref(false) @@ -176,6 +184,7 @@ async function loadChallenge() { challengeDisplay.value = display const data = await Challenge.get(display) taskId.value = data.task_ptr + challengeAuthor.value = data.author_name ?? "" challengeContent.value = await marked.parse(data.content, { async: true, renderer: challengeRenderer, @@ -272,10 +281,23 @@ onUnmounted(disconnectPrompt) .content { padding: 12px; overflow-y: auto; - height: 100%; + flex: 1; + min-height: 0; box-sizing: border-box; } +.desc-pane { + height: 100%; + display: flex; + flex-direction: column; +} + +.challenge-meta { + padding: 10px 12px; + border-bottom: 1px solid var(--n-border-color, #efeff5); + flex-shrink: 0; +} + .no-select { user-select: none; } diff --git a/src/pages/ChallengeEditor.vue b/src/pages/ChallengeEditor.vue index 270a4a9..084173a 100644 --- a/src/pages/ChallengeEditor.vue +++ b/src/pages/ChallengeEditor.vue @@ -29,6 +29,7 @@ 【{{ item.display }}】{{ item.title }} {{ item.score }}分 + 出题人 {{ item.author_name || "未设置" }} @@ -66,6 +67,9 @@ + + {{ challenge.author_name || "未设置" }} + 提交 @@ -107,6 +111,7 @@ const challenge = reactive({ content: "", score: 0, is_public: false, + author_name: "", }) const canSubmit = computed( @@ -129,6 +134,7 @@ function createNew() { challenge.content = "" challenge.score = 0 challenge.is_public = false + challenge.author_name = "" } async function submit() { @@ -140,6 +146,7 @@ async function submit() { challenge.content = "" challenge.score = 0 challenge.is_public = false + challenge.author_name = "" await getContent() } catch (error: any) { message.error(error.response.data.detail) @@ -168,6 +175,7 @@ async function show(display: number) { challenge.content = item.content challenge.score = item.score challenge.is_public = item.is_public + challenge.author_name = item.author_name ?? "" } async function togglePublic(display: number) { diff --git a/src/utils/type.ts b/src/utils/type.ts index 36669fa..2331ab2 100644 --- a/src/utils/type.ts +++ b/src/utils/type.ts @@ -56,6 +56,7 @@ export interface ChallengeSlim { pass_score: number | null submitted: boolean is_public: boolean + author_name: string | null } export interface ChallengeIn {