yangdamao 3 жил өмнө
parent
commit
203725bbba

+ 7 - 1
src/apis/course.js

@@ -133,7 +133,13 @@ export default {
 			params: data
 		})
 	},
-
+	reSectionExamList(data) {
+		return request({
+			url: '/course/sectionExamList',
+			method: 'get',
+			params: data
+		})
+	},
   reChapterList(data) {
 		return request({
 			url: '/course/chapterList',

+ 150 - 16
src/pages/course-detail/index.vue

@@ -106,6 +106,7 @@
                                         :key="chapterIndex"
                                       >
                                         <div
+                                          v-if="chapter.type == 1"
                                           class="bank-chapter__item__text"
                                           @click="openChapter(chapter)"
                                         >
@@ -122,7 +123,7 @@
 
                                         <div
                                           class="bank-section"
-                                          v-if="chapter.showList"
+                                          v-if="chapter.showList && chapter.type == 1"
                                         >
                                           <div
                                             class="bank-section__item"
@@ -133,7 +134,7 @@
                                               section, sectionIndex
                                             ) in chapter.list"
                                             :key="sectionIndex"
-                                            @click="getResource(section)"
+                                            @click="getResource(section,1)"
                                           >
                                             <template v-if="section.type != 2">
                                               <template>
@@ -190,7 +191,14 @@
                                                   </div>
                                                 </div>
                                               </template>
-
+                                              <template
+                                                v-if="checkSection(section)"
+                                              >
+                                                <div class="btn btn--green" 
+                                                @click="getResource(section,2)">
+                                                  习题
+                                                </div>
+                                              </template>
                                               <template
                                                 v-if="section.durationTime > 0"
                                               >
@@ -311,6 +319,47 @@
                                             </template>
                                           </div>
                                         </div>
+                                         <div
+                                          v-if="chapter.type == 2"
+                                          class="bank-section__item"
+                                          @click="getResource(chapter,3)"
+                                        >
+                                          <template>
+                                              <template>
+                                                <div
+                                                  class="test-btn"
+                                                  v-if="chapter.doType == 1"
+                                                >
+                                                  练习
+                                                </div>
+                                                <div
+                                                  class="test-btn"
+                                                  v-if="chapter.doType != 1"
+                                                >
+                                                  考试
+                                                </div>
+                                              </template>
+                                              <div
+                                                class="bank-section__item__text"
+                                              >
+                                                {{ chapter.name }}
+                                              </div>
+                                              <template>
+                                                  <div
+                                                    class="btn btn--green"
+                                                    v-if="chapter.learning == 1"
+                                                  >
+                                                    合格
+                                                  </div>
+                                                  <div
+                                                    class="btn btn--red"
+                                                    v-if="chapter.learning == 0"
+                                                  >
+                                                    不合格
+                                                  </div>
+                                              </template>
+                                            </template>
+                                        </div>
                                       </div>
                                     </div>
                                   </div>
@@ -348,7 +397,7 @@
                                               section, sectionIndex
                                             ) in menu.list"
                                             :key="sectionIndex"
-                                            @click="getResource(section)"
+                                            @click="getResource(section,1)"
                                           >
                                             <template v-if="section.type != 2">
                                               <template>
@@ -403,7 +452,14 @@
                                                   }}</span>
                                                 </div>
                                               </div>
-
+                                              <template
+                                                v-if="checkSection(section)"
+                                              >
+                                                <div class="btn btn--green" 
+                                                @click="getResource(section,2)">
+                                                  习题
+                                                </div>
+                                              </template>
                                               <template
                                                 v-if="section.durationTime > 0"
                                               >
@@ -537,7 +593,7 @@
                                         :class="{
                                           active: isActive(menu),
                                         }"
-                                        @click="getResource(menu)"
+                                        @click="getResource(menu,1)"
                                       >
                                         <template>
                                           <div
@@ -582,7 +638,14 @@
                                             </div>
                                           </div>
                                         </template>
-
+                                        <template
+                                            v-if="checkSectionList(menu)"
+                                        >
+                                          <div class="btn btn--green" 
+                                            @click="getResource(menu,2,true)">
+                                            习题
+                                          </div>
+                                        </template>
                                         <template v-if="menu.durationTime > 0">
                                           <div class="during">
                                             {{
@@ -704,7 +767,7 @@
                                               section, sectionIndex
                                             ) in chapter.list"
                                             :key="sectionIndex"
-                                            @click="getResource(section)"
+                                            @click="getResource(section,1)"
                                           >
                                             <template v-if="section.type != 2">
                                               <template>
@@ -919,7 +982,7 @@
                                               section, sectionIndex
                                             ) in menu.list"
                                             :key="sectionIndex"
-                                            @click="getResource(section)"
+                                            @click="getResource(section,1)"
                                           >
                                             <template v-if="section.type != 2">
                                               <template>
@@ -1108,7 +1171,7 @@
                                         :class="{
                                           active: isActive(menu),
                                         }"
-                                        @click="getResource(menu)"
+                                        @click="getResource(menu,1)"
                                       >
                                         <template>
                                           <div
@@ -2994,6 +3057,8 @@ export default {
       clickSectionItem: {}, // 点击节的内容
       courseTotal: 0, 
       teaIndex: 0,
+      sectionExamList:[],//节试卷集合
+      sectionExam:[]//节试卷集合
     };
   },
   computed: {
@@ -3225,6 +3290,18 @@ export default {
           this.liveLast = res.data;
         });
     },
+    //校验节是否有试卷
+    checkSection(item){
+      console.log(this.sectionExam,item,'00000000');
+      if(this.sectionExam.length == 0){
+        return false
+      }
+      if(this.sectionExam.some((section) => section.sectionId == item.sectionId)){
+        return true
+      }else{
+        return false
+      }
+    },
     /**
      * 获取观看记录
      */
@@ -4904,7 +4981,7 @@ export default {
     },
     openModule(menuItem, status = false) {
       //重修目录点击
-      console.log(menuItem.list);
+      console.log(menuItem,'menuItem');
       menuItem.showList = !menuItem.showList;
 
       if (!menuItem.list.length) {
@@ -4979,6 +5056,14 @@ export default {
     },
     openChapter(chapter) {
       console.log(chapter, "chapter");
+      //获取节试卷列表
+      this.$request
+        .reSectionExamList({
+          chapterId: chapter.chapterId || chapter.menuId,
+          courseId:this.courseId,
+          gradeId:this.gradeId}).then((res) => {
+            this.sectionExam = res.data
+      })
       chapter.showList = !chapter.showList;
       if (!chapter.list.length) {
         if (chapter.isRebuild) {
@@ -5140,11 +5225,39 @@ 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
+      }
+    },
     /**
      * 点击节
      */
-    async getResource(section) {
-      console.log('点击节节节', section)
+    async getResource(section,type,flag) {
+      //type:1章卷,2节卷,3模考卷
+      console.log('点击节节节', section,type)
+      if(flag){
+         //节卷
+       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]
+       }
+      }
+      console.log('2222222', section)
       this.clickSectionItem = section
       //逻辑
       if (section.sectionType === 2 && section.liveStartTime && section.liveEndTime) {
@@ -5187,7 +5300,9 @@ export default {
                   courseId: this.courseId,
                   gradeId: this.gradeId,
                   moduleId: section.moduleId || 0,
+                  sectionId: section.sectionId || 0,
                   examId: section.typeId,
+                  type: type,
                   chapterId: section.chapterId || 0,
                   orderGoodsId: this.orderGoodsId,
                 },
@@ -5201,7 +5316,9 @@ export default {
                   courseId: this.courseId,
                   gradeId: this.gradeId,
                   moduleId: section.moduleId || 0,
+                  sectionId: section.sectionId || 0,
                   examId: section.typeId,
+                  type: type,
                   chapterId: section.chapterId || 0,
                   orderGoodsId: this.orderGoodsId,
                 },
@@ -5268,7 +5385,9 @@ export default {
                   courseId: this.courseId,
                   gradeId: this.gradeId,
                   moduleId: section.moduleId || 0,
+                  sectionId: section.sectionId || 0,
                   examId: section.typeId,
+                  type: type,
                   chapterId: section.chapterId || 0,
                   orderGoodsId: this.orderGoodsId,
                 },
@@ -5281,7 +5400,9 @@ export default {
                   courseId: this.courseId,
                   gradeId: this.gradeId,
                   moduleId: section.moduleId || 0,
+                  sectionId: section.sectionId || 0,
                   examId: section.typeId,
+                  type: type,
                   chapterId: section.chapterId || 0,
                   orderGoodsId: this.orderGoodsId,
                 },
@@ -5312,7 +5433,9 @@ export default {
                 courseId: this.courseId,
                 gradeId: this.gradeId,
                 moduleId: section.moduleId || 0,
+                sectionId: section.sectionId || 0,
                 examId: section.typeId,
+                type: type,
                 chapterId: section.chapterId || 0,
                 orderGoodsId: this.orderGoodsId,
               },
@@ -5326,7 +5449,9 @@ export default {
                 courseId: this.courseId,
                 gradeId: this.gradeId,
                 moduleId: section.moduleId || 0,
+                sectionId: section.sectionId || 0,
                 examId: section.typeId,
+                type: type,
                 chapterId: section.chapterId || 0,
                 orderGoodsId: this.orderGoodsId,
               },
@@ -6692,8 +6817,8 @@ export default {
           console.log('==============self.menuList===', res.rows, self.menuList)
           if ((this.sectionItem.recordingUrl||this.sectionItem.liveUrl) && this.needOpenNew) {
             this.needOpenNew = false;
-            if (this.sectionItem.sectionType == 1) {
-              console.log("录播")
+            if (this.sectionItem.sectionType == 1) {  
+              console.log("录播",this.sectionItem)
               //录播
               this.chapterId = this.sectionItem.chapterId;
               this.moduleId = this.sectionItem.moduleId;
@@ -6702,7 +6827,7 @@ export default {
               this.playVideo(this.sectionItem);
             } else if (this.sectionItem.sectionType == 2) {
               console.log("直播")
-              this.getResource(this.sectionItem)
+              this.getResource(this.sectionItem,1)
               //直播
               // this.studyRecordGetLastLive();
             } else if (this.sectionItem.sectionType == 3) {
@@ -6786,6 +6911,15 @@ export default {
             }
           }
         });
+
+      //获取节试卷列表
+      this.$request
+        .reSectionExamList({
+          chapterId: 0,
+          courseId:this.courseId,
+          gradeId:this.gradeId}).then((res) => {
+            this.sectionExamList = res.data
+      })
     },
 
     getReMenuList() {

+ 6 - 2
src/pages/course-exam/index.vue

@@ -1085,6 +1085,7 @@ export default {
       gradeId: 0,
       moduleId: 0,
       chapterId: 0,
+      sectionId: 0,
       faceUrl: "",
       stream: null,
       ossAvatarUrl: "",
@@ -1106,6 +1107,7 @@ export default {
     this.courseId = this.$route.query.courseId;
     this.gradeId = this.$route.query.gradeId;
     this.moduleId = this.$route.query.moduleId;
+    this.sectionId = this.$route.query.sectionId;
     this.chapterId = this.$route.query.chapterId;
     this.orderGoodsId = this.$route.query.orderGoodsId;
     await this.getGoodsDetail();
@@ -1574,8 +1576,9 @@ export default {
         // }
         this.$request
           .bankRecord({
-            chapterExamId: this.chapterId || 0,
-            moduleExamId: this.moduleId || 0,
+            chapterId: this.chapterId || 0,
+            moduleId: this.moduleId || 0,
+            sectionId: this.sectionId || 0,
             goodsId: this.goodsId,
             examId: this.examId,
             type: this.type,
@@ -2256,6 +2259,7 @@ export default {
         .bankRecordEdit({
           moduleId: this.moduleId || 0,
           chapterId: this.chapterId || 0,
+          sectionId: this.sectionId || 0,
           gradeId: this.gradeId,
           examId: this.examId,
           type: this.type,

+ 99 - 7
src/pages/person-center/my-course/index.vue

@@ -100,7 +100,7 @@
                   :key="k"
                   style="padding-left: 20px"
                 >
-                   <div
+                  <div
                     v-if="i.type == 2"
                     class="sectionStyle hoverStyleSection"
                     style="padding-left: 20px"
@@ -202,20 +202,30 @@
                             }}
                           </span>
                         </el-col>
+                        <el-col :span="2" :offset="1" v-if="checkSection(is)">
+                          <el-button
+                            size="mini"
+                            type="primary"
+                            style="width: 90px !important"
+                            plain
+                            @click="getResource(item, is,2)"
+                            >习题</el-button
+                          >
+                        </el-col>
                         <el-col :span="2" :offset="1" v-if="!is.sectionType">
                           <el-button
                             size="mini"
                             style="width: 90px !important"
                             type="text"
                             v-if="is.doType == 1"
-                            @click="getResource(item, is, 3)"
+                            @click="getResource(item, is, 1)"
                             >进入学习</el-button
                           ><el-button
                             size="mini"
                             style="width: 90px !important"
                             type="text"
                             v-else
-                            @click="getResource(item, is, 3)"
+                            @click="getResource(item, is, 1)"
                             >进入考试</el-button
                           >
                         </el-col>
@@ -366,6 +376,16 @@
                         }}
                       </span>
                     </el-col>
+                    <el-col :span="2" :offset="1" v-if="checkSection(i)">
+                      <el-button
+                        size="mini"
+                        type="primary"
+                        style="width: 90px !important"
+                        plain
+                        @click="getResource(item, i,2)"
+                        >习题</el-button
+                      >
+                    </el-col>
                     <el-col :span="2" :offset="1" v-if="!i.sectionType">
                       <el-button
                         size="mini"
@@ -512,6 +532,16 @@
                     }}
                   </span>
                 </el-col>
+                <el-col :span="2" :offset="1" v-if="checkSectionList(items)">
+                  <el-button
+                    size="mini"
+                    type="primary"
+                    style="width: 90px !important"
+                    plain
+                    @click="getResource(item, items,2,true)"
+                    >习题</el-button
+                  >
+                </el-col>
                 <el-col :span="2" :offset="1" v-if="!items.sectionType">
                   <el-button
                     size="mini"
@@ -692,6 +722,8 @@ export default {
       newActiveSubjectId: "", //当前选中ID
       businessData: {},
       teaIndex: 0,
+      sectionExamList:[],//节试卷集合
+      sectionExam:[]//节试卷集合
     };
   },
   computed: {
@@ -1036,6 +1068,14 @@ export default {
           item.showStatus = !item.showStatus;
           return;
         }
+        //获取节试卷列表
+        this.$request
+          .reSectionExamList({
+            chapterId: 0,
+            courseId:item.courseId,
+            gradeId:item.gradeId}).then((res) => {
+              this.sectionExamList = res.data
+        })
         this.$request
           .reMenuList({
             courseId: item.courseId,
@@ -1107,6 +1147,14 @@ export default {
           item.showStatus = !item.showStatus;
           return;
         }
+        //获取节试卷列表
+        this.$request
+          .reSectionExamList({
+            chapterId: type === 1 ? item.menuId : item.chapterId,
+            courseId:item.courseId,
+            gradeId:item.gradeId}).then((res) => {
+              this.sectionExam = res.data
+        })
         this.$request
           .reSectionList({
             chapterId: type === 1 ? item.menuId : item.chapterId,
@@ -1317,9 +1365,24 @@ export default {
             });
         });
     },
-    async getResource(courseLists, section,type) {
-      //type:1章卷,2节卷,3模考卷
-      console.log(section);
+    async getResource(courseLists, section,type,flag) {
+      //type:1章卷,2节卷,3模考卷,4习题
+      if(flag){
+        let data = this.sectionExamList.filter(x => x.sectionId = section.menuId)
+        if(data && data.length > 0){
+          section = data[0]
+        }else{
+          section.typeId =''
+        }
+      }else if(type && type == 2){
+        let data = this.sectionExam.filter(x => x.sectionId = section.sectionId)
+        if(data && data.length > 0){
+          section = data[0]
+        }else{
+          section.typeId =''
+        }
+      }
+      console.log(section,'section');
       if (section.type == 2) {
         //试卷
         console.log("试卷");
@@ -1349,6 +1412,7 @@ export default {
                   courseId: courseLists.courseId,
                   gradeId: this.goodsData.gradeId,
                   moduleId: section.moduleId || 0,
+                  sectionId: section.sectionId || 0,
                   examId: section.typeId,
                   type: type,
                   chapterId: section.chapterId || 0,
@@ -1364,6 +1428,7 @@ export default {
                   courseId: courseLists.courseId,
                   gradeId: this.goodsData.gradeId,
                   moduleId: section.moduleId || 0,
+                  sectionId: section.sectionId || 0,
                   examId: section.typeId,
                   type: type,
                   chapterId: section.chapterId || 0,
@@ -1437,6 +1502,7 @@ export default {
                   courseId: courseLists.courseId,
                   gradeId: this.goodsData.gradeId,
                   moduleId: section.moduleId || 0,
+                  sectionId: section.sectionId || 0,
                   examId: section.typeId,
                   type: type,
                   chapterId: section.chapterId || 0,
@@ -1451,6 +1517,7 @@ export default {
                   courseId: courseLists.courseId,
                   gradeId: this.goodsData.gradeId,
                   moduleId: section.moduleId || 0,
+                  sectionId: section.sectionId || 0,
                   examId: section.typeId,
                   type: type,
                   chapterId: section.chapterId || 0,
@@ -1488,6 +1555,7 @@ export default {
                 courseId: courseLists.courseId,
                 gradeId: this.goodsData.gradeId,
                 moduleId: section.moduleId || 0,
+                sectionId: section.sectionId || 0,
                 examId: section.typeId,
                 type: type,
                 chapterId: section.chapterId || 0,
@@ -1503,6 +1571,7 @@ export default {
                 courseId: courseLists.courseId,
                 gradeId: this.goodsData.gradeId,
                 moduleId: section.moduleId || 0,
+                sectionId: section.sectionId || 0,
                 examId: section.typeId,
                 type: type,
                 chapterId: section.chapterId || 0,
@@ -1527,7 +1596,30 @@ export default {
         return;
       }
     },
-
+    //校验节是否有试卷
+    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{
+        return false
+      }
+    },
     // 新增用户视频学习日志
     studyLog(moduleId, chapterId, sectionId, courseLists) {
       this.$axios({