From 4c9617caf178895dce24aa2118b6cead06f5e732 Mon Sep 17 00:00:00 2001 From: yuetsh <517252939@qq.com> Date: Tue, 27 Oct 2026 11:59:56 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E9=87=8D=E6=96=B0=E8=AE=BE=E8=AE=A1?= =?UTF-8?q?=E4=BD=9C=E5=93=81=E5=B1=95=EF=BC=8C=E7=82=B9=E5=BC=80=E8=83=BD?= =?UTF-8?q?=E7=9C=8B=E5=A4=A7=E5=9B=BE=E3=80=81=E8=8E=B7=E5=A5=96=E5=92=8C?= =?UTF-8?q?=E6=8F=90=E7=A4=BA=E8=AF=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 点作品不再跳到只有网页的全屏页,而是弹出大图:作者、题目、所获奖项、得分、浏览次数, 有提示词的能看“是怎么问出来的”(作品展接口),← → 在同一奖项里切换 - 卡片缩略图改用 buildPreviewDocument,题目素材能加载;未评分的不显示星标 - 顶部加奖项跳转;标题和导航统一叫“作品展” - 作品展接口返回 task_type(拼素材地址要用) Co-Authored-By: Claude Opus 5.5 --- client/src/pages/Showcase.vue | 470 +++++++++++++++++++++++++++------- client/src/utils/type.ts | 4 + server/src/routes/showcase.ts | 10 +- server/tests/api.test.ts | 2 +- 4 files changed, 391 insertions(+), 95 deletions(-) diff --git a/client/src/pages/Showcase.vue b/client/src/pages/Showcase.vue index 76302b8..305f036 100644 --- a/client/src/pages/Showcase.vue +++ b/client/src/pages/Showcase.vue @@ -1,167 +1,455 @@ diff --git a/client/src/utils/type.ts b/client/src/utils/type.ts index 711855f..16e4737 100644 --- a/client/src/utils/type.ts +++ b/client/src/utils/type.ts @@ -261,6 +261,7 @@ export interface ShowcaseItem { username: string task_title: string task_display: number + task_type: TASK_TYPE score: number view_count: number html: string | null @@ -306,6 +307,7 @@ export interface ShowcaseSubmissionLookupOut { username: string task_title: string task_display: number + task_type: TASK_TYPE score: number view_count: number has_prompt_chain: boolean @@ -317,6 +319,7 @@ export interface AwardItemManageOut { username: string task_title: string task_display: number + task_type: TASK_TYPE score: number view_count: number sort_order: number @@ -330,6 +333,7 @@ export interface ShowcaseDetail { username: string task_title: string task_display: number + task_type: TASK_TYPE score: number view_count: number html: string | null diff --git a/server/src/routes/showcase.ts b/server/src/routes/showcase.ts index c342fb9..faaa3b9 100644 --- a/server/src/routes/showcase.ts +++ b/server/src/routes/showcase.ts @@ -20,7 +20,7 @@ const ORDER_BY: Record = { const HAS_CHAIN = `EXISTS (SELECT 1 FROM prompt_message m WHERE m.submission_id = s.id) AS has_prompt_chain` const ITEM_SELECT = `SELECT sa.id, sa.submission_id, sa.sort_order, sa.awarded_at, sa.is_stale, - u.username, t.title AS task_title, t.display AS task_display, + u.username, t.title AS task_title, t.display AS task_display, t.task_type, s.score, s.view_count, s.html, s.css, s.js, ${HAS_CHAIN} FROM submission_submissionaward sa JOIN submission_submission s ON s.id = sa.submission_id @@ -34,6 +34,7 @@ function itemManageOut(r: any) { username: r.username, task_title: r.task_title, task_display: r.task_display, + task_type: r.task_type, score: r.score, view_count: r.view_count, sort_order: r.sort_order, @@ -104,6 +105,7 @@ router.get("/", (c) => { username: r.username, task_title: r.task_title, task_display: r.task_display, + task_type: r.task_type, score: r.score, view_count: r.view_count, html: r.html, @@ -167,7 +169,7 @@ router.get("/manage/submissions/:submission_id", (c) => { const id = uuidParam(c, "submission_id") const s = orNotFound( get( - `SELECT s.id, u.username, t.title AS task_title, t.display AS task_display, + `SELECT s.id, u.username, t.title AS task_title, t.display AS task_display, t.task_type, s.score, s.view_count, ${HAS_CHAIN} FROM submission_submission s JOIN account_user u ON u.id = s.user_id @@ -181,6 +183,7 @@ router.get("/manage/submissions/:submission_id", (c) => { username: s.username, task_title: s.task_title, task_display: s.task_display, + task_type: s.task_type, score: s.score, view_count: s.view_count, has_prompt_chain: bool(s.has_prompt_chain), @@ -301,7 +304,7 @@ router.get("/:submission_id", (c) => { assertAwarded(id) const s = orNotFound( get( - `SELECT s.id, u.username, t.title AS task_title, t.display AS task_display, + `SELECT s.id, u.username, t.title AS task_title, t.display AS task_display, t.task_type, s.score, s.view_count, s.html, s.css, s.js, ${HAS_CHAIN} FROM submission_submission s JOIN account_user u ON u.id = s.user_id @@ -320,6 +323,7 @@ router.get("/:submission_id", (c) => { username: s.username, task_title: s.task_title, task_display: s.task_display, + task_type: s.task_type, score: s.score, view_count: s.view_count, html: s.html, diff --git a/server/tests/api.test.ts b/server/tests/api.test.ts index d150648..eaf27ef 100644 --- a/server/tests/api.test.ts +++ b/server/tests/api.test.ts @@ -415,7 +415,7 @@ describe("作品展", () => { const author1 = await client("author") expect((await author1("GET", "/api/submission/showcase/")).json).toHaveLength(1) - expect((await author1("GET", `/api/submission/showcase/${uuid(sub)}/`)).json.awards).toEqual(["最佳"]) + expect((await author1("GET", `/api/submission/showcase/${uuid(sub)}/`)).json).toMatchObject({ awards: ["最佳"], task_type: "challenge" }) await adm("PUT", `/api/submission/showcase/manage/awards/${award.id}`, { name: "最佳", is_active: false }) expect((await author1("GET", "/api/submission/showcase/")).json).toEqual([])