|
|
|
|
@ -4,38 +4,39 @@ |
|
|
|
|
*/ |
|
|
|
|
import router from './router/router' |
|
|
|
|
import store from './store' |
|
|
|
|
import {validatenull} from '@/util/validate' |
|
|
|
|
import {getToken} from '@/util/auth' |
|
|
|
|
import { validatenull } from '@/util/validate' |
|
|
|
|
import { getToken } from '@/util/auth' |
|
|
|
|
import NProgress from 'nprogress' // progress bar
|
|
|
|
|
import 'nprogress/nprogress.css' // progress bar style
|
|
|
|
|
NProgress.configure({showSpinner: false}); |
|
|
|
|
NProgress.configure({ showSpinner: false }); |
|
|
|
|
const lockPage = store.getters.website.lockPage; //锁屏页
|
|
|
|
|
router.beforeEach((to, from, next) => { |
|
|
|
|
console.log(to); |
|
|
|
|
if(to.path.indexOf('home') < 0){ |
|
|
|
|
console.log(to); |
|
|
|
|
if (to.path.indexOf('home') < 0) { |
|
|
|
|
document.documentElement.style.fontSize = ''; |
|
|
|
|
}else{ |
|
|
|
|
} else { |
|
|
|
|
window.onresize = () => { |
|
|
|
|
if(location.href.indexOf('home') < 0){ |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
var dev_width = document.documentElement.clientWidth || document.body.clientWidth |
|
|
|
|
document.documentElement.style.fontSize = (dev_width / 1920) * 100 + 'px' |
|
|
|
|
} |
|
|
|
|
if (location.href.indexOf('home') < 0) { |
|
|
|
|
} |
|
|
|
|
else { |
|
|
|
|
var dev_width = document.documentElement.clientWidth || document.body.clientWidth |
|
|
|
|
document.documentElement.style.fontSize = (dev_width / 1920) * 100 + 'px' |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
const meta = to.meta || {}; |
|
|
|
|
const isMenu = meta.menu === undefined ? to.query.menu : meta.menu; |
|
|
|
|
store.commit('SET_IS_MENU', isMenu === undefined); |
|
|
|
|
if (getToken()) { |
|
|
|
|
if (store.getters.isLock && to.path !== lockPage) { //如果系统激活锁屏,全部跳转到锁屏页
|
|
|
|
|
next({path: lockPage}) |
|
|
|
|
next({ path: lockPage }) |
|
|
|
|
} else if (to.path === '/login') { //如果登录成功访问登录页跳转到主页
|
|
|
|
|
next({path: '/'}) |
|
|
|
|
next({ path: '/' }) |
|
|
|
|
} else { |
|
|
|
|
//如果用户信息为空则获取用户信息,获取用户信息失败,跳转到登录页
|
|
|
|
|
if (store.getters.token.length === 0) { |
|
|
|
|
store.dispatch('FedLogOut').then(() => { |
|
|
|
|
next({path: '/login'}) |
|
|
|
|
next({ path: '/login' }) |
|
|
|
|
}) |
|
|
|
|
} else { |
|
|
|
|
const value = to.query.src || to.fullPath; |
|
|
|
|
|