From ad2a9449bd985631e81f611fc6b4d5f340d33881 Mon Sep 17 00:00:00 2001 From: yanghang Date: Tue, 1 Jul 2025 09:09:53 +0800 Subject: [PATCH 1/7] =?UTF-8?q?bug=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/course/components/talkingItem.vue | 14 ++--- src/pages/course/study.vue | 59 ++++++++++++--------- 2 files changed, 42 insertions(+), 31 deletions(-) diff --git a/src/pages/course/components/talkingItem.vue b/src/pages/course/components/talkingItem.vue index f723dec9..a77c9905 100644 --- a/src/pages/course/components/talkingItem.vue +++ b/src/pages/course/components/talkingItem.vue @@ -65,7 +65,7 @@ - + {{ userInfo.userName }} @@ -97,7 +97,7 @@ style="width: 100%;height: 100%;" > - + 完成 撤回 @@ -107,7 +107,7 @@ - + {{ userInfo.userName }} @@ -148,6 +148,7 @@ import { getUserInfo } from '@/common/common'; }) const { type, dataInfo, activeVoiceId } = toRefs(props) const emit = defineEmits(['changePlay', 'nextQuestion']) + // 声音播放初始化 const talkVoiceObj = uni.createInnerAudioContext() const userInfo = computed(() => getUserInfo()) watch(() => props.activeVoiceId,(val) => { @@ -160,7 +161,6 @@ import { getUserInfo } from '@/common/common'; }) talkVoiceObj.onEnded(()=>{ - // talkVoiceObj.src = '' emit('changePlay',unref(dataInfo)?.id) }) talkVoiceObj.onError(()=>{ @@ -171,8 +171,8 @@ import { getUserInfo } from '@/common/common'; talkVoiceObj.pause() emit('changePlay',unref(dataInfo)?.id) } + // 重播 const restartPlay = () => { - console.log(userInfo) if(talkVoiceObj.src){ talkVoiceObj.seek(0) talkVoiceObj.play() @@ -205,7 +205,9 @@ import { getUserInfo } from '@/common/common'; } } const playQnsVoice = (readType = 'qns', item) =>{ - if(item.type === 2){ + console.log(unref(dataInfo)) + if(type.value === 2){ + // 录音 playVoice(readType) return } diff --git a/src/pages/course/study.vue b/src/pages/course/study.vue index 0a5b2e8d..28585253 100644 --- a/src/pages/course/study.vue +++ b/src/pages/course/study.vue @@ -37,7 +37,7 @@ 课程学习 - + {{ showOrder }} / {{ pgrphNum }} @@ -95,7 +95,7 @@ diff --git a/src/pages/course/study.vue b/src/pages/course/study.vue index fe3b49de..b6f12d22 100644 --- a/src/pages/course/study.vue +++ b/src/pages/course/study.vue @@ -145,13 +145,13 @@ const getData = async () => { try{ const { body } = await getCourseStudyInfoApi({crsId: crsId.value}) initsocketTask() + teacherList.value = body.teacheList.map(t=>({ + ...t, + voicePath: '', + voiceObj: null + })) if(body.stdyProgressFlag === 'N'){ step.value = 1 - teacherList.value = body.teacheList.map(t=>({ - ...t, - voicePath: '', - voiceObj: null - })) }else{ common.show('提示信息', '此门课程已有学习历史,请选择是否继续学习?',true, '重新开始','继续学习').then((res) => { if(res) { @@ -218,6 +218,7 @@ const showKeyboard = () => { let _data = { qnsId: unref(lastTalkingInfo).qnsId,// 问题ID 必输项:true 类型:String pgrphId: unref(lastTalkingInfo).pgrphId,// 段落ID 必输项:true 类型:String + qstLogId: unref(qstLogId),// 段落ID 必输项:true 类型:String crsId: crsId.value,// 课程ID 必输项:true 类型:String stdyBatch: stdyBatch.value,// 学习批次 必输项:true 类型:String ansterContent: answerValue.value // 回答文本内容 必输项:false 类型:String @@ -313,16 +314,19 @@ const getGraphInfoUnStudy = () => { pgrphNum.value = res.body.pgrphNum showOrder.value = res.body.showOrder + logId.value = res.body.logId || '' scrollToBottomNow() }) } const lastTalkingInfo = ref({}) +const qstLogId = ref('') // 获取问题 const getQuestionInfoUnStudy = (pgrphId) => { queryTraStdyBatchWaitQuestionInfoApi({ crsId: crsId.value, stdyId: unref(stdyId), stdyBatch: unref(stdyBatch), + logId: unref(logId), pgrphId }).then(res=>{ let _id = new Date().getTime() + 'id' @@ -333,6 +337,7 @@ const getQuestionInfoUnStudy = (pgrphId) => { id: _id } talkingList.value.push(lastTalkingInfo.value) + qstLogId.value = res.body.qstLogId scrollToBottomNow() }) } @@ -378,6 +383,7 @@ const isManualClose = ref(false) // 是否手动关闭 const stdyId = ref('') const stdyBatch = ref('') +const logId = ref('') // ws 初始化逻辑 const initsocketTask = () => { socketStore.creatSocket() @@ -387,6 +393,7 @@ const initsocketTask = () => { if(commond === 'STDYBTH' && !stdyId.value){ stdyId.value = body.stdyId || '' stdyBatch.value = body.stdyBatch || '' + logId.value = body.logId || '' getGraphInfoUnStudy() } }else{ @@ -489,11 +496,11 @@ const hideOverlayTalking = (obj) => { stopRecord() // #endif if(!isOut.value){ - console.log(11111111111111) setTimeout(()=>{ let _data = { qnsId: unref(lastTalkingInfo).qnsId,// 问题ID 必输项:true 类型:String pgrphId: unref(lastTalkingInfo).pgrphId,// 段落ID 必输项:true 类型:String + qstLogId: unref(qstLogId),// 段落ID 必输项:true 类型:String crsId: crsId.value,// 课程ID 必输项:true 类型:String stdyBatch: stdyBatch.value,// 学习批次 必输项:true 类型:String ansterContent: '',// 回答文本内容 必输项:false 类型:String