|
|
|
|
@ -537,8 +537,7 @@ |
|
|
|
|
api.saveCourse(this.course, this.accessToken) |
|
|
|
|
.then((response) => { |
|
|
|
|
this.courseSaving = false; |
|
|
|
|
this.course = api.convertCourseJson(response.data); |
|
|
|
|
this.course.live = this.live; |
|
|
|
|
this.processCourseJson(response.data); |
|
|
|
|
}) |
|
|
|
|
.catch((err) => { |
|
|
|
|
this.courseSaving = false; |
|
|
|
|
@ -812,10 +811,7 @@ |
|
|
|
|
.catch((err) => { |
|
|
|
|
this.courseSyncHook = false; |
|
|
|
|
this.courseSaving = false; |
|
|
|
|
//console.error(err); |
|
|
|
|
this.changeSavingStatus(true, true); |
|
|
|
|
// alert('Произошло что-то страшное: '+err.toString()); |
|
|
|
|
//console.log(err.response.data); |
|
|
|
|
if(err.response) { |
|
|
|
|
for(let i in err.response.data) { |
|
|
|
|
if(typeof err.response.data[i] === "array") { |
|
|
|
|
@ -967,19 +963,7 @@ |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
// if (this.courseId) { |
|
|
|
|
// this.loadCourse().then(()=>{this.updateViewSection(window.location, 'load')}).catch(()=>{ |
|
|
|
|
// this.updateViewSection(window.location, 'load err') |
|
|
|
|
// }) |
|
|
|
|
// } else { |
|
|
|
|
// this.loadCourseDraft().then(()=>{this.updateViewSection(window.location, 'load draft')}).catch(()=>{ |
|
|
|
|
// this.updateViewSection(window.location, 'load draft err') |
|
|
|
|
// }); |
|
|
|
|
// } |
|
|
|
|
|
|
|
|
|
//console.log('wait promises'); |
|
|
|
|
Promise.all(promises.map(p => p.catch(e => e))).then(()=>{ |
|
|
|
|
//console.log('promises end'); |
|
|
|
|
this.mounting = false; |
|
|
|
|
let load; |
|
|
|
|
if (this.courseId) { |
|
|
|
|
@ -995,9 +979,6 @@ |
|
|
|
|
this.updateViewSection(window.location, 'load err '+this.courseId) |
|
|
|
|
}) |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
//console.log('mounted end'); |
|
|
|
|
// this.updateViewSection(window.location); |
|
|
|
|
}, |
|
|
|
|
computed: { |
|
|
|
|
displayPrice: { |
|
|
|
|
@ -1027,17 +1008,12 @@ |
|
|
|
|
watch: { |
|
|
|
|
'course': { |
|
|
|
|
handler: function (newValue, oldValue) { |
|
|
|
|
// //console.log('watch', JSON.stringify(newValue), JSON.stringify(oldValue)); |
|
|
|
|
// Если курс загрузился и есть ID - делаем кнопки превью и публикации активными |
|
|
|
|
//console.log('newValue.id', newValue.id); |
|
|
|
|
if (newValue.id) { |
|
|
|
|
// //console.log('newValue.id disabled remove', newValue.id); |
|
|
|
|
$('#course-redactor__preview-button').removeAttr('disabled'); |
|
|
|
|
$('#course-redactor__publish-button').removeAttr('disabled'); |
|
|
|
|
} |
|
|
|
|
// //console.log('courseSyncHook', this.courseSyncHook); |
|
|
|
|
if (this.courseSyncHook || this.courseLoading) { |
|
|
|
|
//console.log('abort save draft', this.courseSyncHook, this.courseLoading); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
this.saveCourseDraft(newValue, oldValue); |
|
|
|
|
|