From 70fe0f0c42f6a03e9f8d17a17f1efaf0baa061b9 Mon Sep 17 00:00:00 2001 From: qsh <> Date: Thu, 19 Jun 2025 16:02:14 +0800 Subject: [PATCH] sc --- src/jtools/store/question.js | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/jtools/store/question.js b/src/jtools/store/question.js index d4874b8..77f0cfb 100644 --- a/src/jtools/store/question.js +++ b/src/jtools/store/question.js @@ -9,8 +9,8 @@ const question = defineStore({ state: () => ({ currentCartype: storage.get('carType') || '1001', currentCarName: storage.get('carName') || '小车C1/C2/C3', - orderQuestion_subject1: storage.get('question_subject1') || [], //科目一顺序做题 - orderQuestion_subject4: storage.get('question_subject4') || [], //科目四顺序做题 + orderQuestion_subject1: [], //科目一顺序做题 + orderQuestion_subject4: [], //科目四顺序做题 currentIndex_subject1: 0, //科目一索引 顺序做题 currentIndex_subject4: 0, //科目四索引 顺序做题 curSubject: storage.get('curSubject') || '1', @@ -77,8 +77,7 @@ const question = defineStore({ const arr = uni.getStorageSync(`question1Sub${i + 1}`) || []; this.orderQuestion_subject1 = [...this.orderQuestion_subject1, ...arr]; } - if (this.orderQuestion_subject1 && this.orderQuestion_subject1.length) { - } else { + if (this.orderQuestion_subject1.length == 0) { this.loading_subject1 = true; this.loadAllQuestion(url, 1); } @@ -95,8 +94,7 @@ const question = defineStore({ const arr = uni.getStorageSync(`question4Sub${i + 1}`) || []; this.orderQuestion_subject4 = [...this.orderQuestion_subject4, ...arr]; } - if (this.orderQuestion_subject4 && this.orderQuestion_subject4.length) { - } else { + if (this.orderQuestion_subject4.length == 0) { this.loading_subject4 = true; this.loadAllQuestion(url, 4); } @@ -114,7 +112,7 @@ const question = defineStore({ storage.remove(`question${course}Sub${i + 1}`); } that[`orderQuestion_subject${course}`] = resp.data?.data || []; - const diveList = that.divideArray(that.orderQuestion_subject4, JSON_SPLIT_LENGTH); + const diveList = that.divideArray(that[`orderQuestion_subject${course}`], JSON_SPLIT_LENGTH); that[`loading_subject${course}`] = false; for (let i = 0; i < JSON_SPLIT_LENGTH; i++) { uni.setStorageSync(`question${course}Sub${i + 1}`, diveList[i]);