浏览代码

修改逻辑

lex 1 年之前
父节点
当前提交
5c455f4e1d
共有 1 个文件被更改,包括 21 次插入10 次删除
  1. 21 10
      src/views/student-register/index.tsx

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

@@ -1194,20 +1194,31 @@ export default defineComponent({
         const rate = Math.floor(
           (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(
           '/edu-app/open/studentRegisterPointRecord/update',
           {
             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
             }
           }
         );