Przeglądaj źródła

对接重修目录

谢杰标 2 lat temu
rodzic
commit
ad1998c58c

+ 87 - 71
src/apis/course.js

@@ -1,13 +1,13 @@
 import request from '@/axios'
 export default {
-  
-  /**
-   * 
-   * @param {*} data 
-   * @returns 
-   * 我的网课列表
-   */
-  courseGoodsList(data) {
+
+	/**
+	 * 
+	 * @param {*} data 
+	 * @returns 
+	 * 我的网课列表
+	 */
+	courseGoodsList(data) {
 		return request({
 			url: '/course/goodsList',
 			method: 'get',
@@ -15,13 +15,13 @@ export default {
 		})
 	},
 
-  /**
-   * 
-   * @param {*} data 
-   * @returns 
-   * 课程可选班级列表
-   */
-  goodsGradeList(data) {
+	/**
+	 * 
+	 * @param {*} data 
+	 * @returns 
+	 * 课程可选班级列表
+	 */
+	goodsGradeList(data) {
 		return request({
 			url: '/grade/grade/list',
 			method: 'get',
@@ -29,28 +29,28 @@ export default {
 		})
 	},
 
-  /**
-   * 
-   * @param {*} data 
-   * @returns 
-   * 选定班级
-   */
-  changeGrade(data) {
+	/**
+	 * 
+	 * @param {*} data 
+	 * @returns 
+	 * 选定班级
+	 */
+	changeGrade(data) {
 		return request({
 			url: '/grade/grade/changeGrade',
 			method: 'post',
-			data:data
+			data: data
 		})
 	},
 
-  courseGoodsRebuildStatus(data) {
+	courseGoodsRebuildStatus(data) {
 		return request({
 			url: '/course/goodsRebuildStatus',
 			method: 'get',
-			params:data
+			params: data
 		})
 	},
-  
+
 	//查看班级作弊重学详细情况
 	getcourseperiodcheat(data) {
 		return request({
@@ -60,7 +60,7 @@ export default {
 		})
 	},
 
-  
+
 	courseCourseList(data) {
 		return request({
 			url: '/course/courseList',
@@ -78,29 +78,29 @@ export default {
 		})
 	},
 
-  courseDetail(data) {
+	courseDetail(data) {
 		return request({
-			url: '/course/'+data,
+			url: '/course/' + data,
 			method: 'get'
 		})
 	},
 
-  goodsDetail(data) {
+	goodsDetail(data) {
 		return request({
-			url: '/goods/'+ data,
+			url: '/goods/' + data,
 			method: 'get'
 		})
 	},
 
-  
+
 	courseHandouts(data) {
 		return request({
-			url: '/course/handouts/'+data,
+			url: '/course/handouts/' + data,
 			method: 'get'
 		})
 	},
-  
-  reMenuList(data) {
+
+	reMenuList(data) {
 		return request({
 			url: '/course/menuList',
 			method: 'get',
@@ -108,7 +108,7 @@ export default {
 		})
 	},
 
-  noteList(data) {
+	noteList(data) {
 		return request({
 			url: '/user/note/listDate',
 			method: 'get',
@@ -116,7 +116,7 @@ export default {
 		})
 	},
 
-  
+
 	reChapterList(data) {
 		return request({
 			url: '/course/chapterList',
@@ -125,7 +125,7 @@ export default {
 		})
 	},
 
-  
+
 	reSectionList(data) {
 		return request({
 			url: '/course/sectionList',
@@ -140,7 +140,23 @@ export default {
 			params: data
 		})
 	},
-  reChapterList(data) {
+	// 获取商品所有节列表
+	getAllSectionList(data) {
+		return request({
+			url: '/goods/section/list',
+			method: 'get',
+			params: data
+		})
+	},
+	// 重修课程目录
+	getRebuildCourse(data) {
+		return request({
+			url: '/course/goods/rebuild/menu',
+			method: 'get',
+			params: data
+		})
+	},
+	reChapterList(data) {
 		return request({
 			url: '/course/chapterList',
 			method: 'get',
@@ -148,7 +164,7 @@ export default {
 		})
 	},
 
-  reSectionList(data) {
+	reSectionList(data) {
 		return request({
 			url: '/course/sectionList',
 			method: 'get',
@@ -156,31 +172,31 @@ export default {
 		})
 	},
 
-  studyRecordMenuAllList(data) {
+	studyRecordMenuAllList(data) {
 		return request({
 			url: '/study/record/menuAllList',
 			method: 'get',
-			params:data
+			params: data
 		})
 	},
 
-  gradeCheckGoodsStudy(data) {
+	gradeCheckGoodsStudy(data) {
 		return request({
 			url: '/grade/grade/checkGoodsStudy',
 			method: 'get',
-			params:data
+			params: data
 		})
 	},
 
-  goodsTodayStudySectionNum(data) {
+	goodsTodayStudySectionNum(data) {
 		return request({
 			url: '/goods/todayStudySectionNum',
 			method: 'get',
-			params:data
+			params: data
 		})
 	},
 
-  coursePhotoRecord(data) {
+	coursePhotoRecord(data) {
 		return request({
 			url: '/course/photo/log',
 			method: 'post',
@@ -188,15 +204,15 @@ export default {
 		})
 	},
 
-  faceCertificationCompareFace(data) {
+	faceCertificationCompareFace(data) {
 		return request({
 			url: '/face/certification/CompareFace',
 			method: 'post',
-			data:data
+			data: data
 		})
 	},
 
-  studyRecord(data) {
+	studyRecord(data) {
 		return request({
 			url: '/study/record',
 			method: 'post',
@@ -204,7 +220,7 @@ export default {
 		})
 	},
 
-  getPhotoLastRecord(data) {
+	getPhotoLastRecord(data) {
 		return request({
 			url: '/course/photo/log/getLastInfo',
 			method: 'get',
@@ -212,7 +228,7 @@ export default {
 		})
 	},
 
-  
+
 	recordLast(data) {
 		return request({
 			url: '/study/record/last',
@@ -220,7 +236,7 @@ export default {
 			params: data
 		})
 	},
-  studRrecordListUserRecord(data) {
+	studRrecordListUserRecord(data) {
 		return request({
 			url: '/study/record/listUserRecord',
 			method: 'get',
@@ -228,33 +244,33 @@ export default {
 		})
 	},
 
-  
+
 	faceCertificationIDCardOCR(data) {
 		return request({
 			url: '/face/certification/IDCardOCR',
 			method: 'post',
-			data:data
+			data: data
 		})
 	},
 
-  facCertificationImageRecognition(data) {
+	facCertificationImageRecognition(data) {
 		return request({
 			url: '/face/certification/ImageRecognition',
 			method: 'post',
-			data:data
+			data: data
 		})
 	},
 
-  faceCertificationIdCardCompareFace(data) {
+	faceCertificationIdCardCompareFace(data) {
 		return request({
 			url: '/face/certification/idCardCompareFace',
 			method: 'post',
-			data:data
+			data: data
 		})
 	},
 
 
-  appBeforeAddress(data) {
+	appBeforeAddress(data) {
 		return request({
 			url: '/app/before/address',
 			method: 'get',
@@ -262,27 +278,27 @@ export default {
 		})
 	},
 
-  goodsListGoodsUserLive(data) {
+	goodsListGoodsUserLive(data) {
 		return request({
-			url:`/goods/listGoodsUserLive`,
+			url: `/goods/listGoodsUserLive`,
 			method: 'get',
-			params:data
+			params: data
 		})
 	},
 
-  polyvLiveHistoryChatMsgList(data) {
+	polyvLiveHistoryChatMsgList(data) {
 		return request({
 			url: '/polyv/live/historyChatMsgList',
 			method: 'get',
-			params:data
+			params: data
 		})
 	},
 
-  studyRecordQueryLiveLast(data) {
+	studyRecordQueryLiveLast(data) {
 		return request({
 			url: '/study/record/queryLiveLast',
 			method: 'get',
-			params:data
+			params: data
 		})
 	},
 
@@ -294,19 +310,19 @@ export default {
 		})
 	},
 
-  goodsLivingSectionList(data) {
+	goodsLivingSectionList(data) {
 		return request({
 			url: '/goods/livingSectionList',
 			method: 'get',
-			params:data
+			params: data
 		})
 	},
 
-  courseMajorList(data) {
+	courseMajorList(data) {
 		return request({
 			url: '/course/major/list',
 			method: 'get',
-			params:data
+			params: data
 		})
 	},
 }

+ 25 - 9
src/components/courseTree/CourseTree.vue

@@ -209,7 +209,7 @@
                               class="btn btn--red"
                               v-if="section.learning == 0"
                             >
-                            不及格(需重考)
+                              不及格(需重考)
                             </div>
                             <div
                               class="btn btn--green"
@@ -418,7 +418,7 @@
                               class="btn btn--red"
                               v-if="section.learning == 0"
                             >
-                            不及格(需重考)
+                              不及格(需重考)
                             </div>
                             <div
                               class="btn btn--green"
@@ -585,6 +585,10 @@ export default {
         return {};
       },
     },
+    rebuild: {
+      type: Number,
+      default: 0,
+    },
   },
   data() {
     return {
@@ -595,12 +599,12 @@ export default {
       sectionExam: [],
       sectionExamList: [],
       dialogPalyVisible: false,
+      allSectionList: [],
     };
   },
-  created() {
-    this.init();
+  created(){
+    this.init()
   },
-  mounted() {},
   methods: {
     async init() {
       this.nowTime = Number(new Date().getTime() / 1000).toFixed(0);
@@ -610,9 +614,10 @@ export default {
         0,
         false
       );
-      if (this.query.sectionType == 1) {
+      if (this.query.sectionType == 1 && this.rebuild == 0) {
         this.toPlay(sectionItem);
       }
+      this.getAllSectionList();
     },
     activeFunc(courseId, index) {
       let { courseId: nowCourseId, courseList } = this.treeList[index];
@@ -739,6 +744,17 @@ export default {
           return Promise.resolve(chapter.list);
         });
     },
+    getAllSectionList() {
+      this.$request
+        .getAllSectionList({
+          gradeId: this.gradeId,
+          goodsId: this.goodsId,
+          rebuild: this.rebuild,
+        })
+        .then((res) => {
+          this.allSectionList = res.data;
+        });
+    },
     /**
      * 判断是否是当前播放的节
      */
@@ -998,7 +1014,7 @@ export default {
       });
     },
     toPlay(section) {
-      this.$emit("getResource", section);
+      this.$emit("getResource", section, this.rebuild);
     },
     //获取商品双师资模板
     getDoubleTeacherList() {
@@ -1128,7 +1144,7 @@ export default {
     isLastVideo() {
       try {
         let { sectionId, chapterId } = this.sectionItem;
-        let lastVideo = this.allVideoList.slice(-1)[0];
+        let lastVideo = this.allSectionList.slice(-1)[0];
         return (
           sectionId == lastVideo.sectionId && chapterId == lastVideo.chapterId
         );
@@ -1136,7 +1152,7 @@ export default {
         return false;
       }
     },
-  },
+  }
 };
 </script>
 

+ 78 - 68
src/pages/course-detail/index.vue

@@ -32,8 +32,10 @@
                   <div v-show="vid" id="player"></div>
                   <div v-show="vidzb" id="playerzb"></div>
                   <div class="recordStyle" v-if="showRecordStatus">
-                    您上次看         ndToTime(recordObj.videoCurrentTime)
-                    }},正在自动续播<span
+                    您上次看{{
+                      $tools.secondToTime(recordObj.videoCurrentTime)
+                    }},正在自动续播
+                    <span
                       style="
                         display: inline-block;
                         width: 50px;
@@ -60,7 +62,7 @@
                             <span class="label">{{ tab.label }}</span>
                           </div>
                           <!-- 章节目录 -->
-                          <template v-if="tab.name == '1'">
+                          <template v-if="tab.name == '1' && courseList.length">
                             <Course-tree
                               ref="courseTree"
                               :courseList="courseList"
@@ -74,8 +76,22 @@
                             </Course-tree>
                           </template>
                           <!-- 重修目录 -->
-                          <template v-if="tab.name == '2'">
-                            <div class="right-box__body">
+                          <template
+                            v-if="tab.name == '2' && rebuildCourseList.length"
+                          >
+                            <Course-tree
+                              ref="courseTree"
+                              :courseList="rebuildCourseList"
+                              :goodsLearningOrder="
+                                businessData.goodsLearningOrder
+                              "
+                              :rebuild="1"
+                              :sectionItem.sync="sectionItem"
+                              :sectionMaxNum="goodsData.sectionMaxNum"
+                              @getResource="getResource"
+                            >
+                            </Course-tree>
+                            <!-- <div class="right-box__body">
                               <div
                                 class="item"
                                 v-for="(menu, index) in reMenuList"
@@ -642,7 +658,7 @@
                                   </div>
                                 </template>
                               </div>
-                            </div>
+                            </div> -->
                           </template>
                           <template v-if="tab.name == '3'">
                             <div class="answer-question">
@@ -2090,7 +2106,6 @@ export default {
       photoHistoryList: [], //已拍照历史的下标点
       moduleId: 0,
       chapterId: 0,
-      menuTab: [],
       lectureShow: true,
       textarea: "",
       textareaNote: "",
@@ -2381,7 +2396,8 @@ export default {
       sectionExamList: [], //节试卷集合
       sectionExam: [], //节试卷集合
       compareFaceData: 0, // 拍照匹配相似度
-      allCourseList: [],
+      rebuildCourseList: [],
+      playTabIndex: "",
     };
   },
   computed: {
@@ -2402,6 +2418,33 @@ export default {
         return ary;
       };
     },
+    menuTab() {
+      let menuTab = [
+        {
+          name: "1",
+          label: "章节目录",
+        },
+        {
+          name: "3",
+          label: "答疑",
+        },
+        {
+          name: "4",
+          label: "笔记",
+        },
+        {
+          name: "5",
+          label: "讲义",
+        },
+      ];
+      if (this.rebuildCourseList.length) {
+        menuTab.splice(1, 0, {
+          name: "2",
+          label: "重修目录",
+        });
+      }
+      return menuTab;
+    },
   },
   async mounted() {
     this.courseId = +this.$route.query.courseId || "";
@@ -2452,6 +2495,7 @@ export default {
 
     this.getbaseprofiletplists().then(async (res) => {
       await this.courseCourseList();
+      this.getRebuildCourse();
     });
     document.addEventListener("visibilitychange", this.pauseVideo);
   },
@@ -4223,7 +4267,7 @@ export default {
         this.nowTime = Number(new Date().getTime() / 1000).toFixed(0);
         this.getAnswerList(); //答疑列表
         // this.getMenuList(this.courseId); //学习目录
-        this.getReMenuList(); //获取重修目录
+        // this.getReMenuList(); //获取重修目录
         this.getNoteList(); //获取节笔记
         resolve();
       });
@@ -4395,13 +4439,14 @@ export default {
     /**
      * 点击节
      */
-    async getResource(section, type) {
+    async getResource(section, index) {
       this.clickSectionItem = section;
       if (this.clickLock) {
         return;
       }
       this.clickLock = true;
       this.initVideo(section);
+      this.playTabIndex = index
     },
     initVideo(option) {
       this.playVideo(option);
@@ -4856,11 +4901,17 @@ export default {
               //开头拍1张
               this.photoList.push(1);
             } else if (photoNum == 3) {
-                this.photoList.push(1);  
-                let centerTime = this.randomNum(1/3*totalVideoTime, 2/3*totalVideoTime);; 
-                this.photoList.push(centerTime); 
-                let endTakeTime = this.randomNum(2/3*totalVideoTime, totalVideoTime);
-                this.photoList.push(endTakeTime); 
+              this.photoList.push(1);
+              let centerTime = this.randomNum(
+                (1 / 3) * totalVideoTime,
+                (2 / 3) * totalVideoTime
+              );
+              this.photoList.push(centerTime);
+              let endTakeTime = this.randomNum(
+                (2 / 3) * totalVideoTime,
+                totalVideoTime
+              );
+              this.photoList.push(endTakeTime);
             }
           }
           this.postCoursePhotoRecord(true); //提交随机拍照时间数组
@@ -5023,9 +5074,7 @@ export default {
 
           self.ossAvatarUrl = "";
         })
-        .catch((err) => {
-          
-        });
+        .catch((err) => {});
     },
     /**
      * 获取重修列表中是否有相同对象
@@ -5579,7 +5628,17 @@ export default {
           this.sectionExamList = res.data;
         });
     },
-
+    getRebuildCourse() {
+      this.$request
+        .getRebuildCourse({
+          goodsId: this.goodsId,
+          rebuild: 1,
+          gradeId: this.gradeId,
+        })
+        .then(async (res) => {
+          this.rebuildCourseList = res.data;
+        });
+    },
     getReMenuList() {
       let self = this;
       this.$request
@@ -5600,55 +5659,6 @@ export default {
             item.isRebuild = 1;
           }
           self.reMenuList = res.rows;
-          if (self.reMenuList.length > 0) {
-            this.menuTab = [
-              {
-                name: "1",
-                label: "章节目录",
-              },
-              {
-                name: "2",
-                label: "重修目录",
-              },
-              {
-                name: "3",
-                label: "答疑",
-              },
-              {
-                name: "4",
-                label: "笔记",
-              },
-              {
-                name: "5",
-                label: "讲义",
-              },
-            ];
-
-            if (this.courseTabIndex == "2") {
-              return;
-            }
-            this.courseTabIndex = "1";
-          } else {
-            this.menuTab = [
-              {
-                name: "1",
-                label: "章节目录",
-              },
-              {
-                name: "3",
-                label: "答疑",
-              },
-              {
-                name: "4",
-                label: "笔记",
-              },
-              {
-                name: "5",
-                label: "讲义",
-              },
-            ];
-            this.courseTabIndex = "1";
-          }
         });
     },