diff --git a/src/components/Library/LibraryFileList.vue b/src/components/Library/LibraryFileList.vue index 756a4fa..7edf333 100644 --- a/src/components/Library/LibraryFileList.vue +++ b/src/components/Library/LibraryFileList.vue @@ -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) diff --git a/src/components/exam/ExamDialog.vue b/src/components/exam/ExamDialog.vue index 7002a5d..2f7e5e3 100644 --- a/src/components/exam/ExamDialog.vue +++ b/src/components/exam/ExamDialog.vue @@ -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) diff --git a/src/components/question/QuestionList.vue b/src/components/question/QuestionList.vue index 76119ba..10e7e9e 100644 --- a/src/components/question/QuestionList.vue +++ b/src/components/question/QuestionList.vue @@ -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, diff --git a/src/stores/question.ts b/src/stores/question.ts index 0e16fd0..4eb6bad 100644 --- a/src/stores/question.ts +++ b/src/stores/question.ts @@ -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[], diff --git a/src/views/Exam.vue b/src/views/Exam.vue index 9e1c82d..baeb478 100644 --- a/src/views/Exam.vue +++ b/src/views/Exam.vue @@ -30,7 +30,6 @@ onMounted(() => { }) const examClick = () => { - questionStore.questionList = [] examStore.config = examStore.getEmptyConfig() examStore.dialogVisible = true }