Исправление ошибки с дублированием блока

remotes/origin/hasaccess
Vitaly Baev 8 years ago
parent 59ca1b41f1
commit 7ff7bc0013
  1. 12
      web/src/components/CourseRedactor.vue
  2. 8
      web/src/js/modules/api.js

@ -334,7 +334,8 @@
],
showErrors: false,
savingTimeout: null,
categoryOptions: []
categoryOptions: [],
courseSyncHook: false, // Если true, то watch не будет отправлять курс на обновление
}
},
validations: {
@ -528,7 +529,11 @@
this.savingTimeout = setTimeout(() => {
document.getElementById('course-redactor__saving-status').innerText = '';
}, 2000);
// this.course = api.convertCourseJson(response.data);
this.courseSyncHook = true;
this.course = api.convertCourseJson(response.data);
this.$nextTick(() => {
this.courseSyncHook = false;
})
})
.catch((err) => {
this.courseSaving = false;
@ -630,6 +635,9 @@
watch: {
'course': {
handler: function (newValue, oldValue) {
if (this.courseSyncHook) {
return;
}
this.saveCourseDraft(newValue, oldValue);
},
deep: true,

@ -55,9 +55,11 @@ export const api = {
let deferredStart = null;
if (courseObject.is_deferred) {
let deferredStartTime = moment(courseObject.time.value, "HH:mm");
let deferredStartDate = moment(courseObject.date).hour(deferredStartTime.hour());
deferredStart = deferredStartDate.format();
if (courseObject.date && courseObject.time && courseObject.time.value) {
let deferredStartTime = moment(courseObject.time.value, "HH:mm");
let deferredStartDate = moment(courseObject.date).hour(deferredStartTime.hour());
deferredStart = deferredStartDate.format();
}
}
const courseJson = {

Loading…
Cancel
Save