From d8119506ef1cd505c25a6496ac53a3443f99ac7e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E8=88=AA?= Date: Thu, 21 Aug 2025 11:11:15 +0800 Subject: [PATCH] =?UTF-8?q?fix=EF=BC=9A=20bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/course/components/talkingItem.vue | 31 +++++++----- src/pages/course/study.vue | 54 ++++++++++++--------- 2 files changed, 50 insertions(+), 35 deletions(-) diff --git a/src/pages/course/components/talkingItem.vue b/src/pages/course/components/talkingItem.vue index 513c86e0..7909e506 100644 --- a/src/pages/course/components/talkingItem.vue +++ b/src/pages/course/components/talkingItem.vue @@ -39,7 +39,12 @@ {{ showContent }} - + @@ -97,7 +102,7 @@ 继续学 @@ -226,7 +231,7 @@ import { getUserInfo } from '@/common/common'; import { useStorageStore } from "@/store/storage.js" import { onUnload } from '@dcloudio/uni-app' -import RadioSubject from '@/components/examination/radio-subject.vue' +import Subject from '@/components/examination/subject.vue' // import RadioSubjectRequest from '@/pages/wrong_question_record/components/radio-subject.vue' const storageStore = useStorageStore() @@ -285,7 +290,12 @@ const audioCacheObj = computed(() => storageStore.audioObj) talkVoiceObj.value.playbackRate = Number(props.voiceRate) const userInfo = computed(() => getUserInfo()) const itemVoice = ref('') - + const subjectInfo = computed(()=>{ + return { + ...dataInfo.value, + ...(dataInfo.value?.traQnsInfoVo||{}) + } + }) const mode = ref('study') // 考试 examination 练习practice 学习study const showWithdraw = computed(()=>{ @@ -350,7 +360,6 @@ const audioCacheObj = computed(() => storageStore.audioObj) const voiceTime = ref('') const itemInfo = ref({}) onMounted(()=>{ - console.log() initVoice() }) onUnload(()=>{ @@ -405,7 +414,6 @@ const audioCacheObj = computed(() => storageStore.audioObj) voiceLoading.value = true let _type = props.type == 2 ? 'ans' : props.type == 3 ? 'pgrh' : props.type == 4 ? 'qns' : '' let _readId = props.type == 2 ? unref(dataInfo)?.intrctId : props.type == 3 ? unref(dataInfo)?.pgrphId : props.type == 4 ? unref(dataInfo)?.qnsId : '' - console.log(unref(dataInfo)) let _params = { crsId: unref(dataInfo)?.crsId || '', pgrphId: unref(dataInfo)?.pgrphId || '', @@ -454,7 +462,6 @@ const audioCacheObj = computed(() => storageStore.audioObj) success: cb, file: ()=>{ voiceLoading.value = false - console.log('文件保存失败!') } }) } @@ -530,7 +537,6 @@ const audioCacheObj = computed(() => storageStore.audioObj) } // 撤回 const withdraw = () => { - console.log(unref(dataInfo)) emit('withdraw', unref(dataInfo)) } // 完成 @@ -538,9 +544,12 @@ const audioCacheObj = computed(() => storageStore.audioObj) emit('finishQuestion',data) } // 答题 选择 - const subject_click = (type,data) => { - if(type === 'answer'){ - emit('answerQuestion', data, unref(dataInfo)) + const subject_click = (type, data) => { + if(['answer', 'choose'].includes(type)){ + emit('answerQuestion', { + ...data, + ...unref(dataInfo) + }) } } diff --git a/src/pages/course/study.vue b/src/pages/course/study.vue index 8be24b68..93611c61 100644 --- a/src/pages/course/study.vue +++ b/src/pages/course/study.vue @@ -431,6 +431,7 @@ const qstLogId = ref('') // 获取问题 const getQuestionInfoUnStudy = (pgrphId) => { + console.log(pgrphId) textChartApi({ processType: 'QSN-ANSER', requestBody: JSON.stringify({ @@ -438,7 +439,7 @@ stdyId: unref(stdyId), stdyBatch: unref(stdyBatch), logId: unref(logId), - pgrphId + pgrphId: pgrphId }) }) .then(res => { @@ -492,6 +493,7 @@ // 继续 执行方法 const nextQuestionSuccess = (info, type = 'next') => { + console.log(info) let _id = new Date().getTime() + 'id' if (type === 'next') { talkingList.value.push({ @@ -533,26 +535,29 @@ // 重新回答 textChartApi({ processType: 'NEW-ANSER', //NEW-KNOW - requestBody: info.qstLogId + requestBody: info.qnsId }).then(res => { let _body = res.body || {} if (!_body.chatBody) { return } + console.log(info, 222222) lastTalkingInfo.value = { crsId: info.crsId, qstLogId: _body.chatBody, - pgrphId: info.pgrphId, chatContent: _body.chatContent, userInfo: { ...choiceTeacherInfo.value }, ..._body.chatBody, + pgrphId: info.pgrphId, type: Number(_body.bodyTyp) || 0, id: _id, - isQuestion: true + isQuestion: true, + my_answer: [], + backend_answer: [] } - talkingList.value.push(lastTalkingInfo.value) + talkingList.value.push(JSON.parse(JSON.stringify(lastTalkingInfo.value))) qstLogId.value = _body.chatBody.qstLogId scrollToBottomNow() }) @@ -588,7 +593,7 @@ id: _id, isQuestion: true } - talkingList.value.push(lastTalkingInfo.value) + talkingList.value.push(JSON.parse(JSON.stringify(lastTalkingInfo.value))) logId.value = _body.chatBody.logId qstLogId.value = _body.chatBody.qstLogId || qstLogId.value scrollToBottomNow() @@ -684,7 +689,9 @@ scrollToBottomNow() } onHide(() => { + //#ifdef APP-PLUS uni.offKeyboardHeightChange(setHeight) + // #endif if (watchFlag.value === 1) return changePlayItemId('') socketStore.closeSocket() @@ -693,7 +700,9 @@ // }).finally(() => {}) }) onShow(() => { + //#ifdef APP-PLUS uni.onKeyboardHeightChange(setHeight) + // #endif if (watchFlag.value === 1) return // getData('2'); initsocketTask() @@ -836,10 +845,7 @@ talkingList.value.push({ ..._data, chatContent: _body.chatContent, - userInfo: { - ...choiceTeacherInfo.value - }, - intrctId: _body.chatBody || '', + recordId: _body.chatBody || '', talkingContent: val, talkingVoice: '', type: 2, @@ -860,17 +866,24 @@ textChartApi({ processType: 'ANSER-WITHDRAW', requestBody: JSON.stringify({ - intrctId: data.intrctId + recordId : data.recordId }) }) .then(res => { // 删除撤回的数据item common.msg('撤回成功!') - talkingList.value = talkingList.value.filter(t => t.intrctId !== data.intrctId) + talkingList.value = talkingList.value.filter(t => t.recordId !== data.recordId ) }) } const loadingQstLogId = ref('') - const answerQuestionNow = (data, item) => { + const answerQuestionNow = (data) => { + let _data = { + qnsId: data.qnsId, // 问题ID 必输项:true 类型:String + pgrphId: data.pgrphId, // 段落ID 必输项:true 类型:String + crsId: crsId.value, // 课程ID 必输项:true 类型:String + stdyBatch: stdyBatch.value, // 学习批次 必输项:true 类型:String + ansterContent: data.answer.join(',') // 回答文本内容 必输项:false 类型:String + } // 发出答案 let _answer = data.answerItems.map(t => t.itemNo).join(',') let _id1 = new Date().getTime() + '3d' @@ -883,13 +896,6 @@ type: 0 }) scrollToBottomNow(0) - let _data = { - qnsId: item.qnsId, // 问题ID 必输项:true 类型:String - pgrphId: item.pgrphId, // 段落ID 必输项:true 类型:String - crsId: crsId.value, // 课程ID 必输项:true 类型:String - stdyBatch: stdyBatch.value, // 学习批次 必输项:true 类型:String - ansterContent: data.answer.join(',') // 回答文本内容 必输项:false 类型:String - } textChartApi({ processType: 'ANSER-CHOICE', requestBody: JSON.stringify(_data) @@ -901,8 +907,8 @@ stdyId: unref(stdyId), stdyBatch: unref(stdyBatch), logId: unref(logId), - pgrphId: item.pgrphId, - qnsId: item.qnsId, + pgrphId: data.pgrphId, + qnsId: data.qnsId, chatContent: _body.chatContent || '', ...(_body.chatBody || {}), type: Number(_body.bodyTyp || 8), @@ -914,7 +920,7 @@ my_answer: [], backend_answer: [] } - talkingList.value.push(lastTalkingInfo.value) + talkingList.value.push(JSON.parse(JSON.stringify(lastTalkingInfo.value))) scrollToBottomNow(0) }) } @@ -953,7 +959,7 @@ }, type: 5 } - talkingList.value.push(lastTalkingInfo.value) + talkingList.value.push(JSON.parse(JSON.stringify(lastTalkingInfo.value))) scrollToBottomNow(0) getQuestionEvalateRequest(_id, data, 1) })