1 parent
af63b05d4b
commit
bde387e8bc
3 files changed
+20
-3
No files matched your search
@@ -74,6 +74,17 @@ export async function getProblemList(
|
||||
}
|
||||
}
|
||||
|
||||
// 比赛「从题库中选择」用:列所有可见的公开题,不只是自己创建的
|
||||
export async function getLibraryProblemList(offset = 0, limit = 10, keyword: string) {
|
||||
const res = await api.get<AdminProblemList>("admin/problems", {
|
||||
params: { offset, limit, keyword, library: 1 },
|
||||
})
|
||||
return {
|
||||
results: res.results.map(toAdminProblemRow),
|
||||
total: res.total,
|
||||
}
|
||||
}
|
||||
|
||||
export function deleteProblem(id: number) {
|
||||
return api.delete(`admin/problems/${id}`)
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<script lang="ts" setup>
|
||||
import { getProblemList } from "admin/api"
|
||||
import { getLibraryProblemList } from "admin/api"
|
||||
import Pagination from "shared/components/Pagination.vue"
|
||||
import type { AdminProblemRow } from "utils/types"
|
||||
import AddButton from "./AddButton.vue"
|
||||
@@ -44,7 +44,7 @@ const columns: DataTableColumn<AdminProblemRow>[] = [
|
||||
|
||||
async function getList() {
|
||||
const offset = (query.page - 1) * query.limit
|
||||
const res = await getProblemList(offset, query.limit, query.keyword, "", "")
|
||||
const res = await getLibraryProblemList(offset, query.limit, query.keyword)
|
||||
total.value = res.total
|
||||
problems.value = res.results
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user