谢杰标 2 жил өмнө
parent
commit
7369621b32
1 өөрчлөгдсөн 18 нэмэгдсэн , 35 устгасан
  1. 18 35
      pages3/polyv/detail.vue

+ 18 - 35
pages3/polyv/detail.vue

@@ -2061,9 +2061,9 @@ export default {
      * 获取讲义权限
      */
     courseHandouts() {
-      // this.$api.courseHandouts(this.goodsData.handoutsId).then((res) => {
-      //   this.courseHandoutsData = [res.data.data];
-      // });
+      if (!this.goodsData.handoutsId) {
+        return;
+      }
       this.$api
         .getHandoutList({ handoutsId: this.goodsData.handoutsId })
         .then((res) => {
@@ -2108,6 +2108,9 @@ export default {
       }, 15000);
     },
     getPhotoLastRecord() {
+      if (this.erJianErZao) {
+        return;
+      }
       let self = this;
       let data = {
         sectionId: parseInt(self.playSectionId),
@@ -2128,7 +2131,9 @@ export default {
           for (let i = 0; i < res.data.data.length; i++) {
             //-2存储随机拍照数组
             if (res.data.data[i].photoIndex == -2) {
-              self.photoList = res.data.data[i].timeInterval.split(",");
+              self.photoList =
+                res.data.data[i].timeInterval &&
+                res.data.data[i].timeInterval.split(",");
             } else {
               self.photoHistoryList.push(res.data.data[i].photoIndex);
             }
@@ -2273,15 +2278,16 @@ export default {
     },
     // 随机拍摄时间
     randomConfig(totalVideoTime, duration) {
+      this.photoHistoryList = [];
       let photoList = [duration];
       let pre = duration;
       if (totalVideoTime > 300) {
         while (pre <= totalVideoTime) {
-          pre += this.randomNum(360, 900);
+          pre += this.randomNum(600, 900);
           pre <= totalVideoTime && photoList.push(pre);
         }
         if (totalVideoTime - 300 > photoList.slice(-1)[0]) {
-          photoList.push(this.randomNum(totalVideoTime - 300, totalVideoTime));
+          photoList.push(this.randomNum(totalVideoTime - 180, totalVideoTime));
         }
       }
       return photoList;
@@ -2448,7 +2454,6 @@ export default {
     },
     //正常播放视频
     async playVideo(item) {
-      console.log(item.recordingUrl, "22222222", this.vid);
       if (this.timer) {
         clearInterval(this.timer);
       }
@@ -2704,7 +2709,6 @@ export default {
       this.postAnswer();
     },
     postStudyRecord(status = 0, sectionId = this.playSectionId) {
-      console.log("学习记录接口的playSectionId", sectionId, polyvPlayerContext);
       let currentTime = 0;
       let PlayDuration = 0;
       // var polyvPlayerContext = this.selectComponent("#playerVideo");
@@ -2718,7 +2722,6 @@ export default {
         PlayDuration = polyvPlayerContext.j2s_realPlayVideoTime(); //本次看的时长
         // #endif
       }
-      console.log("---学习记录:currentTime", currentTime);
       if (this.playChannelId > 0) {
         currentTime = 2; //直播无法获取,无论开始结束都传2秒
       }
@@ -2778,7 +2781,6 @@ export default {
         });
     },
     uploadFile(options, int) {
-      console.log("options:", options);
       var self = this;
       return new Promise((resolve, reject) => {
         var data = {
@@ -2808,7 +2810,6 @@ export default {
           filePath = new File([url], "a.jpg", {
             type: "image/jpg",
           });
-          console.log("filePath:", filePath);
 
           uni.uploadFile({
             url: ossToken.host,
@@ -2829,11 +2830,9 @@ export default {
             success: (result) => {
               this.$u.toast("上传成功");
               self.ossAvatarUrl = ossToken.dir;
-              console.log("h5上传成功--:", this.ossAvatarUrl);
               resolve();
             },
             fail: (error) => {
-              console.log("h5上传失败:", error);
               uni.showToast({
                 title: "上传接口报错,请重新拍照上传" + error,
                 icon: "none",
@@ -2865,7 +2864,6 @@ export default {
               // if (result.statusCode === 200) {
               this.$u.toast("上传成功");
               self.ossAvatarUrl = ossToken.dir;
-              console.log("statusCode:", this.ossAvatarUrl);
               resolve();
             },
             fail: (error) => {
@@ -2882,7 +2880,6 @@ export default {
       });
     },
     imageInfos() {
-      console.log("avatarUrl:", this.avatarUrl);
       var self = this;
       return new Promise(async (resolve, reject) => {
         // #ifdef MP-WEIXIN
@@ -2946,21 +2943,17 @@ export default {
         this.playTime = polyvPlayerContext.j2s_getCurrentTime();
         // #endif
         this.configPhoto();
+        console.info(this.photoList, "photoList");
         let photoTime = 0; //获取拍照秒数
         for (let i = 0; i < this.photoList.length; i++) {
           photoTime = Number(this.photoList[i]); //获取拍照秒数
-          console.log(
-            "photoTime:",
-            photoTime,
-            "this.sectionItem.learning",
-            this.sectionItem.learning
-          );
           if (photoTime < this.playTime && photoTime > this.playTime - 8) {
             //3秒区间内才触发拍照,避免拉动滚动条
             if (this.photoHistoryList.indexOf(i) < 0) {
               //不存在拍照历史,没有重修过,没有学过,则拍照
               //启动拍照
               //暂停
+              console.log("去拍照");
               // #ifdef MP-WEIXIN
               polyvPlayerContext.exitFullScreen();
               polyvPlayerContext.pause();
@@ -2970,15 +2963,12 @@ export default {
               polyvPlayerContext.toggleFullscreen();
               // #endif
               this.photoIndex = i;
-              console.log("i:i", i);
               if (
                 uni.getStorageSync(`tabkePhotoShow${this.goodsId}`) ==
                 this.goodsId
               ) {
-                console.log("2222");
                 this.openPhoto();
               } else {
-                console.log("1111");
                 this.popupPhotoShow = true;
                 uni.setStorageSync(
                   `tabkePhotoShow${this.goodsId}`,
@@ -3024,11 +3014,6 @@ export default {
     },
     onStateChange(newstate, oldstate) {
       polyvPlayerContext = this.selectComponent("#playerVideo");
-      console.log(
-        "视频的开始播放事件",
-        newstate.detail.newstate,
-        this.needSeek
-      );
       if (newstate.detail.newstate == "playing") {
         if (this.needSeek) {
           // var polyvPlayerContext = this.selectComponent("#playerVideo");
@@ -3054,8 +3039,8 @@ export default {
         //开始播放
         this.timer && clearInterval(this.timer);
         if (
-          this.erJianErZao ||
-          (this.sectionItem.learning != 1 && this.photoNum > 0)
+          this.sectionItem.learning != 1 &&
+          (this.erJianErZao || this.photoNum > 0)
         ) {
           this.timer = setInterval(this.timeEvent, 1000); //定时器
         }
@@ -3156,7 +3141,6 @@ export default {
 
     //拍照
     openPhoto() {
-      console.log("开始拍照");
       // var polyvPlayerContext = this.selectComponent("#playerVideo");
       if (polyvPlayerContext) {
         // #ifdef MP-WEIXIN
@@ -3754,12 +3738,11 @@ export default {
             // 新增用户视频学习日志
             this.studyLog();
           }
-          console.log(564646465);
           //开始播放
           this.timer && clearInterval(this.timer);
           if (
-            this.erJianErZao ||
-            (this.sectionItem.learning != 1 && this.photoNum > 0)
+            this.sectionItem.learning != 1 &&
+            (this.erJianErZao || this.photoNum > 0)
           ) {
             this.timer = setInterval(this.timeEvent, 1000); //定时器
           }