|
@@ -1,6 +1,6 @@
|
|
|
import router from './router'
|
|
|
import store from './store'
|
|
|
-import {Message} from 'element-ui'
|
|
|
+import {Message,MessageBox } from 'element-ui'
|
|
|
import NProgress from 'nprogress'
|
|
|
import 'nprogress/nprogress.css'
|
|
|
import {getToken} from '@/benyun/utils/auth'
|
|
@@ -22,7 +22,6 @@ const infoHandle = (to:any, next:any) => {
|
|
|
router.addRoute(item)
|
|
|
}
|
|
|
// router.addRoutes(accessRoutes) // 动态添加可访问路由表
|
|
|
- console.log(to)
|
|
|
next({ ...to, replace: true }) // hack方法 确保addRoutes已完成
|
|
|
})
|
|
|
}).catch(err => {
|
|
@@ -71,12 +70,20 @@ router.beforeEach((to:any, from:any, next:any) => {
|
|
|
infoHandle(to,next)
|
|
|
// location.href = '/index';
|
|
|
}).catch((err:any) => {
|
|
|
+ let msg = '未知错误,请联系管理员!'
|
|
|
if(err && err.msg) {
|
|
|
- Message.error(err.msg);
|
|
|
+ msg = err.msg
|
|
|
+ // Message.error(err.msg);
|
|
|
}
|
|
|
+ MessageBox.alert(msg, '提示', {
|
|
|
+ confirmButtonText: '确定',
|
|
|
+ callback: () => {
|
|
|
+ const redirect = location.origin
|
|
|
+ location.href = `${process.env.VUE_APP_LOGIN_URL}?&redirect=${encodeURIComponent(redirect)}`
|
|
|
+ }
|
|
|
+ });
|
|
|
// const redirect = location.href.replace(/\??ticket=[^&]*&?/g, '')
|
|
|
- const redirect = location.origin
|
|
|
- location.href = `${process.env.VUE_APP_LOGIN_URL}?&redirect=${encodeURIComponent(redirect)}`
|
|
|
+
|
|
|
})
|
|
|
// next()
|
|
|
}
|