From f86bd75868eb9b0e81d5cb43d6e76c08a0da3083 Mon Sep 17 00:00:00 2001 From: yiming <m13691596795@163.com> Date: 星期一, 15 四月 2024 16:55:49 +0800 Subject: [PATCH] 音频bug3 --- packageDomain/pages/resourceDetails/myAudio/index.js | 73 ++++++++++++++++++++---------------- 1 files changed, 41 insertions(+), 32 deletions(-) diff --git a/packageDomain/pages/resourceDetails/myAudio/index.js b/packageDomain/pages/resourceDetails/myAudio/index.js index 0221d5a..e3ad275 100644 --- a/packageDomain/pages/resourceDetails/myAudio/index.js +++ b/packageDomain/pages/resourceDetails/myAudio/index.js @@ -161,7 +161,7 @@ // 鍋滄闊抽鎾斁 myAudio.stop(); // 閿�姣� InnerAudioContext 瀹炰緥 - myAudio.destroy(); + // myAudio.destroy(); }, count(timeStr) { const data = { @@ -233,6 +233,7 @@ wx.navigateBack(); }, resourceDetailsData() { + let datas = '' let query = { path: '*', queryType: '*', @@ -264,37 +265,46 @@ this.setData({ threeLeveData: this.data.threeLeveData }) - this.data.threeLeveData.forEach((items, index) => { // 淇敼姝ゅ娣诲姞index鍙傛暟 - if (this.data.productLinkPath == items.productLinkPath) { - if (this.data.formPath == 'jsek_cloudLearning') { - // 杩欓噷澶勭悊浜戝涔犵殑 - this.setData({ - showData: app.config.requestCtx + '/file/api/ApiDownloadForAuthorize?md5=' + items.protectedFile + '&token=' + wx.getStorageSync(app.config.tokenKey), - titleName: items.name - }) - this.pubulicPlayFun() - } else { - this.setData({ - showData: app.config.requestCtx + '/file/api/ApiDownload?md5=' + items.file, - titleName: items.name - }) - this.pubulicPlayFun() - } - let selectedIndex = index; // 瀛樺偍閫変腑椤圭殑绱㈠紩 - this.setData({ - selectedId: selectedIndex // 璁剧疆閫変腑椤圭殑绱㈠紩 - }); - } - }); + } + this.data.threeLeveData.forEach((items, index) => { // 淇敼姝ゅ娣诲姞index鍙傛暟 + if (this.data.productLinkPath == items.productLinkPath) { + datas = items + let selectedIndex = index; // 瀛樺偍閫変腑椤圭殑绱㈠紩 + this.setData({ + selectedId: selectedIndex // 璁剧疆閫変腑椤圭殑绱㈠紩 + }); + } + + }); + if (this.data.formPath == 'jsek_cloudLearning') { + // 杩欓噷澶勭悊浜戝涔犵殑 + this.setData({ + showData: app.config.requestCtx + '/file/api/ApiDownloadForAuthorize?md5=' + datas.protectedFile + '&token=' + wx.getStorageSync(app.config.tokenKey), + titleName: datas.name + }) + this.pubulicPlayFun() + } else { + this.setData({ + showData: app.config.requestCtx + '/file/api/ApiDownload?md5=' + datas.file, + titleName: datas.name + }) + this.pubulicPlayFun() + } + }) this.data.threeLeveData.forEach((item) => {}) - this.setData({ - loading: false, - hidden: false - }) + setTimeout(() => { + this.setData({ + loading: false, + hidden: false + }) + }, 3000) + }) }, + + onVideo(e) { this.setData({ myAudioCurrent: '00:00', @@ -447,7 +457,7 @@ this.setData({ "pageCount.total": res.totalSize, noteList: res.datas, - loading: false + // loading: false }) // console.log('绗旇鍒楄〃', res.datas); }) @@ -591,15 +601,14 @@ // 鍦╫nCanplay閲岃幏鍙栧苟璁剧疆闊抽鏃堕暱鍜屾挱鏀捐繘搴� myAudio.onCanplay(() => { myAudio.duration; //蹇呴』鍐欙紝涓嶇劧鑾峰彇涓嶅埌 - this.setData({ - myAudioDuration: this.format(myAudio.duration), - }) setTimeout(() => { + this.setData({ myAudioDuration: this.format(myAudio.duration), myAudioCurrent: this.format(myAudio.currentTime) }); + }, 100); }); @@ -613,7 +622,7 @@ //杩涘害鏉″彉鍖� myAudio.onTimeUpdate(() => { - console.log(this.format(myAudio.duration)); + // console.log(this.format(myAudio.duration)); this.setData({ myAudioPos: myAudio.currentTime / myAudio.duration * 100, myAudioCurrent: this.format(myAudio.currentTime), -- Gitblit v1.9.1