Поправки багов
This commit is contained in:
@@ -51,6 +51,7 @@ import Component from 'vue-class-component';
|
|||||||
export default @Component({
|
export default @Component({
|
||||||
watch: {
|
watch: {
|
||||||
rootRoute: function(newValue) {
|
rootRoute: function(newValue) {
|
||||||
|
this.setAppTitle();
|
||||||
if ((this.mode == 'reader' || this.mode == 'omnireader') && (newValue != '/reader')) {
|
if ((this.mode == 'reader' || this.mode == 'omnireader') && (newValue != '/reader')) {
|
||||||
this.$router.replace('/reader');
|
this.$router.replace('/reader');
|
||||||
}
|
}
|
||||||
@@ -156,13 +157,14 @@ class App extends Vue {
|
|||||||
const m = this.$route.path.match(/^(\/[^/]*).*$/i);
|
const m = this.$route.path.match(/^(\/[^/]*).*$/i);
|
||||||
this.$root.rootRoute = (m ? m[1] : this.$route.path);
|
this.$root.rootRoute = (m ? m[1] : this.$route.path);
|
||||||
|
|
||||||
this.setAppTitle();
|
|
||||||
return this.$root.rootRoute;
|
return this.$root.rootRoute;
|
||||||
}
|
}
|
||||||
|
|
||||||
setAppTitle(title) {
|
setAppTitle(title) {
|
||||||
if (!title) {
|
if (!title) {
|
||||||
if (this.config) {
|
if (this.mode == 'omnireader') {
|
||||||
|
document.title = `Omni Reader - всегда с вами`;
|
||||||
|
} else if (this.config) {
|
||||||
document.title = `${this.config.name} - ${this.itemRuText[this.$root.rootRoute]}`;
|
document.title = `${this.config.name} - ${this.itemRuText[this.$root.rootRoute]}`;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -113,11 +113,16 @@ class Reader extends Vue {
|
|||||||
|
|
||||||
buttonClick(button) {
|
buttonClick(button) {
|
||||||
switch (button) {
|
switch (button) {
|
||||||
case 'loader': this.commit('reader/setLoaderActive', !this.loaderActive); break;
|
case 'loader': this.commit('reader/setLoaderActive', !this.loaderActive); this.resetRoute(); break;
|
||||||
case 'fullscreen': this.commit('reader/setFullScreenActive', !this.fullScreenActive); break;
|
case 'fullscreen': this.commit('reader/setFullScreenActive', !this.fullScreenActive); break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
resetRoute() {
|
||||||
|
if (this.loaderActive)
|
||||||
|
this.$router.replace('/reader');
|
||||||
|
}
|
||||||
|
|
||||||
buttonActiveClass(button) {
|
buttonActiveClass(button) {
|
||||||
const classActive = { 'tool-button-active': true, 'tool-button-active:hover': true };
|
const classActive = { 'tool-button-active': true, 'tool-button-active:hover': true };
|
||||||
switch (button) {
|
switch (button) {
|
||||||
@@ -146,10 +151,6 @@ class Reader extends Vue {
|
|||||||
this.$root.$emit('set-app-title');
|
this.$root.$emit('set-app-title');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (result == 'LoaderPage') {
|
|
||||||
this.$router.replace('/reader');
|
|
||||||
}
|
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -177,6 +178,7 @@ class Reader extends Vue {
|
|||||||
} catch (e) {
|
} catch (e) {
|
||||||
progress.hide(); this.progressActive = false;
|
progress.hide(); this.progressActive = false;
|
||||||
this.commit('reader/setLoaderActive', true);
|
this.commit('reader/setLoaderActive', true);
|
||||||
|
this.resetRoute();
|
||||||
this.$alert(e.message, 'Ошибка', {type: 'error'});
|
this.$alert(e.message, 'Ошибка', {type: 'error'});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -206,6 +208,7 @@ class Reader extends Vue {
|
|||||||
} catch (e) {
|
} catch (e) {
|
||||||
progress.hide(); this.progressActive = false;
|
progress.hide(); this.progressActive = false;
|
||||||
this.commit('reader/setLoaderActive', true);
|
this.commit('reader/setLoaderActive', true);
|
||||||
|
this.resetRoute();
|
||||||
this.$alert(e.message, 'Ошибка', {type: 'error'});
|
this.$alert(e.message, 'Ошибка', {type: 'error'});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="main">
|
<div ref="main" class="main">
|
||||||
|
<pre>{{ this.lastOpenedBook }}</pre>
|
||||||
<pre>{{ meta }}</pre>
|
<pre>{{ meta }}</pre>
|
||||||
<pre>{{ bookPos }}</pre>
|
<pre>{{ bookPos }}</pre>
|
||||||
<pre>{{ $route.query }}</pre>
|
<pre>{{ $route.query }}</pre>
|
||||||
@@ -18,6 +19,7 @@ export default @Component({
|
|||||||
watch: {
|
watch: {
|
||||||
bookPos: function(newValue) {
|
bookPos: function(newValue) {
|
||||||
this.updateRoute(newValue);
|
this.updateRoute(newValue);
|
||||||
|
this.commit('reader/setOpenedBook', Object.assign({}, this.lastOpenedBook, {bookPos: newValue}));
|
||||||
this.drawPage();
|
this.drawPage();
|
||||||
},
|
},
|
||||||
routeParamPos: function(newValue) {
|
routeParamPos: function(newValue) {
|
||||||
@@ -42,6 +44,7 @@ class TextPage extends Vue {
|
|||||||
}
|
}
|
||||||
|
|
||||||
activated() {
|
activated() {
|
||||||
|
this.$refs.main.focus();
|
||||||
this.book = null;
|
this.book = null;
|
||||||
this.meta = null;
|
this.meta = null;
|
||||||
this.fb2 = null;
|
this.fb2 = null;
|
||||||
@@ -61,6 +64,7 @@ class TextPage extends Vue {
|
|||||||
this.book = await bookManager.getBook(last);
|
this.book = await bookManager.getBook(last);
|
||||||
this.meta = bookManager.metaOnly(this.book);
|
this.meta = bookManager.metaOnly(this.book);
|
||||||
this.fb2 = this.meta.fb2;
|
this.fb2 = this.meta.fb2;
|
||||||
|
|
||||||
this.$root.$emit('set-app-title', _.compact([
|
this.$root.$emit('set-app-title', _.compact([
|
||||||
this.fb2.lastName,
|
this.fb2.lastName,
|
||||||
this.fb2.middleName,
|
this.fb2.middleName,
|
||||||
|
|||||||
Reference in New Issue
Block a user