diff --git a/apps/web/src/admin/api.ts b/apps/web/src/admin/api.ts index 714a841..1c7b8b8 100644 --- a/apps/web/src/admin/api.ts +++ b/apps/web/src/admin/api.ts @@ -72,17 +72,36 @@ export async function getProblemList( tagId?: number, /** 题型:sql = SQL 题,code = 编程题;不传是全部(比赛题列表不认) */ kind?: "sql" | "code" | "", + /** 1 = 学生看得到的,0 = 藏着的;不传是全部(比赛题列表不认) */ + visible?: "1" | "0" | "", ) { const endpoint = contestID ? `admin/contests/${contestID}/problems` : "admin/problems" const res = await api.get(endpoint, { - params: { offset, limit, keyword, author, tagId, kind: kind || undefined }, + params: { + offset, + limit, + keyword, + author, + tagId, + kind: kind || undefined, + visible: visible || undefined, + }, }) return { results: res.results.map(toAdminProblemRow), total: res.total, + counts: res.counts ?? null, } } +/** 勾了几道,一次让学生看得到 / 藏起来 */ +export function batchSetProblemVisible(problemIds: number[], visible: boolean) { + return api.post<{ problemCount: number }>("admin/problems/batch-visible", { + problemIds, + visible, + }) +} + // 比赛「从题库中选择」用:列所有可见的公开题,不只是自己创建的 export async function getLibraryProblemList(offset = 0, limit = 10, keyword: string) { const res = await api.get("admin/problems", { diff --git a/apps/web/src/admin/problem/components/Actions.vue b/apps/web/src/admin/problem/components/Actions.vue index 21a5a4c..3ca505a 100644 --- a/apps/web/src/admin/problem/components/Actions.vue +++ b/apps/web/src/admin/problem/components/Actions.vue @@ -1,13 +1,22 @@