From bc0b0d6e0454dfb391ca17d08b67ed1aa550bd03 Mon Sep 17 00:00:00 2001 From: Book Pauk Date: Sun, 3 Feb 2019 23:23:59 +0700 Subject: [PATCH] =?UTF-8?q?=D0=94=D0=BE=D0=B4=D0=B5=D0=BB=D0=BA=D0=B8=20?= =?UTF-8?q?=D0=B7=D0=B0=D0=B3=D1=80=D1=83=D0=B7=D0=BA=D0=B8=20=D0=BA=D0=BD?= =?UTF-8?q?=D0=B8=D0=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/Reader/HistoryPage/HistoryPage.vue | 3 +-- client/components/Reader/Reader.vue | 13 +++++++++++-- client/components/Reader/share/bookManager.js | 2 +- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/client/components/Reader/HistoryPage/HistoryPage.vue b/client/components/Reader/HistoryPage/HistoryPage.vue index b2a74e12..7f0962eb 100644 --- a/client/components/Reader/HistoryPage/HistoryPage.vue +++ b/client/components/Reader/HistoryPage/HistoryPage.vue @@ -207,8 +207,7 @@ class HistoryPage extends Vue { } loadBook(url) { - if (this.mostRecentBook.url != url) - this.$emit('load-book', {url}); + this.$emit('load-book', {url}); this.close(); } diff --git a/client/components/Reader/Reader.vue b/client/components/Reader/Reader.vue index 68ba537d..67610ab4 100644 --- a/client/components/Reader/Reader.vue +++ b/client/components/Reader/Reader.vue @@ -148,6 +148,7 @@ class Reader extends Vue { mostRecentBookReactive = null; created() { + this.loading = true; this.commit = this.$store.commit; this.dispatch = this.$store.dispatch; this.reader = this.$store.state.reader; @@ -187,6 +188,7 @@ class Reader extends Vue { this.loaderActive = true; } } + this.loading = false; })(); } @@ -471,7 +473,7 @@ class Reader extends Vue { else if (this.mostRecentBookReactive) result = 'TextPage'; - if (!result) { + if (!result && !this.loading) { this.loaderActive = true; result = 'LoaderPage'; } @@ -484,7 +486,7 @@ class Reader extends Vue { //акивируем страницу с текстом this.$nextTick(async() => { const last = this.mostRecentBookReactive; - const isParsed = await bookManager.hasBookParsed(last); + const isParsed = bookManager.hasBookParsed(last); if (!isParsed) { this.$root.$emit('set-app-title'); return; @@ -511,6 +513,13 @@ class Reader extends Vue { return; } + // уже просматривается сейчас + const recent = this.mostRecentBook(); + if (recent && recent.url == opts.url && bookManager.hasBookParsed(recent)) { + this.loaderActive = false; + return; + } + this.progressActive = true; this.$nextTick(async() => { const progress = this.$refs.page; diff --git a/client/components/Reader/share/bookManager.js b/client/components/Reader/share/bookManager.js index 01e73029..bb976085 100644 --- a/client/components/Reader/share/bookManager.js +++ b/client/components/Reader/share/bookManager.js @@ -93,7 +93,7 @@ class BookManager { if (!meta.key) meta.key = this.keyFromUrl(meta.url); let book = this.books[meta.key]; - return (book && book.parsed); + return !!(book && book.parsed); } async getBook(meta, callback) {