chenxiong 3 жил өмнө
parent
commit
51a8540f57

+ 10 - 0
common/httpList/goods.js

@@ -358,6 +358,16 @@ export default {
 		})
 	},
 	
+	studyRecordMenuAllList(data) {
+		return myRequest({
+			url: '/study/record/menuAllList',
+			method: 'get',
+			data:data
+		})
+	},
+	
+	
+	
 	goodsTodayStudySectionNum(data) {
 		return myRequest({
 			url: '/goods/todayStudySectionNum',

+ 45 - 1
components/course/courseChapter.vue

@@ -144,6 +144,20 @@ export default {
 			}
 			return {}
 		},
+		studyRecordMenuAllList() {
+			return new Promise(resolve => {
+				
+				this.$api.studyRecordMenuAllList({
+					courseId:this.courseId,
+					gradeId:this.gradeId,
+					goodsId:this.goodsId
+				}).then(res => {
+					if(res.data.code == 200) {
+						resolve(res.data.data)
+					}
+				})
+			})
+		},
 		/**
 		 * 去做题
 		 */
@@ -193,7 +207,37 @@ export default {
 				}
 			} else if(this.learningOrder == 2 && !item.rebuild) {
 				let canLearn = this.list[index-1].learning == 1; 
-				if(canLearn) { //视频的上一节学完
+				let rows = await this.studyRecordMenuAllList();
+				let isStop = false;
+				let newRows = [];
+				for(let i = 0; i < rows.length; i++ ) {
+					let moduleTrue = rows[i].moduleId == moduleId;
+					let chapterTrue = rows[i].chapterId == chapterId;
+					if(moduleTrue && chapterTrue) {
+						isStop = true;
+						if(rows[i].sectionType != 2) {
+							newRows.push(rows[i])
+						}
+					} else {
+						if(!isStop) {
+							if(rows[i].sectionType != 2) {
+								newRows.push(rows[i])
+							}
+							
+						} else {
+							break;
+						}
+						
+					}
+				}
+				console.log(newRows)
+				let isAllLearn = newRows.every(item => {
+					return item.studyStatus == 1;
+				})
+				
+				if(isAllLearn) { //之前的都学完了
+					
+				// if(canLearn) { //视频的上一节学完
 					
 					let num = await this.bankRecordDoNum(item.typeId)
 					//有次数限制

+ 85 - 41
components/course/courseSection.vue

@@ -170,6 +170,20 @@ export default {
 		});
 	},
 	methods: {
+		studyRecordMenuAllList() {
+			return new Promise(resolve => {
+				
+				this.$api.studyRecordMenuAllList({
+					courseId:this.courseId,
+					gradeId:this.gradeId,
+					goodsId:this.goodsId
+				}).then(res => {
+					if(res.data.code == 200) {
+						resolve(res.data.data)
+					}
+				})
+			})
+		},
 		goodsTodayStudySectionNum() {
 			return new Promise(resolve => {
 				this.$api.goodsTodayStudySectionNum({goodsId:this.goodsId,gradeId:this.gradeId}).then(res => {
@@ -183,6 +197,7 @@ export default {
 			if(this.clickLock) {
 				return;
 			}
+
 			this.clickLock = true;
 			console.log(this.learningOrder,'this.learningOrder')
 			console.log(this.preItem,'this.preItem')
@@ -199,50 +214,79 @@ export default {
 			// }
 			if(this.learningOrder == 2 && !this.isRebuild) { //要按从头到尾顺序学习, 且不是重修课程
 				if(this.preItem) {
-					if(this.preItem.menuType == 3) { //上一个是节
-						if(this.preItem.learning == 1) { //上一节学完
-							this.playVideo();
+					let rows = await this.studyRecordMenuAllList();
+					let newRows = [];
+					for(let i = 0; i < rows.length; i++ ) {
+						let moduleTrue = (rows[i].moduleId == this.menuItem.menuId) || (rows[i].moduleId == this.menuItem.moduleId)
+						let chapterTrue = rows[i].chapterId == this.menuItem.chapterId;
+						let sectionTrue = rows[i].sectionId == this.menuItem.sectionId;
+						if(moduleTrue && chapterTrue && sectionTrue) {
+							break;
 						} else {
-							uni.showToast({
-								icon:'none',
-								title:'请按顺序学习视频课程'
-							})
-						}
-					} else if(this.preItem.menuType == 2) { //上一个是章
-						this.$api.reSectionList({chapterId: this.preItem.menuId || this.preItem.chapterId,gradeId:this.gradeId,courseId:this.courseId,moduleId:this.preItem.moduleId || 0}).then(res => {
-							if(res.data.code==200){
-								let lastItem = res.data.data[res.data.data.length -1];
-								if(lastItem.learning == 1) {
-									this.playVideo();
-								} else {
-									uni.showToast({
-										icon:'none',
-										title:'请按顺序学习视频课程'
-									})
-								}
+							if(rows[i].sectionType != 2) {
+								newRows.push(rows[i])
 							}
-						});
-					} else if(this.preItem.menuType == 1) { //上一个是模块
-						this.$api.reChapterList({moduleId:this.preItem.menuId,gradeId:this.gradeId,courseId:this.courseId}).then(res => {
-							if(res.data.code==200){
-								let lastChapterItem = res.data.data[res.data.data.length -1];
+							
+						}
+					}
+					console.log(newRows)
+					let isAllLearn = newRows.every(item => {
+						return item.studyStatus == 1;
+					})
+					
+					if(isAllLearn) {
+						this.playVideo();
+					} else {
+						uni.showToast({
+							icon:'none',
+							title:'请按顺序学习视频课程'
+						})
+					}
+					
+					// if(this.preItem.menuType == 3) { //上一个是节
+					// 	if(this.preItem.learning == 1) { //上一节学完
+					// 		this.playVideo();
+					// 	} else {
+					// 		uni.showToast({
+					// 			icon:'none',
+					// 			title:'请按顺序学习视频课程'
+					// 		})
+					// 	}
+					// } else if(this.preItem.menuType == 2) { //上一个是章
+					// 	this.$api.reSectionList({chapterId: this.preItem.menuId || this.preItem.chapterId,gradeId:this.gradeId,courseId:this.courseId,moduleId:this.preItem.moduleId || 0}).then(res => {
+					// 		if(res.data.code==200){
+					// 			let lastItem = res.data.data[res.data.data.length -1];
+					// 			if(lastItem.learning == 1) {
+					// 				this.playVideo();
+					// 			} else {
+					// 				uni.showToast({
+					// 					icon:'none',
+					// 					title:'请按顺序学习视频课程'
+					// 				})
+					// 			}
+					// 		}
+					// 	});
+					// } else if(this.preItem.menuType == 1) { //上一个是模块
+					// 	this.$api.reChapterList({moduleId:this.preItem.menuId,gradeId:this.gradeId,courseId:this.courseId}).then(res => {
+					// 		if(res.data.code==200){
+					// 			let lastChapterItem = res.data.data[res.data.data.length -1];
 								
-								this.$api.reSectionList({chapterId:lastChapterItem.chapterId,gradeId:this.gradeId,courseId:this.courseId,moduleId:this.menuItem.menuId || this.menuItem.moduleId}).then(res => {
-									if(res.data.code==200){
-										let lastSectionItem = res.data.data[res.data.data.length -1];
-										if(lastSectionItem.learning == 1) {
-											this.playVideo();
-										} else {
-											uni.showToast({
-												icon:'none',
-												title:'请按顺序学习视频课程'
-											})
-										}
-									}
-								});
-							}
-						});
-					} 
+					// 			this.$api.reSectionList({chapterId:lastChapterItem.chapterId,gradeId:this.gradeId,courseId:this.courseId,moduleId:this.menuItem.menuId || this.menuItem.moduleId}).then(res => {
+					// 				if(res.data.code==200){
+					// 					let lastSectionItem = res.data.data[res.data.data.length -1];
+					// 					if(lastSectionItem.learning == 1) {
+					// 						this.playVideo();
+					// 					} else {
+					// 						uni.showToast({
+					// 							icon:'none',
+					// 							title:'请按顺序学习视频课程'
+					// 						})
+					// 					}
+					// 				}
+					// 			});
+					// 		}
+					// 	});
+					// } 
 				} else { //第一章第一节
 					this.playVideo();
 				}

+ 1 - 58
pages2/class/questionBank.vue

@@ -754,7 +754,7 @@ export default {
 						success: result => {
 							if (result.statusCode === 200) {
 								self.ossAvatarUrl = ossToken.dir;
-								resolve();
+								resolve(ossToken.dir);
 							} else {
 								uni.showToast({
 									title: '上传失败',
@@ -1870,63 +1870,6 @@ export default {
 				}
 			});
 		},
-
-		uploadFile(options, int) {
-			var self = this;
-			return new Promise((resolve, reject) => {
-				var data = {
-					imageStatus: int
-				};
-				self.$api.aliyunpolicy(data).then(res => {
-					console.log(res.data, 6);
-					if (res.data.code != 200) {
-						self.$method.showToast('签名错误' + JSON.stringify(res.data));
-						return;
-					}
-					var ossToken = res.data.data.resultContent;
-					if (ossToken.host == null || ossToken.host == undefined) {
-						self.$method.showToast('上传路径报错' + JSON.stringify(res.data));
-						return;
-					}
-					uni.uploadFile({
-						url: ossToken.host,
-						name: 'file',
-						filePath: options,
-						fileType: 'image',
-						header: {
-							AuthorizationToken: 'WX ' + uni.getStorageSync('token')
-						},
-						formData: {
-							key: ossToken.dir,
-							OSSAccessKeyId: ossToken.accessid,
-							policy: ossToken.policy,
-							Signature: ossToken.signature,
-							callback: ossToken.callback,
-							success_action_status: 200
-						},
-						success: result => {
-							if (result.statusCode === 200) {
-								self.ossAvatarUrl = ossToken.dir;
-								resolve(ossToken.dir);
-							} else {
-								uni.showToast({
-									title: '上传失败',
-									icon: 'none'
-								});
-								return;
-							}
-						},
-						fail: error => {
-							uni.showToast({
-								title: '上传接口报错' + error,
-								icon: 'none'
-							});
-							return;
-						}
-					});
-				});
-			});
-		},
 		/**
 		 * @param {Object} type
 		 * @param {Object} bankindex