fix(后台): 用户、题目、比赛、公告、标签几张列表的操作不再收进 ⋯,直接摆在行尾;名字和题目那列不再吃掉整行的空,创建日期不再折成两行
1366 宽的屏上题目列表、比赛列表的按钮都放得下;题目的知识点多于两个时只摆一个加「+N」。 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
bd3a57468f
commit
6470f56f87
9 files changed
+119
-158
No files matched your search
@@ -1,9 +1,8 @@
|
||||
<script lang="ts" setup>
|
||||
import { Icon } from "@iconify/vue"
|
||||
import { deleteAnnouncement } from "admin/api"
|
||||
|
||||
/**
|
||||
* 公告一行的操作(设计稿「后台公告」AnnAdmin):「编辑」常驻,置顶 / 删除收进 ⋯
|
||||
* 公告一行的操作:编辑、置顶、删除直接摆出来(用户说的:不要收进 ⋯)
|
||||
*/
|
||||
interface Props {
|
||||
announcementID: number
|
||||
@@ -23,36 +22,26 @@ function goEdit() {
|
||||
})
|
||||
}
|
||||
|
||||
const menuOptions = computed<DropdownOption[]>(() => [
|
||||
{ label: props.top ? "取消置顶" : "置顶", key: "top" },
|
||||
{ type: "divider", key: "divider" },
|
||||
{ label: "删除", key: "delete" },
|
||||
])
|
||||
|
||||
function onMenu(key: string) {
|
||||
if (key === "top") emit("toggleTop")
|
||||
else if (key === "delete") {
|
||||
dialog.warning({
|
||||
title: "删除这条公告?",
|
||||
content: "删掉就找不回来了。只是不想让学生看到的话,关掉「学生看得到」就行。",
|
||||
positiveText: "删除",
|
||||
negativeText: "不删",
|
||||
onPositiveClick: async () => {
|
||||
await deleteAnnouncement(props.announcementID)
|
||||
message.success("删掉了")
|
||||
emit("deleted")
|
||||
},
|
||||
})
|
||||
}
|
||||
function confirmDelete() {
|
||||
dialog.warning({
|
||||
title: "删除这条公告?",
|
||||
content: "删掉就找不回来了。只是不想让学生看到的话,关掉「学生看得到」就行。",
|
||||
positiveText: "删除",
|
||||
negativeText: "不删",
|
||||
onPositiveClick: async () => {
|
||||
await deleteAnnouncement(props.announcementID)
|
||||
message.success("删掉了")
|
||||
emit("deleted")
|
||||
},
|
||||
})
|
||||
}
|
||||
</script>
|
||||
<template>
|
||||
<n-flex :size="4" justify="end" :wrap="false">
|
||||
<n-flex :size="6" :wrap="false">
|
||||
<n-button size="small" @click="goEdit">编辑</n-button>
|
||||
<n-dropdown trigger="click" placement="bottom-end" :options="menuOptions" @select="onMenu">
|
||||
<n-button size="small" quaternary aria-label="更多">
|
||||
<template #icon><Icon icon="ph:dots-three-bold" /></template>
|
||||
</n-button>
|
||||
</n-dropdown>
|
||||
<n-button size="small" @click="emit('toggleTop')">
|
||||
{{ props.top ? "取消置顶" : "置顶" }}
|
||||
</n-button>
|
||||
<n-button size="small" quaternary type="error" @click="confirmDelete">删除</n-button>
|
||||
</n-flex>
|
||||
</template>
|
||||
@@ -18,7 +18,7 @@ const announcements = ref<AdminAnnouncementListItem[]>([])
|
||||
|
||||
/**
|
||||
* 后台公告列表(设计稿「后台公告」AnnAdmin):一行一条,标题(置顶挂标,公告 / 更新淡淡写在后面)、
|
||||
* 发布、改过、学生看得到;「编辑」常驻,置顶 / 删除收进 ⋯。ID、作者(都是同一个人)、
|
||||
* 发布、改过、学生看得到;编辑、置顶、删除直接摆出来。ID、作者(都是同一个人)、
|
||||
* 精确到秒的两列时间拿掉
|
||||
*/
|
||||
const theme = useThemeVars()
|
||||
@@ -27,7 +27,7 @@ const columns: DataTableColumn<AdminAnnouncementListItem>[] = [
|
||||
{
|
||||
title: "标题",
|
||||
key: "title",
|
||||
minWidth: 300,
|
||||
width: 360,
|
||||
render: (row) =>
|
||||
h("span", { class: "title-cell" }, [
|
||||
h(
|
||||
@@ -73,7 +73,7 @@ const columns: DataTableColumn<AdminAnnouncementListItem>[] = [
|
||||
{
|
||||
title: "",
|
||||
key: "actions",
|
||||
width: 110,
|
||||
minWidth: 240,
|
||||
render: (row) =>
|
||||
h(Actions, {
|
||||
announcementID: row.id,
|
||||
|
||||
Reference in new issue
Block a user