后台筛选管理员

This commit is contained in:
2025-04-30 09:52:07 +08:00
parent 27a63e4bc7
commit 40a9a1414b
4 changed files with 266 additions and 204 deletions

View File

@@ -80,9 +80,14 @@ export function getContestProblem(id: number) {
}
// 用户列表
export function getUserList(offset = 0, limit = 10, keyword: string) {
export function getUserList(
offset = 0,
limit = 10,
admin = false,
keyword: string,
) {
return http.get("admin/user", {
params: { paging: true, offset, limit, keyword },
params: { paging: true, offset, limit, keyword, admin },
})
}

View File

@@ -16,6 +16,7 @@ const query = reactive({
limit: 10,
page: 1,
keyword: "",
admin: false,
})
const [create, toggleCreate] = useToggle(false)
const password = ref("")
@@ -71,7 +72,7 @@ const options: SelectOption[] = [
async function listUsers() {
const offset = (query.page - 1) * query.limit
const res = await getUserList(offset, query.limit, query.keyword)
const res = await getUserList(offset, query.limit, query.admin, query.keyword)
total.value = res.data.total
users.value = res.data.results
}
@@ -170,9 +171,13 @@ watch(query, listUsers, { deep: true })
</template>
确定删除选中的用户吗删除后无法恢复
</n-popconfirm>
<div>
<n-input placeholder="请输入关键字搜索" v-model:value="query.keyword" />
</div>
<n-flex align="center">
<span>超管出列</span>
<n-switch v-model:value="query.admin" />
<div>
<n-input style="width: 200px" v-model:value="query.keyword" />
</div>
</n-flex>
</n-flex>
</n-flex>
<n-data-table