From 46b1a99c27482b3798aff89e7fda3554f9ae3801 Mon Sep 17 00:00:00 2001 From: 闫增涛 <1829501689@qq.com> Date: 星期三, 17 四月 2024 09:19:41 +0800 Subject: [PATCH] 云学习购买页显示优化 --- packageBookService/pages/bookServices/examination/examination.js | 102 +++++++++++++++++++++++++++++++++++++------------- 1 files changed, 75 insertions(+), 27 deletions(-) diff --git a/packageBookService/pages/bookServices/examination/examination.js b/packageBookService/pages/bookServices/examination/examination.js index a819f70..19c8ee5 100644 --- a/packageBookService/pages/bookServices/examination/examination.js +++ b/packageBookService/pages/bookServices/examination/examination.js @@ -47,7 +47,8 @@ sliderValue: 0, // 瀛椾綋婊戝潡 startTime: "", //杩涘叆椤甸潰褰撳墠鏃堕棿 pauseTime: 0, //鏆傚仠鏃堕棿 - + showDialog: false, // 鏈彁浜ら��鍑烘嫤鎴脊绐� + showId: '' }, /** @@ -68,6 +69,9 @@ idPathList: options.idPathList ? JSON.parse(options.idPathList) : [], answerType: options.answerType, }); + wx.setNavigationBarTitle({ + title: options.answerTitle, + }) if (this.data.answerType == "mock") { this.setData({ uuid: options.uuid, @@ -195,7 +199,20 @@ }, }); }, - + // 淇敼nav棰滆壊 + changeNavBarColor(e) { + if (type == 'night') { + wx.setNavigationBarColor({ + backgroundColor: '#000000', + frontColor: '#ffffff', + }) + } else { + wx.setNavigationBarColor({ + backgroundColor: '#ffffff', + frontColor: '#000000', + }) + } + }, // 姝e垯鎵惧嚭鍚姏src extractSourceSrc(htmlString) { // 姝e垯琛ㄨ揪寮忓尮閰�<source>鏍囩涓殑src灞炴�у�� @@ -232,21 +249,28 @@ }, // 杩斿洖鎷︽埅 beforeleave() { - wx.showModal({ - title: "鎻愮ず", - content: "鏈彁浜わ紝鏄惁閫�鍑虹瓟棰�", - confirmColor: "#ff6c00", - cancelColor: "#949494", - complete: (res) => { - if (res.cancel) {} - if (res.confirm) { - this.setData({ - submitStatus: true, - }); - wx.navigateBack(); - } - }, - }); + if ((this.data.answerType == 'option' || this.data.answerType == 'mock') && !this.data.submitStatus) { + wx.showModal({ + title: "鎻愮ず", + content: "鏈彁浜わ紝鏄惁閫�鍑虹瓟棰�", + confirmColor: "#ff6c00", + cancelColor: "#949494", + complete: (res) => { + if (res.cancel) { + this.setData({ + showDialog: true + }) + } + if (res.confirm) { + this.setData({ + submitStatus: true, + showDialog: false + }); + wx.navigateBack(); + } + }, + }); + } }, onChangeSlider(e) { this.setData({ @@ -261,9 +285,21 @@ }, //璁剧疆鑳屾櫙鑹� changeBGColor(e) { + const flag = e.detail.value this.setData({ - isNight: e.detail.value, + isNight: flag, }); + if (flag) { + wx.setNavigationBarColor({ + backgroundColor: '#000000', + frontColor: '#ffffff', + }) + } else { + wx.setNavigationBarColor({ + backgroundColor: '#ffffff', + frontColor: '#000000', + }) + } }, // 鑾峰彇淇濆瓨鐨勫�掕鏃舵椂闂� getSavedTime() { @@ -321,11 +357,13 @@ }, // 鍒囨崲棰樼洰 changeSwiper(e) { - this.setData({ - currentIndex: e.detail.index, - }); 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]; + this.setData({ + currentIndex: e.detail.index, + showId: lastItem.id + }); if ( (this.data.answerType == "collectQuestion" || this.data.answerType == "errorQuestion") && @@ -554,6 +592,7 @@ } this.setData({ loading: false, + showDialog: false, }); }, // 鍒濆鍖栧嚱鏁� @@ -566,7 +605,6 @@ }); if (this.data.answerType == "option") { if (this.data) - // this.startCountdown() this.setData({ countdownTime: 2 * 60 * 60 * 1000, }); @@ -630,6 +668,9 @@ oldMockData.state == "2" ) { this.startCountdown(); + this.setData({ + showDialog: true + }) } if (oldMockData.state == "3") { this.setData({ @@ -651,6 +692,7 @@ subjectiveNum: 0, currentIndex: 0, submitStatus: false, + showDialog: true }); if (this.data.answerType == "option") { this.setData({ @@ -729,6 +771,9 @@ await this.getQuestionList(value.dataList); } else { await this.getQuestionList(); // 鑾峰彇棰樺簱棰樼洰 + this.setData({ + showDialog: true + }) } }); } @@ -984,7 +1029,7 @@ } // 鏈夐鐩啀寮�濮嬪�掕鏃� if (this.data.questionDataList.length) { - // console.log(this.data.questionDataList); + console.log(this.data.questionDataList); this.startCountdown(); } else { this.setData({ @@ -993,6 +1038,7 @@ } this.setData({ loading: false, + showId: this.data.questionDataList[0].id }); }, // 鎵规敼棰樼洰 锛堢粌涔狅紝鎴戠殑閿欓锛屾垜鐨勬敹钘�,锛岀粍鍗凤級 @@ -1184,7 +1230,6 @@ } } } - this.setAnswerInfo(setInfoData); }, // 鎻愪氦绛旈鏁版嵁 @@ -1466,6 +1511,7 @@ } this.setData({ questionDataList: questionArr, + showId: questionArr[0].id, cardList: cardList, loading: false, }); @@ -1714,11 +1760,11 @@ } this.setData({ questionDataList: questionArr, + showId: questionArr[0].id, cardList: cardList, loading: false, }); }); - // loadings.value = false }, // 鑾峰彇缁勫嵎缁撴灉 async getEduQuizConfig() { @@ -1997,6 +2043,7 @@ } this.setData({ loading: false, + showId: this.data.questionDataList[0].id }); }, // 鑾峰彇缁勫嵎鏁版嵁 @@ -2057,11 +2104,12 @@ }) .then((res) => { if (res[0]) { + // 杩欓噷鐨� countdownTime 璧嬪�硷細濡傛灉鏄椂闂村埌浜嗘彁浜わ紝璁板綍鐨勫墿浣欐椂闂村氨鏄�0锛屾墍浠ワ細濡傛灉鏄�0鐨勮瘽璧嬪��1绉掞紝闃叉鐩戝惉鍒版椂闂翠负0鍐嶆鎻愪氦 this.setData({ currentIndex: JSON.parse(res[0].value).currentIndex, "mockData.time": JSON.parse(res[0].value).time, - countdownTime: JSON.parse(res[0].value).time ? - JSON.parse(res[0].value).time : this.data.mockData.sumTime, + countdownTime: JSON.parse(res[0].value).time > 0 ? + JSON.parse(res[0].value).time : 1000, "mockData.answer": JSON.parse(res[0].value).answerData, }); console.log(JSON.parse(res[0].value)); -- Gitblit v1.9.1