添加提交

This commit is contained in:
2025-03-18 19:16:08 +08:00
parent 3618b5a4b2
commit e4e7507f85
15 changed files with 382 additions and 19 deletions

View File

@@ -105,3 +105,34 @@ export const Tutorial = {
// return text.split("\n").map((item) => Number(item.split(" ")[0]))
},
}
export const Submission = {
async create(
taskId: number,
code: {
html?: string
css?: string
js?: string
},
) {
const data = { task_id: taskId, ...code }
const res = await http.post("/submission/", data)
return res.data
},
async list(query: { page: number }) {
const res = await http.get("/submission", {
params: query,
})
return res.data
},
async get(id: string) {
const res = await http.get("/submission/" + id)
return res.data
},
async updateScore(id: string, score: number) {
await http.put(`/submission/${id}/score`, { score })
},
}