Browse Source

'加入音色选择'

hfll
hflllll 1 month ago
parent
commit
b4c4308f99
2 changed files with 26 additions and 24 deletions
  1. +23
    -22
      subPages/home/book.vue
  2. +3
    -2
      subPages/home/music.vue

+ 23
- 22
subPages/home/book.vue View File

@ -768,6 +768,7 @@ export default {
} }
} }
}, },
async previousPage() { async previousPage() {
// //
if (this.isAudioLoading) { if (this.isAudioLoading) {
@ -787,27 +788,27 @@ export default {
// //
this.resetAudioState(); this.resetAudioState();
} }
},
async nextPage() {
//
if (this.isAudioLoading) {
return;
}
},
async nextPage() {
//
if (this.isAudioLoading) {
return;
}
if (this.currentPage < this.bookPages.length) {
//
this.pauseAudio();
if (this.currentPage < this.bookPages.length) {
//
this.pauseAudio();
this.currentPage++;
//
if (this.courseIdList[this.currentPage - 1] && this.bookPages[this.currentPage - 1].length === 0) {
await this.getBookPages(this.courseIdList[this.currentPage - 1]);
}
//
this.resetAudioState();
this.currentPage++;
//
if (this.courseIdList[this.currentPage - 1] && this.bookPages[this.currentPage - 1].length === 0) {
await this.getBookPages(this.courseIdList[this.currentPage - 1]);
} }
},
//
this.resetAudioState();
}
},
formatTime(seconds) { formatTime(seconds) {
const mins = Math.floor(seconds / 60); const mins = Math.floor(seconds / 60);
const secs = Math.floor(seconds % 60); const secs = Math.floor(seconds % 60);
@ -816,7 +817,7 @@ export default {
toggleSound() { toggleSound() {
console.log('音色切换') console.log('音色切换')
uni.navigateTo({ uni.navigateTo({
url: '/subPages/home/music'
url: '/subPages/home/music?voiceId=' + this.voiceId
}) })
}, },
unlockBook() { unlockBook() {
@ -931,9 +932,9 @@ export default {
}, },
async onLoad(args) { async onLoad(args) {
uni.$on('selectVoice', (voiceId) => { uni.$on('selectVoice', (voiceId) => {
console.log('收到音色选择:', voiceId);
// console.log(':', voiceId);
this.selectedVoiceId = voiceId
this.voiceId = voiceId
}) })
this.courseId = args.courseId this.courseId = args.courseId
// //


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

@ -54,7 +54,7 @@
export default { export default {
data() { data() {
return { return {
selectedVoiceId: 2, //
selectedVoiceId: '', //
voiceList: [ voiceList: [
] ]
@ -81,7 +81,8 @@ export default {
} }
} }
}, },
onLoad() {
onLoad(options) {
this.selectedVoiceId = options.voiceId
this.getVoice() this.getVoice()
} }
} }


Loading…
Cancel
Save