谢杰标 2 年 前
コミット
df79fcc857
1 ファイル変更47 行追加40 行削除
  1. 47 40
      pages3/polyv/detail.vue

+ 47 - 40
pages3/polyv/detail.vue

@@ -2795,42 +2795,44 @@ export default {
       if (status > 0) {
         data.status = status;
       }
-      // console.log("提交接口:", data,'sectionId:', sectionId,'chapterId:', self.chapterId,'moduleId:', self.moduleId, 'courseId:', this.courseId);
-      return this.$api
-        .studyRecord(data)
-        .then((res) => {
-          if (res.data.code == 200) {
-            if (status > 0) {
-              this.studyRecordMenuAllList();
-              let moduleId = this.moduleId || 0;
-              let chapterId = this.chapterId || 0;
-              let playNextIdisRebuild = `moduleId${moduleId}chapterId${chapterId}sectionId${sectionId}isRebuild`;
-              let playNextId = `moduleId${moduleId}chapterId${chapterId}sectionId${sectionId}`; //拼接对应章节唯一id
+      console.log(data,'记录参数')
+      return new Promise((resolve, reject) => {
+        this.$api
+          .studyRecord(data)
+          .then((res) => {
+            console.log(res,'记录返回')
+            if (res.data.code == 200) {
+              if (status > 0) {
+                this.studyRecordMenuAllList();
+                let moduleId = this.moduleId || 0;
+                let chapterId = this.chapterId || 0;
+                let playNextIdisRebuild = `moduleId${moduleId}chapterId${chapterId}sectionId${sectionId}isRebuild`;
+                let playNextId = `moduleId${moduleId}chapterId${chapterId}sectionId${sectionId}`; //拼接对应章节唯一id
 
-              uni.$emit("playNext" + playNextIdisRebuild, {
-                fromRebuild: this.isRebuild,
-              }); //通知播放结束,不来自重修目录的点击不用弹窗学习下一节
-              uni.$emit("playNext" + playNextId); //通知播放结束
-            }
-            self.ossAvatarUrl = "";
-            this.isReach = false;
-            return Promise.resolve();
-          } else {
-            this.uploadLock = false;
-            uni.showToast({
-              icon: "none",
-              title: res.data.msg,
-            });
-            if (this.erJianErZao && res.data.code == 559) {
-              this.isReach = true;
-              this.openPhoto();
-              return Promise.reject();
+                uni.$emit("playNext" + playNextIdisRebuild, {
+                  fromRebuild: this.isRebuild,
+                }); //通知播放结束,不来自重修目录的点击不用弹窗学习下一节
+                uni.$emit("playNext" + playNextId); //通知播放结束
+              }
+              self.ossAvatarUrl = "";
+            } else {
+              this.uploadLock = false;
+              uni.showToast({
+                icon: "none",
+                title: res.data.msg,
+              });
+              if (this.erJianErZao && res.data.code == 559) {
+                this.isReach = true;
+                this.openPhoto();
+                reject('中断执行');
+              }
             }
-          }
-        })
-        .catch((err) => {
-          this.studyRecordMenuAllList();
-        });
+            resolve();
+          })
+          .catch((err) => {
+            this.studyRecordMenuAllList();
+          });
+      });
     },
     uploadFile(options, int) {
       var self = this;
@@ -3064,9 +3066,10 @@ export default {
         },
       }).then((res) => {});
     },
-    onStateChange(newstate, oldstate) {
+    async onStateChange(newstate, oldstate) {
       polyvPlayerContext = this.selectComponent("#playerVideo");
       if (newstate.detail.newstate == "playing") {
+        console.log('重新播放123123')
         this.pauseTime = 0;
         if (this.needSeek) {
           // var polyvPlayerContext = this.selectComponent("#playerVideo");
@@ -3110,13 +3113,14 @@ export default {
           title: "播放完毕",
         });
         this.hasStart = false;
-        this.postStudyRecord(1);
+        await this.postStudyRecord(1);
         this.nextSection();
         // uni.$emit('playNext') //播放重修下一节
       }
     },
     //播放下一节
     nextSection() {
+      console.log("播放下一节")
       if (!this.menuAllList.length) {
         return;
       }
@@ -3331,9 +3335,13 @@ export default {
             this.photoHistoryList.push(this.photoIndex);
             // console.log('拍照确定提交', this.photoHistoryList);
             this.postStudyRecord(); //提交记录
+            console.log(this.erJianErZao , this.isReach)
             if (this.erJianErZao && this.isReach) {
               await this.postStudyRecord(1);
+              this.nextSection();
+              return
             }
+            console.log(65465456)
             //恢复播放
             // #ifdef MP-WEIXIN
             uni.setKeepScreenOn({
@@ -3727,7 +3735,6 @@ export default {
       const polyvPlayer = window.polyvPlayer;
       this.pauseTime = 0;
       this.$api.polyvVideoSign(this.vid).then(async (res) => {
-        console.log("播放凭证res", res, 465555555555555555555);
         this.player = await polyvPlayer({
           wrap: "#player",
           width: "100%",
@@ -3757,7 +3764,7 @@ export default {
         polyvPlayerContext = this.player;
         console.log("this.player:", this.player);
 
-        this.player.on("s2j_onPlayStart", (vid) => {
+        this.player.on("s2j_onPlayStart", async (vid) => {
           // 视频初次播放时触发
           console.log("视频初次播放时触发:");
           // #ifdef H5
@@ -3826,7 +3833,7 @@ export default {
           }, 15000);
         });
 
-        this.player.on("s2j_onPlayOver", () => {
+        this.player.on("s2j_onPlayOver", async () => {
           // 当前视频播放完毕时触发
           console.log("结束了结束了");
           this.hasStart = false;
@@ -3836,7 +3843,7 @@ export default {
             icon: "none",
             title: "播放完毕",
           });
-          this.postStudyRecord(1);
+          await this.postStudyRecord(1);
           this.nextSection(); // 播放下一节
         });
       });