谢杰标 2 years ago
parent
commit
b9490ff700
1 changed files with 48 additions and 28 deletions
  1. 48 28
      src/pages/person-center/my-course/index.vue

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

@@ -238,7 +238,7 @@
                             <el-col
                               :span="2"
                               :offset="1"
-                              v-if="checkSection(is)"
+                              v-if="checkSection(is.sectionId, 'sectionExam')"
                             >
                               <el-button
                                 size="mini"
@@ -423,7 +423,11 @@
                             }}
                           </span>
                         </el-col>
-                        <el-col :span="2" :offset="1" v-if="checkSection(i)">
+                        <el-col
+                          :span="2"
+                          :offset="1"
+                          v-if="checkSection(i.sectionId, 'sectionExam')"
+                        >
                           <el-button
                             size="mini"
                             type="text"
@@ -584,7 +588,7 @@
                     <el-col
                       :span="2"
                       :offset="1"
-                      v-if="checkSectionList(items)"
+                      v-if="checkSection(items.menuId, 'sectionExamList')"
                     >
                       <el-button
                         size="mini"
@@ -924,6 +928,7 @@ export default {
             // this.subjectList = array;
             this.subjectList = array.filter((item) => item.name);
             this.newActiveSubjectId = "";
+
             resolve();
             // if (res.rows && res.rows.length > 0) {
             //   this.getRecord(res.rows[0]);
@@ -1430,9 +1435,42 @@ export default {
             });
         });
     },
+    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];
+        }
+      }
+      this.$router.push({
+        path: "/course-exam/" + this.goodsData.goodsId,
+        query: {
+          courseId: courseLists.courseId,
+          gradeId: this.goodsData.gradeId,
+          moduleId: section.moduleId || 0,
+          sectionId: section.sectionId || 0,
+          examId: section.typeId,
+          learning: section.learning,
+          type: type,
+          chapterId: section.chapterId || 0,
+          orderGoodsId: this.goodsData.orderGoodsId,
+        },
+      });
+    },
     async getResource(courseLists, section, type, flag) {
       //type:1章卷,2节卷,3模考卷,4习题
-
+      console.log(courseLists, section);
       if (!this.checkCanLearn()) {
         return false;
       }
@@ -1456,6 +1494,8 @@ export default {
           section.typeId = "";
         }
       }
+      console.log(courseLists, section);
+      return;
       if (section.type == 2) {
         //试卷
         console.log("试卷");
@@ -1676,32 +1716,12 @@ export default {
       }
     },
     //校验节是否有试卷
-    checkSection(item) {
-      if (this.sectionExam.length == 0) {
-        return false;
-      }
-      if (
-        this.sectionExam.some((section) => section.sectionId == item.sectionId)
-      ) {
-        return true;
-      } else {
-        return false;
-      }
-    },
-    //校验节是否有试卷
-    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 {
+    checkSection(sectionId, key) {
+      let _data = this[key];
+      if (_data.length == 0) {
         return false;
       }
+      return _data.some((section) => section.sectionId == sectionId);
     },
     // 新增用户视频学习日志
     studyLog(moduleId, chapterId, sectionId, courseLists) {