| | |
| | | pauseTime: 0, //暂停时间 |
| | | formPath: '', |
| | | loading: true, |
| | | hidden: true |
| | | hidden: true, |
| | | playerList: [], |
| | | progress: 0, |
| | | }, |
| | | |
| | | format(time) { |
| | |
| | | let duration = this.data.pauseTime - this.data.startTime |
| | | this.count(duration) |
| | | } |
| | | this.setPlayerList() |
| | | }, |
| | | |
| | | /** |
| | |
| | | myAudio.stop(); |
| | | // 销毁 InnerAudioContext 实例 |
| | | // myAudio.destroy(); |
| | | this.setPlayerList() |
| | | }, |
| | | count(timeStr) { |
| | | const data = { |
| | |
| | | this.data.threeLeveData.forEach((items, indexs) => { |
| | | if (this.data.productLinkPath == items.productLinkPath) { |
| | | selectedId = indexs; |
| | | |
| | | } |
| | | }) |
| | | if (selectedId !== -1) { |
| | | let datas = this.data.threeLeveData[selectedId]; |
| | | |
| | | if (this.data.formPath == 'jsek_cloudLearning') { |
| | | showDataUrl = app.config.requestCtx + '/file/api/ApiDownloadForAuthorize?md5=' + datas.protectedFile + '&token=' + wx.getStorageSync(app.config.tokenKey); |
| | | let file = datas.protectedFile ? datas.protectedFile : datas.file |
| | | showDataUrl = app.config.requestCtx + '/file/api/ApiDownloadForAuthorize?md5=' + file + '&token=' + wx.getStorageSync(app.config.tokenKey); |
| | | } else { |
| | | showDataUrl = datas.file ? app.config.requestCtx + '/file/api/ApiDownload?md5=' + datas.file : app.config.requestCtx + '/file/api/ApiDownload?md5=' + datas.freeFile |
| | | } |
| | | titleName = datas.name; |
| | | console.log(showDataUrl, 676767) |
| | | } |
| | | |
| | | this.setData({ |
| | |
| | | }, |
| | | |
| | | onVideo(e) { |
| | | this.setPlayerList() |
| | | this.setData({ |
| | | myAudioCurrent: '00:00', |
| | | myAudioPos: '', |
| | | isplay: false |
| | | }) |
| | | const item = e.currentTarget.dataset.item |
| | | console.log(item, 222) |
| | | if (this.data.showData != '') { |
| | | this.setData({ |
| | | titleName: item.name, |
| | | selectId: item.id, |
| | | selectedId: e.currentTarget.dataset.index, |
| | | showData: '' |
| | | showData: '', |
| | | activeId: item.id |
| | | |
| | | }) |
| | | if (item.selectType == "audio" || item.learnSelectType === "audio") { |
| | | if (this.data.formPath == 'jsek_cloudLearning') { |
| | | let file = item.protectedFile ? item.protectedFile : item.file |
| | | // 这里处理云学习的 |
| | | this.setData({ |
| | | showData: app.config.requestCtx + '/file/api/ApiDownloadForAuthorize?md5=' + item.protectedFile + '&token=' + wx.getStorageSync(app.config.tokenKey) |
| | | showData: app.config.requestCtx + '/file/api/ApiDownloadForAuthorize?md5=' + file + '&token=' + wx.getStorageSync(app.config.tokenKey) |
| | | }) |
| | | this.pubulicPlayFun() |
| | | } else { |
| | |
| | | myAudioPos: myAudio.currentTime / myAudio.duration * 100, |
| | | myAudioCurrent: this.format(myAudio.currentTime), |
| | | myAudioDuration: this.format(myAudio.duration), |
| | | progress: ((myAudio.currentTime / myAudio.duration) * 100).toFixed(2) |
| | | }); |
| | | console.log(myAudio.currentTime.toFixed(3), myAudio.duration); |
| | | // console.log(myAudio.currentTime.toFixed(3), myAudio.duration); |
| | | }) |
| | | }, |
| | | |
| | |
| | | myAudio.playbackRate = this.data.speed; // 播放速率 |
| | | }, 200); |
| | | }, |
| | | |
| | | //获取视频学习 |
| | | getPlayerList() { |
| | | app.MG.identity |
| | | .getUserKey({ |
| | | domain: 'videoPlayer', |
| | | keys: [this.data.bookId] |
| | | }) |
| | | .then((res) => { |
| | | if (res.length > 0) { |
| | | this.setData({ |
| | | playerList: JSON.parse(res[0].value) |
| | | }) |
| | | } |
| | | }) |
| | | }, |
| | | setPlayerList() { |
| | | let that = this |
| | | if (that.data.progress > 0) { |
| | | let index = that.data.playerList.findIndex((itemData) => itemData.cmsItemId == that.data.selectId) |
| | | if (index > -1) { |
| | | that.data.playerList.splice(index, 1) |
| | | } |
| | | that.data.playerList.push({ |
| | | cmsItemId: that.data.selectId, |
| | | progress: that.data.progress |
| | | }) |
| | | app.MG.identity |
| | | .setUserKey({ |
| | | setKeyRequests: [{ |
| | | domain: 'videoPlayer', |
| | | key: that.data.bookId, |
| | | value: JSON.stringify(that.data.playerList) |
| | | }] |
| | | }) |
| | | .then((res) => {}) |
| | | } |
| | | }, |
| | | }) |