From 6df96b3e7a7da1985ee875e84711e9f15c5fbff0 Mon Sep 17 00:00:00 2001 From: litian <C21AF165> Date: 星期二, 24 十二月 2024 18:25:02 +0800 Subject: [PATCH] Merge refs/remotes/origin/master into refs/heads/master --- packageDomain/pages/resourceDetails/myAudio/index.js | 62 +++++++++++++++++++++++++++++- 1 files changed, 59 insertions(+), 3 deletions(-) diff --git a/packageDomain/pages/resourceDetails/myAudio/index.js b/packageDomain/pages/resourceDetails/myAudio/index.js index 624b1dc..03888b5 100644 --- a/packageDomain/pages/resourceDetails/myAudio/index.js +++ b/packageDomain/pages/resourceDetails/myAudio/index.js @@ -57,7 +57,10 @@ buyIdList: [], buyList: [], learnClassData: null, - bookDetail: null + bookDetail: null, + learnStartTime: 0, + learnTimeList: [], + learnTimeData: 0 }, format(time) { @@ -126,7 +129,13 @@ this.resourceDetailsData() this.getNoteList() } - if (options.formPath == 'jsek_cloudLearning') this.getBookInfo(options.bookId) + if (options.formPath == 'jsek_cloudLearning') { + this.setData({ + learnStartTime: Date.now(), + }) + this.getLearnTime() + } + this.getBookInfo(options.bookId) }, /** @@ -187,6 +196,10 @@ this.count(duration) } this.setPlayerList() + if (this.data.fromPath == 'jsek_cloudLearning') { + let cloudDuration = this.data.pauseTime - this.data.learnStartTime + this.cloudCount(cloudDuration) + } }, count(timeStr) { const data = { @@ -206,6 +219,48 @@ } console.log('缁熻', data) app.MG.job.newJobWithApiNewEvent(data).then((res) => {}) + }, + + getLearnTime() { + app.MG.identity + .getUserKey({ + domain: 'cloudLearningTime', + keys: [this.data.bookId] + }) + .then((res) => { + if (res.length > 0) { + if (JSON.parse(res[0].value) && JSON.parse(res[0].value).length > 0) { + this.setData({ + learnTimeList: JSON.parse(res[0].value), + learnTimeData: JSON.parse(res[0].value)[0].learnTime, + }) + } else { + this.setData({ + learnTimeList: [], + learnTimeData: 0 + }) + } + } + }) + }, + cloudCount(timeStr) { + let time = Number(this.data.learnTimeData) + Number(timeStr) + this.setData({ + learnTimeList: [{ + learnTime: time + }], + }) + app.MG.identity + .setUserKey({ + setKeyRequests: [{ + domain: 'cloudLearningTime', + key: this.data.bookId, + value: JSON.stringify(this.data.learnTimeList) + }] + }) + .then((res) => { + console.log(timeStr, '瀛︿範鏃堕暱') + }) }, // 鑾峰彇鍥句功璇︽儏 getBookInfo(id) { @@ -317,6 +372,7 @@ let selectedId = -1; // 鍒濆鍖栭�変腑椤圭储寮� let showDataUrl = ''; let titleName = ''; + console.log(res.datas.cmsDatas[0].datas, 1) res.datas.cmsDatas[0].datas.forEach((item, index) => { if (this.data.source == 'qrcode') { if (item.id == this.data.activeId) { @@ -345,7 +401,7 @@ if (selectedId !== -1) { let datas = this.data.threeLeveData[selectedId]; if (this.data.formPath == 'jsek_cloudLearning') { - let file = datas.protectedFile ? datas.protectedFile : datas.file + let file = datas.protectedFile ? datas.protectedFile : datas.freeFile 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 -- Gitblit v1.9.1