From d1af1dbe114f1643eed6de4e6b86af5de0d84188 Mon Sep 17 00:00:00 2001 From: Wang Zhuoxuan Date: Sat, 11 Apr 2026 21:56:59 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=AF=B9=E6=8E=A5=E9=A2=98=E7=9B=AE?= =?UTF-8?q?=E7=8A=B6=E6=80=81=E8=BD=AC=E6=8D=A2=E6=8E=A5=E5=8F=A3=EF=BC=8C?= =?UTF-8?q?=E8=A1=A5=E5=85=A8=E8=BD=AC=E6=8D=A2=E8=B7=AF=E5=BE=84=E5=92=8C?= =?UTF-8?q?=E9=94=99=E8=AF=AF=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 补全 draft→archived、reviewing→archived 转换路径,与 API 规范对齐 - 添加 draft→archived、reviewing→archived 状态流转描述文案 - 为 confirmStatusChange、handleApproveUgc、handleRejectUgc 添加 try/catch 错误处理 --- .claude/settings.local.json | 3 +- .../question/StatusTransitionDialog.tsx | 2 + src/components/question/columns.tsx | 4 +- src/routes/questions/index.tsx | 45 ++++++++++++------- 4 files changed, 36 insertions(+), 18 deletions(-) diff --git a/.claude/settings.local.json b/.claude/settings.local.json index 4f9c81f..5cbcb07 100644 --- a/.claude/settings.local.json +++ b/.claude/settings.local.json @@ -14,7 +14,8 @@ "Bash(bunx:*)", "Bash(bun run:*)", "Bash(git add:*)", - "Bash(git commit:*)" + "Bash(git commit:*)", + "mcp__plugin_ecc_sequential-thinking__sequentialthinking" ] } } diff --git a/src/components/question/StatusTransitionDialog.tsx b/src/components/question/StatusTransitionDialog.tsx index 7024390..0ff7fb4 100644 --- a/src/components/question/StatusTransitionDialog.tsx +++ b/src/components/question/StatusTransitionDialog.tsx @@ -65,8 +65,10 @@ export function StatusTransitionDialog({ function getDescription(from: QuestionStatus, to: QuestionStatus): string { const descriptions: Record = { "draft→reviewing": "提交后题目将进入审核队列,等待审核通过后才能发布。", + "draft→archived": "直接将草稿题目归档,题目将不会出现在任何列表中。可随时恢复为草稿。", "reviewing→published": "审核通过后题目将对所有用户可见,请确认题目内容无误。", "reviewing→draft": "将题目退回草稿状态,可以继续修改后重新提交。", + "reviewing→archived": "将审核中的题目直接归档,不再继续审核流程。可随时恢复为草稿。", "published→archived": "下架后题目将对用户不可见,但数据会保留。可随时恢复为草稿。", "archived→draft": "恢复为草稿后可以重新编辑并提交审核。", } diff --git a/src/components/question/columns.tsx b/src/components/question/columns.tsx index 1366f92..d0f1efb 100644 --- a/src/components/question/columns.tsx +++ b/src/components/question/columns.tsx @@ -28,9 +28,9 @@ interface ColumnContext { function getQuestionStatusesForTransition(current: QuestionStatus): QuestionStatus[] { switch (current) { case "draft": - return ["reviewing"] + return ["reviewing", "archived"] case "reviewing": - return ["published", "draft"] + return ["published", "draft", "archived"] case "published": return ["archived"] case "archived": diff --git a/src/routes/questions/index.tsx b/src/routes/questions/index.tsx index 39a92c4..6d7568c 100644 --- a/src/routes/questions/index.tsx +++ b/src/routes/questions/index.tsx @@ -161,11 +161,16 @@ export default function QuestionsPage() { async function confirmStatusChange() { if (!statusTarget || !statusTargetState) return - await updateQuestionStatus(statusTarget.id, statusTargetState) - setStatusDialogOpen(false) - setStatusTarget(null) - setStatusTargetState(null) - await loadQuestions() + try { + await updateQuestionStatus(statusTarget.id, statusTargetState) + setStatusDialogOpen(false) + setStatusTarget(null) + setStatusTargetState(null) + await loadQuestions() + } catch (err) { + const message = err instanceof Error ? err.message : "状态变更失败" + alert(message) + } } function openDelete(question: Question) { @@ -201,20 +206,30 @@ export default function QuestionsPage() { async function handleApproveUgc(_note?: string) { if (!ugcReviewQuestion) return - await updateQuestionStatus(ugcReviewQuestion.id, "published") - setUgcReviewOpen(false) - setUgcReviewQuestion(null) - await loadQuestions() + try { + await updateQuestionStatus(ugcReviewQuestion.id, "published") + setUgcReviewOpen(false) + setUgcReviewQuestion(null) + await loadQuestions() + } catch (err) { + const message = err instanceof Error ? err.message : "审核操作失败" + alert(message) + } } async function handleRejectUgc(_note: string) { if (!ugcReviewQuestion) return - // TODO: 这里可以添加 API 调用来保存审核备注 - // 暂时只更新状态 - await updateQuestionStatus(ugcReviewQuestion.id, "draft") - setUgcReviewOpen(false) - setUgcReviewQuestion(null) - await loadQuestions() + try { + // TODO: 这里可以添加 API 调用来保存审核备注 + // 暂时只更新状态 + await updateQuestionStatus(ugcReviewQuestion.id, "draft") + setUgcReviewOpen(false) + setUgcReviewQuestion(null) + await loadQuestions() + } catch (err) { + const message = err instanceof Error ? err.message : "审核操作失败" + alert(message) + } } const columns = getColumns({