|
|
|
|
@ -3,63 +3,38 @@ |
|
|
|
|
<div v-if="!courseLoading && !mounting"> |
|
|
|
|
<form v-if="viewSection !== 'lessons-edit'" @submit.prevent="onSubmit"> |
|
|
|
|
<div class="info"> |
|
|
|
|
<div class="info__section" :style="coverBackgroundStyle"> |
|
|
|
|
<div class="info__main"> |
|
|
|
|
<div class="info__head"> |
|
|
|
|
<div class="info__user"> |
|
|
|
|
<div class="info__ava ava"> |
|
|
|
|
<img :src="authorPicture" alt="Аватар" class="ava__pic"> |
|
|
|
|
</div> |
|
|
|
|
<div v-if="me" class="info__group info__field--light"> |
|
|
|
|
<div class="info__label">АВТОР</div> |
|
|
|
|
<div class="info__value">{{ authorName }}</div> |
|
|
|
|
</div> |
|
|
|
|
</div> |
|
|
|
|
<div class="info__upload upload"> |
|
|
|
|
Загрузить фон |
|
|
|
|
<div class="info__section"> |
|
|
|
|
<div class="courses__item"> |
|
|
|
|
<div class="courses__preview"> |
|
|
|
|
<img class="courses__pic" :src="course.coverImage || defaultCover" width="300px" /> |
|
|
|
|
<div class="upload" v-if="! course.coverImage"> |
|
|
|
|
<div class="upload__title">Загрузить превью</div> |
|
|
|
|
<input type="file" class="upload__file" @change="onCoverImageSelected"> |
|
|
|
|
</div> |
|
|
|
|
<a href="#" title="Удалить превью" class="course-delete-cover" v-if="course.coverImage" @click="removeCover"> |
|
|
|
|
<svg class="icon icon-delete"> |
|
|
|
|
<use xlink:href="/static/img/sprite.svg#icon-delete"></use> |
|
|
|
|
</svg> |
|
|
|
|
</a> |
|
|
|
|
</div> |
|
|
|
|
<div class="info__title"> |
|
|
|
|
<div class="info__field field field_info" |
|
|
|
|
v-bind:class="{ error: ($v.course.title.$dirty || showErrors) && $v.course.title.$invalid }"> |
|
|
|
|
<div class="field__label">{{titles.courseTitle}}</div> |
|
|
|
|
<div class="field__wrap"> |
|
|
|
|
<textarea class="field__textarea" |
|
|
|
|
rows="1" |
|
|
|
|
:title="titles.courseTitle" |
|
|
|
|
v-autosize="course.title" |
|
|
|
|
@change="onCourseNameInput" |
|
|
|
|
v-model="course.title"></textarea> |
|
|
|
|
</div> |
|
|
|
|
</div> |
|
|
|
|
<div class="info__field field field_info field_short_description" |
|
|
|
|
v-bind:class="{ error: ($v.course.short_description.$dirty || showErrors) && $v.course.short_description.$invalid }"> |
|
|
|
|
<div class="field__label">{{titles.shortDescription}}</div> |
|
|
|
|
<div class="field__wrap"> |
|
|
|
|
<vue-redactor :value="course.short_description" |
|
|
|
|
v-on:update:value="(value) => { this.course.short_description = value; }" /> |
|
|
|
|
</div> |
|
|
|
|
</div> |
|
|
|
|
</div> |
|
|
|
|
<div class="info__foot" v-if="!live"> |
|
|
|
|
<div class="info__field field field_info info__field--light" |
|
|
|
|
v-bind:class="{ error: ($v.course.category.$dirty || showErrors) && $v.course.category.$invalid }"> |
|
|
|
|
<div class="field__label field__label_gray">КАТЕГОРИЯ</div> |
|
|
|
|
<div class="field__wrap"> |
|
|
|
|
<lil-select :value.sync="course.category" :options="categoryOptions" |
|
|
|
|
<div class="courses__details"> |
|
|
|
|
<div class="courses__theme theme field info__field--light" v-if="!live" v-bind:class="{ error: (!$v.live && $v.course.category.$dirty || showErrors) && $v.course.category.$invalid }"> |
|
|
|
|
<lil-select :value.sync="course.category" :options="categoryOptions" |
|
|
|
|
placeholder="Выберите категорию"/> |
|
|
|
|
</div> |
|
|
|
|
</div> |
|
|
|
|
<div class="info__field field field_info" |
|
|
|
|
v-bind:class="{ error: ($v.course.duration.$dirty || showErrors) && $v.course.duration.$invalid }"> |
|
|
|
|
<div class="field__label field__label_gray">ПРОДОЛЖИТЕЛЬНОСТЬ</div> |
|
|
|
|
<div class="field__wrap field__wrap__appended"> |
|
|
|
|
<input type="text" class="field__input field__input__appended" v-model.number="course.duration" |
|
|
|
|
@input="$v.course.duration.$touch()"> |
|
|
|
|
<button disabled class="field__append">{{pluralize(course.duration, ['день', 'дня', 'дней'])}}</button> |
|
|
|
|
</div> |
|
|
|
|
</div> |
|
|
|
|
<div class="courses__price" v-if="course.is_paid && course.price">{{ course.price }}₽</div> |
|
|
|
|
</div> |
|
|
|
|
<div class="courses__title field field" v-bind:class="{ error: ($v.course.title.$dirty || showErrors) && $v.course.title.$invalid }"> |
|
|
|
|
<textarea class="field__textarea" |
|
|
|
|
rows="1" |
|
|
|
|
:title="titles.courseTitle" |
|
|
|
|
v-autosize="course.title" |
|
|
|
|
@change="onCourseNameInput" |
|
|
|
|
v-model="course.title" |
|
|
|
|
placeholder="Добавить заголовок"></textarea> |
|
|
|
|
</div> |
|
|
|
|
<div class="courses__content field" v-bind:class="{ error: ($v.course.short_description.$dirty || showErrors) && $v.course.short_description.$invalid }"> |
|
|
|
|
<vue-redactor :value.sync="course.short_description" placeholder="Добавить краткое описание"/> |
|
|
|
|
</div> |
|
|
|
|
</div> |
|
|
|
|
</div> |
|
|
|
|
@ -90,6 +65,16 @@ |
|
|
|
|
</div> |
|
|
|
|
</div> --> |
|
|
|
|
|
|
|
|
|
<div class="info__field field field_info" v-if="!live" |
|
|
|
|
v-bind:class="{ error: ($v.course.duration.$dirty || showErrors) && $v.course.duration.$invalid }"> |
|
|
|
|
<div class="field__label field__label_gray">ПРОДОЛЖИТЕЛЬНОСТЬ</div> |
|
|
|
|
<div class="field__wrap field__wrap__appended"> |
|
|
|
|
<input type="text" class="field__input field__input__appended" v-model.number="course.duration" |
|
|
|
|
@input="$v.course.duration.$touch()"> |
|
|
|
|
<button disabled class="field__append">{{pluralize(course.duration, ['день', 'дня', 'дней'])}}</button> |
|
|
|
|
</div> |
|
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
<div v-if="!live" class="info__field field"> |
|
|
|
|
<div class="field__label field__label_gray">ДОСТУП</div> |
|
|
|
|
<div class="field__wrap"> |
|
|
|
|
@ -267,6 +252,7 @@ |
|
|
|
|
users: null, |
|
|
|
|
ROLE_ADMIN: ROLE_ADMIN, |
|
|
|
|
slugChanged: false, |
|
|
|
|
defaultCover: '/img/no_cover.png', |
|
|
|
|
course: { |
|
|
|
|
title: '', |
|
|
|
|
status: null, |
|
|
|
|
@ -444,6 +430,16 @@ |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
methods: { |
|
|
|
|
removeCover() { |
|
|
|
|
if(! this.course.coverImageId){ |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
api.removeImage(this.course.coverImageId, this.accessToken) |
|
|
|
|
.then(response => { |
|
|
|
|
this.course.coverImageId = null; |
|
|
|
|
this.course.coverImage = null; |
|
|
|
|
}); |
|
|
|
|
}, |
|
|
|
|
onCoverImageSelected(event) { |
|
|
|
|
let file = event.target.files[0]; |
|
|
|
|
let reader = new FileReader(); |
|
|
|
|
@ -1005,9 +1001,6 @@ |
|
|
|
|
// this.updateViewSection(window.location); |
|
|
|
|
}, |
|
|
|
|
computed: { |
|
|
|
|
coverBackgroundStyle() { |
|
|
|
|
return this.course.coverImage ? `background-image: url(${this.course.coverImage});` : ''; |
|
|
|
|
}, |
|
|
|
|
displayPrice: { |
|
|
|
|
get: function () { |
|
|
|
|
return this.course.is_paid ? (this.course.price || '') : ''; |
|
|
|
|
@ -1175,10 +1168,67 @@ |
|
|
|
|
overflow: scroll; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
.field_short_description .redactor-box { |
|
|
|
|
.courses__item { |
|
|
|
|
flex: 0 0 300px; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
.courses__item .field { |
|
|
|
|
margin-bottom: 0; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
.courses__content .redactor-box { |
|
|
|
|
overflow-x: visible; |
|
|
|
|
overflow-y: auto; |
|
|
|
|
max-height: 200px; |
|
|
|
|
background: none; |
|
|
|
|
margin-top: 10px; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
.courses__content .redactor-layer{ |
|
|
|
|
background: none; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
.courses__theme { |
|
|
|
|
flex: 1; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
.courses__price { |
|
|
|
|
margin-left: 20px; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
.courses__preview { |
|
|
|
|
.upload { |
|
|
|
|
position: absolute; |
|
|
|
|
top: 0; |
|
|
|
|
left: 0; |
|
|
|
|
width: 100%; |
|
|
|
|
height: 100%; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
.upload__title { |
|
|
|
|
color: #888888; |
|
|
|
|
font-size: 16px; |
|
|
|
|
margin-top: 100px; |
|
|
|
|
width: 100%; |
|
|
|
|
text-align: center; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
.upload__file { |
|
|
|
|
width: 100%; |
|
|
|
|
height: 100%; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
.course-delete-cover { |
|
|
|
|
left: 5px; |
|
|
|
|
position: absolute; |
|
|
|
|
bottom: 3px; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
.select__head { |
|
|
|
|
font-size: inherit; |
|
|
|
|
line-height: inherit; |
|
|
|
|
height: auto; |
|
|
|
|
} |
|
|
|
|
</style> |
|
|
|
|
|
|
|
|
|
|