谢杰标 2 роки тому
батько
коміт
db5aac9bd7

+ 50 - 34
src/pages/course-detail/index.vue

@@ -276,11 +276,16 @@
                                               </template>
 
                                               <template
-                                                v-if="checkSection(section)"
+                                                v-if="
+                                                  checkSection(
+                                                    section.sectionId,
+                                                    'sectionExam'
+                                                  )
+                                                "
                                               >
                                                 <div
                                                   class="exercises"
-                                                  @click="
+                                                  @click.stop="
                                                     getResource(section, 2)
                                                   "
                                                 >
@@ -549,11 +554,16 @@
                                               </template>
 
                                               <template
-                                                v-if="checkSection(section)"
+                                                v-if="
+                                                  checkSection(
+                                                    section.sectionId,
+                                                    'sectionExam'
+                                                  )
+                                                "
                                               >
                                                 <div
                                                   class="exercises"
-                                                  @click="
+                                                  @click.stop="
                                                     getResource(section, 2)
                                                   "
                                                 >
@@ -732,14 +742,19 @@
                                           </div>
                                         </template>
 
-                                        <template v-if="checkSectionList(menu)">
-                                          <!-- <div class="btn btn--green" 
-                                            @click.stop="getResource(menu,2,true)">
-                                            习题
-                                          </div> -->
+                                        <template
+                                          v-if="
+                                            checkSection(
+                                              menu.menuId,
+                                              'sectionExamList'
+                                            )
+                                          "
+                                        >
                                           <div
                                             class="exercises"
-                                            @click="getResource(menu, 2, true)"
+                                            @click.stop="
+                                              getResource(menu, 2, true)
+                                            "
                                           >
                                             习题
                                             <i
@@ -3351,17 +3366,12 @@ export default {
         });
     },
     //校验节是否有试卷
-    checkSection(item) {
-      if (this.sectionExam.length == 0) {
-        return false;
-      }
-      if (
-        this.sectionExam.some((section) => section.sectionId == item.sectionId)
-      ) {
-        return true;
-      } else {
+    checkSection(sectionId, key) {
+      let _data = this[key];
+      if (_data.length == 0) {
         return false;
       }
+      return _data.some((section) => section.sectionId == sectionId);
     },
     /**
      * 获取观看记录
@@ -5297,25 +5307,31 @@ export default {
         console.log("直播的用户学习日志:", res);
       });
     },
-    //校验节是否有试卷
-    checkSectionList(item) {
-      console.log(item, "item");
-      console.log(this.sectionExamList, "this.sectionExamList");
-      if (this.sectionExamList.length == 0) {
-        return false;
-      }
-      if (
-        this.sectionExamList.some((section) => section.sectionId == item.menuId)
-      ) {
-        return true;
-      } else {
-        return false;
+    handelPracticeOrRxam(section, type) {
+      if (type == 3) {
+        //节卷
+        let data = this.sectionExamList.filter(
+          (x) => x.sectionId == section.menuId
+        );
+        if (data && data.length > 0) {
+          section = data[0];
+        }
+      } else if (type == 2) {
+        //节卷
+        let data = this.sectionExam.filter(
+          (x) => x.sectionId == section.sectionId
+        );
+        if (data && data.length > 0) {
+          section = data[0];
+        }
       }
+      // 节卷不需要控制
     },
     /**
      * 点击节
      */
     async getResource(section, type, flag) {
+      // return
       if (flag) {
         //节卷
         let data = this.sectionExamList.filter(
@@ -5351,8 +5367,6 @@ export default {
       }
       if (section.type == 2) {
         //试卷
-        console.log("试卷");
-        console.log(section);
         let learnNum = await this.goodsTodayStudySectionNum();
         let hasLearn = await this.gradeCheckGoodsStudy(section.typeId);
 
@@ -5565,6 +5579,7 @@ export default {
         return;
       }
       if (section.type != 2) {
+        console.log(this.clickLock);
         if (this.clickLock) {
           return;
         }
@@ -5586,6 +5601,7 @@ export default {
           //要按从头到尾顺序学习, 且不是重修课程
 
           let rows = await this.studyRecordMenuAllList();
+          console.log(rows, "rows");
           if (this.hasPreItem(rows, section)) {
             //判断是否有上一节
             let newRows = [];

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

@@ -1324,6 +1324,13 @@ export default {
       }
       return index === -1;
     },
+    checkLearnOrder(course) {
+      let goodsLearningOrder = 2;
+      // 非按顺序学习以及重修
+      if (goodsLearningOrder != 2 || course.isRebuild) {
+        return true;
+      }
+    },
     async studyFunc(courseItem, items) {
       if (!this.checkCanLearn()) {
         return false;
@@ -1425,7 +1432,7 @@ export default {
     },
     async getResource(courseLists, section, type, flag) {
       //type:1章卷,2节卷,3模考卷,4习题
-      
+
       if (!this.checkCanLearn()) {
         return false;
       }