谢杰标 2 năm trước cách đây
mục cha
commit
c51917e9d6
1 tập tin đã thay đổi với 37 bổ sung69 xóa
  1. 37 69
      pages3/polyv/detail.vue

+ 37 - 69
pages3/polyv/detail.vue

@@ -797,10 +797,8 @@ export default {
       noteValue: "",
       noteId: 0,
       recordObj: {},
-      gradeDetail: {},
       isTaking: true, //是否正在拍照
       needSeek: false, //第一次播放是否需要跳转
-      needProfileModal: false, //是否需要资料审核弹框
       photoNum: 0,
       photoList: [], //拍照的时间点
       photoConfig: false, //是否配置好拍照次数
@@ -835,7 +833,6 @@ export default {
       menuAllList: [],
       popupPhotoShow: false,
       curPlayIndex: 0, // 正在播放的节的下标
-      H5isAllowSeek: "on",
       faceUrl: "",
       erJianErZao: false,
       pauseTime: 0,
@@ -911,25 +908,21 @@ export default {
     }
     this.option = option;
     let { skipPort, id, goodsId, orderGoodsId, gradeId, informId } = option;
-    console.log("🚀 ~ file: detail.vue:928 ~ onLoad ~ id:", option);
     if (skipPort) {
       await this.$method.skipLogin(skipPort);
     }
     if (this.$method.isGoLogin()) {
       return;
     }
-    // 公众号模板消息的数据埋点
-    informId && this.clickOfficial(informId);
-    !this.userInfo && this.$api.refreshUserInfo();
     this.courseId = Number(id) || "";
     this.goodsId = Number(goodsId);
     this.orderGoodsId = Number(orderGoodsId) || "";
     this.gradeId = gradeId;
-    // 锁
-    lockAction();
-    this.lockTimer = setInterval(lockAction, 10000);
-    // 看是否需要填写资料
-    await this.getbaseprofiletplists();
+    await this.isCanLearn();
+    !this.userInfo && this.$api.refreshUserInfo();
+    // 公众号模板消息的数据埋点
+    informId && this.clickOfficial(informId);
+    this.init();
     this.courseCourseList();
   },
   async onShow() {
@@ -947,6 +940,19 @@ export default {
   mounted() {},
   methods: {
     ...mapMutations(["updateChapterOpen", "updateLiveLast"]),
+    init() {
+      // #ifdef MP-WEIXIN
+      this.getCameraSetting();
+      this.isAllowSeek = "no"
+      // #endif
+      // #ifdef H5
+      this.isAllowSeek = "on" 
+      // #endif
+      // 锁
+      lockAction();
+      this.lockTimer = setInterval(lockAction, 10000);
+
+    },
     // 新增微信公众号模板消息点击数据
     clickOfficial(informId) {
       this.$http({
@@ -1141,7 +1147,7 @@ export default {
         this.jumpNote({
           sectionType: 1,
           ...this.option,
-        })
+        });
         return;
       }
       this.studyRecordQueryLiveLast();
@@ -1432,16 +1438,6 @@ export default {
             }
           } else {
             this.CountTo = -1;
-            if (this.goodsPlayConfig && this.goodsPlayConfig.autoPlay > 0) {
-              // #ifdef MP-WEIXIN
-              this.autoplay = true;
-              // var polyvPlayerContext = this.selectComponent("#playerVideo");
-              // polyvPlayerContext.play();
-              // #endif
-              // #ifdef H5
-              // polyvPlayerContext.j2s_resumeVideo()
-              // #endif
-            }
           }
         });
     },
@@ -1706,9 +1702,6 @@ export default {
         });
     },
     async getbaseprofiletplists() {
-      // #ifdef MP-WEIXIN
-      this.getCameraSetting();
-      // #endif
       let {
         data: { code, rows },
       } = await this.$api.getbaseprofiletplists({
@@ -1728,7 +1721,6 @@ export default {
             code === 200 &&
             (!data || (data.status === 3 && data.changeStatus === 1))
           ) {
-            this.needProfileModal = true;
             uni.showModal({
               content: !data
                 ? "请前往填写资料"
@@ -1758,7 +1750,6 @@ export default {
               code === 200 &&
               (!data || (data.status === 3 && data.changeStatus === 1))
             ) {
-              this.needProfileModal = true;
               uni.showModal({
                 content: !data
                   ? "请前往填写盖章资料"
@@ -1786,7 +1777,6 @@ export default {
         let info = await this.$api.userConfirmInfoDetail({
           orderGoodsId: this.orderGoodsId,
         });
-        return Promise.resolve();
         if (!info.data.data || info.data.data.pushInfo !== 1) {
           uni.showModal({
             showCancel: false,
@@ -1801,6 +1791,10 @@ export default {
       }
       return Promise.resolve();
     },
+    async isCanLearn() {
+      await this.getbaseprofiletplists();
+      await this.getGradeInfo();
+    },
     /**
      * 计算tabs宽度
      */
@@ -2115,7 +2109,7 @@ export default {
           videoCurrentTime: Number(item.noteSecond),
         });
       } else {
-        this.refPlv.seekVideo(item.noteSecond)
+        this.refPlv.seekVideo(item.noteSecond);
       }
     },
     postNote() {
@@ -2157,43 +2151,27 @@ export default {
     },
     getGradeInfo() {
       // 即刻 1  待定2  日期3
-      let self = this;
-      this.$store.state.allowLoading = false;
-      this.$api.goodsGradeInfo(this.gradeId).then((res) => {
+      return this.$api.goodsGradeInfo(this.gradeId).then((res) => {
         if (res.data.code == 200) {
-          self.gradeDetail = res.data.data;
-          if (self.needProfileModal) {
-            return;
-          }
-          if (self.gradeDetail.learningStatus == 2) {
-            uni.showModal({
-              showCancel: false,
-              confirmText: "确定",
-              content:
-                "当前课程正在申请中,正式开班后方可进行学习,请耐心等候!",
-              success: function (resultst) {
-                uni.navigateBack();
-              },
-            });
-          }
+          let { data } = res.data;
           if (
-            self.gradeDetail.learningStatus == 3 &&
-            Number(self.gradeDetail.learningTimeStart) >
-              Number(new Date() / 1000)
+            data.learningStatus == 2 ||
+            (data.learningStatus == 3 &&
+              Number(data.learningTimeStart) > Number(new Date() / 1000))
           ) {
             uni.showModal({
               showCancel: false,
-              cancelText: "返回",
+              confirmText: "确定",
               content:
                 "当前课程正在申请中,正式开班后方可进行学习,请耐心等候!",
               success: function (resultst) {
                 uni.navigateBack();
               },
             });
+            return Promise.reject(123);
           }
         }
       });
-      this.$store.state.allowLoading = true;
     },
     getNoteList() {
       if (this.current != 2) {
@@ -2683,7 +2661,6 @@ export default {
         });
       }
     },
-
     //拍照
     openPhoto() {
       if (polyvPlayerContext) {
@@ -2956,20 +2933,11 @@ export default {
       this.$api.goodsDetail(this.goodsId).then(async (res) => {
         this.goodsData = res.data.data;
         this.option.periodWaitTime && (await this.checkFinishRequiredCourse());
-        if (this.goodsData.buyNote) {
-          this.baseHandoutTipList();
-        }
-        self.gradeId = self.goodsData.gradeId;
-        self.erJianErZao = self.goodsData.erJianErZao;
-        self.getMenuList();
-        self.getReMenuList(); //获取重修目录
-        setTimeout(function () {
-          if (!self.needProfileModal) {
-            self.getGradeInfo();
-          }
-        }, 500);
-        //获取节笔记
-        this.getNoteList();
+        this.goodsData.buyNote && this.baseHandoutTipList();
+        this.gradeId = this.goodsData.gradeId;
+        this.erJianErZao = this.goodsData.erJianErZao;
+        this.getMenuList();
+        this.getReMenuList(); //获取重修目录
         if (self.goodsData.goodsPlayConfig) {
           self.goodsPlayConfig = JSON.parse(self.goodsData.goodsPlayConfig);
           if (self.goodsPlayConfig.autoPlay > 0) {
@@ -2980,7 +2948,7 @@ export default {
             self.isAllowSeek = "yes";
             // #endif
             // #ifdef H5
-            self.H5isAllowSeek = "off";
+            self.isAllowSeek = "off";
             // #endif
           }
           if (self.goodsPlayConfig.speed > 0) {