Fix(AI):[#3949]语音播放AI回复内容,返回AI主页、小程序首页,语音仍在播放

This commit is contained in:
lifizer
2025-07-01 15:56:09 +08:00
parent 8b21a232fe
commit 5cf21bf46c
3 changed files with 22 additions and 5 deletions
+4 -2
View File
@@ -77,9 +77,11 @@ export const chatMixins = {
}.bind(this)).exec() }.bind(this)).exec()
}, },
onUnload() { onUnload() {
if (this.audioContext) {
this.audioContext.stop()
}
wx.getBackgroundAudioManager().stop()
this.closeWsFn() this.closeWsFn()
// console.log('在页面卸载时取消监听')
// wx.offKeyboardHeightChange()
}, },
created() { created() {
const _this = this const _this = this
+14
View File
@@ -97,6 +97,20 @@
/> />
重新生成 重新生成
</view> </view>
<view
:class="{
'playing': audioPlayId === item.conversationId && isPlayAudio
}"
class="item"
@click="ttsHandle(item)"
>
<image
:src="webUrl + '/aiChat/' + ((audioPlayId === item.conversationId && isPlayAudio) ? 'audio-on' : 'audio-off') +'.png'"
class="icon"
mode="widthFix"
/>
语音播放
</view>
</view> </view>
</view> </view>
</view> </view>
+4 -3
View File
@@ -491,9 +491,6 @@ export default {
this.createNewHandle() this.createNewHandle()
} }
}, },
onUnload() {
this.closeWsFn()
},
methods: { methods: {
createdCallbak() { createdCallbak() {
this.$nextTick(() => { this.$nextTick(() => {
@@ -541,6 +538,10 @@ export default {
}, },
// 创建新会话 // 创建新会话
createNewHandle() { createNewHandle() {
if (this.audioContext) {
this.audioContext.stop()
}
wx.getBackgroundAudioManager().stop()
if (!this.chatNumber) return if (!this.chatNumber) return
this.closeWsFn() this.closeWsFn()
this.chatNumber = '' this.chatNumber = ''