| 12345678910111213141516171819202122232425 |
- import router from './router'
- import { getToken, setToken } from '@/utils/auth' // getToken from cookie
- //路由跳转之前
- router.beforeEach((to, _from, next) => {
- const path = to.path;
- const Authorization = to.query.Authorization
- if (path=='/auth' && Authorization) {
- setToken(Authorization);
- // console.log(Authorization);
- next({ path: '/' });
- }else{
- const token = getToken();
- if( token && token != 'undefined' ){
- next();
- }else{
- // window.location.href = 'http://dgt.dgtis.com/oneportal/login'
- window.location.href = 'http://192.168.100.208:8080/oneportal/login'
- }
- }
- })
- router.afterEach(() => {})
|