From 8a27f5724e10e82cc5a30bf7051397da2e697e63 Mon Sep 17 00:00:00 2001 From: zhongshujie <2862698242@qq.com> Date: 星期四, 19 十二月 2024 10:49:11 +0800 Subject: [PATCH] bug优化,答题卡初始化 --- packageBookService/pages/psychologyAnswer/psychologyAnswer.js | 44 ++++++++++++++++---------------------------- 1 files changed, 16 insertions(+), 28 deletions(-) diff --git a/packageBookService/pages/psychologyAnswer/psychologyAnswer.js b/packageBookService/pages/psychologyAnswer/psychologyAnswer.js index ccdacf5..5f5ffde 100644 --- a/packageBookService/pages/psychologyAnswer/psychologyAnswer.js +++ b/packageBookService/pages/psychologyAnswer/psychologyAnswer.js @@ -282,21 +282,12 @@ }, // 鍒囨崲棰樼洰 changeSwiper(e) { - let index = e.detail.index - 1 >= 0 ? e.detail.index - 1 : 0; - const item = this.data.questionDataList[index]; - const lastItem = this.data.questionDataList[index + 1]; + let index = e.detail.index; + const lastItem = this.data.questionDataList[index]; this.setData({ currentIndex: e.detail.index, showId: lastItem.id }); - if ( - (this.data.answerType == "collectQuestion" || - this.data.answerType == "errorQuestion") && - !item.isComplete - ) { - let flag = this.isHaveAnswer(item.userAnswer); - if (flag) this.handleQuestion(index); - } }, // 鎴戠殑閿欓锛屾敹钘忔煡鐪嬭В鏋愭寜閽� viewParsing() { @@ -471,10 +462,6 @@ // 鍏堥亶鍘嗘墍鏈夐鐩紝灏嗘湭鎵规敼鐨勯鐩壒鏀� const qustionList = this.data.questionDataList; if (qustionList.length) this.handleQuestion(); - this.setData({ - isShowDialog: true, - submitStatus: true, - }) // 璁板綍鐢ㄦ埛绛旈鏁版嵁 let saveData = []; for (let index = 0; index < this.data.questionDataList.length; index++) { @@ -499,11 +486,15 @@ loading: false, showDialog: false, }); + this.setData({ + isShowDialog: true, + submitStatus: true, + }); }, // 鍒濆鍖栧嚱鏁� async init(isReset) { this.setData({ - loading: false, + loading: true, }); const questuionName = this.data.questuionName const questuionList = pastData.postData.list @@ -552,7 +543,6 @@ const questionList = this.data.questionDataList; const optionList = this.data.questionDataOptions; const scoreData = this.data.scoreDataList; - debugger for (let index = 0; index < questionList.length; index++) { const item = questionList[index]; if (item.questionType == 'judge' && item.userAnswer) { @@ -724,26 +714,24 @@ this.setData({ questionDataList: newArr, scoreDataList: scoreArr, + loading: false, }) } catch (error) { this.setData({ questionDataList: newArr, - scoreDataList: scoreArr + scoreDataList: scoreArr, + loading: false, }) console.log(error); } - console.log(this.data.scoreDataList, "scoreDataList"); + const e = { + detail: { + index: 0 + } + }; + this.changeSwiper(e) }); }, - - - - - - - - - // 璁板綍妯¤�冪瓟棰樻暟鎹� saveMockData() { -- Gitblit v1.9.1