谢杰标 2 vuotta sitten
vanhempi
commit
70049871b2
2 muutettua tiedostoa jossa 27 lisäystä ja 73 poistoa
  1. 2 2
      components/popup/camera.vue
  2. 25 71
      pages3/polyv/detail.vue

+ 2 - 2
components/popup/camera.vue

@@ -124,7 +124,7 @@
     <!-- 拍照提示 -->
     <popup-photo
       :popupPhotoShow.sync="popupPhotoShow"
-      @takePhoto="toTakePhoto()"
+      @takePhoto="openCamera"
     ></popup-photo>
   </view>
 </template>
@@ -394,7 +394,7 @@ export default {
       });
     },
     getUserMedia(constraints, success, error) {
-      console.log("getUserMedia===", constraints, "success:", success);
+      console.log("getUserMedia===", constraints,);
       if (window.navigator.mediaDevices.getUserMedia) {
         // 最新的标准API
         window.navigator.mediaDevices

+ 25 - 71
pages3/polyv/detail.vue

@@ -554,12 +554,11 @@ export default {
     if (this.$method.isGoLogin()) {
       return;
     }
-
-    this.option.isQ !== "" && (await this.qCheckIsCanLearn(orderGoodsId));
+    this.orderGoodsId = Number(orderGoodsId) || "";
+    this.isCanLearn();
     !this.userInfo && this.$api.refreshUserInfo();
     this.courseId = Number(id) || "";
     this.goodsId = Number(goodsId);
-    this.orderGoodsId = Number(orderGoodsId) || "";
     this.gradeId = Number(gradeId);
     // 公众号模板消息的数据埋点
     informId && this.clickOfficial(informId);
@@ -593,8 +592,8 @@ export default {
       this.lockTimer = setInterval(lockAction, 10000);
     },
     // 七大员是否能进入学习
-    async qCheckIsCanLearn(orderGoodsId) {
-      let res = await this.$api.qCheckIsCanLearn(orderGoodsId);
+    async qCheckIsCanLearn() {
+      let res = await this.$api.qCheckIsCanLearn(this.orderGoodsId);
       if (res.data.code !== 200) {
         uni.showModal({
           showCancel: false,
@@ -607,7 +606,7 @@ export default {
         return Promise.reject();
       }
       let res1 = await this.$api.syncSevenPublicClass({
-        orderGoodsId,
+        orderGoodsId: this.orderGoodsId,
       });
       if (res1.data.code !== 200) {
         uni.showModal({
@@ -848,8 +847,6 @@ export default {
         this.chapterId = item.chapterId || null;
 
         this.$store.commit("setPlayChannelId", { playChannelId: 0 });
-        //获取拍照历史
-        this.getPhotoLastRecord();
         this.playVideo(item);
       });
       uni.$on("levelId", (item) => {
@@ -869,7 +866,6 @@ export default {
         this.$store.commit("setPlaySectionId", {
           playSectionId: item.sectionId || item.menuId,
         });
-        this.getPhotoLastRecord();
         this.playChannel(item);
         this.channelItem = item;
       });
@@ -902,7 +898,6 @@ export default {
       this.$store.commit("setPlaySectionId", { playSectionId: 0 });
       this.$store.commit("setPlayChannelId", { playChannelId: 0 });
       this.$store.commit("setPlayVID", { playVID: null });
-      this.closePlv();
       //移除所有的事件监听器
       uni.$off();
       this.clearTimer && clearTimeout(this.clearTimer);
@@ -1070,7 +1065,6 @@ export default {
       this.chapterId = sectionItem.chapterId;
       if (sectionItem.sectionType == 1) {
         //录播
-        await this.getPhotoLastRecord(); // 获取拍照历史
         this.playVideo(sectionItem);
       } else if (sectionItem.sectionType == 2) {
         //直播
@@ -1384,6 +1378,7 @@ export default {
       return Promise.resolve();
     },
     async isCanLearn() {
+      this.option.isQ !== "" && (await this.qCheckIsCanLearn());
       await this.getbaseprofiletplists();
       await this.getGradeInfo();
       await this.getGoodsDetail();
@@ -1408,21 +1403,22 @@ export default {
       this.refPlv = this.$refs.player;
     },
     getPhotoLastRecord() {
-      if (this.erJianErZao || !this.playSecIsLearn || this.photoNum <= 0) {
-        return;
-      }
+      // if (this.erJianErZao || !this.playSecIsLearn || this.photoNum <= 0) {
+      //   return;
+      // }
       let self = this;
+      let { chapterId, sectionId, moduleId } = this.sectionItem;
       let data = {
-        sectionId: parseInt(self.playSectionId),
-        goodsId: parseInt(self.goodsId),
-        courseId: parseInt(self.courseId),
-        gradeId: parseInt(self.gradeId),
-        chapterId: parseInt(self.chapterId),
-        moduleId: parseInt(self.moduleId),
+        sectionId: sectionId || 0,
+        goodsId: this.goodsId,
+        courseId: this.courseId,
+        gradeId: this.gradeId,
+        chapterId: chapterId || 0,
+        moduleId: moduleId || 0,
         orderGoodsId: this.orderGoodsId,
       };
-      // /course/photo/log/getLastInfo'
       this.$api.getPhotoLastRecord(data).then((res) => {
+        console.log(res.data.data, 99999999999);
         if (res.data.code == 200) {
           //清空历史数据
           self.photoHistoryList = [];
@@ -1567,6 +1563,7 @@ export default {
         for (let i = 1; i < num; i++) {
           photoList.push(i * fixS);
         }
+        this.photoNum = num + 1;
       } else {
         if (this.photoNum == 3) {
           if (totalVideoTime >= 900) {
@@ -1609,52 +1606,6 @@ export default {
         });
       });
     },
-    timeEventLiving() {
-      if (plv != null) {
-        if (this.livePlay) {
-          this.liveDuration = this.liveDuration + 1; //每隔1秒
-          if (this.liveDuration == 2) {
-            //直播第2秒拍照
-            if (
-              this.goodsPhotographConfig &&
-              this.goodsPhotographConfig.livephotograph == 1 &&
-              this.channelItem.learning != 1 &&
-              this.photoHistoryList.length == 0
-            ) {
-              //开启直播拍照
-              this.openPhoto();
-            } else {
-              this.postStudyRecord(0);
-            }
-          }
-        }
-      }
-    },
-    playerLiveStatusChange(e) {
-      const status = e.detail.status;
-      if (status === "live") {
-        //开始播放
-        if (this.timer) {
-          clearInterval(this.timer);
-        }
-        this.livePlay = true;
-        this.timer = setInterval(this.timeEventLiving, 1000); //定时器
-      }
-      if (status === "end") {
-        this.hasStart = false;
-        if (this.livePlay) {
-          //只有播放过的结束才提交,避免未开播触发结束
-          this.postStudyRecord(1);
-        }
-        this.livePlay = false;
-        // 未开始
-      }
-    },
-    closePlv() {
-      if (plv) {
-        plv.destroy();
-      }
-    },
     studyNotice() {
       this.noticeShow = true;
     },
@@ -1669,8 +1620,9 @@ export default {
       this.recordObj = videoCurrentTime
         ? { videoCurrentTime }
         : await this.getRecordLast(item);
+      await this.getPhotoLastRecord();
       // 查找拍照历史
-      if (this.photoNum > 0 && learning != 1) {
+      if ((this.photoNum > 0 || this.jjShiGongYuan) && learning != 1) {
         await this.getPhotoLastRecord();
       }
       this.$store.commit("setPlayVID", {
@@ -2018,7 +1970,7 @@ export default {
         this.postStudyRecord(0);
       }, 15000);
     },
-    openCamera(){
+    openCamera() {
       this.$refs["camera"].openCamera();
     },
     pause() {
@@ -2114,7 +2066,6 @@ export default {
                 this.photoConfig = false;
                 this.photoIndex = 0;
                 this.sectionItem = data;
-                await this.getPhotoLastRecord(); // 获取拍照历史
                 this.playVideo(data);
               } else if (data.sectionType == 2) {
                 //直播
@@ -2339,7 +2290,10 @@ export default {
     },
     async getGoodsDetail() {
       let { data } = await this.$api.goodsDetail(this.goodsId);
-      console.log("🚀 ~ file: detail.vue:2342 ~ getGoodsDetail ~ data:", data)
+      console.log(
+        "🚀 ~ file: detail.vue:2342 ~ getGoodsDetail ~ data:",
+        data.data
+      );
       this.goodsData = data.data;
       this.erJianErZao = this.goodsData.erJianErZao;
       this.erJianErZao && (await this.userConfirmInfoDetail());