feat:更新考试记录功能

This commit is contained in:
2026-08-03 22:43:32 +08:00
parent 7ae51438f4
commit 69a5ab4851
8 changed files with 75 additions and 22 deletions

View File

@@ -1,12 +1,12 @@
import { defineStore } from 'pinia'
import type { IExamConfig } from '@/types/exam.ts'
import type { IExamConfig, IExamRecord } from '@/types/exam.ts'
import { addExamRecordApi } from '@/apis/exam.ts'
export const useExamStore = defineStore('exam', {
state: () => ({
hasStart: false,
hasSubmit: false,
dialogVisible: false,
config: {} as IExamConfig
config: {} as IExamConfig,
currentRecord: {} as IExamRecord
}),
actions: {
getEmptyConfig(): IExamConfig {
@@ -14,6 +14,9 @@ export const useExamStore = defineStore('exam', {
subject: '',
total: 50
}
},
async addRecord() {
await addExamRecordApi(this.currentRecord)
}
}
})