diff --git a/client/components/Reader/RecentBooksPage/RecentBooksPage.vue b/client/components/Reader/RecentBooksPage/RecentBooksPage.vue index a49f04c6..ee47f324 100644 --- a/client/components/Reader/RecentBooksPage/RecentBooksPage.vue +++ b/client/components/Reader/RecentBooksPage/RecentBooksPage.vue @@ -7,6 +7,20 @@ + +
@@ -166,6 +180,14 @@ >
+ +
+ +
@@ -210,6 +232,7 @@ class RecentBooksPage { tableData = []; sortMethod = ''; showSameBook = false; + archive = false; created() { this.commit = this.$store.commit; @@ -261,7 +284,7 @@ class RecentBooksPage { //подготовка полей for (const book of sorted) { - if (book.deleted) + if ((!this.archive && book.deleted) || (this.archive && book.deleted != 1)) continue; let d = new Date(); @@ -429,7 +452,7 @@ class RecentBooksPage { get header() { const len = (this.tableData ? this.tableData.length : 0); - return `${(this.search ? 'Найдено' : 'Всего')} ${len} файл${this.wordEnding(len)}`; + return `${(this.search ? 'Найдено' : 'Всего')} ${len} файл${this.wordEnding(len)}${this.archive ? ' в архиве' : ''}`; } async downloadBook(fb2path, fullTitle) { @@ -455,7 +478,20 @@ class RecentBooksPage { } async handleDel(key) { + if (!this.archive) { + await bookManager.delRecentBook({key}); + this.$root.notify.info('Перенесено в архив'); + } else { + if (await this.$root.stdDialog.confirm('Подтвердите удаление из архива:', ' ')) { + await bookManager.delRecentBook({key}, 2); + this.$root.notify.info('Удалено безвозвратно'); + } + } + } + + async handleRestore(key) { await bookManager.delRecentBook({key}); + this.$root.notify.info('Перенесено в архив'); } loadBook(row) { @@ -575,6 +611,11 @@ class RecentBooksPage { ]; } + archiveToggle() { + this.archive = !this.archive; + this.updateTableData(); + } + close() { this.$emit('recent-books-close'); } @@ -692,4 +733,24 @@ export default vueComponent(RecentBooksPage); background-color: #FF3030; } +.header-button, .header-button-pressed { + width: 80px; + height: 30px; + cursor: pointer; + color: #555555; +} + +.header-button:hover { + color: white; + background-color: #39902F; +} + +.header-button-pressed { + color: black; + background-color: yellow; +} + +.header-button-pressed:hover { + color: black; +} diff --git a/client/components/Reader/share/bookManager.js b/client/components/Reader/share/bookManager.js index 1e232d00..9ff19dca 100644 --- a/client/components/Reader/share/bookManager.js +++ b/client/components/Reader/share/bookManager.js @@ -433,9 +433,9 @@ class BookManager { return this.recent[value.key]; } - async delRecentBook(value) { + async delRecentBook(value, delFlag = 1) { const item = this.recent[value.key]; - item.deleted = 1; + item.deleted = delFlag; if (this.recentLastKey == value.key) { await this.recentSetLastKey(null);