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