From 8f92c5585237e99d177a7d445d4eb263d8455c09 Mon Sep 17 00:00:00 2001 From: Cxx0822 <1556464090@qq.com> Date: Mon, 3 Aug 2026 23:05:48 +0800 Subject: [PATCH] =?UTF-8?q?fix:=E4=BF=AE=E5=A4=8D=E5=86=8D=E6=AC=A1?= =?UTF-8?q?=E8=80=83=E8=AF=95=E6=B2=A1=E6=83=85=E5=86=B5=E7=8A=B6=E6=80=81?= =?UTF-8?q?=E7=9A=84=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/Library/LibraryFileList.vue | 7 ++----- src/components/exam/ExamDialog.vue | 4 +++- src/components/question/QuestionList.vue | 6 ++++-- src/stores/question.ts | 2 -- src/views/Exam.vue | 1 - 5 files changed, 9 insertions(+), 11 deletions(-) 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 }