LIL-467 Сделать значение по умолчанию пустой строкой, а не '0'

remotes/origin/hasaccess^2
gzbender 8 years ago
parent dceed7010b
commit 7a931aadcd
  1. 29
      web/src/components/CourseRedactor.vue
  2. 4
      web/src/js/modules/api.js

@ -619,6 +619,14 @@
$(window).scrollTop(elementTop); $(window).scrollTop(elementTop);
}); });
}, },
processCourseJson(data) {
this.course = api.convertCourseJson(data);
this.course.live = this.live;
this.lessons = data.lessons.map((lessonJson) => {
return api.convertLessonJson(lessonJson);
});
this.course.duration = this.course.duration || '';
},
loadCourseDraft() { loadCourseDraft() {
//console.log('loadCourseDraft'); //console.log('loadCourseDraft');
if(this.live) { return; } if(this.live) { return; }
@ -628,12 +636,8 @@
response response
.then((response) => { .then((response) => {
this.course = api.convertCourseJson(response.data); this.processCourseJson(response.data);
this.course.live = this.live;
this.courseLoading = false; this.courseLoading = false;
this.lessons = response.data.lessons.map((lessonJson) => {
return api.convertLessonJson(lessonJson);
});
}) })
.catch((err) => { .catch((err) => {
this.courseLoading = false; this.courseLoading = false;
@ -653,21 +657,10 @@
} }
request request
.then((response) => { .then((response) => {
this.course = api.convertCourseJson(response.data); this.processCourseJson(response.data);
this.course.live = this.live;
/* if (this.live && this.course.date) {
this.course.date = _.find(this.scheduleOptions, (item) => {
return item.value == this.course.date;
})
} */
this.$nextTick(() => { this.$nextTick(() => {
this.courseLoading = false; this.courseLoading = false;
}); });
this.lessons = response.data.lessons.map((lessonJson) => {
return api.convertLessonJson(lessonJson);
});
}) })
.catch((err) => { .catch((err) => {
this.courseLoading = false; this.courseLoading = false;
@ -1025,7 +1018,7 @@
}, },
displayPrice: { displayPrice: {
get: function () { get: function () {
return this.course.is_paid ? (this.course.price || 0) : 0; return this.course.is_paid ? (this.course.price || '') : '';
}, },
set: function (value) { set: function (value) {
this.course.price = value || 0; this.course.price = value || 0;

@ -107,9 +107,9 @@ export const api = {
author: courseObject.author ? courseObject.author : null, author: courseObject.author ? courseObject.author : null,
short_description: courseObject.short_description, short_description: courseObject.short_description,
category: courseObject.category, category: courseObject.category,
price: courseObject.is_paid ? courseObject.price : 0, price: courseObject.is_paid && courseObject.price || 0,
deferred_start_at: deferredStart, deferred_start_at: deferredStart,
duration: courseObject.duration, duration: courseObject.duration || 0,
is_featured: courseObject.is_featured, is_featured: courseObject.is_featured,
slug: courseObject.url, slug: courseObject.url,
date: (courseObject.date) ? courseObject.date.value:null, date: (courseObject.date) ? courseObject.date.value:null,

Loading…
Cancel
Save