Преглед изворни кода

对接599拍照是否够数量

谢杰标 пре 2 година
родитељ
комит
1ef805be98
1 измењених фајлова са 30 додато и 14 уклоњено
  1. 30 14
      pages3/polyv/detail.vue

+ 30 - 14
pages3/polyv/detail.vue

@@ -924,6 +924,7 @@ export default {
       pauseTime: 0,
       pauseTimer: null,
       barTimer: null,
+      isReach: false,
     };
   },
   computed: {
@@ -1012,7 +1013,7 @@ export default {
       // /course/courseList查询商品下的课程列表
       this.courseList = [];
       this.menuList = [];
-      this.photoConfig = false
+      this.photoConfig = false;
       this.$api
         .courseCourseList({
           pageNum: 1,
@@ -1185,7 +1186,7 @@ export default {
                 }
               },
             });
-            this.clearPauseTimer()
+            this.clearPauseTimer();
           }
         }, 5000);
       }
@@ -1309,7 +1310,7 @@ export default {
       });
       this.updateChapterOpen(true);
     },
-    clearPauseTimer(){
+    clearPauseTimer() {
       if (this.pauseTimer) {
         clearInterval(this.pauseTimer);
         this.pauseTimer = null;
@@ -1336,7 +1337,7 @@ export default {
         clearInterval(this.studyTimer);
         this.hasStart = false;
       }
-      this.clearPauseTimer()
+      this.clearPauseTimer();
       if (this.barTimer) {
         clearInterval(this.barTimer);
         this.barTimer = null;
@@ -2795,7 +2796,7 @@ export default {
         data.status = status;
       }
       // console.log("提交接口:", data,'sectionId:', sectionId,'chapterId:', self.chapterId,'moduleId:', self.moduleId, 'courseId:', this.courseId);
-      this.$api
+      return this.$api
         .studyRecord(data)
         .then((res) => {
           if (res.data.code == 200) {
@@ -2811,14 +2812,20 @@ export default {
               }); //通知播放结束,不来自重修目录的点击不用弹窗学习下一节
               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();
+            }
           }
         })
         .catch((err) => {
@@ -3085,7 +3092,8 @@ export default {
         //开始播放
         this.timer && clearInterval(this.timer);
         if (this.playSecIsLearn && (this.erJianErZao || this.photoNum > 0)) {
-          this.clearPauseTimer()
+          this.clearPauseTimer();
+          this.isReach = false;
           this.timer = setInterval(this.timeEvent, 1000); //定时器
         }
       }
@@ -3319,10 +3327,13 @@ export default {
       if (compareFaceData >= 80) {
         const waitYS = await this.imageInfos();
         this.postCoursePhotoRecord()
-          .then((res) => {
+          .then(async (res) => {
             this.photoHistoryList.push(this.photoIndex);
             // console.log('拍照确定提交', this.photoHistoryList);
             this.postStudyRecord(); //提交记录
+            if (this.erJianErZao && this.isReach) {
+              await this.postStudyRecord(1);
+            }
             //恢复播放
             // #ifdef MP-WEIXIN
             uni.setKeepScreenOn({
@@ -3368,12 +3379,16 @@ export default {
       this.isTaking = true;
       // #ifdef H5
       this.faceUrl = "";
-      this.getUserMedia({
-        video: {
-          width: 400,
-          height: 300,
+      this.getUserMedia(
+        {
+          video: {
+            width: 400,
+            height: 300,
+          },
         },
-      });
+        this.photographSuccess,
+        this.photographError
+      );
       // #endif
     },
     toTakePhoto() {
@@ -3800,7 +3815,8 @@ export default {
           //开始播放
           this.timer && clearInterval(this.timer);
           if (this.playSecIsLearn && (this.erJianErZao || this.photoNum > 0)) {
-            this.clearPauseTimer()
+            this.isReach = false;
+            this.clearPauseTimer();
             this.timer = setInterval(this.timeEvent, 1000); //定时器
           }