skyblued 2 years ago
parent
commit
f0593cb33b
1 changed files with 5 additions and 4 deletions
  1. 5 4
      src/subpages/colexiu/App.tsx

+ 5 - 4
src/subpages/colexiu/App.tsx

@@ -16,13 +16,12 @@ export default defineComponent({
     }
 
     let startTime = Date.now()
-    const initBehaviorId = '' + new Date().valueOf()
+    const initBehaviorId = '' + Date.now()
     /** 学生端记录在云教练里面的时长 */
     const recordTotalTime = async () => {
       const client = useClientType()
       if (client != 'student') return
       const search = useOriginSearch()
-      const behaviorId = sessionStorage.getItem('behaviorId') || search.behaviorId || initBehaviorId
       const prefix = getRequestHostname()
       const totalTime = Date.now() - startTime
       startTime = Date.now()
@@ -35,7 +34,7 @@ export default defineComponent({
           feature: search.feature,
           playTime: totalTime / 1000,
           deviceType: getPlatform(),
-          behaviorId,
+          behaviorId: initBehaviorId,
         },
       })
     }
@@ -44,9 +43,11 @@ export default defineComponent({
       clearInterval(timer)
       if (!route.name) return
       console.log('进入云教练')
+
+      // window.addEventListener('beforeunload', recordTotalTime)
       timer = setInterval(() => {
         recordTotalTime()
-      }, 10 * 1000)
+      }, 60 * 1000)
     })
 
     return () => <router-view></router-view>