From 81c23f9c2f5bdfbe962d0b19a5a80ea7c12f043d Mon Sep 17 00:00:00 2001 From: litian <C21AF165> Date: 星期三, 10 七月 2024 17:39:02 +0800 Subject: [PATCH] 二维码 --- packageDomain/pages/resourceDetails/myVideo/index.js | 119 +++++++++++++++++++++++++++++++++++++++++------------------ 1 files changed, 82 insertions(+), 37 deletions(-) diff --git a/packageDomain/pages/resourceDetails/myVideo/index.js b/packageDomain/pages/resourceDetails/myVideo/index.js index 588d5d8..ab3f70a 100644 --- a/packageDomain/pages/resourceDetails/myVideo/index.js +++ b/packageDomain/pages/resourceDetails/myVideo/index.js @@ -42,7 +42,9 @@ loading: false, hidden: true, videoError: false, - videoLoading: false + videoLoading: false, + progress: 0, + playerList: [] }, // 鏍煎紡鍖栫瑪璁版椂闂� convertTimestamp(timestamp) { @@ -116,6 +118,7 @@ let duration = this.data.pauseTime - this.data.startTime this.count(duration) } + this.setPlayerList() }, /** @@ -129,6 +132,7 @@ let duration = this.data.pauseTime - this.data.startTime this.count(duration) } + this.setPlayerList() }, count(timeStr) { const data = { @@ -184,7 +188,6 @@ }, showDialog(e) { - this.setData({ dialogKey: true, textvalue: '', @@ -204,7 +207,8 @@ }, resourceDetailsData() { this.setData({ - // videoLoaidng: true + videoLoaidng: true, + loading: true }) let query = { storeInfo: this.data.storeInfo, @@ -232,61 +236,58 @@ } } app.MG.store.getProductDetail(query).then(res => { - console.log(this.data.productLinkPath, 345) res.datas.cmsDatas[0].datas.forEach((item) => { - console.log(item, 222) if (item.selectType === "video" || item.learnSelectType === "video") { this.data.threeLeveData.push(item) this.setData({ threeLeveData: this.data.threeLeveData }) - this.data.threeLeveData.forEach((items, index) => { // 淇敼姝ゅ娣诲姞index鍙傛暟 - if (this.data.productLinkPath == items.productLinkPath) { - console.log(items, 5678) - if (this.data.formPath === "jsek_cloudLearning") { - let file - items.protectedFile ? file = items.protectedFile : file = items.freeFile - this.setData({ - showData: app.config.requestCtx + '/file/api/ApiDownloadForAuthorize?md5=' + file + '&token=' + wx.getStorageSync(app.config.tokenKey), - titleName: items.name - }) - } else { - this.setData({ - showData: item.file ? app.config.requestCtx + '/file/api/ApiDownload?md5=' + item.file : app.config.requestCtx + '/file/api/ApiDownload?md5=' + item.freeFile, - titleName: items.name - }) - } - let selectedIndex = index; // 瀛樺偍閫変腑椤圭殑绱㈠紩 - this.setData({ - selectedId: selectedIndex // 璁剧疆閫変腑椤圭殑绱㈠紩 - }); - } - }); } }) + this.data.threeLeveData.forEach((items, index) => { // 淇敼姝ゅ娣诲姞index鍙傛暟 + if (this.data.productLinkPath == items.productLinkPath) { + if (this.data.formPath === "jsek_cloudLearning") { + let file + items.protectedFile || item.file ? file = items.protectedFile || item.file : file = items.freeFile + this.setData({ + showData: app.config.requestCtx + '/file/api/ApiDownloadForAuthorize?md5=' + file + '&token=' + wx.getStorageSync(app.config.tokenKey), + titleName: items.name + }) + } else { + this.setData({ + showData: items.file ? app.config.requestCtx + '/file/api/ApiDownload?md5=' + items.file : app.config.requestCtx + '/file/api/ApiDownload?md5=' + items.freeFile, + titleName: items.name + }) + } + let selectedIndex = index; // 瀛樺偍閫変腑椤圭殑绱㈠紩 + this.setData({ + selectedId: selectedIndex // 璁剧疆閫変腑椤圭殑绱㈠紩 + }); + } + }); this.setData({ loading: false, hidden: false }) - console.log('鍦板潃', this.data.showData); }) }, onVideo(e) { + this.setPlayerList() const item = e.currentTarget.dataset.item this.setData({ videoLoaidng: true, selectedId: e.currentTarget.dataset.index, + activeId: item.id, // showData: '', titleName: item.name }) if (item.selectType == "video" || item.learnSelectType === "video") { if (this.data.formPath === "jsek_cloudLearning") { let file - item.protectedFile ? file = item.protectedFile : file = item.freeFile + item.protectedFile || item.file ? file = item.protectedFile || item.file : file = item.freeFile this.setData({ showData: app.config.requestCtx + '/file/api/ApiDownloadForAuthorize?md5=' + file + '&token=' + wx.getStorageSync(app.config.tokenKey) }) - console.log(this.data.showData); } else { this.setData({ showData: item.file ? app.config.requestCtx + '/file/api/ApiDownload?md5=' + item.file : app.config.requestCtx + '/file/api/ApiDownload?md5=' + item.freeFile, @@ -294,6 +295,54 @@ } } }, + + timeUpdate(e) { + let { + currentTime, + duration + } = e.detail + this.setData({ + progress: ((currentTime / duration) * 100).toFixed(2) + }) + }, + //鑾峰彇瑙嗛瀛︿範 + 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.activeId) + if (index > -1) { + that.data.playerList.splice(index, 1) + } + that.data.playerList.push({ + cmsItemId: that.data.activeId, + progress: that.data.progress + }) + app.MG.identity + .setUserKey({ + setKeyRequests: [{ + domain: 'videoPlayer', + key: that.data.bookId, + value: JSON.stringify(that.data.playerList) + }] + }) + .then((res) => {}) + } + }, + getProductUserSubmitTopicGet() { app.MG.ugc.getProductUserSubmitTopic({ @@ -350,8 +399,6 @@ } else if (this.data.submitType == 'edit') { this.updateNote() } - console.log(this.data.textvalue); - console.log(this.data.titleName); this.setData({ dialogKey: false }); @@ -366,9 +413,9 @@ }, // 鑾峰彇绗旇鍒楄〃 async getNoteList() { - // this.setData({ - // loading: true - // }) + this.setData({ + loading: true + }) let topicId await app.MG.ugc .getProductUserSubmitTopic({ @@ -404,7 +451,6 @@ // item.deleteHover = false item.createDate = this.convertTimestamp(item.createDate) }) - console.log(res, 'res'); this.setData({ "pageCount.total": res.totalSize, noteList: res.datas, @@ -545,7 +591,6 @@ console.log(e); }, videoError: function (e) { - console.log('瑙嗛鍔犺浇澶辫触', e); this.setData({ videoError: true }); -- Gitblit v1.9.1