Merge branch 'hotfix/lil-588' into 'master'

Hotfix/lil 588

See merge request lilcity/backend!91
remotes/origin/hotfix/LIL-661
cfwme 8 years ago
commit 14a2b9e221
  1. 12
      apps/school/templates/school/livelesson_detail.html
  2. 4
      web/package.json
  3. 41
      web/src/components/blocks/Image.vue
  4. 18
      web/src/sass/_common.sass

@ -8,13 +8,12 @@
<div class="lesson"> <div class="lesson">
<div class="lesson__subtitle subtitle">{{ livelesson.title }}</div> <div class="lesson__subtitle subtitle">{{ livelesson.title }}</div>
<div class="lesson__content">{{ livelesson.short_description }}</div> <div class="lesson__content">{{ livelesson.short_description }}</div>
<div class="lesson__video video">
{% if livelesson.stream_index %} {% if livelesson.stream_index %}
<a class="lesson__video video" href="#"> <iframe class="lesson__video_frame" src="https://player.vimeo.com/video/{{ livelesson.stream_index }}?autoplay=1" frameborder="0" webkitallowfullscreen
<iframe class="lesson__video_frame" src="https://player.vimeo.com/video/{{ livelesson.stream_index }}?autoplay=1" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen>
mozallowfullscreen allowfullscreen> </iframe>
</iframe> <span>Если видео не загрузилось, - уменьшите качество видео или <a href="#" onclick="location.reload();">обновите страницу</a></span>
</a>
Если видео не загрузилось, уменьшите качество видео или <a href="#" onclick="location.reload();">обновите страницу</a>
<iframe class="lesson__chat_frame" src="https://vimeo.com/live-chat/{{ livelesson.stream_index }}" frameborder="0"></iframe> <iframe class="lesson__chat_frame" src="https://vimeo.com/live-chat/{{ livelesson.stream_index }}" frameborder="0"></iframe>
{% else %} {% else %}
{% if livelesson.cover %} {% if livelesson.cover %}
@ -22,6 +21,7 @@
{% else %} {% else %}
{% endif %} {% endif %}
{% endif %} {% endif %}
</div>
</div> </div>
</div> </div>
</div> </div>

@ -34,9 +34,13 @@
"webpack": "^3.10.0" "webpack": "^3.10.0"
}, },
"dependencies": { "dependencies": {
"autosize": "^4.0.2",
"autosize-input": "^1.0.2",
"axios": "^0.17.1", "axios": "^0.17.1",
"babel-polyfill": "^6.26.0", "babel-polyfill": "^6.26.0",
"baguettebox.js": "^1.10.0", "baguettebox.js": "^1.10.0",
"downscale": "^1.0.4",
"glob": "^7.1.2",
"history": "^4.7.2", "history": "^4.7.2",
"ilyabirman-likely": "^2.3.0", "ilyabirman-likely": "^2.3.0",
"inputmask": "^3.3.11", "inputmask": "^3.3.11",

@ -1,5 +1,5 @@
<template> <template>
<div class="kit__photo"> <div class="kit__photo" :class="{'loading': loading}">
<svg class="icon icon-add-plus" v-if="!imageUrl"> <svg class="icon icon-add-plus" v-if="!imageUrl">
<use xlink:href="/static/img/sprite.svg#icon-add-plus"></use> <use xlink:href="/static/img/sprite.svg#icon-add-plus"></use>
</svg> </svg>
@ -10,6 +10,7 @@
<script> <script>
import {api} from "../../js/modules/api"; import {api} from "../../js/modules/api";
import downscale from 'downscale';
export default { export default {
name: "lil-image", name: "lil-image",
@ -22,19 +23,37 @@
methods: { methods: {
onImageAdded(event) { onImageAdded(event) {
this.loading = true; this.loading = true;
const maxSize = 1600;
let file = event.target.files[0]; let file = event.target.files[0];
let reader = new FileReader(); const reader = new FileReader();
reader.onload = () => { reader.onload = () => {
api.uploadImage(reader.result, this.accessToken) let img = document.createElement('img');
.then((response) => { img.onload = () => {
this.loading = false; let w = 0;
this.$emit('update:imageId', response.data.id); let h = 0;
this.$emit('update:imageUrl', response.data.image); if(img.width > img.height) {
}) w = maxSize;
.catch((error) => { h = 0;
this.loading = false; }
console.log('error', error); else {
w = 0;
h = maxSize;
}
downscale(img.src, w, h).then((dataURL) => {
img = null;
api.uploadImage(dataURL, this.accessToken)
.then((response) => {
this.loading = false;
this.$emit('update:imageId', response.data.id);
this.$emit('update:imageUrl', response.data.image);
})
.catch((error) => {
this.loading = false;
console.log('error', error);
});
}); });
}
img.src = reader.result;
}; };
if (file) { if (file) {
reader.readAsDataURL(file); reader.readAsDataURL(file);

@ -3480,6 +3480,24 @@ a.grey-link
.icon .icon
font-size: 20px font-size: 20px
fill: #B5B5B5 fill: #B5B5B5
&.loading &-image
visibility: hidden
&.loading
.icon
visibility: hidden
&:after
content: ''
position: absolute
top: 50%
left: 50%
width: 24px
height: 24px
margin: -12px 0 0 -12px
border: 3px solid #B5B5B5
border-left: 3px solid transparent
border-radius: 50%
animation: loading .6s infinite linear
&__file &__file
position: absolute position: absolute
top: 0 top: 0

Loading…
Cancel
Save