Commit 097f457f94c532278a4ee6cfcf3ad382f1c0a777
1 parent
25fa9812
wip: bug修复
Showing
1 changed file
with
14 additions
and
3 deletions
src/views/basic/askTestQuestion/components/wrongQuestionDialog.vue
| ... | ... | @@ -300,7 +300,7 @@ export default { |
| 300 | 300 | data() { |
| 301 | 301 | return { |
| 302 | 302 | score: 0, // 分数 |
| 303 | - inputValue: " 2024年11月11日数学-错题复习", // 标题 | |
| 303 | + inputValue: "", // 标题 | |
| 304 | 304 | isEditing: false, // 用于判断是否处于编辑模式 |
| 305 | 305 | selectedIndex: null, // 当前选中的外层对象的索引 |
| 306 | 306 | selectedItemIndex: null, // 当前选中的内层对象的索引 |
| ... | ... | @@ -323,6 +323,9 @@ export default { |
| 323 | 323 | watch: { |
| 324 | 324 | visible(val) { |
| 325 | 325 | if (val) { |
| 326 | + this.inputValue = | |
| 327 | + JSON.parse(localStorage.getItem(this.userId + "input")) || | |
| 328 | + this.getFormattedDate() + this.subjectName + "--错题复习"; | |
| 326 | 329 | // 上面数据测试 |
| 327 | 330 | this.testData = |
| 328 | 331 | JSON.parse(localStorage.getItem(this.userId + "testData")) || []; |
| ... | ... | @@ -363,8 +366,7 @@ export default { |
| 363 | 366 | // 初始化 |
| 364 | 367 | init() { |
| 365 | 368 | console.log("初始化"); |
| 366 | - this.time = this.getFormattedDate(); | |
| 367 | - this.inputValue = this.time + this.subjectName + "--错题复习"; | |
| 369 | + | |
| 368 | 370 | this.groups = this.classifyByType( |
| 369 | 371 | this.list.map((item, index) => { |
| 370 | 372 | return { ...item, globalIndex: index + 1 }; |
| ... | ... | @@ -546,6 +548,10 @@ export default { |
| 546 | 548 | }, |
| 547 | 549 | handleMouseLeave() { |
| 548 | 550 | this.isHovered = false; |
| 551 | + localStorage.setItem( | |
| 552 | + this.userId + "input", | |
| 553 | + JSON.stringify(this.inputValue) | |
| 554 | + ); | |
| 549 | 555 | }, |
| 550 | 556 | |
| 551 | 557 | getFormattedDate() { |
| ... | ... | @@ -726,6 +732,7 @@ export default { |
| 726 | 732 | if (res.status == 0) { |
| 727 | 733 | this.groups = []; |
| 728 | 734 | this.testData = []; |
| 735 | + this.inputValue = ""; | |
| 729 | 736 | localStorage.setItem( |
| 730 | 737 | this.userId + "testlist", |
| 731 | 738 | JSON.stringify(this.testData) |
| ... | ... | @@ -734,6 +741,10 @@ export default { |
| 734 | 741 | this.userId + "question", |
| 735 | 742 | JSON.stringify(this.groups) |
| 736 | 743 | ); |
| 744 | + localStorage.setItem( | |
| 745 | + this.userId + "input", | |
| 746 | + JSON.stringify(this.inputValue) | |
| 747 | + ); | |
| 737 | 748 | this.$emit("setQuestions"); |
| 738 | 749 | this.handleClose(); |
| 739 | 750 | this.$message({ | ... | ... |