From a0b006c93644f692c9652a600d6b6358a630bb8b Mon Sep 17 00:00:00 2001 From: yuetsh <517252939@qq.com> Date: Sun, 23 Jun 2024 12:27:51 +0000 Subject: [PATCH] add top for announcement --- src/admin/announcement/detail.vue | 5 +++++ src/oj/announcement/components/TitleWithTag.vue | 14 ++++++++++++++ src/oj/announcement/list.vue | 8 +++++++- src/utils/types.ts | 1 + 4 files changed, 27 insertions(+), 1 deletion(-) create mode 100644 src/oj/announcement/components/TitleWithTag.vue diff --git a/src/admin/announcement/detail.vue b/src/admin/announcement/detail.vue index 7f8642e..98dbd68 100644 --- a/src/admin/announcement/detail.vue +++ b/src/admin/announcement/detail.vue @@ -19,6 +19,7 @@ const announcement = reactive({ tag: "公告", content: "", visible: false, + top: false, }) const tags: SelectOption[] = [ @@ -38,6 +39,7 @@ async function init() { announcement.title = res.data.title announcement.content = res.data.content announcement.visible = res.data.visible + announcement.top = res.data.top } async function submit() { @@ -85,6 +87,9 @@ onMounted(init) + + + + + 置顶 + {{ title }} + + + diff --git a/src/oj/announcement/list.vue b/src/oj/announcement/list.vue index 149f260..2202da1 100644 --- a/src/oj/announcement/list.vue +++ b/src/oj/announcement/list.vue @@ -5,6 +5,7 @@ import { parseTime } from "~/utils/functions" import { Announcement } from "~/utils/types" import { isDesktop } from "~/shared/composables/breakpoints" import { NTag } from "naive-ui" +import TitleWithTag from "./components/TitleWithTag.vue" const total = ref(0) const content = ref("") @@ -15,7 +16,12 @@ const query = reactive({ page: 1, }) const columns: DataTableColumn[] = [ - { key: "title", title: "公告标题", minWidth: 300 }, + { + key: "title", + title: "公告标题", + render: (row) => h(TitleWithTag, { title: row.title, top: row.top }), + minWidth: 300, + }, { key: "tag", title: "标签", diff --git a/src/utils/types.ts b/src/utils/types.ts index bc2a9b6..3a0abcc 100644 --- a/src/utils/types.ts +++ b/src/utils/types.ts @@ -337,6 +337,7 @@ export interface AnnouncementEdit { tag: string content: string visible: boolean + top: boolean } export interface Announcement extends AnnouncementEdit {