Forráskód Böngészése

模块卷新增做题顺序判断

xuqiaoying 2 éve
szülő
commit
2552d98950

+ 7 - 6
components/course/courseChapter.vue

@@ -26,6 +26,7 @@
             :levelId="levelId + '-' + itemM.sectionId"
             :testType="2"
             :ChapterSectionExam='sectionExam'
+            :menuAllList="menuAllList"
           ></courseSection>
           <!-- @togoBack='togoBack()' -->
           <u-line v-if="indexM < list.length - 1"></u-line>
@@ -148,12 +149,12 @@ export default {
       examList: {},
       canLearn: false, //是否全部视频看完才可以练习、测试
       sectionExam: [],
-      newMenuAllList: [],
+      // newMenuAllList: [],
     };
   },
   onLoad() {},
   created() {
-    this.newMenuAllList = this.menuAllList
+    // this.newMenuAllList = this.menuAllList
   },
   mounted() {
     if (this.needOpen && this.chapterOpen) {
@@ -206,8 +207,8 @@ export default {
       }
 
       this.$emit("playEnd", { isRebuild: isRebuild.isRebuild });
-      this.newMenuAllList = await this.studyRecordMenuAllList()
-      console.log('播放器节:', this.newMenuAllList);
+      // this.newMenuAllList = await this.studyRecordMenuAllList()
+      // console.log('播放器节:', this.newMenuAllList);
     },
     findNextSection(index) {
       for (let i = index + 1; i < this.list.length; i++) {
@@ -271,7 +272,7 @@ export default {
      * 去做题
      */
     async toDo(id, goodsId = 0, moduleId = 0, chapterId = 0, item, index) {
-      console.log('moduleId:', moduleId, 'chapterId:', chapterId);
+      console.log('menuAllList', this.menuAllList);
       // 查询用户商品今天学习节数- /goods/todayStudySectionNum
       let learnNum = await this.goodsTodayStudySectionNum();
       // 检查用户是否学习过节 - /grade/grade/checkGoodsStudy
@@ -352,7 +353,7 @@ export default {
         let canLearn = this.list[index - 1].learning == 1;
         // /study/record/menuAllList - 查询课程所有子目录结构列表
         // let rows = await this.studyRecordMenuAllList();
-        let rows = this.newMenuAllList
+        let rows = this.menuAllList
         let isStop = false;
         let newRows = [];
         for (let i = 0; i < rows.length; i++) {

+ 31 - 18
components/course/courseModule.vue

@@ -195,7 +195,6 @@ export default {
 					}
 					this.list = res.data.data
 				}
-				console.log('-----------list', this.list)
 			});
 			
 		},
@@ -203,24 +202,38 @@ export default {
 		 * 去做题
 		 */
 		async toDoModuleExam(id, goodsId = 0, moduleId = 0, chapterId = 0, item, index) {
-			uni.navigateTo({
-			url:
-				"/pages2/class/questionBank?courseId=" +
-				this.courseId +
-				"&gradeId=" +
-				this.gradeId +
-				"&isFromVideo=1&id=" +
-				id +
-				"&goodsid=" +
-				goodsId +
-				"&moduleId=" +
-				moduleId +
-				"&chapterId=" +
-				chapterId +
-				"&orderGoodsId=" +
-				this.orderGoodsId +
-				"&type=3" + '&learning=' + item.learning,
+			// console.log('===item', item, this.menuAllList);
+			let newRows = []
+			newRows = this.menuAllList.filter(e => e.moduleId == moduleId)
+			let isAllLearn = newRows.every(item => {
+				return item.studyStatus == 1
 			})
+			if (isAllLearn) {
+				uni.navigateTo({
+					url:
+						"/pages2/class/questionBank?courseId=" +
+						this.courseId +
+						"&gradeId=" +
+						this.gradeId +
+						"&isFromVideo=1&id=" +
+						id +
+						"&goodsid=" +
+						goodsId +
+						"&moduleId=" +
+						moduleId +
+						"&chapterId=" +
+						chapterId +
+						"&orderGoodsId=" +
+						this.orderGoodsId +
+						"&type=3" + '&learning=' + item.learning,
+				})
+			} else {
+				uni.showToast({
+					icon: "none",
+					title: "请学完视频课程再进行练习和测试",
+				})
+			}
+			
 		},
 		
 	},

+ 5 - 7
components/course/courseSection.vue

@@ -162,8 +162,7 @@ export default {
 	onLoad() {
 	},
 	created() {
-		console.log('--------created');
-		this.newMenuAllList = this.menuAllList
+		// this.newMenuAllList = this.menuAllList
 		if (this.testType == 3) {
 			// 模块下的所有节试卷列表
 			this.$api.reSectionExamList({
@@ -190,7 +189,6 @@ export default {
 		uni.$once('playNext'+playNextId, async (data) => {
 			//到时会触发每个节的监听事件,只允许当前节的接收
 			let self = this
-			console.log('playNext====');
 			if(this.nextMenuItem.recordingUrl&&this.isRebuild&&(this.newId==this.playSectionId) && data.fromRebuild){  // fromRebuild 来自重修目录的点击才弹出播放下一节
 				//重修存在下一节
 				uni.showModal({
@@ -222,8 +220,8 @@ export default {
 			} else {
 				console.log('playEnd----');
 				this.$emit('playEnd',{isRebuild:this.isRebuild})
-				this.newMenuAllList = await this.studyRecordMenuAllList()
-				console.log('====this.newMenuAllList', this.newMenuAllList);
+				// this.newMenuAllList = await this.studyRecordMenuAllList()
+				// console.log('====this.newMenuAllList', this.newMenuAllList);
 			}
 		});
 	},
@@ -314,7 +312,7 @@ export default {
 			})
 		},
 		getVideo(){
-			console.log('this.menuItem:', this.menuItem);
+			console.log('this.this.newMenuAllList:', this.menuAllList);
 			if(this.clickLock) {
 				return;
 			}
@@ -324,7 +322,7 @@ export default {
 			if(this.learningOrder == 2 && !this.menuItem.isRebuild && !this.isLive) { //要按从头到尾顺序学习, 且不是重修课程
 				if(this.preItem) {
 					// let rows = await this.studyRecordMenuAllList();
-					let rows = this.newMenuAllList
+					let rows = this.menuAllList
 					let newRows = [];
 					for(let i = 0; i < rows.length; i++ ) {
 						let moduleTrue = rows[i].moduleId == this.menuItem.moduleId || rows[i].moduleId == 0

+ 5 - 1
pages3/polyv/detail.vue

@@ -191,6 +191,7 @@
                 :levelId="'0-0-' + item.menuId"
                 :goodsType='1'
                 :testType="3"
+                :menuAllList="menuAllList"
               ></courseSection
             ></view>
             <!-- @togoBack="togoBack($event)" -->
@@ -2404,6 +2405,7 @@ export default {
       this.$api.studyRecord(data).then((res) => {
         if (res.data.code == 200) {
           if (status > 0) {
+            this.studyRecordMenuAllList()
             let moduleId = this.moduleId || 0;
             let chapterId = this.chapterId || 0;
             let playNextIdisRebuild = `moduleId${moduleId}chapterId${chapterId}sectionId${sectionId}isRebuild`;
@@ -2424,7 +2426,9 @@ export default {
             title: res.data.msg,
           });
         }
-      });
+      }).catch(err => {
+        this.studyRecordMenuAllList()
+      })
     },
     uploadFile(options, int) {
       var self = this;