Aggiornamento Traduzioni ...
This commit is contained in:
@@ -5,9 +5,10 @@ import { PositionResult } from 'vue-router/types/router'
|
||||
import { IMyRoute, IMyRouteRecord, cfgrouter } from './route-config'
|
||||
import { ProgressBar } from '@src/store/Modules/Interface'
|
||||
import { isEqual } from 'lodash'
|
||||
import { UserStore } from '@store'
|
||||
import { GlobalStore, UserStore } from '@store'
|
||||
import { tools } from '@src/store/Modules/tools'
|
||||
import { toolsext } from '@src/store/Modules/toolsext'
|
||||
import { static_data } from '@src/db/static_data'
|
||||
|
||||
Vue.use(VueRouter)
|
||||
/*
|
||||
@@ -15,6 +16,11 @@ Vue.use(VueRouter)
|
||||
* directly export the Router instantiation
|
||||
*/
|
||||
|
||||
let TIMER = null
|
||||
let TIMER_RITORNA = ''
|
||||
let TIMER_STATE = 0
|
||||
let TIMER_RESTORE = ''
|
||||
|
||||
const Router = new VueRouter({
|
||||
scrollBehavior: () => ({ x: 0, y: 0 } as PositionResult),
|
||||
routes: cfgrouter.getmenu(),
|
||||
@@ -50,12 +56,76 @@ Router.beforeEach(async (to: IMyRoute, from: IMyRoute, next) => {
|
||||
// await LoginStore.actions.checkUserSession();
|
||||
// }
|
||||
|
||||
/*
|
||||
if (!from || !to || from.matched.length <= 0) {
|
||||
next()
|
||||
return
|
||||
/*
|
||||
if (!from || !to || from.matched.length <= 0) {
|
||||
next()
|
||||
return
|
||||
}
|
||||
*/
|
||||
// console.log('LOAD from e to: ', from, to)
|
||||
|
||||
if (!!GlobalStore) {
|
||||
if (!GlobalStore.state.finishLoading) {
|
||||
|
||||
let eseguicheck = true
|
||||
|
||||
// Controlla se c'è nella lista allora non eseguire il controllo:
|
||||
for (const route of static_data.routes) {
|
||||
if (route.path === to.path) {
|
||||
eseguicheck = false
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
if (eseguicheck) {
|
||||
|
||||
if (!TIMER && to.path !== '/') {
|
||||
// console.log('TIMER')
|
||||
TIMER = setInterval(() => {
|
||||
// console.log('SETINTERVAL')
|
||||
if (GlobalStore.state.finishLoading) {
|
||||
if (!!TIMER) {
|
||||
// console.log('TIMER_STATE', TIMER_STATE, 'TIMER_RITORNA', TIMER_RITORNA)
|
||||
if (TIMER_STATE === 2) {
|
||||
clearInterval(TIMER)
|
||||
TIMER = null
|
||||
// console.log('TERMINA INTERVALLO')
|
||||
// next('/prova')
|
||||
// return
|
||||
}
|
||||
if (TIMER_RITORNA !== '') {
|
||||
next(TIMER_RITORNA)
|
||||
TIMER_STATE = 2
|
||||
return
|
||||
} else {
|
||||
if (TIMER_STATE === 0) {
|
||||
TIMER_RESTORE = to.path
|
||||
next('/')
|
||||
TIMER_STATE = 1
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}, 200)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
if (GlobalStore.state.finishLoading) {
|
||||
if (!!TIMER) {
|
||||
// console.log('TIMER_STATE', TIMER_STATE, 'to.path', to.path)
|
||||
if (TIMER_RITORNA === '' && TIMER_RESTORE !== '') {
|
||||
TIMER_RITORNA = TIMER_RESTORE
|
||||
// onsole.log('TIMER_RITORNA', TIMER_RITORNA)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// await tools.aspettansec(4000)
|
||||
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
if (from.name && from.matched[0].name === to.name && from.meta.isModal) {
|
||||
next()
|
||||
@@ -64,6 +134,7 @@ Router.beforeEach(async (to: IMyRoute, from: IMyRoute, next) => {
|
||||
}
|
||||
else if (from.name === to.name && isEqual(from.params, to.params)) {
|
||||
console.log('Route interceptor log: <2>')
|
||||
console.log('from e to: ', from, to)
|
||||
next()
|
||||
} else {
|
||||
if (!to.meta.transparent && !to.meta.isModal) {
|
||||
@@ -140,7 +211,6 @@ Router.beforeEach(async (to: IMyRoute, from: IMyRoute, next) => {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// if (to.meta.middleware) {
|
||||
// const middleware = Array.isArray(to.meta.middleware)
|
||||
// ? to.meta.middleware
|
||||
|
||||
@@ -43,6 +43,12 @@ export const cfgrouter = {
|
||||
|
||||
const arrroutes: IListRoutes[] = []
|
||||
|
||||
console.log('GETMENU')
|
||||
|
||||
if (!!GlobalStore) {
|
||||
GlobalStore.actions.addDynamicPages()
|
||||
}
|
||||
|
||||
for (const route of static_data.routes) {
|
||||
tools.addRoute(arrroutes, route)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user