From 9ce7e63b4c2040b5c09c82085e3f176663e25ddb Mon Sep 17 00:00:00 2001 From: 闫增涛 <1829501689@qq.com> Date: 星期三, 18 十二月 2024 10:47:37 +0800 Subject: [PATCH] 加入班级弹窗修改 --- packageBookService/pages/bookServices/examination/examination.js | 62 ++++++++++++++++++++++++++----- 1 files changed, 52 insertions(+), 10 deletions(-) diff --git a/packageBookService/pages/bookServices/examination/examination.js b/packageBookService/pages/bookServices/examination/examination.js index 4b751df..536cd7a 100644 --- a/packageBookService/pages/bookServices/examination/examination.js +++ b/packageBookService/pages/bookServices/examination/examination.js @@ -2285,6 +2285,7 @@ filterList: [], } app.MG.identity.joinedGroupByList(query).then((res) => { + console.log('鐝骇淇℃伅', res); res.datas.forEach(async item => { item.topicId = null const data = await this.getTopicInfo(item.id) @@ -2292,26 +2293,53 @@ item.topicId = data.id } }) + if (res.datas.length) { this.setData({ - joinGroup: true, - classList: res.datas, + classList: res.datas }) + // 鍒ゆ柇鐝骇 鏄惁鎵�灞炰簬璇ヤ功 + const flag = res.datas.some(item => item.linkProductDto.product.id == this.data.bookId) + if (!flag) { + this.setData({ + visible: true, + }) + } else { + this.setData({ + visible: false, + joinGroup: true + }) + } } else { - // 鏈姞鍏ョ彮绾э紝鍞よ捣鍔犲叆鐝骇寮圭獥 this.setData({ - joinGroup: false, - visible: true + visible: true, }) } + + // if (res.datas.length) { + // this.setData({ + // classList: res.datas, + // visible: true + // }) + // } else { + // // 鏈姞鍏ョ彮绾э紝鍞よ捣鍔犲叆鐝骇寮圭獥 + // this.setData({ + // joinGroup: false, + // visible: true + // }) + // } }) }, // 鍔犲叆鐝骇 joinClass(e) { + wx.showLoading({ + title: '鍔犺浇涓�' + }) const data = { refCode: e.detail.value } app.MG.identity.joinGroupByRefCode(data).then((res) => { + wx.hideLoading() if (res == '缁勪笉瀛樺湪') { wx.showToast({ icon: 'error', @@ -2358,9 +2386,11 @@ .then((res) => { if (res.length) { let value = JSON.parse(res[0].value); + const scoreData = value.dataList.find(item => item.name == "瀹㈣棰樺緱鍒�" && item.path == this.data.productLinkPath) this.setData({ submitStatus: value.submitStatus, currentIndex: value.currentIndex, + subjectiveNum: scoreData ? scoreData.score : 0 }); // 鎼哄甫绛旈璁板綍 鑾峰彇棰樼洰 this.getQuestionList(value.dataList); @@ -2385,6 +2415,11 @@ })) }) }) + list.push({ + name: "瀹㈣棰樺緱鍒�", + score: this.data.subjectiveNum, + path: this.data.productLinkPath, + }) console.log('鎻愪氦鏁版嵁', list); app.MG.identity .setUserKey({ @@ -2402,20 +2437,27 @@ }, // 澶勭悊鏁欏浜掑姩绛旈 handleClassQuestion() { - debugger + console.log(1, this.data.questionDataList); const flag = this.data.questionDataList.some(item => !item.userAnswer) if (flag) { // 娌″仛瀹岋紝淇濆瓨鍗冲彲 const isAnswer = this.data.questionDataList.some(item => item.userAnswer) if (isAnswer) this.setinteractionInfo(false) } else { - // 鍋氬畬浜嗭紝鎻愪氦鍒癿essage - this.setinteractionInfo(true) - if (this.data.classList.length) { + // 鍋氬畬浜嗕笖鍔犲叆浜嗙彮绾э紝鎻愪氦鍒癿essage + if (this.data.classList.length && this.data.joinGroup) { this.data.classList.forEach(item => { - this.newTopicMessage(item.topicId) + if (item.linkProductDto.product.id == this.data.bookId) + this.newTopicMessage(item.topicId) }) + this.setinteractionInfo(true) + } else { + // 鍋氬畬浜嗭紝娌″姞鍏ョ彮绾� + this.setinteractionInfo(false) } + this.setData({ + isShowDialog: true + }) } this.setData({ submitStatus: true -- Gitblit v1.9.1