From 344e9734b67291a6f27fb096a677dcf3191c0f4a Mon Sep 17 00:00:00 2001 From: yuetsh <517252939@qq.com> Date: Wed, 5 Aug 2026 06:11:46 -0600 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=A0=87=E7=AD=BE=E7=AE=A1=E7=90=86?= =?UTF-8?q?=E9=A1=B5=E7=82=B9=E5=87=BB=E6=A0=87=E7=AD=BE=E6=9F=A5=E7=9C=8B?= =?UTF-8?q?=E5=AF=B9=E5=BA=94=E9=A2=98=E7=9B=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/admin/problem/tags.vue | 37 +++++++++++++++++++++++++++++++++++-- 1 file changed, 35 insertions(+), 2 deletions(-) diff --git a/src/admin/problem/tags.vue b/src/admin/problem/tags.vue index 2af570c..9b0befe 100644 --- a/src/admin/problem/tags.vue +++ b/src/admin/problem/tags.vue @@ -2,6 +2,7 @@ import { NButton, NFlex, NInput } from "naive-ui" import type { AdminTag } from "utils/types" import { deleteTag, getTagAdminList, renameTag } from "../api" +import TagProblemsModal from "./components/TagProblemsModal.vue" const message = useMessage() const dialog = useDialog() @@ -11,6 +12,14 @@ const keyword = ref("") const editingId = ref(null) const editingName = ref("") +const activeTag = ref(null) +const [showTagProblems, toggleTagProblems] = useToggle(false) + +function openTagProblems(tag: AdminTag) { + activeTag.value = tag + toggleTagProblems(true) +} + const columns: DataTableColumn[] = [ { title: "ID", key: "id", width: 80 }, { @@ -30,9 +39,27 @@ const columns: DataTableColumn[] = [ if (e.key === "Escape") cancelEdit() }, }) - : row.name, + : h( + NButton, + { + text: true, + type: "primary", + onClick: () => openTagProblems(row), + }, + () => row.name, + ), + }, + { + title: "题目数", + key: "problem_count", + width: 100, + render: (row) => + h( + NButton, + { text: true, type: "primary", onClick: () => openTagProblems(row) }, + () => String(row.problem_count), + ), }, - { title: "题目数", key: "problem_count", width: 100 }, { title: "选项", key: "actions", @@ -140,6 +167,12 @@ watchDebounced(keyword, listTags, { debounce: 500, maxWait: 1000 }) /> +