Правки редактирования курса

remotes/origin/hasaccess
Vitaly Baev 8 years ago
parent d16142c5a2
commit 3c6458bbc5
  1. 30
      apps/course/templates/course/course_edit.html
  2. 30
      web/src/components/CourseRedactor.vue
  3. 18
      web/src/components/blocks/BlockAdd.vue
  4. 2
      web/src/js/modules/api.js

@ -1,24 +1,12 @@
{% extends "templates/lilcity/index.html" %}
{% load static %}
{% block content %}
<script>
{% if request.user.is_authenticated %}
{% autoescape off %}
window.USER = {{ request.user.serialized }}
{% endautoescape %}
{% if request.user.auth_token %}
AUTH_TOKEN = "{{ request.user.auth_token }}"
{% else %}
AUTH_TOKEN = null
{% endif %}
{% else %}
windows.USER = null
{% endif %}
</script>
<div class="section section_border">
<div class="section__center center center_sm">
{{course}}
{{course.id}}
</div>
</div>
{% endblock content %}
<course-redactor author-picture="{% if request.user.photo %}{{ request.user.photo.url }}{% else %}{% static 'img/user.jpg' %}{% endif %}"
author-name="{{ request.user.first_name }} {{ request.user.last_name }}"
access-token="{{ request.user.auth_token }}"
{% if course and course.id %}:course-id="{{ course.id }}"{% endif %}></course-redactor>
{% endblock content %}
{% block foot %}
<script type="text/javascript" src={% static "courseRedactor.js" %}></script>
<link rel="stylesheet" href={% static "courseRedactor.css" %}/>
{% endblock foot %}

@ -217,7 +217,11 @@
</form>
</div>
<div v-else>
<div>Loading...</div>
<div class="section">
<div class="section__center center">
Загрузка...
</div>
</div>
</div>
</div>
</template>
@ -242,20 +246,20 @@
return {
viewSection: 'course',
course: {
title: 'Как просто научиться рисовать простых персонажей.',
category: 9,
title: '',
category: null,
categorySelect: null,
duration: 1,
price: 1000,
price: 0,
url: '',
coverImage: '',
coverImageId: null,
is_paid: true,
is_paid: false,
is_featured: true,
is_deferred: false,
date: '2018-03-08',
date: '',
time: null,
short_description: 'Этот курс поможет детям освоить базовые навыки рисования простых персонажей',
short_description: '',
content: [],
gallery: {
images: [],
@ -427,6 +431,17 @@
this.courseLoading = false;
console.log('error course loading', err);
});
},
loadLessons(courseId) {
api.getCourseLessons(courseId, this.accessToken)
.then((response) => {
this.lessons = response.data.results.map((lessonJson) => {
return api.convertLessonJson(lessonJson);
});
})
.catch((err) => {
console.log('error course loading', err);
});
}
},
mounted() {
@ -445,6 +460,7 @@
if (this.courseId) {
this.loadCourse(this.courseId);
this.loadLessons(this.courseId);
}
},
computed: {

@ -67,8 +67,8 @@
this.add({
type: 'text',
data: {
title: 'тест заголовок',
text: 'текст',
title: '',
text: '',
}
})
},
@ -76,7 +76,7 @@
this.add({
type: 'image',
data: {
title: 'тест картинка',
title: '',
image_id: null,
image_url: null,
}
@ -86,8 +86,8 @@
this.add({
type: 'image-text',
data: {
title: 'тест картинка-текст',
text: 'текст какой-то',
title: '',
text: '',
image_id: null,
image_url: null,
}
@ -97,8 +97,8 @@
this.add({
type: 'images',
data: {
title: 'тест заголовок картинок',
text: 'описание блока галереи',
title: '',
text: '',
images: [],
}
})
@ -107,8 +107,8 @@
this.add({
type: 'video',
data: {
title: 'тест видео',
video_url: 'http://vimeo.com/safmklsamfk',
title: '',
video_url: '',
}
})
},

@ -216,7 +216,7 @@ export const api = {
short_description: courseJSON.short_description,
category: courseJSON.category.id ? courseJSON.category.id : courseJSON.category,
price: parseFloat(courseJSON.price),
is_paid: parseFloat(courseJSON.price) === 0,
is_paid: parseFloat(courseJSON.price) > 0,
is_deferred: isDeferred,
date: deferredDate,
time: deferredTime ? {title: deferredTime, value: deferredTime} : null,

Loading…
Cancel
Save