谢杰标 2 rokov pred
rodič
commit
12f3772f17

+ 0 - 2
components/course/courseSection.vue

@@ -473,8 +473,6 @@ export default {
           return;
         }
         // console.log('===设置播放的节IDthis.menuItem,', this.menuItem, this.playId);
-        //设置播放的节ID
-        this.$store.commit("updatePlayNextId", this.playId);
         uni.$emit("getSection", this.menuItem);
         uni.$emit("isRebuild", this.isRebuild);
       }

+ 1 - 5
components/myPlayer/polyvPlayer.vue

@@ -90,7 +90,7 @@ export default {
       config: null,
       Elevideo: null,
       isInitSeek: false,
-      needSeek: false,
+      needSeek: false, // 是由有记录需要跳转播放
       playTime: 0,
     };
   },
@@ -149,10 +149,6 @@ export default {
       });
     },
     wxStatechange(newstate) {
-      console.log(
-        "🚀 ~ file: polyvPlayer.vue:152 ~ wxStatechange ~ newstate:",
-        newstate
-      );
       polyvPlayerContext = this.selectComponent("#playerVideo");
       // ["playing", "pause", "ended","error"]
       let state = newstate.detail.newstate;

+ 23 - 26
pages3/polyv/detail.vue

@@ -313,7 +313,6 @@ export default {
       lockTimer: null,
       orderGoodsId: 0,
       noticeShow: false,
-      enableAutoRotation: true,
       showSet: false,
       courseId: 0,
       current: 0,
@@ -331,22 +330,17 @@ export default {
       currentTime: 0,
       avatarUrl: "",
       ossAvatarUrl: "",
-      studyDuration: 0, // 当前视频时长
       gradeId: 0,
       chapterId: 0,
       moduleId: 0,
       videoCurrentTime: 0,
       photoIndex: 0,
-      isTaking: true, //是否正在拍照
-      needSeek: false, //第一次播放是否需要跳转
       photoNum: 0,
       photoList: [], //拍照的时间点
       photoConfig: false, //是否配置好拍照次数
       photoHistoryList: [], //已拍照历史的下标点
       sectionItem: {},
-      uploadLock: false, //上传图片
       isRebuild: false, //视频是否从重修目录点击
-      clearTimer: null,
       livingItem: "",
       option: null,
       toggleCourseShow: false, // 切换课程弹窗
@@ -376,12 +370,16 @@ export default {
       isHaverebuild: false,
       isPlaying: false,
       beforeHideIsPlaying: false,
+      isLeave: false,
       text: "",
     };
   },
   computed: {
-    ...mapGetters(["userInfo", "playSectionId", "config"]),
+    ...mapGetters(["userInfo", "config"]),
     playSecIsLearn() {
+      if (!this.playVid) {
+        return false;
+      }
       return this.sectionItem.learning != 1;
     },
     orderNum() {
@@ -445,8 +443,10 @@ export default {
     this.courseId = Number(id) || "";
     this.goodsId = Number(goodsId);
     this.gradeId = Number(gradeId);
+    this.isLeave = false;
     uni.addInterceptor("navigateTo", {
-      success: () => {
+      success: (e) => {
+        this.isLeave = true;
         this.isCache = true;
       },
     });
@@ -466,13 +466,15 @@ export default {
     this.init();
   },
   async onShow() {
+    if (!this.$method.isLogin()) {
+      return;
+    }
     if (this.isCache) {
       console.log("返回刷新数据");
       this.isCache = false;
-      reload(this.option);
-      // #ifdef MP-WEIXIN
       this.sectionItem = {};
-      // #endif
+      this.beforeHideIsPlaying = false;
+      reload(this.option);
       return;
     }
 
@@ -489,6 +491,7 @@ export default {
     console.log("onUnloadonUnloadonUnloadonUnload");
     this.originUnload();
     clearInterval(this.lockTimer);
+    uni.removeInterceptor("navigateTo");
   },
   onHide() {
     this.beforeHideIsPlaying = this.isPlaying;
@@ -676,7 +679,7 @@ export default {
         });
     },
     erJianErZaoPauseTip() {
-      if (this.playSecIsLearn && this.erJianErZao) {
+      if (this.playSecIsLearn && this.erJianErZao && !this.isLeave) {
         if (this.pauseTimer) {
           return;
         }
@@ -730,10 +733,12 @@ export default {
       uni.$on(
         "getSection",
         debounce((item) => {
-          if (!this.refPlv) {
+          if (!this.refPlv && this.playVid) {
             this.refPlv = this.$refs.player;
           }
-          this.refPlv.playPause();
+          if (this.isPlaying) {
+            this.refPlv.playPause();
+          }
           this.postStudyRecord(0);
           //清除直播
           this.studyTimer && clearInterval(this.studyTimer);
@@ -762,13 +767,13 @@ export default {
         //退出提交记录
         this.postStudyRecord();
       }
+      this.refPlv = null;
       //清除正在播放的节ID
       // this.$store.commit('setPlayObj',null)
       this.$store.commit("setPlaySectionId", { playSectionId: 0 });
 
       //移除所有的事件监听器
       uni.$off();
-      this.clearTimer && clearTimeout(this.clearTimer);
 
       if (this.studyTimer) {
         clearInterval(this.studyTimer);
@@ -947,7 +952,6 @@ export default {
           }
           cb();
           this.refPlv.resumeVideo();
-          this.enableAutoRotation = true;
         })
         .catch((err) => {
           uni.showToast({
@@ -1395,14 +1399,10 @@ export default {
         fromPlat: 1, //来源平台 1小程序 2网站
         photo: self.ossAvatarUrl,
         sectionId: sectionId || 0,
-        studyDuration: parseInt(
-          PlayDuration > 0 ? PlayDuration : self.studyDuration
-        ),
+        studyDuration: parseInt(PlayDuration),
         chapterId: this.chapterId || 0,
         moduleId: this.moduleId || 0,
-        videoCurrentTime: parseInt(
-          currentTime > 0 ? currentTime : self.studyDuration
-        ),
+        videoCurrentTime: parseInt(currentTime),
       };
       if (this.ossAvatarUrl) {
         data.similarity = this.compareFaceData; // 相似度
@@ -1446,7 +1446,6 @@ export default {
               }, 1000);
               reject("中断执行");
             } else {
-              this.uploadLock = false;
               uni.showToast({
                 icon: "none",
                 title: res.data.msg,
@@ -1533,7 +1532,7 @@ export default {
       clearInterval(this.studyTimer);
     },
     async ended() {
-      console.log("🚀 ~ file: detail.vue:1519 ~ ended ~ ended:", "结束");
+      console.log("结束");
       this.isPlaying = false;
       uni.showToast({
         icon: "none",
@@ -1627,8 +1626,6 @@ export default {
                 this.sectionItem = data;
                 this.playVideo(data);
               }
-              let playNextId = `moduleId${data.moduleId}chapterId${data.chapterId}sectionId${data.sectionId}`;
-              this.$store.commit("updatePlayNextId", playNextId);
               this.updateChapterOpen(true);
             }
           },