Browse Source

'加入音色选择'

hfll
hflllll 1 month ago
parent
commit
1f0b23e80b
2 changed files with 8 additions and 0 deletions
  1. +6
    -0
      subPages/home/book.vue
  2. +2
    -0
      subPages/home/music.vue

+ 6
- 0
subPages/home/book.vue View File

@ -930,6 +930,11 @@ export default {
} }
}, },
async onLoad(args) { async onLoad(args) {
uni.$on('selectVoice', (voiceId) => {
console.log('收到音色选择:', voiceId);
this.selectedVoiceId = voiceId
})
this.courseId = args.courseId this.courseId = args.courseId
// //
this.resetAudioState() this.resetAudioState()
@ -941,6 +946,7 @@ export default {
// //
onUnload() { onUnload() {
uni.$off('selectVoice')
if (this.currentAudio) { if (this.currentAudio) {
this.currentAudio.destroy(); this.currentAudio.destroy();
this.currentAudio = null; this.currentAudio = null;


+ 2
- 0
subPages/home/music.vue View File

@ -67,6 +67,7 @@ export default {
selectVoice(voiceId) { selectVoice(voiceId) {
this.selectedVoiceId = voiceId this.selectedVoiceId = voiceId
console.log('选择音色:', voiceId) console.log('选择音色:', voiceId)
uni.$emit('selectVoice', voiceId)
}, },
confirmSelection() { confirmSelection() {
console.log('确认选择音色:', this.selectedVoiceId) console.log('确认选择音色:', this.selectedVoiceId)
@ -84,6 +85,7 @@ export default {
this.getVoice() this.getVoice()
} }
} }
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">


Loading…
Cancel
Save