Bladeren bron

七大员改造

谢杰标 2 jaren geleden
bovenliggende
commit
b13c82c2c6
1 gewijzigde bestanden met toevoegingen van 44 en 41 verwijderingen
  1. 44 41
      pages3/polyv/detail.vue

+ 44 - 41
pages3/polyv/detail.vue

@@ -985,6 +985,7 @@ export default {
     this.option = option;
     // 公众号模板消息的数据埋点
     option.informId && this.clickOfficial(option.informId);
+
   },
   async onShow() {
     if (uni.getStorageSync("nofresh")) {
@@ -2325,7 +2326,6 @@ export default {
       totalVideoTime = polyvPlayerContext.j2s_getDuration();
       duration = polyvPlayerContext.j2s_getCurrentTime();
       // #endif
-      let photoNum = this.photoNum;
       if (!this.photoConfig) {
         this.photoConfig = true;
         if (this.erJianErZao) {
@@ -2334,43 +2334,7 @@ export default {
         }
         //没有历史拍照间隔数据
         if (this.photoList.length == 0) {
-          if (totalVideoTime >= 900) {
-            //大于15分钟
-            if (photoNum == 1) {
-              //开头拍1张
-              this.photoList.push(0);
-            } else if (photoNum == 3) {
-              //拍3张
-              this.photoList.push(0); //开头拍一张
-              let centerTime = Math.floor(totalVideoTime / 2); //获取中间时间
-              let centerMinTime = centerTime - 300; //前后5分钟
-              let centerMaxTime = centerTime + 300;
-              let centerTakeTime = this.randomNum(centerMinTime, centerMaxTime);
-              this.photoList.push(centerTakeTime); //中间拍一张
-              let endMaxTime = totalVideoTime - 60;
-              let endMinTime = totalVideoTime - 300;
-              let endTakeTime = this.randomNum(endMinTime, endMaxTime);
-              this.photoList.push(endTakeTime); //最后拍一张
-            }
-          } else {
-            //小于15分钟,只拍前后各一张
-            if (photoNum == 1) {
-              //开头拍1张
-              this.photoList.push(0);
-            } else if (photoNum == 3) {
-              this.photoList.push(1);
-              let centerTime = this.randomNum(
-                (1 / 3) * totalVideoTime,
-                (2 / 3) * totalVideoTime
-              );
-              this.photoList.push(centerTime);
-              let endTakeTime = this.randomNum(
-                (2 / 3) * totalVideoTime,
-                totalVideoTime
-              );
-              this.photoList.push(endTakeTime);
-            }
-          }
+          this.commonConfig(totalVideoTime, true?46*60:undefined)
           this.postCoursePhotoRecord(true); //提交随机拍照时间数组
         }
         //兼容已有观看历史
@@ -2389,7 +2353,7 @@ export default {
         }
       }
     },
-    // 随机拍摄时间
+    // 二建随机拍摄时间
     randomConfig(totalVideoTime, duration) {
       this.photoHistoryList = [];
       let photoList = [duration];
@@ -2405,6 +2369,45 @@ export default {
       }
       return photoList;
     },
+    // 随机前后五分钟
+    commonConfig(totalVideoTime, fixS) {
+      let photoList = [0];
+      // 固定间隔时间取
+      if (fixS) {
+        let num = Math.ceil(totalVideoTime / fixS);
+        for (let i = 1; i < num; i++) {
+          photoList.push(i * fixS);
+        }
+      } else {
+        if (this.photoNum == 3) {
+          if (totalVideoTime >= 900) {
+            //大于15分钟
+            let centerTime = Math.floor(totalVideoTime / 2); //获取中间时间
+            let centerMinTime = centerTime - 300; //前后5分钟
+            let centerMaxTime = centerTime + 300;
+            let centerTakeTime = this.randomNum(centerMinTime, centerMaxTime);
+            photoList.push(centerTakeTime); //中间拍一张
+            let endMaxTime = totalVideoTime - 60;
+            let endMinTime = totalVideoTime - 300;
+            let endTakeTime = this.randomNum(endMinTime, endMaxTime);
+            photoList.push(endTakeTime); //最后拍一张
+          } else {
+            //小于15分钟
+            let centerTime = this.randomNum(
+              (1 / 3) * totalVideoTime,
+              (2 / 3) * totalVideoTime
+            );
+            photoList.push(centerTime);
+            let endTakeTime = this.randomNum(
+              (2 / 3) * totalVideoTime,
+              totalVideoTime
+            );
+            photoList.push(endTakeTime);
+          }
+        }
+      }
+      return photoList;
+    },
     getLiveUid(channelId) {
       let self = this;
       return new Promise((resolve) => {
@@ -3314,7 +3317,7 @@ export default {
             video: {
               width: 400,
               height: 300,
-			  facingMode:'user',
+              facingMode: "user",
             },
           },
           this.photographSuccess,
@@ -3472,7 +3475,7 @@ export default {
           video: {
             width: 400,
             height: 300,
-			facingMode:'user',
+            facingMode: "user",
           },
         },
         this.photographSuccess,