Работа над BookUpdateChecker

This commit is contained in:
Book Pauk
2022-07-27 17:28:02 +07:00
parent 4697b46cba
commit 4b0e499c10
2 changed files with 36 additions and 3 deletions

View File

@@ -100,6 +100,12 @@
</q-tooltip>
</button>
<button v-show="showToolButton['recentBooks']" ref="recentBooks" v-ripple class="tool-button" :class="buttonActiveClass('recentBooks')" @click="buttonClick('recentBooks')">
<div v-show="needBookUpdateCount > 0" style="position: absolute">
<div class="need-book-update-count">
{{ needBookUpdateCount }}
</div>
</div>
<q-icon name="la la-book-open" size="32px" />
<q-tooltip :delay="1500" anchor="bottom middle" content-style="font-size: 80%">
{{ rstore.readerActions['recentBooks'] }}
@@ -156,7 +162,7 @@
></SearchPage>
<CopyTextPage v-if="copyTextActive" ref="copyTextPage" @do-action="doAction"></CopyTextPage>
<LibsPage v-show="hidden" ref="libsPage" @load-book="loadBook" @libs-close="libsClose" @do-action="doAction"></LibsPage>
<RecentBooksPage v-show="recentBooksActive" ref="recentBooksPage" @load-book="loadBook" @recent-books-close="recentBooksClose"></RecentBooksPage>
<RecentBooksPage v-show="recentBooksActive" ref="recentBooksPage" @load-book="loadBook" @recent-books-close="recentBooksClose" @update-count-changed="updateCountChanged"></RecentBooksPage>
<SettingsPage v-show="settingsActive" ref="settingsPage" @do-action="doAction"></SettingsPage>
<HelpPage v-if="helpActive" ref="helpPage" @do-action="doAction"></HelpPage>
<ClickMapPage v-show="clickMapActive" ref="clickMapPage"></ClickMapPage>
@@ -311,6 +317,7 @@ class Reader {
bucEnabled = false;
bucSetOnNew = false;
needBookUpdateCount = 0;
created() {
this.rstore = rstore;
@@ -423,6 +430,8 @@ class Reader {
this.updateRoute();
await this.$refs.dialogs.init();
this.$refs.recentBooksPage.init();
})();
//проверки обновлений читалки
@@ -603,11 +612,17 @@ class Reader {
await bookManager.recentSetItem(book);
}
}
await this.$refs.recentBooksPage.updateTableData();
} catch (e) {
console.error(e);
}
}
updateCountChanged(event) {
this.needBookUpdateCount = event.needBookUpdateCount;
}
checkSetStorageAccessKey() {
const q = this.$route.query;
@@ -1680,4 +1695,16 @@ export default vueComponent(Reader);
.clear {
color: rgba(0,0,0,0);
}
.need-book-update-count {
position: relative;
padding: 2px 6px 2px 6px;
left: 27px;
top: 22px;
background-color: blue;
border-radius: 10px;
color: white;
z-index: 10;
font-size: 80%;
}
</style>

View File

@@ -16,7 +16,7 @@
>
<span style="font-size: 90%">{{ needBookUpdateCount }} обновлен{{ wordEnding(needBookUpdateCount, 3) }}</span>
<q-tooltip :delay="1500" anchor="bottom middle" content-style="font-size: 80%">
{{ (showArchive ? 'Скрыть обновления' : 'Показать обновления') }}
{{ (needBookUpdateCount ? 'Скрыть обновления' : 'Показать обновления') }}
</q-tooltip>
</div>
@@ -270,6 +270,12 @@ const componentOptions = {
settings() {
this.loadSettings();
},
needBookUpdateCount() {
if (this.needBookUpdateCount == 0)
this.showNeedBookUpdateOnly = false;
this.$emit('update-count-changed', {needBookUpdateCount: this.needBookUpdateCount});
}
},
};
class RecentBooksPage {
@@ -551,7 +557,7 @@ class RecentBooksPage {
get header() {
const len = (this.tableData ? this.tableData.length : 0);
return `${(this.search ? `Найден${this.wordEnding(len, 2)}` : 'Всего')} ${len} файл${this.wordEnding(len)}${this.showArchive ? ' в архиве' : ''}`;
return `${(this.search || this.showNeedBookUpdateOnly ? `Найден${this.wordEnding(len, 2)}` : 'Всего')} ${len} файл${this.wordEnding(len)}${this.showArchive ? ' в архиве' : ''}`;
}
async downloadBook(fb2path, fullTitle) {