From d23ed6ac2eaab8f3d4e58c136a6e4ccc891bee08 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E8=88=AA?= Date: Mon, 23 Mar 2026 16:39:07 +0800 Subject: [PATCH] =?UTF-8?q?JLBA202505130001=5F=E5=85=B3=E4=BA=8E=E5=90=89?= =?UTF-8?q?=E6=9E=97=E9=93=B6=E8=A1=8C=E6=96=B0=E5=BB=BAAI=E6=99=BA?= =?UTF-8?q?=E8=83=BD=E5=9F=B9=E8=AE=AD=E7=B3=BB=E7=BB=9F=E7=9A=84=E9=9C=80?= =?UTF-8?q?=E6=B1=82=5Ffix:=20bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/index/components/question.vue | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/pages/index/components/question.vue b/src/pages/index/components/question.vue index 79177816..324abf97 100644 --- a/src/pages/index/components/question.vue +++ b/src/pages/index/components/question.vue @@ -68,7 +68,7 @@ activeVoiceId, dataInfo } = toRefs(props) - + const storageStore = useStorageStore(); const emit = defineEmits(['changePlay']) watch(() => props.dataInfo, () => {}, { @@ -112,6 +112,7 @@ emit('changePlay', unref(dataInfo)?.id) console.log(unref(dataInfo)?.id) + isPlaying.value = true if (talkVoiceObj.value && talkVoiceObj.value.src) { console.log(1, talkVoiceObj.value.src) setTimeout(() => { @@ -133,7 +134,7 @@ voiceLoading.value = false; itemVoice.value = url; talkVoiceObj.value.src = url; - if(unref(dataInfo)?.id !== props.activeVoiceId) return + if (unref(dataInfo)?.id !== props.activeVoiceId) return talkVoiceObj.value.play(); } else { downloadFile(unref(dataInfo).bucketKey) @@ -145,29 +146,32 @@ voiceLoading.value = false; itemVoice.value = res.tempFilePath; talkVoiceObj.value.src = res.tempFilePath; - if(unref(dataInfo)?.id !== props.activeVoiceId) return + if (unref(dataInfo)?.id !== props.activeVoiceId) return talkVoiceObj.value.play(); storageStore.setStorage('audio', unref(dataInfo).bucketKey, itemVoice.value); }) .catch((err) => { + isPlaying.value = false voiceLoading.value = false; emit('changePlay', ''); }); } }); } - - + + } const initVoice = () => { console.log('init') talkVoiceObj.value = uni.createInnerAudioContext() talkVoiceObj.value.onEnded(() => { emit('changePlay', '') + isPlaying.value = false // talkVoiceObj.value.src = '' }) talkVoiceObj.value.onError((err) => { console.log(err) + isPlaying.value = false talkVoiceObj.value.src = '' }) // if (unref(dataInfo).intrctWay === '02') { @@ -241,7 +245,6 @@ immediate: true } ) -