Browse Source

Merge branch 'iteration-20240515-video' into jenkins-test

lex 1 year ago
parent
commit
69754f808f
1 changed files with 23 additions and 10 deletions
  1. 23 10
      src/views/student-register/index.tsx

+ 23 - 10
src/views/student-register/index.tsx

@@ -666,6 +666,8 @@ export default defineComponent({
           if (forms.joinType === 'tradition') {
           if (forms.joinType === 'tradition') {
             joinType = 'NOT_BUY_INSTRUMENT';
             joinType = 'NOT_BUY_INSTRUMENT';
           }
           }
+          // 单独存入时间,为了解决视频播放统计不全的问题
+          await updateStat(pageTimer.counter.value);
           // 更新时间
           // 更新时间
           const id = await updateStat(
           const id = await updateStat(
             pageTimer.counter.value,
             pageTimer.counter.value,
@@ -1194,20 +1196,31 @@ export default defineComponent({
         const rate = Math.floor(
         const rate = Math.floor(
           (time / Math.floor(videoForms.player.duration())) * 100
           (time / Math.floor(videoForms.player.duration())) * 100
         );
         );
+
+        const params = {
+          id: forms.saveId,
+          useTime: pageBrowseTime, // 固定5秒
+          joinType,
+          userId,
+          schoolId
+        };
+        let otherParams = {};
+        if (!userId) {
+          otherParams = {
+            videoBrowseData: JSON.stringify(videoBrowseData), // 视屏播放数据
+            videoBrowseDataTime: time || 0, // 有效的视频观看时长
+            videoBrowsePercentage: rate || 0, // 有效的视频观看时长百分比
+            videoBrowseTime: videoIntervalRef?.counter.value, // 视频观看时长
+            videoBrowsePoint: Math.floor(videoForms.player.currentTime() || 0) // 视频最后观看点 - 向下取整
+          };
+        }
+
         const { data } = await requestStudent.post(
         const { data } = await requestStudent.post(
           '/edu-app/open/studentRegisterPointRecord/update',
           '/edu-app/open/studentRegisterPointRecord/update',
           {
           {
             data: {
             data: {
-              id: forms.saveId,
-              useTime: pageBrowseTime, // 固定5秒
-              joinType,
-              userId,
-              schoolId,
-              videoBrowseData: JSON.stringify(videoBrowseData), // 视屏播放数据
-              videoBrowseDataTime: time || 0, // 有效的视频观看时长
-              videoBrowsePercentage: rate || 0, // 有效的视频观看时长百分比
-              videoBrowseTime: videoIntervalRef?.counter.value, // 视频观看时长
-              videoBrowsePoint: Math.floor(videoForms.player.currentTime() || 0) // 视频最后观看点 - 向下取整
+              ...params,
+              ...otherParams
             }
             }
           }
           }
         );
         );