guojy 1 vuosi sitten
vanhempi
commit
3ab6ab7981
1 muutettua tiedostoa jossa 4 lisäystä ja 3 poistoa
  1. 4 3
      src/view/course/user/courseDeal.vue

+ 4 - 3
src/view/course/user/courseDeal.vue

@@ -135,7 +135,7 @@ export default {
     getCodeDetail() {
       getCourseCodeDetail(this.$route.query.code).then(res => {
         this.codeDetail = res;
-        if(!res){
+        if(!res && !this.courseDetail.buy){
           this.$toast.fail("该课程码已失效");
         }
       });
@@ -180,11 +180,11 @@ export default {
     // 初始化
     init() {
       this.courseId = this.$route.params.id;
-      this.getDetail();
       if (this.$route.query && this.$route.query.code) {
         this.goLeft = '首页'
-        this.getCodeDetail();
+        this.getDetail();
       }else{
+        this.getDetail();
         this.canGive = false;
       }
     },
@@ -199,6 +199,7 @@ export default {
           !this.giveCode
         ) {
           this.$toast.fail("您已经购买课程,无需再次购买");
+          this.getCodeDetail();
         }else if(!res.enable){
           this.canGive2 = false;
           this.$toast.fail("课程已下架");