From b473b0c263a47bc33306991b497af50a738fbce7 Mon Sep 17 00:00:00 2001 From: 闫增涛 <1829501689@qq.com> Date: 星期五, 20 十二月 2024 16:39:15 +0800 Subject: [PATCH] 教学互动答题修改 --- packageBookService/pages/bookServices/examination/examination.js | 167 +++++++++++++++++++++-------------------- packageBookService/pages/bookServices/examination/questionOptions/index.js | 3 assets/js/middleGround/api/edu.js | 8 ++ packageBookService/pages/bookServices/detail/index.js | 2 packageBookService/pages/bookServices/examination/examination.wxml | 5 packageBookService/pages/bookServices/examination/questionOptions/index.wxml | 2 6 files changed, 101 insertions(+), 86 deletions(-) diff --git a/assets/js/middleGround/api/edu.js b/assets/js/middleGround/api/edu.js index b9e9cb1..62162e5 100644 --- a/assets/js/middleGround/api/edu.js +++ b/assets/js/middleGround/api/edu.js @@ -188,6 +188,14 @@ data }) }, + // 鑾峰彇鍔犲叆鐨勭彮绾у垪琛� + getJoinCourseClassList(data) { + return request({ + url: '/edu/api/ApiGetJoinCourseClassList', + method: 'post', + data + }) + }, } export default eduApi \ No newline at end of file diff --git a/packageBookService/pages/bookServices/detail/index.js b/packageBookService/pages/bookServices/detail/index.js index 9294513..0e00a4d 100644 --- a/packageBookService/pages/bookServices/detail/index.js +++ b/packageBookService/pages/bookServices/detail/index.js @@ -1175,7 +1175,7 @@ jslx: false, }); } else { - data = res.datas.cmsDatas[0].datas.filter((item) => item.type == 'questionBankFolder' && item.refCode != 'jsek_interaction') + data = res.datas.cmsDatas[0].datas.filter((item) => item.type == 'questionBankFolder') // && item.refCode != 'jsek_interaction' that.setData({ jslx: true, diff --git a/packageBookService/pages/bookServices/examination/examination.js b/packageBookService/pages/bookServices/examination/examination.js index 536cd7a..357ec3c 100644 --- a/packageBookService/pages/bookServices/examination/examination.js +++ b/packageBookService/pages/bookServices/examination/examination.js @@ -91,7 +91,6 @@ } const token = wx.getStorageSync(app.config.tokenKey) - if (!token) { loginInfo(app, (data) => { if (data) { @@ -103,7 +102,6 @@ } else { this.init() } - }, /** @@ -761,6 +759,14 @@ }, ], }); this.init(); + } else if (this.data.answerType == 'interaction') { + this.setData({ + countdownTime: 2 * 60 * 60 * 1000, + }); + this.delinteractionInfo(() => { + this.getQuestionList() + this.clearTime(); + }) } else { this.init(); this.clearTime(); @@ -1080,9 +1086,6 @@ questionDataList: questionList, cardList: cardUpdatedList, }); - console.log( - '棰樼洰', this.data.questionDataList - ); }); }); } @@ -2282,10 +2285,9 @@ const query = { start: 0, size: 999, - filterList: [], + infoTypes: [], } 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) @@ -2293,21 +2295,47 @@ item.topicId = data.id } }) - + console.log('鐝骇', res) if (res.datas.length) { this.setData({ classList: res.datas }) // 鍒ゆ柇鐝骇 鏄惁鎵�灞炰簬璇ヤ功 - const flag = res.datas.some(item => item.linkProductDto.product.id == this.data.bookId) - if (!flag) { - this.setData({ - visible: true, - }) + const classData = res.datas.find(item => item.linkProductDto.product.id == this.data.bookId) + if (classData) { + if (classData.userState == 'Normal') { + // 鍔犲叆鐝骇 + this.setData({ + joinGroup: true + }) + } else if (classData.userState == 'WaitValid') { + this.setData({ + submitStatus: true + }) + // 瀹℃牳涓� + wx.showModal({ + title: '鎻愮ず', + content: '璇风瓑寰呰�佸笀瀹℃牳鍔犲叆鐝骇鍚庣瓟棰�', + confirmColor: "#ff6c00", + complete: (res) => { + if (res.cancel) { + wx.navigateBack() + } + if (res.confirm) { + wx.navigateBack() + } + } + }) + } else { + // 鎷掔粷 + this.setData({ + visible: true + }) + } } else { + // 鏈姞鍏ョ彮绾� this.setData({ - visible: false, - joinGroup: true + visible: true }) } } else { @@ -2316,18 +2344,6 @@ }) } - // if (res.datas.length) { - // this.setData({ - // classList: res.datas, - // visible: true - // }) - // } else { - // // 鏈姞鍏ョ彮绾э紝鍞よ捣鍔犲叆鐝骇寮圭獥 - // this.setData({ - // joinGroup: false, - // visible: true - // }) - // } }) }, // 鍔犲叆鐝骇 @@ -2388,9 +2404,9 @@ 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 + currentIndex: value.currentIndex ? value.currentIndex : 0, + subjectiveNum: scoreData ? scoreData.score : 0, + submitStatus: true }); // 鎼哄甫绛旈璁板綍 鑾峰彇棰樼洰 this.getQuestionList(value.dataList); @@ -2403,7 +2419,7 @@ }); }, // 鎻愪氦鏁欏浜掑姩绛旈鏁版嵁 - setinteractionInfo(submitStatus) { + setinteractionInfo() { const list = [] this.data.cardList.forEach(item => { list.push({ @@ -2420,14 +2436,12 @@ score: this.data.subjectiveNum, path: this.data.productLinkPath, }) - console.log('鎻愪氦鏁版嵁', list); app.MG.identity .setUserKey({ setKeyRequests: [{ domain: "interactionData", key: this.data.productLinkPath, value: JSON.stringify({ - submitStatus, currentIndex: this.data.currentIndex, dataList: list }), @@ -2437,12 +2451,11 @@ }, // 澶勭悊鏁欏浜掑姩绛旈 handleClassQuestion() { - 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) + if (isAnswer) this.setinteractionInfo() } else { // 鍋氬畬浜嗕笖鍔犲叆浜嗙彮绾э紝鎻愪氦鍒癿essage if (this.data.classList.length && this.data.joinGroup) { @@ -2450,10 +2463,10 @@ if (item.linkProductDto.product.id == this.data.bookId) this.newTopicMessage(item.topicId) }) - this.setinteractionInfo(true) + this.setinteractionInfo() } else { // 鍋氬畬浜嗭紝娌″姞鍏ョ彮绾� - this.setinteractionInfo(false) + this.setinteractionInfo() } this.setData({ isShowDialog: true @@ -2475,49 +2488,41 @@ state: citem.questionType == 'shortAnswer' ? 'none' : citem.isRight, type: citem.questionType }) - } - const data = { - description: '', - icon: '', - state: 'Normal', - topicIdOrRefCode: String(topicId), - name: this.data.answerTitle, - content: JSON.stringify({ - bookId: this.data.bookId, - userName: JSON.parse(wx.getStorageSync(app.config.userInfoKey)).name, - path: this.data.productLinkPath, - content - }), - type: 'Normal', - cmsTypeRefCode: '', - newDataListRequest: [] - } - app.MG.ugc.newTopicMessage(data).then((res) => { - if (res) { - this.setData({ - isShowDialog: true - }) + const userInfo = JSON.parse(wx.getStorageSync(app.config.userInfoKey)) + const data = { + description: '', + icon: '', + state: 'Normal', + topicIdOrRefCode: String(topicId), + name: this.data.answerTitle, + content: JSON.stringify({ + bookId: this.data.bookId, + userName: userInfo.name ? userInfo.name : userInfo.nickName ? userInfo.nickName : '-', + path: this.data.productLinkPath, + content + }), + type: 'Normal', + cmsTypeRefCode: '', + newDataListRequest: [] } - }) + app.MG.ugc.newTopicMessage(data).then((res) => { + if (res) { + this.setData({ + isShowDialog: true + }) + } + }) + } }, - // 鏂板缓瀛恡opicMessage - // newTopicSubMessage(parentId,topicId) { - // const data = { - // description: '', - // icon: '', - // parentId, - // state: 'Normal', - // topicIdOrRefCode: String(topicId), - // name: this.data.answerTitle, - // content: '', - // type: 'Normal', - // cmsTypeRefCode: '', - // newDataListRequest: [] - // } - // MG.ugc.newTopicMessage(data).then((res) => { - // if (res) { - - // } - // }) - // }, -}); \ No newline at end of file + // 鍒犻櫎鏁欏浜掑姩绛旈璁板綍 + delinteractionInfo(callback) { + app.MG.identity + .delUserKey({ + domain: 'interactionData', + keys: [this.data.productLinkPath] + }) + .then((res) => { + if (callback) callback() + }) + } +}) \ No newline at end of file diff --git a/packageBookService/pages/bookServices/examination/examination.wxml b/packageBookService/pages/bookServices/examination/examination.wxml index cb4691c..64a5873 100644 --- a/packageBookService/pages/bookServices/examination/examination.wxml +++ b/packageBookService/pages/bookServices/examination/examination.wxml @@ -59,6 +59,7 @@ subjectiveGrade="{{subjectiveGrade}}" correctNum="{{correctNum}}" mockSumTime="{{mockData.sumTime}}" + joinGroup="{{joinGroup}}" showId="{{showId}}" bind:setCollect="setCollect" bind:submitPaper="submitPaper" @@ -80,6 +81,4 @@ ></page-container> <!-- 鍔犲叆鐝骇寮圭獥 --> -<join-dialog visible="{{visible}}" bind:joinClass="joinClass"> - -</join-dialog> \ No newline at end of file +<join-dialog visible="{{visible}}" bind:joinClass="joinClass"> </join-dialog> diff --git a/packageBookService/pages/bookServices/examination/questionOptions/index.js b/packageBookService/pages/bookServices/examination/questionOptions/index.js index f4c88f8..dfaa84d 100644 --- a/packageBookService/pages/bookServices/examination/questionOptions/index.js +++ b/packageBookService/pages/bookServices/examination/questionOptions/index.js @@ -57,6 +57,9 @@ }, isShowDialog: { type: Boolean + }, + joinGroup:{ + type:Boolean } }, diff --git a/packageBookService/pages/bookServices/examination/questionOptions/index.wxml b/packageBookService/pages/bookServices/examination/questionOptions/index.wxml index 70bf3e4..af4c963 100644 --- a/packageBookService/pages/bookServices/examination/questionOptions/index.wxml +++ b/packageBookService/pages/bookServices/examination/questionOptions/index.wxml @@ -37,7 +37,7 @@ <view class="li-option" bind:tap="resterBtn" - wx:if="{{answerType == 'option' || (answerType == 'mock' && !submitStatus)}}" + wx:if="{{answerType == 'option' || (answerType == 'mock' && !submitStatus) || (answerType == 'interaction' && !joinGroup)}}" style="color: {{isNight ? '#fff' : '#000'}};" > <image -- Gitblit v1.9.1