fix(后台): 用户、题目、比赛、公告、标签几张列表的操作不再收进 ⋯,直接摆在行尾;名字和题目那列不再吃掉整行的空,创建日期不再折成两行

1366 宽的屏上题目列表、比赛列表的按钮都放得下;题目的知识点多于两个时只摆一个加「+N」。

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
xuyueandClaude Opus 5.5 committed 2026-10-13 14:29:56 +08:00
1 parent bd3a57468f
commit 6470f56f87
9 files changed
+119 -158

No files matched your search

+16 -29
View File
@@ -1,12 +1,10 @@
<script lang="ts" setup>
import { Icon } from "@iconify/vue"
import { editUser } from "admin/api"
import type { AdminUserForm } from "utils/types"
/**
* 用户列表一行的操作(设计稿「后台用户与批量建号」UsList):最常用的「重置密码」常驻
* (学生忘了密码是后台进得最多的一件事),其余收进 ⋯。原来四颗彩色按钮并排,
* 1366 的屏上把「上次登录」挤成了半截
* 用户列表一行的操作:重置密码、编辑、禁用、删除直接摆出来(用户说的:不要收进 ⋯)。
* 删除前确认,交过题的账号删不掉,提示改为禁用
*/
interface Props {
user: AdminUserForm
@@ -27,34 +25,23 @@ async function banUser() {
emit("userBanned", props.user)
}
const menuOptions = computed<DropdownOption[]>(() => [
{ label: "编辑", key: "edit" },
{ label: props.user.isDisabled ? "解除禁用" : "禁用", key: "ban" },
{ type: "divider", key: "divider" },
{ label: "删除", key: "delete" },
])
function onMenu(key: string) {
if (key === "edit") emit("openEditModal", props.user)
else if (key === "ban") banUser()
else if (key === "delete") {
dialog.warning({
title: `删除 ${props.user.username}?`,
content: "删掉就找不回来了。交过题的账号删不掉,那种请改为禁用。",
positiveText: "删除",
negativeText: "不删",
onPositiveClick: () => emit("deleteUser", [props.user.id]),
})
}
function confirmDelete() {
dialog.warning({
title: `删除 ${props.user.username}?`,
content: "删掉就找不回来了。交过题的账号删不掉,那种请改为禁用。",
positiveText: "删除",
negativeText: "不删",
onPositiveClick: () => emit("deleteUser", [props.user.id]),
})
}
</script>
<template>
<n-flex :size="4" justify="end" :wrap="false">
<n-flex :size="6" :wrap="false">
<n-button size="small" @click="emit('resetPassword', props.user)">重置密码</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('openEditModal', props.user)">编辑</n-button>
<n-button size="small" @click="banUser">
{{ props.user.isDisabled ? "解除禁用" : "禁用" }}
</n-button>
<n-button size="small" quaternary type="error" @click="confirmDelete">删除</n-button>
</n-flex>
</template>