diff --git a/client/components/Api/Api.vue b/client/components/Api/Api.vue index b37c478..a4703c0 100644 --- a/client/components/Api/Api.vue +++ b/client/components/Api/Api.vue @@ -231,8 +231,12 @@ class Api { return await this.request({action: 'get-genre-tree'}); } - async getBookLink(params) { - return await this.request(Object.assign({action: 'get-book-link'}, params), 120); + async getBookLink(bookId) { + return await this.request({action: 'get-book-link', bookId}, 120); + } + + async getBookInfo(bookId) { + return await this.request({action: 'get-book-info', bookId}, 120); } async getConfig() { diff --git a/client/components/App.vue b/client/components/App.vue index b36ba19..8e46141 100644 --- a/client/components/App.vue +++ b/client/components/App.vue @@ -133,6 +133,15 @@ body, html, #app { animation: rotating 2s linear infinite; } +.q-dialog__inner--minimized { + padding: 10px !important; +} + +.q-dialog__inner--minimized > div { + max-height: 100% !important; + max-width: 800px !important; +} + @keyframes rotating { from { transform: rotate(0deg); diff --git a/client/components/Search/BaseList.js b/client/components/Search/BaseList.js index 0a5d23e..a9fc857 100644 --- a/client/components/Search/BaseList.js +++ b/client/components/Search/BaseList.js @@ -129,31 +129,8 @@ export default class BaseList { })(); try { - const makeValidFilenameOrEmpty = (s) => { - try { - return utils.makeValidFilename(s); - } catch(e) { - return ''; - } - }; - - //имя файла - let downFileName = 'default-name'; - const author = book.author.split(','); - const at = [author[0], book.title]; - downFileName = makeValidFilenameOrEmpty(at.filter(r => r).join(' - ')) - || makeValidFilenameOrEmpty(at[0]) - || makeValidFilenameOrEmpty(at[1]) - || downFileName; - downFileName = downFileName.substring(0, 100); - - const ext = `.${book.ext}`; - if (downFileName.substring(downFileName.length - ext.length) != ext) - downFileName += ext; - - const bookPath = `${book.folder}/${book.file}${ext}`; //подготовка - const response = await this.api.getBookLink({bookPath, downFileName}); + const response = await this.api.getBookLink(book.id); const link = response.link; const href = `${window.location.origin}${link}`; @@ -162,7 +139,7 @@ export default class BaseList { //скачивание const d = this.$refs.download; d.href = href; - d.download = downFileName; + d.download = response.downFileName; d.click(); } else if (action == 'copyLink') { @@ -185,6 +162,10 @@ export default class BaseList { const url = this.config.bookReadLink.replace('${DOWNLOAD_LINK}', href); window.open(url, '_blank'); } + } else if (action == 'bookInfo') { + //информация о книге + const response = await this.api.getBookInfo(book.id); + this.$emit('listEvent', {action: 'bookInfo', data: response.bookInfo}); } } catch(e) { this.$root.stdDialog.alert(e.message, 'Ошибка'); @@ -208,6 +189,7 @@ export default class BaseList { case 'download': case 'copyLink': case 'readBook': + case 'bookInfo': this.download(event.book, event.action);//no await break; } diff --git a/client/components/Search/BookInfoDialog/BookInfoDialog.vue b/client/components/Search/BookInfoDialog/BookInfoDialog.vue new file mode 100644 index 0000000..b7bed34 --- /dev/null +++ b/client/components/Search/BookInfoDialog/BookInfoDialog.vue @@ -0,0 +1,298 @@ + + + + + + + diff --git a/client/components/Search/BookView/BookView.vue b/client/components/Search/BookView/BookView.vue index 7baebb7..688d656 100644 --- a/client/components/Search/BookView/BookView.vue +++ b/client/components/Search/BookView/BookView.vue @@ -33,18 +33,20 @@
-
- {{ bookAuthor }} +
+
+ {{ bookAuthor }} +
{{ book.serno }}.
-
+
{{ book.title }}
-
+
{{ bookSeries }}
@@ -53,15 +55,19 @@ {{ bookSize }}, {{ book.ext }}
-
+
+ [ . . . ] +
+ +
(скачать)
-
+
-
+
(читать)
@@ -107,6 +113,7 @@ class BookView { }; showRates = true; + showInfo = true; showGenres = true; showDeleted = false; showDates = false; @@ -119,6 +126,7 @@ class BookView { const settings = this.settings; this.showRates = settings.showRates; + this.showInfo = settings.showInfo; this.showGenres = settings.showGenres; this.showDates = settings.showDates; this.showDeleted = settings.showDeleted; @@ -183,28 +191,8 @@ class BookView { return utils.sqlDateFormat(this.book.date); } - selectAuthor() { - this.$emit('bookEvent', {action: 'authorClick', book: this.book}); - } - - selectSeries() { - this.$emit('bookEvent', {action: 'seriesClick', book: this.book}); - } - - selectTitle() { - this.$emit('bookEvent', {action: 'titleClick', book: this.book}); - } - - download() { - this.$emit('bookEvent', {action: 'download', book: this.book}); - } - - copyLink() { - this.$emit('bookEvent', {action: 'copyLink', book: this.book}); - } - - readBook() { - this.$emit('bookEvent', {action: 'readBook', book: this.book}); + emit(action) { + this.$emit('bookEvent', {action, book: this.book}); } } diff --git a/client/components/Search/Search.vue b/client/components/Search/Search.vue index 6143a0f..a07514d 100644 --- a/client/components/Search/Search.vue +++ b/client/components/Search/Search.vue @@ -3,12 +3,23 @@
- + Новый поиск + + +
Коллекция @@ -17,26 +28,10 @@ {{ collection }}
- - - - - +
- + -
-
- {{ projectName }} -
+ + +
+ + + +