В настройки веб-интерфейса добавлена опция "Скачивать книги в виде zip-архива"
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import axios from 'axios';
|
||||
import dayjs from 'dayjs';
|
||||
import _ from 'lodash';
|
||||
|
||||
@@ -50,6 +51,7 @@ export default class BaseList {
|
||||
expandedAuthor = [];
|
||||
expandedSeries = [];
|
||||
|
||||
downloadAsZip = false;
|
||||
showCounts = true;
|
||||
showRates = true;
|
||||
showGenres = true;
|
||||
@@ -81,6 +83,7 @@ export default class BaseList {
|
||||
|
||||
this.expandedAuthor = _.cloneDeep(settings.expandedAuthor);
|
||||
this.expandedSeries = _.cloneDeep(settings.expandedSeries);
|
||||
this.downloadAsZip = settings.downloadAsZip;
|
||||
this.showCounts = settings.showCounts;
|
||||
this.showRates = settings.showRates;
|
||||
this.showGenres = settings.showGenres;
|
||||
@@ -133,13 +136,20 @@ export default class BaseList {
|
||||
const response = await this.api.getBookLink(book._uid);
|
||||
|
||||
const link = response.link;
|
||||
const href = `${window.location.origin}${link}`;
|
||||
let href = `${window.location.origin}${link}`;
|
||||
|
||||
//downloadAsZip
|
||||
if (this.downloadAsZip && (action == 'download' || action == 'copyLink')) {
|
||||
href += '/zip';
|
||||
//подожлем формирования zip-файла
|
||||
await axios.head(href);
|
||||
}
|
||||
|
||||
//action
|
||||
if (action == 'download') {
|
||||
//скачивание
|
||||
const d = this.$refs.download;
|
||||
d.href = href;
|
||||
d.download = response.downFileName;
|
||||
|
||||
d.click();
|
||||
} else if (action == 'copyLink') {
|
||||
|
||||
@@ -19,7 +19,8 @@
|
||||
/>
|
||||
</div>
|
||||
|
||||
<q-checkbox v-model="showCounts" size="36px" label="Показывать количество" />
|
||||
<q-checkbox v-model="downloadAsZip" size="36px" label="Скачивать книги в виде zip-архива" />
|
||||
<q-checkbox v-model="showCounts" size="36px" label="Показывать количество" />
|
||||
<q-checkbox v-model="showRates" size="36px" label="Показывать оценки" />
|
||||
<q-checkbox v-model="showInfo" size="36px" label="Показывать кнопку (инфо)" />
|
||||
<q-checkbox v-model="showGenres" size="36px" label="Показывать жанры" />
|
||||
@@ -60,6 +61,9 @@ const componentOptions = {
|
||||
limit(newValue) {
|
||||
this.commit('setSettings', {'limit': newValue});
|
||||
},
|
||||
downloadAsZip(newValue) {
|
||||
this.commit('setSettings', {'downloadAsZip': newValue});
|
||||
},
|
||||
showCounts(newValue) {
|
||||
this.commit('setSettings', {'showCounts': newValue});
|
||||
},
|
||||
@@ -93,6 +97,7 @@ class SettingsDialog {
|
||||
|
||||
//settings
|
||||
limit = 20;
|
||||
downloadAsZip = false;
|
||||
showCounts = true;
|
||||
showRates = true;
|
||||
showInfo = true;
|
||||
@@ -129,6 +134,7 @@ class SettingsDialog {
|
||||
|
||||
this.limit = settings.limit;
|
||||
|
||||
this.downloadAsZip = settings.downloadAsZip;
|
||||
this.showCounts = settings.showCounts;
|
||||
this.showRates = settings.showRates;
|
||||
this.showInfo = settings.showInfo;
|
||||
|
||||
@@ -7,6 +7,7 @@ const state = {
|
||||
limit: 20,
|
||||
expandedAuthor: [],
|
||||
expandedSeries: [],
|
||||
downloadAsZip: false,
|
||||
showCounts: true,
|
||||
showRates: true,
|
||||
showInfo: true,
|
||||
|
||||
Reference in New Issue
Block a user