|
|
|
|
@ -552,17 +552,21 @@ |
|
|
|
|
}, |
|
|
|
|
onLessonSubmit() { |
|
|
|
|
if(!this.validateLesson()) { |
|
|
|
|
return; |
|
|
|
|
return new Promise(function(resolve, reject) { |
|
|
|
|
reject('validation reject'); |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
showNotification("success", "Момент, вносим последние правки!"); |
|
|
|
|
|
|
|
|
|
this.saveLesson(); |
|
|
|
|
return this.saveLesson(); |
|
|
|
|
}, |
|
|
|
|
saveLesson() { |
|
|
|
|
this.lessonSaving = true; |
|
|
|
|
const currentLessonId = this.currentLesson.id; |
|
|
|
|
this.currentLesson.course_id = this.course.id; |
|
|
|
|
api.saveLesson(this.currentLesson, this.accessToken) |
|
|
|
|
.then((response) => { |
|
|
|
|
let req = api.saveLesson(this.currentLesson, this.accessToken); |
|
|
|
|
|
|
|
|
|
req.then((response) => { |
|
|
|
|
const newLesson = api.convertLessonJson(response.data); |
|
|
|
|
newLesson.course_id = this.course.id; |
|
|
|
|
this.currentLesson = newLesson; |
|
|
|
|
@ -583,7 +587,7 @@ |
|
|
|
|
}, 2000); |
|
|
|
|
|
|
|
|
|
showNotification("success", 'Урок сохранён'); |
|
|
|
|
this.goToLessons(); |
|
|
|
|
// this.goToLessons(); |
|
|
|
|
|
|
|
|
|
this.lessonSaving = false; |
|
|
|
|
}) |
|
|
|
|
@ -604,6 +608,8 @@ |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
return req; |
|
|
|
|
}, |
|
|
|
|
goToLessons() { |
|
|
|
|
history.push("/course/create/lessons"); |
|
|
|
|
@ -729,8 +735,17 @@ |
|
|
|
|
if(this.course.id) { |
|
|
|
|
let url; |
|
|
|
|
|
|
|
|
|
if(this.currentLesson && this.currentLesson.id) { |
|
|
|
|
url = `/lesson/${this.currentLesson.id}`; |
|
|
|
|
if(this.viewSection === 'lessons-edit') { |
|
|
|
|
this.onLessonSubmit().then(()=>{ |
|
|
|
|
url = `/lesson/${this.currentLesson.id}`; |
|
|
|
|
|
|
|
|
|
let newTab = window.open(url, '_blank'); |
|
|
|
|
newTab.focus(); |
|
|
|
|
}).catch((e)=>{ |
|
|
|
|
// showNotification("error", "Пока еще нечего посмотреть, давайте что-нибудь напишем"); |
|
|
|
|
|
|
|
|
|
console.log(e); |
|
|
|
|
}); |
|
|
|
|
} else { |
|
|
|
|
if(this.live) { |
|
|
|
|
url = `/school/lessons/${this.course.id}`; |
|
|
|
|
@ -740,10 +755,10 @@ |
|
|
|
|
} |
|
|
|
|
url = `/course/${this.course.id}`; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
let newTab = window.open(url, '_blank'); |
|
|
|
|
newTab.focus(); |
|
|
|
|
let newTab = window.open(url, '_blank'); |
|
|
|
|
newTab.focus(); |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
showNotification("error", "Пока еще нечего посмотреть, давайте что-нибудь напишем"); |
|
|
|
|
} |
|
|
|
|
|