From 7adfe5210fad2b4ab1b1be41e2d58eb3dd9b2b1a Mon Sep 17 00:00:00 2001
From: 闫增涛 <1829501689@qq.com>
Date: 星期二, 02 四月 2024 09:38:22 +0800
Subject: [PATCH] 代码合并

---
 packageBookService/pages/bookServices/examination/examination.js |   38 ++++++++++++++++++++++++++++++++++++++
 1 files changed, 38 insertions(+), 0 deletions(-)

diff --git a/packageBookService/pages/bookServices/examination/examination.js b/packageBookService/pages/bookServices/examination/examination.js
index 83953d8..b10cd73 100644
--- a/packageBookService/pages/bookServices/examination/examination.js
+++ b/packageBookService/pages/bookServices/examination/examination.js
@@ -45,6 +45,8 @@
     saveTime: 20,
     isNight: false,
     sliderValue: 0, // 瀛椾綋婊戝潡
+    startTime: "", //杩涘叆椤甸潰褰撳墠鏃堕棿
+    pauseTime: 0 //鏆傚仠鏃堕棿 
   },
 
   /**
@@ -110,6 +112,9 @@
         }
       }, 1000)
     }
+    this.setData({
+      startTime: Date.now()
+    })
   },
 
   /**
@@ -118,6 +123,13 @@
   onHide() {
     if (wx.timer) {
       clearInterval(wx.timer)
+    }
+    this.setData({
+      pauseTime: Date.now()
+    })
+    if (wx.getStorageSync(app.config.tokenKey)) {
+      let duration = this.data.pauseTime - this.data.startTime
+      this.count(duration)
     }
   },
 
@@ -131,6 +143,32 @@
     if (this.data.countdownInterval !== null) {
       clearInterval(this.data.countdownInterval)
     }
+    this.setData({
+      pauseTime: Date.now()
+    })
+    if (wx.getStorageSync(app.config.tokenKey)) {
+      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 (this.data.bookId) {
+      data.productId = this.data.bookId
+    }
+    //闃呰璧勬簮鐨刬d
+    // if (product.cmsItemId) {
+    //   data.cmsItemId = product.cmsItemId
+    // }
+    app.MG.job.newJobWithApiNewEvent(data).then((res) => {})
   },
 
   /**

--
Gitblit v1.9.1