Ver código fonte

Merge branch '03/18VipActive' into test

lex-xin 4 anos atrás
pai
commit
d746ad5720
1 arquivos alterados com 37 adições e 21 exclusões
  1. 37 21
      src/views/teacher/VIP00Apply.vue

+ 37 - 21
src/views/teacher/VIP00Apply.vue

@@ -735,13 +735,17 @@
 				}
 			},
 			onShowTimeTable() { // 显示排课列表
-				// if(!this.checkCourseList()) {
-				// 	return
-				// }
+				if(!this.checkCourseList()) {
+					return
+				}
 				this.statusList.classTime = true
 				this.setTimeTable()
 			},
 			setTimeTable() {
+				if(!this.checkCourseList(false)) {
+					return
+				}
+				// return
 				// 重置排课列表
 				this.timeTable = []
 
@@ -774,6 +778,7 @@
 				let forMark = 0
 				while (totalCount && totalCount > 0) {
 					for (let i = 0; i < scheduleList.length; i++) {
+						// console.log(totalCount, scheduleList)
 						if (online == 0 && offline == 0) break
 						let num = scheduleList[i].weekIndex - dateOperation.getDay()
 						// 如果是同一天一个周期会出现排课都排到一天
@@ -794,26 +799,31 @@
 								'startClassTimeStr': scheduleList[i].startTime,
 								"endClassTimeStr": scheduleList[i].endTime
 							}
+							// console.log(scheduleList[i].type, online, offline)
 							if (scheduleList[i].type == '线上' && online > 0) {
 								tempArr.teachMode = 'ONLINE'
 								this.timeTable.push(tempArr)
 								online--
+
+								totalCount--
 							} else if (scheduleList[i].type == '线下' && offline > 0) {
 								tempArr.teachMode = 'OFFLINE'
 								this.timeTable.push(tempArr)
 								offline--
-							} else {
-								if (online > 0) {
-									tempArr.teachMode = 'ONLINE'
-									this.timeTable.push(tempArr)
-									online--
-								} else if (offline > 0) {
-									tempArr.teachMode = 'OFFLINE'
-									this.timeTable.push(tempArr)
-									offline--
-								}
+
+								totalCount--
 							}
-							totalCount--
+							//  else {
+							// 	if (online > 0) {
+							// 		tempArr.teachMode = 'ONLINE'
+							// 		this.timeTable.push(tempArr)
+							// 		online--
+							// 	} else if (offline > 0) {
+							// 		tempArr.teachMode = 'OFFLINE'
+							// 		this.timeTable.push(tempArr)
+							// 		offline--
+							// 	}
+							// }
 						}
 					}
 					// 加一周
@@ -1184,10 +1194,9 @@
 					setLoading(false)
 				})
 			},
-			checkCourseList() {
+			checkCourseList(isShowToast = true) {
 				let form = this.form
 				let scheduleList = this.scheduleList || []
-				console.log(this.scheduleList)
 				let hasOnLine = false // 是否有线上课时安排
 				let hasOffLine = false
 				scheduleList.forEach(item => {
@@ -1198,22 +1207,29 @@
 						hasOffLine = true
 					}
 				})
-				console.log(hasOnLine, hasOffLine)
 				let statusList = this.statusList
 				let onlineClassesStatus = !form.onlineClassesNums && form.onlineClassesNums <= 0 ? true : false
 				let offlineClassesStatus = !form.offlineClassesNums && form.offlineClassesNums <= 0 ? true : false
 				if (statusList.hasOnline) {
-					if (!onlineClassesStatus && hasOnLine) {
-						this.$toast('课时安排缺少线上课类型')
+					if (!onlineClassesStatus && !hasOnLine) {
+						if(isShowToast) {
+							this.$toast('课时安排缺少线上课类型')
+						}
 						return false
 					}
+				} else {
+					return false
 				}
 
 				if (statusList.hasOffline) {
-					if (offlineClassesStatus && hasOffline) {
-						this.$toast('课时安排缺少线下课类型')
+					if (!offlineClassesStatus && !hasOffLine) {
+						if(isShowToast) {
+							this.$toast('课时安排缺少线下课类型')
+						}
 						return false
 					}
+				} else {
+					return false
 				}
 				return true
 			},