Доделки загрузки книг

This commit is contained in:
Book Pauk
2019-02-03 23:23:59 +07:00
parent ce6f41dbe4
commit bc0b0d6e04
3 changed files with 13 additions and 5 deletions

View File

@@ -207,8 +207,7 @@ class HistoryPage extends Vue {
} }
loadBook(url) { loadBook(url) {
if (this.mostRecentBook.url != url) this.$emit('load-book', {url});
this.$emit('load-book', {url});
this.close(); this.close();
} }

View File

@@ -148,6 +148,7 @@ class Reader extends Vue {
mostRecentBookReactive = null; mostRecentBookReactive = null;
created() { created() {
this.loading = true;
this.commit = this.$store.commit; this.commit = this.$store.commit;
this.dispatch = this.$store.dispatch; this.dispatch = this.$store.dispatch;
this.reader = this.$store.state.reader; this.reader = this.$store.state.reader;
@@ -187,6 +188,7 @@ class Reader extends Vue {
this.loaderActive = true; this.loaderActive = true;
} }
} }
this.loading = false;
})(); })();
} }
@@ -471,7 +473,7 @@ class Reader extends Vue {
else if (this.mostRecentBookReactive) else if (this.mostRecentBookReactive)
result = 'TextPage'; result = 'TextPage';
if (!result) { if (!result && !this.loading) {
this.loaderActive = true; this.loaderActive = true;
result = 'LoaderPage'; result = 'LoaderPage';
} }
@@ -484,7 +486,7 @@ class Reader extends Vue {
//акивируем страницу с текстом //акивируем страницу с текстом
this.$nextTick(async() => { this.$nextTick(async() => {
const last = this.mostRecentBookReactive; const last = this.mostRecentBookReactive;
const isParsed = await bookManager.hasBookParsed(last); const isParsed = bookManager.hasBookParsed(last);
if (!isParsed) { if (!isParsed) {
this.$root.$emit('set-app-title'); this.$root.$emit('set-app-title');
return; return;
@@ -511,6 +513,13 @@ class Reader extends Vue {
return; return;
} }
// уже просматривается сейчас
const recent = this.mostRecentBook();
if (recent && recent.url == opts.url && bookManager.hasBookParsed(recent)) {
this.loaderActive = false;
return;
}
this.progressActive = true; this.progressActive = true;
this.$nextTick(async() => { this.$nextTick(async() => {
const progress = this.$refs.page; const progress = this.$refs.page;

View File

@@ -93,7 +93,7 @@ class BookManager {
if (!meta.key) if (!meta.key)
meta.key = this.keyFromUrl(meta.url); meta.key = this.keyFromUrl(meta.url);
let book = this.books[meta.key]; let book = this.books[meta.key];
return (book && book.parsed); return !!(book && book.parsed);
} }
async getBook(meta, callback) { async getBook(meta, callback) {