Files
OJ2/apps/web/src/admin/user/components/UserNameCell.vue
T
xuyueandClaude Opus 5.5 5561e0bc3a feat(后台用户): 用户列表按班级看、「重置密码」常驻;批量建号粘进名单当场列出会建成的账号,重名和已有的先点出来,建好能下载名单、打印账号条
用户列表去掉 ID、真名、占位邮箱和四颗彩色按钮。下载的名单开头带 BOM,Excel 打开中文不再乱码。

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-13 13:56:03 +08:00

38 lines
1.2 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<script setup lang="ts">
import { PROBLEM_PERMISSION, USER_TYPE } from "utils/constants"
import { getUserRole } from "utils/functions"
import type { AdminUserForm } from "utils/types"
import TextCopy from "shared/components/TextCopy.vue"
interface Props {
user: AdminUserForm
}
const props = defineProps<Props>()
const hasRoleTag = computed(() => props.user.adminType !== USER_TYPE.REGULAR_USER)
</script>
<template>
<!-- 用户名在前(老师要认的是它),角色、禁用这些标签跟在后面 -->
<n-flex align="center" :size="6" :wrap="false">
<TextCopy>{{ props.user.username }}</TextCopy>
<n-tag v-if="props.user.isDisabled" type="error" size="small" :bordered="false"> 已禁用 </n-tag>
<n-tag
v-if="hasRoleTag"
:type="getUserRole(props.user.adminType).type"
size="small"
:bordered="false"
>
{{ getUserRole(props.user.adminType).label }}
</n-tag>
<n-tag
v-if="
props.user.adminType === USER_TYPE.STUDENT_ADMIN ||
props.user.adminType === USER_TYPE.TEACHER_ADMIN
"
size="small"
:bordered="false"
>
{{ props.user.problemPermission === PROBLEM_PERMISSION.ALL ? "全部题目" : "自己的题" }}
</n-tag>
</n-flex>
</template>