Browse Source

fix:bug修复

钱新宇 2 tháng trước cách đây
mục cha
commit
c00a714f2e
1 tập tin đã thay đổi với 41 bổ sung47 xóa
  1. 41 47
      pages/video/index.vue

+ 41 - 47
pages/video/index.vue

@@ -15,22 +15,14 @@
           </view>
         </view>
         <view class="video_btn">
-          <button
-            class="after_exam"
-            v-if="item.learn_status > 0"
-            @click="goExam(item.id, item.report_id)"
-          >
+          <button class="after_exam" @click="goExam(item.id, item.report_id, item.learn_status)">
             {{ item.report_id > 0 ? "查看报告" : "课后评测" }}
           </button>
-          <button class="to_learn" @click.stop="goDetail(item.id)">
-            开始学习
-          </button>
+          <button class="to_learn" @click.stop="goDetail(item.id)">开始学习</button>
         </view>
       </view>
     </view>
-    <view class="to_bottom" v-if="!videoList.length">
-      -----您还没有可学习课程-----</view
-    >
+    <view class="to_bottom" v-if="!videoList.length"> -----您还没有可学习课程-----</view>
     <view class="contact_follow">
       <button class="contact_btn" open-type="contact">
         <uni-icons type="headphones" size="30" color="#FFFFFF"></uni-icons>
@@ -67,17 +59,15 @@ export default {
     // 设置请求中
     this.isReqing = true;
     // 请求列表
-    this.$http
-      .request("api/video_course/get_list", this.requestParam)
-      .then((re) => {
-        // 设置非请求中
-        this.isReqing = false;
-        // 成功结果
-        if (re.code == "success") {
-          if (re.data.last_page <= this.requestParam.page) this.isLast = true;
-          this.videoList = re.data.data;
-        }
-      });
+    this.$http.request("api/video_course/get_list", this.requestParam).then((re) => {
+      // 设置非请求中
+      this.isReqing = false;
+      // 成功结果
+      if (re.code == "success") {
+        if (re.data.last_page <= this.requestParam.page) this.isLast = true;
+        this.videoList = re.data.data;
+      }
+    });
   },
   onPullDownRefresh() {
     // 如果请求中,不允许请求,
@@ -89,17 +79,15 @@ export default {
     // 设置请求中
     this.isReqing = true;
     // 请求列表
-    this.$http
-      .request("api/video_course/get_list", this.requestParam)
-      .then((re) => {
-        // 设置非请求中
-        this.isReqing = false;
-        // 成功结果
-        if (re.code == "success") {
-          if (re.data.last_page <= this.requestParam.page) this.isLast = true;
-          this.videoList = re.data.data;
-        }
-      });
+    this.$http.request("api/video_course/get_list", this.requestParam).then((re) => {
+      // 设置非请求中
+      this.isReqing = false;
+      // 成功结果
+      if (re.code == "success") {
+        if (re.data.last_page <= this.requestParam.page) this.isLast = true;
+        this.videoList = re.data.data;
+      }
+    });
     uni.stopPullDownRefresh();
   },
   onReachBottom() {
@@ -114,19 +102,17 @@ export default {
     // 设置请求中
     this.isReqing = true;
     // 请求列表
-    this.$http
-      .request("api/video_course/get_list", this.requestParam)
-      .then((re) => {
-        // 设置非请求中
-        this.isReqing = false;
-        // 成功结果
-        if (re.code == "success") {
-          // 数据
-          if (re.data.last_page <= this.requestParam.page) this.isLast = true;
-          // 追加数据
-          this.videoList.push(...re.data.data);
-        }
-      });
+    this.$http.request("api/video_course/get_list", this.requestParam).then((re) => {
+      // 设置非请求中
+      this.isReqing = false;
+      // 成功结果
+      if (re.code == "success") {
+        // 数据
+        if (re.data.last_page <= this.requestParam.page) this.isLast = true;
+        // 追加数据
+        this.videoList.push(...re.data.data);
+      }
+    });
   },
   methods: {
     goDetail(id) {
@@ -134,7 +120,15 @@ export default {
         url: "/pages/video/detail?id=" + id,
       });
     },
-    goExam(id, report_id) {
+    goExam(id, report_id, status) {
+      if (status < 0) {
+        uni.showToast({
+          title: "请先完成课程再来答题吧",
+          icon: "none",
+          duration: 2000,
+        });
+        return;
+      }
       if (report_id > 0) {
         uni.navigateTo({
           url: "/pages/video/record?type=exam&record_id=" + report_id,