diff --git a/apps/web/src/admin/user/components/Password.vue b/apps/web/src/admin/user/components/Password.vue
new file mode 100644
index 0000000..4d4f6d8
--- /dev/null
+++ b/apps/web/src/admin/user/components/Password.vue
@@ -0,0 +1,46 @@
+
+
+
+ ••••••
+
+ 显示
+
+
+ {{ props.user.rawPassword }}
+
+
diff --git a/apps/web/src/admin/user/list.vue b/apps/web/src/admin/user/list.vue
index e4bd0d7..36f39df 100644
--- a/apps/web/src/admin/user/list.vue
+++ b/apps/web/src/admin/user/list.vue
@@ -13,6 +13,7 @@ import {
} from "../api"
import Actions from "./components/Actions.vue"
import Name from "./components/Name.vue"
+import Password from "./components/Password.vue"
import { PROBLEM_PERMISSION, USER_TYPE } from "utils/constants"
import { useRouteQuery } from "@vueuse/router"
import TextCopy from "shared/components/TextCopy.vue"
@@ -49,6 +50,9 @@ const sortOptions = [
]
const [create, toggleCreate] = useToggle(false)
const password = ref("")
+// 已经点开的管理员密码,按 user id 记。listUsers() 里清空,所以翻页/搜索/换筛选之后
+// 一律回到打码状态 —— 不做定时自动隐藏,也不记进 localStorage。
+const revealedPasswords = ref(new Set())
const userIDs = ref([])
const rowKey = (row: User) => row.id
@@ -65,8 +69,13 @@ const columns: DataTableColumn[] = [
{
title: "密码",
key: "raw_password",
- width: 100,
- render: (row) => h(TextCopy, () => row.rawPassword),
+ width: 150,
+ render: (row) =>
+ h(Password, {
+ user: row,
+ revealed: revealedPasswords.value.has(row.id),
+ onReveal: (id: number) => revealedPasswords.value.add(id),
+ }),
},
{
title: "创建时间",
@@ -131,6 +140,7 @@ async function listUsers() {
)
total.value = res.total
users.value = res.results
+ revealedPasswords.value.clear()
}
function chooseUsers(rowKeys: DataTableRowKey[]) {
diff --git a/apps/web/src/utils/functions.ts b/apps/web/src/utils/functions.ts
index 31e58fd..f0ea79e 100644
--- a/apps/web/src/utils/functions.ts
+++ b/apps/web/src/utils/functions.ts
@@ -141,7 +141,7 @@ export function debounce any>(
export function getUserRole(role: User["adminType"]): {
type: "default" | "info" | "warning" | "error"
- label: "普通" | "学生管理员" | "教师管理员" | "超管"
+ label: "普通" | "生管" | "师管" | "超管"
} {
const roleMap = {
[USER_TYPE.REGULAR_USER]: {
@@ -150,11 +150,11 @@ export function getUserRole(role: User["adminType"]): {
},
[USER_TYPE.STUDENT_ADMIN]: {
type: "info" as const,
- label: "学生管理员" as const,
+ label: "生管" as const,
},
[USER_TYPE.TEACHER_ADMIN]: {
type: "warning" as const,
- label: "教师管理员" as const,
+ label: "师管" as const,
},
[USER_TYPE.SUPER_ADMIN]: {
type: "error" as const,