import router from './router' import { MessageBox } from 'element-ui'; import { getToken, setToken } from '@/utils/auth' // getToken from cookie import { lockStatus,unlock } from "@/api/allApi"; //路由跳转之前 router.beforeEach((to, _from, next) => { setToken('a487d485f3652cfeb71819467244eda0'); 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(); // lockStatus().then(response=>{ // let lockStatus = response.data.data; // if(lockStatus==0){ // MessageBox.alert('欢迎来到DGT誉商城系统,已为您发放工龄年限积分,请前往个人中心查看。', '积分发放通知', { // confirmButtonText: '确定', // showClose:false, // callback: action => { // unlock().then(response=>{ // next(); // }) // } // }); // }else{ // next(); // } // }) }else{ const prodHref = 'http://dgt.dgtis.com/oneportal/login';//正式地址 // const prodHref = 'http://dgtcloud.dgtis.com/oneportal/login';//阿里云地址 const devHref = 'http://192.168.100.208:8080/oneportal/login';//测试地址 location.href = process.env.NODE_ENV === 'production' ? prodHref : devHref; } } }) router.afterEach(() => {})