From 6a734d758720185f538e672c879121adb6732274 Mon Sep 17 00:00:00 2001 From: litian <C21AF165> Date: 星期二, 02 四月 2024 09:20:45 +0800 Subject: [PATCH] 代码合并,问题修改,学习 --- packageBookService/pages/components/webView/index.js | 40 +++++++++++++++++++++++++++++++++++++--- 1 files changed, 37 insertions(+), 3 deletions(-) diff --git a/packageBookService/pages/components/webView/index.js b/packageBookService/pages/components/webView/index.js index 797d971..4ee82de 100644 --- a/packageBookService/pages/components/webView/index.js +++ b/packageBookService/pages/components/webView/index.js @@ -12,6 +12,8 @@ currentPage: '', pdfList: [], skeletonLoding: true, + startTime: "", //杩涘叆椤甸潰褰撳墠鏃堕棿 + pauseTime: 0 //鏆傚仠鏃堕棿 }, /** @@ -86,7 +88,6 @@ md5: data.md5 }).then((res) => { let pageCount = data.bookBuy ? res.totalPages : Number(data.freePage) - if (pageCount) { let list = []; @@ -179,21 +180,54 @@ * 鐢熷懡鍛ㄦ湡鍑芥暟--鐩戝惉椤甸潰鏄剧ず */ onShow() { - + this.setData({ + startTime: Date.now() + }) }, /** * 鐢熷懡鍛ㄦ湡鍑芥暟--鐩戝惉椤甸潰闅愯棌 */ onHide() { - + this.setData({ + pauseTime: Date.now() + }) + if (wx.getStorageSync(app.config.tokenKey) && epubObj.bookBuy) { + let duration = this.data.pauseTime - this.data.startTime + this.count(duration) + } }, /** * 鐢熷懡鍛ㄦ湡鍑芥暟--鐩戝惉椤甸潰鍗歌浇 */ onUnload() { + this.setData({ + pauseTime: Date.now() + }) + if (wx.getStorageSync(app.config.tokenKey) && epubObj.bookBuy) { + let duration = this.data.pauseTime - this.data.startTime + this.count(duration) + } + }, + count(timeStr) { + const data = { + appRefCode: app.config.appRefCode, + type: 'LearningTime', //缁熻绫诲瀷--闃呰鏃堕暱 + data: timeStr + '', //缁熻鍐呭--鏃堕暱姣 + event: 'LearningTime', + sysType: 'App' + } + //闃呰鍟嗗搧鐨刬d + if (epubObj.bookId) { + data.productId = epubObj.bookId + } + //闃呰璧勬簮鐨刬d + // if (product.cmsItemId) { + // data.cmsItemId = product.cmsItemId + // } + app.MG.job.newJobWithApiNewEvent(data).then((res) => {}) }, /** -- Gitblit v1.9.1