|
@@ -696,9 +696,52 @@ export default {
|
|
|
if (!this.checkCourseList()) {
|
|
|
return;
|
|
|
}
|
|
|
+
|
|
|
+ const checkmMsg = this.checkTimeTable()
|
|
|
+ if (checkmMsg) {
|
|
|
+ this.$toast(checkmMsg)
|
|
|
+ return
|
|
|
+ }
|
|
|
this.statusList.classTime = true;
|
|
|
this.setTimeTable();
|
|
|
},
|
|
|
+ checkTimeTable() {
|
|
|
+ let form = this.form,
|
|
|
+ scheduleList = this.scheduleList;
|
|
|
+ let online = parseInt(
|
|
|
+ form.onlineClassesNums ? form.onlineClassesNums : 0
|
|
|
+ );
|
|
|
+ let offline = parseInt(
|
|
|
+ form.offlineClassesNums ? form.offlineClassesNums : 0
|
|
|
+ );
|
|
|
+ // 网管课默认只有线上课次
|
|
|
+ if(!this.courseTypeIsVip) {
|
|
|
+ online = parseInt(form.totalClassTime || 0)
|
|
|
+ }
|
|
|
+ // let totalCount = Number(online) + Number(offline)
|
|
|
+ let hasOnlineSchedule = false,
|
|
|
+ hasOfflineSchedule = false
|
|
|
+
|
|
|
+ for (let i = 0; i < scheduleList.length; i++) {
|
|
|
+ const item = scheduleList[i];
|
|
|
+ if (item.type == '线上') {
|
|
|
+ hasOnlineSchedule = true;
|
|
|
+ }
|
|
|
+ if (item.type == '线下') {
|
|
|
+ hasOfflineSchedule = true;
|
|
|
+ }
|
|
|
+ if (hasOnlineSchedule && hasOfflineSchedule) {
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (online > 0 && !hasOnlineSchedule) {
|
|
|
+ return '请添加线上课时安排';
|
|
|
+ }
|
|
|
+ if (offline > 0 && !hasOfflineSchedule) {
|
|
|
+ return '请添加线下课时安排';
|
|
|
+ }
|
|
|
+ console.log({...form}, online, offline, hasOnlineSchedule, hasOfflineSchedule)
|
|
|
+ },
|
|
|
setTimeTable() {
|
|
|
if (!this.checkCourseList(false)) {
|
|
|
return;
|