From c99f9976a5ef9d8974105feb8fc0580a10adf98c Mon Sep 17 00:00:00 2001 From: QYF-GitLab1 <1940665526@qq.com> Date: 星期一, 23 十二月 2024 14:58:49 +0800 Subject: [PATCH] 111 --- packageBookService/pages/bookServices/examination/questionList/index.js | 33 +++++++++++++++++++++++++++------ 1 files changed, 27 insertions(+), 6 deletions(-) diff --git a/packageBookService/pages/bookServices/examination/questionList/index.js b/packageBookService/pages/bookServices/examination/questionList/index.js index 2b484c8..1669dde 100644 --- a/packageBookService/pages/bookServices/examination/questionList/index.js +++ b/packageBookService/pages/bookServices/examination/questionList/index.js @@ -1,4 +1,7 @@ // pages/bookServices/examination/questionList/index.js +const innerAudioContext = wx.createInnerAudioContext({ + useWebAudioImplement: false +}) Component({ /** * 缁勪欢鐨勫睘鎬у垪琛� @@ -26,15 +29,20 @@ }, sliderValue: { type: Number, + }, + noData: { + type: Boolean, } }, - observers: { - 'questionList': function (newValue) { - console.log(newValue); + observers: {}, + detached() { + if (innerAudioContext) { + try { + innerAudioContext.stop(); + innerAudioContext.destroy(); + } catch (error) {} } - }, - created() { - // console.log('缁勪欢浼犲弬', this.properties); + }, /** * 缁勪欢鐨勫垵濮嬫暟鎹� @@ -52,12 +60,25 @@ type: 'fraction' }, showIndex: 0, + isPlay: false }, /** * 缁勪欢鐨勬柟娉曞垪琛� */ methods: { + audioPlay(e) { + const src = e.currentTarget.dataset.src + innerAudioContext.src = src + if (!this.data.isPlay) { + innerAudioContext.play() + } else { + innerAudioContext.pause() + } + this.setData({ + isPlay: !this.data.isPlay + }) + }, // 鍒囨崲棰樼洰 changeSwiper(e) { this.setData({ -- Gitblit v1.9.1