From 097f457f94c532278a4ee6cfcf3ad382f1c0a777 Mon Sep 17 00:00:00 2001 From: 刘有才luck <14606842+liu-youcai-luck@user.noreply.gitee.com> Date: Thu, 12 Dec 2024 13:57:08 +0800 Subject: [PATCH] wip: bug修复 --- src/views/basic/askTestQuestion/components/wrongQuestionDialog.vue | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/src/views/basic/askTestQuestion/components/wrongQuestionDialog.vue b/src/views/basic/askTestQuestion/components/wrongQuestionDialog.vue index fe02d36..19de2e6 100644 --- a/src/views/basic/askTestQuestion/components/wrongQuestionDialog.vue +++ b/src/views/basic/askTestQuestion/components/wrongQuestionDialog.vue @@ -300,7 +300,7 @@ export default { data() { return { score: 0, // 分数 - inputValue: " 2024年11月11日数学-错题复习", // 标题 + inputValue: "", // 标题 isEditing: false, // 用于判断是否处于编辑模式 selectedIndex: null, // 当前选中的外层对象的索引 selectedItemIndex: null, // 当前选中的内层对象的索引 @@ -323,6 +323,9 @@ export default { watch: { visible(val) { if (val) { + this.inputValue = + JSON.parse(localStorage.getItem(this.userId + "input")) || + this.getFormattedDate() + this.subjectName + "--错题复习"; // 上面数据测试 this.testData = JSON.parse(localStorage.getItem(this.userId + "testData")) || []; @@ -363,8 +366,7 @@ export default { // 初始化 init() { console.log("初始化"); - this.time = this.getFormattedDate(); - this.inputValue = this.time + this.subjectName + "--错题复习"; + this.groups = this.classifyByType( this.list.map((item, index) => { return { ...item, globalIndex: index + 1 }; @@ -546,6 +548,10 @@ export default { }, handleMouseLeave() { this.isHovered = false; + localStorage.setItem( + this.userId + "input", + JSON.stringify(this.inputValue) + ); }, getFormattedDate() { @@ -726,6 +732,7 @@ export default { if (res.status == 0) { this.groups = []; this.testData = []; + this.inputValue = ""; localStorage.setItem( this.userId + "testlist", JSON.stringify(this.testData) @@ -734,6 +741,10 @@ export default { this.userId + "question", JSON.stringify(this.groups) ); + localStorage.setItem( + this.userId + "input", + JSON.stringify(this.inputValue) + ); this.$emit("setQuestions"); this.handleClose(); this.$message({ -- libgit2 0.21.4