fix:修复再次考试没情况状态的错误
This commit is contained in:
@@ -65,14 +65,10 @@ const trainClick = async (file: ILibraryFile) => {
|
||||
await libraryStore.queryFileById(file.id)
|
||||
await generateQuestion()
|
||||
questionStore.type = 'Practice'
|
||||
questionStore.hasStart = true
|
||||
questionStore.hasSubmit = false
|
||||
questionStore.checkList = []
|
||||
}
|
||||
|
||||
const generateQuestion = async () => {
|
||||
questionStore.questionContent = ''
|
||||
questionStore.hasGenerateQuestion = false
|
||||
|
||||
const loading = ElLoading.service({
|
||||
lock: true,
|
||||
@@ -105,9 +101,10 @@ const generateQuestion = async () => {
|
||||
}
|
||||
|
||||
ElMessage.success('生成完成')
|
||||
questionStore.hasGenerateQuestion = true
|
||||
|
||||
questionStore.questionList = JSON.parse(questionStore.questionContent)
|
||||
questionStore.hasSubmit = false
|
||||
questionStore.checkList = []
|
||||
libraryStore.fileTrainDialogVisible = true
|
||||
} catch (error) {
|
||||
console.log(error)
|
||||
|
||||
@@ -71,7 +71,7 @@ const confirmClick = async (formEl: FormInstance | undefined) => {
|
||||
}
|
||||
|
||||
const generateExam = async () => {
|
||||
questionStore.questionList = []
|
||||
questionStore.questionContent = ''
|
||||
|
||||
const loading = ElLoading.service({
|
||||
lock: true,
|
||||
@@ -107,6 +107,8 @@ const generateExam = async () => {
|
||||
ElMessage.success('生成完成')
|
||||
|
||||
questionStore.questionList = JSON.parse(questionStore.questionContent)
|
||||
questionStore.hasSubmit = false
|
||||
questionStore.checkList = []
|
||||
examStore.dialogVisible = false
|
||||
} catch (error) {
|
||||
console.log(error)
|
||||
|
||||
@@ -125,12 +125,14 @@ const addMistakeList = async () => {
|
||||
const mistakeList = getMistakeList(questionStore.questionList, questionStore.checkList)
|
||||
mistakeStore.currentMistakes = []
|
||||
const subject = questionStore.type === 'Practice' ? libraryStore.currentFile.subject : examStore.config.subject
|
||||
const module = questionStore.type === 'Practice' ? libraryStore.currentFile.module : ''
|
||||
const name = questionStore.type === 'Practice' ? libraryStore.currentFile.name : ''
|
||||
|
||||
mistakeList.forEach((item) => {
|
||||
const mistake:IMistake = {
|
||||
answer: item.answer,
|
||||
module: libraryStore.currentFile.module,
|
||||
name: libraryStore.currentFile.name,
|
||||
module,
|
||||
name,
|
||||
options: item.options,
|
||||
question: item.question,
|
||||
subject,
|
||||
|
||||
@@ -4,9 +4,7 @@ import type { IQuestion } from '@/types/question.ts'
|
||||
|
||||
export const useQuestionStore = defineStore('question', {
|
||||
state: () => ({
|
||||
hasStart: false,
|
||||
hasSubmit: false,
|
||||
hasGenerateQuestion: false,
|
||||
type: 'Practice' as 'Practice' | 'Exam',
|
||||
questionContent: '',
|
||||
questionList: [] as IQuestion[],
|
||||
|
||||
@@ -30,7 +30,6 @@ onMounted(() => {
|
||||
})
|
||||
|
||||
const examClick = () => {
|
||||
questionStore.questionList = []
|
||||
examStore.config = examStore.getEmptyConfig()
|
||||
examStore.dialogVisible = true
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user