|
|
|
|
@ -45,7 +45,7 @@ |
|
|
|
|
<div v-if="!live" class="info__field field"> |
|
|
|
|
<div class="field__label field__label_gray">ССЫЛКА</div> |
|
|
|
|
<div class="field__wrap"> |
|
|
|
|
<input type="text" class="field__input" v-model="course.url" @input="slugChanged = true"> |
|
|
|
|
<input type="text" class="field__input" v-model="course.slug" @input="slugChanged = true"> |
|
|
|
|
</div> |
|
|
|
|
<div class="field__wrap field__wrap--additional">{{ courseFullUrl }}</div> |
|
|
|
|
</div> |
|
|
|
|
@ -273,6 +273,7 @@ |
|
|
|
|
price: null, |
|
|
|
|
old_price: null, |
|
|
|
|
age: 0, |
|
|
|
|
slug: '', |
|
|
|
|
url: '', |
|
|
|
|
coverImage: '', |
|
|
|
|
kit__body: null, |
|
|
|
|
@ -473,8 +474,8 @@ |
|
|
|
|
}, |
|
|
|
|
onCourseNameInput() { |
|
|
|
|
this.$v.course.title.$touch(); |
|
|
|
|
if (!this.slugChanged) { |
|
|
|
|
this.course.url = slugify(this.course.title); |
|
|
|
|
if (!this.slugChanged && !this.$v.course.status) { |
|
|
|
|
this.course.slug = slugify(this.course.title); |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
removeLesson(lessonIndex) { |
|
|
|
|
@ -741,24 +742,6 @@ |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
saveCourseDraft: function (newValue, oldValue) { |
|
|
|
|
//console.log('saveCourseDraft'); |
|
|
|
|
// if (!oldValue.id) { |
|
|
|
|
// return; |
|
|
|
|
// } |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// if(this.live) { |
|
|
|
|
// if(!this.course.date || this.course.short_description == '' || this.course.title == '') { |
|
|
|
|
// //console.log('live valiedation error'); |
|
|
|
|
// return; |
|
|
|
|
// } |
|
|
|
|
// } else { |
|
|
|
|
// if(this.course.short_description == '' || this.course.title == '') { |
|
|
|
|
// //console.log('course validation error'); |
|
|
|
|
// return; |
|
|
|
|
// } |
|
|
|
|
// } |
|
|
|
|
|
|
|
|
|
if (this.savingDebounceTimeout) { |
|
|
|
|
clearTimeout(this.savingDebounceTimeout); |
|
|
|
|
} |
|
|
|
|
@ -771,13 +754,14 @@ |
|
|
|
|
this.courseSaving = true; |
|
|
|
|
this.changeSavingStatus(); |
|
|
|
|
const courseObject = this.course; |
|
|
|
|
courseObject.url = (courseObject.url) ? slugify(courseObject.url):courseObject.url; |
|
|
|
|
courseObject.slug = courseObject.slug && slugify(courseObject.slug); |
|
|
|
|
api.saveCourse(courseObject, this.accessToken) |
|
|
|
|
.then((response) => { |
|
|
|
|
this.courseSaving = false; |
|
|
|
|
this.changeSavingStatus(true); |
|
|
|
|
this.courseSyncHook = true; |
|
|
|
|
const courseData = api.convertCourseJson(response.data); |
|
|
|
|
this.course.slug = courseData.slug; |
|
|
|
|
if (this.course.coverImage) { |
|
|
|
|
courseData.coverImage = this.course.coverImage; |
|
|
|
|
} |
|
|
|
|
@ -804,19 +788,11 @@ |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
if (courseData.url) { |
|
|
|
|
this.slugChanged = true; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if(courseData.id) { |
|
|
|
|
this.course.id = courseData.id; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/*if(this.live && courseData.date) { |
|
|
|
|
this.course.date = _.find(this.scheduleOptions, function(item){ |
|
|
|
|
return item.value == courseData.date; |
|
|
|
|
}); |
|
|
|
|
}*/ |
|
|
|
|
this.$nextTick(() => { |
|
|
|
|
this.courseSyncHook = false; |
|
|
|
|
}); |
|
|
|
|
@ -1029,10 +1005,7 @@ |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
courseFullUrl() { |
|
|
|
|
if (!this.course.url) { |
|
|
|
|
return `https://lil.city/course/${this.course.id}`; |
|
|
|
|
} |
|
|
|
|
let suffix = this.course.url ? this.course.url : 'ваша_ссылка'; |
|
|
|
|
let suffix = this.course.slug || this.course.id || 'ваша_ссылка'; |
|
|
|
|
return `https://lil.city/course/${suffix}`; |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
|