From fa93e847216dfe1da8920aecfa37c37b887c0f29 Mon Sep 17 00:00:00 2001
From: litian <C21AF165>
Date: 星期一, 23 九月 2024 17:52:12 +0800
Subject: [PATCH] rwd

---
 packageDomain/pages/resourceDetails/myVideo/index.js |   62 +++++++++++++++++++++++++++++-
 1 files changed, 59 insertions(+), 3 deletions(-)

diff --git a/packageDomain/pages/resourceDetails/myVideo/index.js b/packageDomain/pages/resourceDetails/myVideo/index.js
index c4906d2..41f8562 100644
--- a/packageDomain/pages/resourceDetails/myVideo/index.js
+++ b/packageDomain/pages/resourceDetails/myVideo/index.js
@@ -3,6 +3,7 @@
 import {
   loginInfo
 } from '../../../../assets/js/login';
+import moment from 'moment'
 Page({
 
   /**
@@ -54,7 +55,10 @@
     buyIdList: [],
     buyList: [],
     learnClassData: null,
-    bookDetail: null
+    bookDetail: null,
+    learnStartTime: 0,
+    learnTimeList: [],
+    learnTimeData: 0
   },
   // 鏍煎紡鍖栫瑪璁版椂闂�
   convertTimestamp(timestamp) {
@@ -110,7 +114,13 @@
     } else {
       this.resourceDetailsData()
     }
-    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)
   },
 
   /**
@@ -149,7 +159,53 @@
       this.count(duration)
     }
     this.setPlayerList()
+    if (this.data.fromPath == 'jsek_cloudLearning') {
+      let cloudDuration = this.data.pauseTime - this.data.learnStartTime
+      this.cloudCount(cloudDuration)
+    }
   },
+  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) {
@@ -570,7 +626,7 @@
       res.datas.forEach((item) => {
         // item.compliceHover = false
         // item.deleteHover = false
-        item.createDate = this.convertTimestamp(item.createDate)
+        item.createDate = moment(item.createDate).format('YYYY-MM-DD HH:mm:ss')
       })
       this.setData({
         "pageCount.total": res.totalSize,

--
Gitblit v1.9.1