| 123456789101112131415161718192021222324252627 |
- 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.indexOf('auth') != -1 && Authorization) {
- setToken(Authorization);
- // console.log(Authorization);
- next({ path: '/' });
- }else{
- const token = getToken();
- if( token && token != 'undefined' ){
- next();
- }else{
- //本地地址
- location.href = 'http://192.168.100.208:8080/oneportal/login';
- //发布地址
- // location.href = 'http://dgtcloud.dgtis.com/oneportal/login';
- }
- }
- })
- router.afterEach(() => {})
|