Deploy / deploy (build, debian, 22) (push) Canceled after 0s
- 挑战列表改成独立页面(ChallengeHome):每题一行,完成状态、分值、出题人,可按未做 / 已交筛选; 教程面板只放教程 - 教程每一节的代码各存一份(和挑战同一个按任务的 key),切回来时还在,第一次才放示例代码; 提交列表“复制到编辑器”对教程也写入该任务的代码 - 教程 / 挑战出题页合并为 TaskEditor:“提交”改为“保存”,保存后停在当前项,删除前说明会连带删除学生提交; admin 也能在列表里切换挑战是否公开(保存时本来就能设) - 用户管理:初始密码默认隐藏,封号前确认,批量新建说明用户名规则 - 整站暗色:顶栏切换跟随系统 / 亮色 / 暗色;Naive 暗色主题、markdown 和代码高亮的暗色覆盖 (styles/dark-content.css 由 GitHub 暗色样式生成)、CodeMirror One Dark 配色、md-editor 暗色; 组件里剩下的硬编码颜色全部换成配色变量 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
68 lines
1.5 KiB
Vue
68 lines
1.5 KiB
Vue
<template>
|
|
<n-flex>
|
|
<n-button secondary v-if="user.role !== Role.Super" @click="edit">
|
|
修改
|
|
</n-button>
|
|
<n-button
|
|
secondary
|
|
type="error"
|
|
v-if="user.role !== Role.Super && user.is_active"
|
|
@click="toggleUserActive"
|
|
>
|
|
封号
|
|
</n-button>
|
|
<n-button
|
|
secondary
|
|
type="primary"
|
|
v-if="user.role !== Role.Super && !user.is_active"
|
|
@click="toggleUserActive"
|
|
>
|
|
解封
|
|
</n-button>
|
|
<UserFormModal
|
|
v-model:show="showEdit"
|
|
:user="user"
|
|
@saved="emits('reload')"
|
|
/>
|
|
</n-flex>
|
|
</template>
|
|
<script lang="ts" setup>
|
|
import { ref } from "vue"
|
|
import { useDialog, useMessage } from "naive-ui"
|
|
import { Account } from "../../api"
|
|
import { Role, type User } from "../../utils/type"
|
|
import UserFormModal from "./UserFormModal.vue"
|
|
|
|
interface Props {
|
|
user: User
|
|
}
|
|
|
|
const props = defineProps<Props>()
|
|
const emits = defineEmits(["reload"])
|
|
|
|
const message = useMessage()
|
|
const dialog = useDialog()
|
|
const showEdit = ref(false)
|
|
|
|
function edit() {
|
|
showEdit.value = true
|
|
}
|
|
|
|
async function doToggle() {
|
|
const data = await Account.toggleActive(props.user.id)
|
|
message.success(data.message)
|
|
emits("reload")
|
|
}
|
|
|
|
function toggleUserActive() {
|
|
if (!props.user.is_active) return doToggle()
|
|
dialog.warning({
|
|
title: `封禁「${props.user.username}」?`,
|
|
content: "封禁后这个账号不能登录,已经登录的也会被退出。之后可以再解封。",
|
|
positiveText: "封禁",
|
|
negativeText: "取消",
|
|
onPositiveClick: doToggle,
|
|
})
|
|
}
|
|
</script>
|