Kaynağa Gözat

fix: 授权相机和牌照框同时出现的问题。多课程默认显示一个课程

xuqiaoying 3 yıl önce
ebeveyn
işleme
e64c7990d6
2 değiştirilmiş dosya ile 39 ekleme ve 26 silme
  1. 6 5
      pages3/live/detail.vue
  2. 33 21
      pages3/polyv/detail.vue

+ 6 - 5
pages3/live/detail.vue

@@ -755,7 +755,6 @@ export default {
     ...mapGetters(["userInfo", "playSectionId", "playChannelId", "playVID"]),
   },
   onLoad(option) {
-    // console.log('====option', option, this.playChannelId)
     this.options = option
     this.courseId = option.courseId || ''
     this.goodsId = Number(option.goodsId);
@@ -857,13 +856,15 @@ export default {
         if (res.data.code == 200) {
           if (res.data.data && Object.keys(res.data.data).length) { //有最后一次看的录播的信息
             this.courseId = res.data.data.courseId
-            this.originOnShow()
-            this.originOnMount()
           } else {
-            this.toggleCourseShow = true
+            this.courseId = this.courseList[0].courseId // 没有观看记录默认一个课程
+            // this.toggleCourseShow = true
           }
-          
+        } else {
+          this.courseId = this.courseList[0].courseId // 没有观看记录默认一个课程
         }
+        this.originOnShow()
+        this.originOnMount()
       })
     },
     // 原来onshow里面的内容

+ 33 - 21
pages3/polyv/detail.vue

@@ -746,11 +746,30 @@ export default {
       teacherIndex: 0,
       newActiveSubjectId: "", //当前选中ID
       compareFaceData: 0, // 拍照匹配相似度
+      prendreAutoCarme: false, // 是否发起授权相机
     };
   },
   computed: {
     ...mapGetters(["userInfo", "playSectionId", "playChannelId", "playVID"]),
   },
+  watch: {
+    showSet(n) {
+      if (n) {
+        var polyvPlayerContext = this.selectComponent("#playerVideo")
+        if (polyvPlayerContext) {
+          polyvPlayerContext.pause()
+        }
+      }
+    },
+    photoPopup(n) {
+      if (n) {
+        if (this.prendreAutoCarme ) {
+          this.photoPopup = false
+        }
+        this.showSet && (this.photoPopup = false)
+      }
+    }
+  },
   onLoad(option) {
     this.courseId = Number(option.id) || '';
     this.goodsId = Number(option.goodsId);
@@ -869,18 +888,18 @@ export default {
           this.sectionItem = res.data.data
           if (res.data.data && Object.keys(res.data.data).length) { //有最后一次看的录播的信息
             this.courseId = res.data.data.courseId
-            console.log('查询用户最后一次看的录播的信息', res.data, this.courseId)
-            this.originOnShow()
-            this.originMounted()
-
-            //获取商品双师资模板
-            this.getCourseTeacher(this.courseList)
+            // console.log('查询用户最后一次看的录播的信息', res.data, this.courseId)
           } else {
-            this.getCourseTeacher(this.courseList)
-            this.toggleCourseShow = true
+            this.courseId = this.courseList[0].courseId // 没有观看记录默认一个课程
+            // this.toggleCourseShow = true
           }
-          
+        } else {
+          this.courseId = this.courseList[0].courseId // 没有观看记录默认一个课程
         }
+        this.originOnShow()
+        this.originMounted()
+        //获取商品双师资模板
+        this.getCourseTeacher(this.courseList)
       })
     },
     getCourseTeacher(rows) {
@@ -888,7 +907,6 @@ export default {
       this.$api.courseTeacherList({
           goodsId: this.goodsId
       }).then((res1) => {
-        console.log(res1,'res1');
         if(res1.data.data && res1.data.data.length > 0){
             //课程老师模板
             let teacherTel = res1.data.data;
@@ -1175,7 +1193,6 @@ export default {
                   //   orderGoodsId: this.orderGoodsId,
                   // });
                   this.courseId = item.courseId
-                  // this.toggleCourseShow = false
                   this.originOnShow()
                   this.originMounted()
                 }
@@ -1227,7 +1244,6 @@ export default {
                       //   orderGoodsId: this.orderGoodsId,
                       // });
                       this.courseId = item.courseId
-                      // this.toggleCourseShow = false
                       this.originOnShow()
                       this.originMounted()
                     }
@@ -1276,7 +1292,6 @@ export default {
                     //   orderGoodsId: this.orderGoodsId,
                     // });
                     this.courseId = item.courseId
-                    // this.toggleCourseShow = false
                     this.originOnShow()
                     this.originMounted()
                   }
@@ -2081,22 +2096,20 @@ export default {
           if (res.authSetting["scope.camera"]) {
             // 用户已经授权
             self.showSet = false;
+            this.prendreAutoCarme = false
           } else {
+            this.prendreAutoCarme = true
             // 用户还没有授权,向用户发起授权请求
             wx.authorize({
               scope: "scope.camera",
-              success() {
+              success:() =>{
                 // 用户同意授权
                 self.showSet = false;
+                this.prendreAutoCarme = false
               },
-              fail() {
+              fail:() => {
                 // 用户不同意授权
                 self.showSet = true;
-                /* wx.showToast({
-		                title: '摄像头授权失败',
-		                icon: 'none',
-		                duration: 3000
-		              }) */
               },
             });
           }
@@ -2601,7 +2614,6 @@ export default {
           orderGoodsId: this.orderGoodsId,
         }
       }).then((res) => {
-        console.log('直播的用户学习日志:', res)
       })
     },
     onStateChange(newstate, oldstate) {