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

Merge branch 'chen' into dev

chenxiong пре 3 година
родитељ
комит
55e5f4c6fe

+ 38 - 10
src/pages/course-detail/index.vue

@@ -225,7 +225,7 @@
                                                 <div
                                                   class="live-btn"
                                                   v-if="
-                                                    section.liveStartTime <
+                                                    section.liveEndTime <
                                                     nowTime
                                                   "
                                                 >
@@ -417,7 +417,7 @@
                                                 <div
                                                   class="live-btn"
                                                   v-if="
-                                                    section.liveStartTime <
+                                                    section.liveEndTime <
                                                     nowTime
                                                   "
                                                 >
@@ -513,6 +513,27 @@
                                           </div>
                                           <div class="bank-section__item__text">
                                             {{ menu.name }}
+                                            <div
+                                              v-if="
+                                                menu.liveStartTime > nowTime
+                                              "
+                                            >
+                                              <span>{{
+                                                $tools.timestampToTime(
+                                                  menu.liveStartTime,
+                                                  (isDay = false)
+                                                )
+                                              }}</span
+                                              >-
+                                              <span>{{
+                                                $tools
+                                                  .timestampToTime(
+                                                    menu.liveEndTime,
+                                                    (isDay = false)
+                                                  )
+                                                  .substr(11, 9)
+                                              }}</span>
+                                            </div>
                                           </div>
                                         </template>
 
@@ -564,7 +585,7 @@
                                           </div>
                                           <div
                                             class="live-btn"
-                                            v-if="menu.liveStartTime < nowTime"
+                                            v-if="menu.liveEndTime < nowTime"
                                           >
                                             已结束
                                           </div>
@@ -733,7 +754,7 @@
                                                 <div
                                                   class="live-btn"
                                                   v-if="
-                                                    section.liveStartTime <
+                                                    section.liveEndTime <
                                                     nowTime
                                                   "
                                                 >
@@ -925,7 +946,7 @@
                                                 <div
                                                   class="live-btn"
                                                   v-if="
-                                                    section.liveStartTime <
+                                                    section.liveEndTime <
                                                     nowTime
                                                   "
                                                 >
@@ -1072,7 +1093,7 @@
                                           </div>
                                           <div
                                             class="live-btn"
-                                            v-if="menu.liveStartTime < nowTime"
+                                            v-if="menu.liveEndTime < nowTime"
                                           >
                                             已结束
                                           </div>
@@ -2371,6 +2392,8 @@ export default {
         })
         .then((res) => {});
     }
+
+    clearInterval(this.livingTimer);
   },
   methods: {
     async takeOk() {
@@ -4389,10 +4412,15 @@ export default {
         uid: this.uidzb,
         vid: this.vidzb,
       });
-      console.log(this.playerzb);
-      this.livingTimer = setInterval(self.timeEventLiving, 1000);
 
-      this.playerzb.on("s2j_onPlayOver", () => {
+      this.playerzb.on("s2j_onStartPlay", () => {
+        console.log('s2j_onStartPlay')
+        this.livingTimer = setInterval(self.timeEventLiving, 1000);
+      });
+
+      this.playerzb.on("s2j_onOver", () => {
+        console.log("s2j_onOver");
+        clearInterval(this.livingTimer);
         this.$message({
           type: "success",
           message: "播放完毕",
@@ -4897,10 +4925,10 @@ export default {
     refreshParentList(sectionItem, rebuildObj) {
       console.log(sectionItem, "sectionItem");
       console.log(rebuildObj, "rebuildObj");
+      let self = this;
       if (sectionItem.menuId) {
         //最外层节有menuid
         //普通章节目录
-        let self = this;
         this.$request
           .reMenuList({ courseId: this.courseId, gradeId: this.gradeId })
           .then((res) => {

+ 8 - 3
src/pages/goods-detail/course-detail.vue

@@ -861,9 +861,14 @@ export default {
         });
 
         self.player.on("s2j_onPlayOver", () => {
-          this.$message({
-            type: "success",
-            message: "试看结束,购买课程可学习全部",
+          this.$confirm("试看结束,购买课程可学习全部", "提示", {
+            closeOnClickModal: false,
+            showCancelButton: false,
+            closeOnPressEscape: false,
+            distinguishCancelAndClose: false,
+            showClose: false,
+          }).then((res) => {
+            this.videoModalShow = false;
           });
         });
       });

+ 2 - 0
src/pages/payment/index.vue

@@ -293,6 +293,7 @@ export default {
             if (this.isBK) {
               this.$router.replace({
                 path: "/payment-success",
+                name: "支付成功",
                 params: {
                   orderSn: this.orderSn,
                   total: this.total,
@@ -305,6 +306,7 @@ export default {
             } else {
               this.$router.replace({
                 path: "/payment-success",
+                name: "支付成功",
                 params: {
                   orderSn: this.orderSn,
                   total: this.total,

+ 33 - 33
src/pages/person-center/my-course/index.vue

@@ -694,44 +694,44 @@ export default {
       }
 
       if (item.educationName == "继续教育") {
-        // this.$request
-        //   .lockLockStatus({
-        //     action: "jxjy",
-        //   })
-        //   .then((res) => {
-        //     //有其他端在操作,不能学习
-        //     this.$message({
-        //       type: "warning",
-        //       message: res.msg,
-        //     });
-        //   })
-        //   .catch((err) => {
-        //可以学习
         this.$request
-          .courseCourseList({
-            pageNum: 1,
-            pageSize: 1,
-            goodsId: item.goodsId,
-            gradeId: item.gradeId,
+          .lockLockStatus({
+            action: "jxjy",
           })
           .then((res) => {
-            if (res.rows.length) {
-              this.$router.push({
-                path: `/my-course-detail/${item.goodsId}`,
-                query: {
-                  gradeId: item.gradeId,
-                  orderGoodsId: item.orderGoodsId,
-                  courseId: res.rows[0].courseId || "",
-                },
-              });
-            } else {
-              this.$message({
-                type: "warning",
-                message: "课程内暂无可以学习的科目",
+            //有其他端在操作,不能学习
+            this.$message({
+              type: "warning",
+              message: res.msg,
+            });
+          })
+          .catch((err) => {
+            //可以学习
+            this.$request
+              .courseCourseList({
+                pageNum: 1,
+                pageSize: 1,
+                goodsId: item.goodsId,
+                gradeId: item.gradeId,
+              })
+              .then((res) => {
+                if (res.rows.length) {
+                  this.$router.push({
+                    path: `/my-course-detail/${item.goodsId}`,
+                    query: {
+                      gradeId: item.gradeId,
+                      orderGoodsId: item.orderGoodsId,
+                      courseId: res.rows[0].courseId || "",
+                    },
+                  });
+                } else {
+                  this.$message({
+                    type: "warning",
+                    message: "课程内暂无可以学习的科目",
+                  });
+                }
               });
-            }
           });
-        // });
       } else {
         this.$request
           .courseCourseList({

+ 107 - 24
src/router/index.js

@@ -7,7 +7,7 @@ Vue.use(Router)
 
 let bankAdmin = ['/person-center/bank-record','/person-center/my-bank/index','/person-center/my-collect','/person-center/my-wrong','/person-center/my-bank/bank-detail/','/person-center/my-bank/bank-statistics/','/person-center/my-bank/bank-explain-detail/','/bank-exam-continue/','/bank-exam/','/subject/collect-bank/','/bank-exam-explain/','/bank-report/'];
 let canToBank = null;
-let courseAdmin = []
+let courseAdmin = ['/my-course-detail/','/course-exam/']
 let canToCourse = null;
 
 const router =  new Router({
@@ -325,13 +325,12 @@ router.beforeEach((to,from,next) => {
         store.dispatch('getUserInfo')
       }
 
-      //题库页面要检测是否有人锁定
-      let isLock = bankAdmin.some(item => {
+      //题库页面要检测是否需要锁定
+      let isBankLock = bankAdmin.some(item => {
         return to.path.indexOf(item) != -1
       })
 
-      console.log(isLock,'isLock')
-      if(isLock) {
+      if(isBankLock) {
         console.log(canToBank,'canToBank')
         
         //没有执行定时器,开启锁定
@@ -354,20 +353,20 @@ router.beforeEach((to,from,next) => {
               }
 
             }).catch(err => {
-              // console.log(err,'err')
-              // //可以学习,开启锁定
-              //   canToBank = 1;
-              // request.lockLockAction({
-              //   action:'bank'
-              // }).then(res => {
-              // })
-              // canToBank = setInterval(() => {
-              //   request.lockLockAction({
-              //     action:'bank'
-              //   }).then(res => {
+              console.log(err,'err')
+              //可以学习,开启锁定
+                canToBank = 1;
+              request.lockLockAction({
+                action:'bank'
+              }).then(res => {
+              })
+              canToBank = setInterval(() => {
+                request.lockLockAction({
+                  action:'bank'
+                }).then(res => {
                   
-              //   })
-              // }, 10000);
+                })
+              }, 10000);
               next()
             })
 
@@ -379,14 +378,98 @@ router.beforeEach((to,from,next) => {
         
         return;
       } else {
-        //非题库页面删除锁定
-        clearInterval(canToBank)
-        canToBank = null;
-        request.lockDelLock({
-          action:'bank'
-        }).then(res => {
+        //从题库页面离开删除锁定
+
+        let isLeaveBank = bankAdmin.some(item => {
+          return from.path.indexOf(item) != -1
+        })
+
+        if(isLeaveBank) {
+          
+          clearInterval(canToBank)
+          canToBank = null;
+          request.lockDelLock({
+            action:'bank'
+          }).then(res => {
+            
+          })
+        }
+      }
+      
+      let isCourseLock = courseAdmin.some(item => {
+        return to.path.indexOf(item) != -1
+      })
+
+      if(isCourseLock) {
+        console.log(canToCourse,'canToBank')
+        
+        //没有执行定时器,开启锁定
+        if(!canToCourse) {
+          request.goodsDetail(to.params.goodsId).then(res => {
+            //继续教育锁定
+            if(res.data.educationName == '继续教育') {
+              request
+                .lockLockStatus({
+                  action: "jxjy",
+                })
+                .then((res) => {
+                  console.log(res,'res')
+                  //有其他端在操作,不能学习
+                  Message({
+                    type: "warning",
+                    message: res.msg,
+                  });
+                  
+                  if(from.path=='/') {
+                    next('/')
+                  }
+
+                }).catch(err => {
+                  // console.log(err,'err')
+                  //可以学习,开启锁定
+                  canToCourse = 1;
+                  request.lockLockAction({
+                    action:'jxjy'
+                  }).then(res => {
+                  })
+                  canToCourse = setInterval(() => {
+                    request.lockLockAction({
+                      action:'jxjy'
+                    }).then(res => {
+                      
+                    })
+                  }, 10000);
+                  next()
+                })
+            } else {
+              next()
+            }
+          })
           
+
+            return;
+        } else {
+          //正在执行定时器,可以直接进入
+          next()
+        }
+        
+        return;
+      } else {
+        //非题库页面删除锁定
+        let isLeaveCouese = bankAdmin.some(item => {
+          return from.path.indexOf(item) != -1
         })
+
+        if(isLeaveCouese) {
+          
+          clearInterval(canToBank)
+          canToBank = null;
+          request.lockDelLock({
+            action:'jxjy'
+          }).then(res => {
+            
+          })
+        }
       }
       
       next()