Поправки порядка загрузки компонентов и сопутствующих багов
This commit is contained in:
@@ -47,14 +47,12 @@
|
|||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
import Vue from 'vue';
|
import Vue from 'vue';
|
||||||
import Component from 'vue-class-component';
|
import Component from 'vue-class-component';
|
||||||
|
import * as utils from '../share/utils';
|
||||||
|
|
||||||
export default @Component({
|
export default @Component({
|
||||||
watch: {
|
watch: {
|
||||||
rootRoute: function() {
|
|
||||||
this.setAppTitle();
|
|
||||||
this.redirectIfNeeded();
|
|
||||||
},
|
|
||||||
mode: function() {
|
mode: function() {
|
||||||
|
this.setAppTitle();
|
||||||
this.redirectIfNeeded();
|
this.redirectIfNeeded();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -123,6 +121,9 @@ class App extends Vue {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
this.setAppTitle();
|
||||||
|
this.redirectIfNeeded();
|
||||||
}
|
}
|
||||||
|
|
||||||
toggleCollapse() {
|
toggleCollapse() {
|
||||||
@@ -201,15 +202,18 @@ class App extends Vue {
|
|||||||
}
|
}
|
||||||
|
|
||||||
redirectIfNeeded() {
|
redirectIfNeeded() {
|
||||||
if ((this.mode == 'reader' || this.mode == 'omnireader') && (this.rootRoute != '/reader')) {
|
if ((this.mode == 'reader' || this.mode == 'omnireader') && (!this.isReaderActive)) {
|
||||||
//старый url
|
//старый url
|
||||||
const search = window.location.search.substr(1);
|
const search = window.location.search.substr(1);
|
||||||
const url = search.split('url=')[1] || '';
|
const s = search.split('url=');
|
||||||
|
const url = s[1] || '';
|
||||||
|
const q = utils.parseQuery(s[0] || '');
|
||||||
if (url) {
|
if (url) {
|
||||||
window.location = `/#/reader?url=${url}`;
|
q.url = decodeURIComponent(url);
|
||||||
} else {
|
|
||||||
this.$router.replace('/reader');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
window.history.replaceState({}, '', '/');
|
||||||
|
this.$router.replace({ path: '/reader', query: q });
|
||||||
}
|
}
|
||||||
|
|
||||||
//yandex-метрика для omnireader
|
//yandex-метрика для omnireader
|
||||||
|
|||||||
@@ -94,6 +94,6 @@ class ProgressPage extends Vue {
|
|||||||
</style>
|
</style>
|
||||||
<style>
|
<style>
|
||||||
.el-progress__text {
|
.el-progress__text {
|
||||||
color: lightgreen;
|
color: lightgreen !important;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -1064,6 +1064,10 @@ class Reader extends Vue {
|
|||||||
box-shadow: 3px 3px 5px black;
|
box-shadow: 3px 3px 5px black;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.tool-button + .tool-button {
|
||||||
|
margin: 0 2px 0 2px;
|
||||||
|
}
|
||||||
|
|
||||||
.tool-button:hover {
|
.tool-button:hover {
|
||||||
background-color: white;
|
background-color: white;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -871,9 +871,9 @@ class SettingsPage extends Vue {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.el-form-item {
|
.el-form-item {
|
||||||
padding: 0;
|
padding: 0 !important;
|
||||||
margin: 0;
|
margin: 0 !important;
|
||||||
margin-bottom: 5px;
|
margin-bottom: 5px !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.color-picked {
|
.color-picked {
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
import Vue from 'vue';
|
import Vue from 'vue';
|
||||||
import App from './components/App.vue';
|
|
||||||
|
|
||||||
import router from './router';
|
import router from './router';
|
||||||
import store from './store';
|
import store from './store';
|
||||||
import './element';
|
import './element';
|
||||||
|
|
||||||
|
import App from './components/App.vue';
|
||||||
//Vue.config.productionTip = false;
|
//Vue.config.productionTip = false;
|
||||||
|
|
||||||
new Vue({
|
new Vue({
|
||||||
|
|||||||
@@ -2,21 +2,25 @@ import Vue from 'vue';
|
|||||||
import VueRouter from 'vue-router';
|
import VueRouter from 'vue-router';
|
||||||
import _ from 'lodash';
|
import _ from 'lodash';
|
||||||
|
|
||||||
import App from './components/App.vue';
|
//немедленная загрузка
|
||||||
|
import CardIndex from './components/CardIndex/CardIndex.vue';
|
||||||
|
//const CardIndex = () => import('./components/CardIndex/CardIndex.vue');
|
||||||
|
|
||||||
const CardIndex = () => import('./components/CardIndex/CardIndex.vue');
|
|
||||||
const Search = () => import('./components/CardIndex/Search/Search.vue');
|
const Search = () => import('./components/CardIndex/Search/Search.vue');
|
||||||
const Card = () => import('./components/CardIndex/Card/Card.vue');
|
const Card = () => import('./components/CardIndex/Card/Card.vue');
|
||||||
const Book = () => import('./components/CardIndex/Book/Book.vue');
|
const Book = () => import('./components/CardIndex/Book/Book.vue');
|
||||||
const History = () => import('./components/CardIndex/History/History.vue');
|
const History = () => import('./components/CardIndex/History/History.vue');
|
||||||
|
|
||||||
const Reader = () => import('./components/Reader/Reader.vue');
|
//немедленная загрузка
|
||||||
|
//const Reader = () => import('./components/Reader/Reader.vue');
|
||||||
|
import Reader from './components/Reader/Reader.vue';
|
||||||
|
|
||||||
//const Forum = () => import('./components/Forum/Forum.vue');
|
//const Forum = () => import('./components/Forum/Forum.vue');
|
||||||
const Income = () => import('./components/Income/Income.vue');
|
const Income = () => import('./components/Income/Income.vue');
|
||||||
const Sources = () => import('./components/Sources/Sources.vue');
|
const Sources = () => import('./components/Sources/Sources.vue');
|
||||||
const Settings = () => import('./components/Settings/Settings.vue');
|
const Settings = () => import('./components/Settings/Settings.vue');
|
||||||
const Help = () => import('./components/Help/Help.vue');
|
const Help = () => import('./components/Help/Help.vue');
|
||||||
const NotFound404 = () => import('./components/NotFound404/NotFound404.vue');
|
//const NotFound404 = () => import('./components/NotFound404/NotFound404.vue');
|
||||||
|
|
||||||
const myRoutes = [
|
const myRoutes = [
|
||||||
['/', null, null, '/cardindex'],
|
['/', null, null, '/cardindex'],
|
||||||
|
|||||||
@@ -166,3 +166,27 @@ export function applyObjDiff(obj, diff, isAddChanged) {
|
|||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function parseQuery(str) {
|
||||||
|
if (typeof str != 'string' || str.length == 0)
|
||||||
|
return {};
|
||||||
|
let s = str.split('&');
|
||||||
|
let s_length = s.length;
|
||||||
|
let bit, query = {}, first, second;
|
||||||
|
|
||||||
|
for (let i = 0; i < s_length; i++) {
|
||||||
|
bit = s[i].split('=');
|
||||||
|
first = decodeURIComponent(bit[0]);
|
||||||
|
if (first.length == 0)
|
||||||
|
continue;
|
||||||
|
second = decodeURIComponent(bit[1]);
|
||||||
|
if (typeof query[first] == 'undefined')
|
||||||
|
query[first] = second;
|
||||||
|
else
|
||||||
|
if (query[first] instanceof Array)
|
||||||
|
query[first].push(second);
|
||||||
|
else
|
||||||
|
query[first] = [query[first], second];
|
||||||
|
}
|
||||||
|
return query;
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user