diff --git a/src/api.ts b/src/api.ts index b307536..21a51c0 100644 --- a/src/api.ts +++ b/src/api.ts @@ -1,6 +1,6 @@ import axios from "axios" import { router } from "./router" -import type { TutorialIn, ChallengeIn, FlagType, SubmissionOut, PromptMessage } from "./utils/type" +import type { TutorialIn, ChallengeIn, FlagType, SubmissionOut, PromptMessage, TaskStatsOut } from "./utils/type" import { BASE_URL, STORAGE_KEY } from "./utils/const" const http = axios.create({ @@ -221,6 +221,13 @@ export const Submission = { return res.data as { nominated: boolean } }, + async getStats(taskId: number, classname?: string): Promise { + const params: Record = {} + if (classname) params.classname = classname + const res = await http.get(`/submission/stats/${taskId}`, { params }) + return res.data as TaskStatsOut + }, + } export const Prompt = { diff --git a/src/components/Task.vue b/src/components/Task.vue index 34a956e..8b729f6 100644 --- a/src/components/Task.vue +++ b/src/components/Task.vue @@ -38,6 +38,13 @@ + + + + diff --git a/src/pages/Submission.vue b/src/pages/Submission.vue index 5edda0c..e7dca6d 100644 --- a/src/pages/Submission.vue +++ b/src/pages/Submission.vue @@ -43,6 +43,8 @@ onMounted(init)