Bladeren bron

新增锁

谢杰标 2 jaren geleden
bovenliggende
commit
1a0446d791
1 gewijzigde bestanden met toevoegingen van 39 en 41 verwijderingen
  1. 39 41
      pages2/learn/details.vue

+ 39 - 41
pages2/learn/details.vue

@@ -48,6 +48,7 @@ export default {
       listData: [],
       orderGoodsId: "",
       rebuildShow: false,
+      lock: false,
     };
   },
   onLoad(option) {
@@ -56,7 +57,8 @@ export default {
     this.gradeId = Number(option.gradeId);
   },
   onShow() {
-    if (this.$method.isGoLogin()) { // 从公众号消息进来的没登录需要跳到登录页,登录后返回
+    if (this.$method.isGoLogin()) {
+      // 从公众号消息进来的没登录需要跳到登录页,登录后返回
       return;
     }
     this.getInfo();
@@ -128,6 +130,10 @@ export default {
     },
     //重学
     getBtn() {
+      if (this.lock) {
+        return;
+      }
+      this.lock = true;
       var self = this;
       self.$api
         .courseperiodrebuild({
@@ -137,51 +143,43 @@ export default {
         })
         .then((res) => {
           if (res.data.code === 200) {
-            // uni.redirectTo({
-            //   url:
-            //     "/pages2/wd/course?gid=" +
-            //     self.gradeId +
-            //     "&id=" +
-            //     self.goodsId +
-            //     "&orderGoodsId=" +
-            //     self.orderGoodsId,
-            // });
             this.$http({
-								url: '/course/courseList',
-								method: 'get',
-								data: {
-									pageNum: 1,
-									pageSize: 100,
-									goodsId: this.goodsId,
-									gradeId: this.gradeId,
-									orderGoodsId: this.orderGoodsId,
-								},
-							})
-							.then(res => {
-								if (res.data.code == 200) {
-									if(res.data.total > 1) {
-										uni.redirectTo({
-											url: `/pages3/polyv/detail?id=''&goodsId=${this.goodsId}&orderGoodsId=${this.orderGoodsId}&gradeId=${this.gradeId}`
-										})
-									} else if(res.data.total == 1) {
-										uni.redirectTo({
-											url: `/pages3/polyv/detail?id=${res.data.rows[0].courseId}&goodsId=${this.goodsId}&orderGoodsId=${this.orderGoodsId}&gradeId=${this.gradeId}`
-										})
-									} else {
-										uni.showToast({
-											icon:'none',
-											title:'暂无可观看的视频课程'
-										})
-									}
-
-								}
-							})
+              url: "/course/courseList",
+              method: "get",
+              data: {
+                pageNum: 1,
+                pageSize: 100,
+                goodsId: this.goodsId,
+                gradeId: this.gradeId,
+                orderGoodsId: this.orderGoodsId,
+              },
+            }).then((res) => {
+              this.lock = false;
+              if (res.data.code == 200) {
+                if (res.data.total > 1) {
+                  uni.redirectTo({
+                    url: `/pages3/polyv/detail?id=''&goodsId=${this.goodsId}&orderGoodsId=${this.orderGoodsId}&gradeId=${this.gradeId}`,
+                  });
+                } else if (res.data.total == 1) {
+                  uni.redirectTo({
+                    url: `/pages3/polyv/detail?id=${res.data.rows[0].courseId}&goodsId=${this.goodsId}&orderGoodsId=${this.orderGoodsId}&gradeId=${this.gradeId}`,
+                  });
+                } else {
+                  uni.showToast({
+                    icon: "none",
+                    title: "暂无可观看的视频课程",
+                  });
+                }
+              }
+            });
             // uni.navigateTo({
             //   url: `/pages3/polyv/detail?id=''&goodsId=${this.goodsId}&orderGoodsId=${this.orderGoodsId}&gradeId=${this.gradeId}`
             // })
           }
-        });
-      // uni.showModal({
+        })
+        .catch((err) => {
+          this.lock = false;
+        }); // uni.showModal({
       // 	title:"注意",
       // 	content:`如对审核结果有异议,请勿点击确认重学。致电020-87085982咨询`,
       // 	confirmText:"确认重学",