|
@@ -10,7 +10,6 @@ const DoBusiness = () => import('@/views/doBusiness/index')
|
|
|
const Evaluate = () => import('@/views/evaluate/index')
|
|
|
const EvTwoLevelMenu = () => import('@/views/evaluate/evTwoLevelMenu')
|
|
|
const Auth = () => import('@/views/auth/index')
|
|
|
-
|
|
|
import store from '../store'
|
|
|
import {
|
|
|
query
|
|
@@ -75,29 +74,36 @@ const router = new Router({
|
|
|
})
|
|
|
router.beforeEach(async (to, from, next) => {
|
|
|
const token = query().token || sessionStorage.getItem('token')
|
|
|
- if (store.state.token && Object.keys(store.state.userInfo).length > 0) {
|
|
|
- next()
|
|
|
- } else if (token) {
|
|
|
- store.commit('setSsoToken', token)
|
|
|
- await store.dispatch('loadUserInfo', {
|
|
|
- token
|
|
|
- })
|
|
|
- // 去除浏览器地址栏token
|
|
|
- if (query().token) {
|
|
|
- router.replace(location.pathname + location.search.replace(/(&?token=\w+&?)/, ''))
|
|
|
- }
|
|
|
+ if(query().loginFromlz||store.state.formLz){
|
|
|
+ store.commit('setFromLz',true);
|
|
|
next()
|
|
|
- } else {
|
|
|
- let lastRoute = {
|
|
|
- path: to.path,
|
|
|
- params: to.params,
|
|
|
- query: to.query
|
|
|
+ }else{
|
|
|
+ if (store.state.token && Object.keys(store.state.userInfo).length > 0) {
|
|
|
+ next()
|
|
|
+ } else if (token) {
|
|
|
+ store.commit('setSsoToken', token)
|
|
|
+ await store.dispatch('loadUserInfo', {
|
|
|
+ token
|
|
|
+ })
|
|
|
+ // 去除浏览器地址栏token
|
|
|
+ if (query().token) {
|
|
|
+ router.replace(location.pathname + location.search.replace(/(&?token=\w+&?)/, ''))
|
|
|
+ }
|
|
|
+ next()
|
|
|
+ } else {
|
|
|
+ let lastRoute = {
|
|
|
+ path: to.path,
|
|
|
+ params: to.params,
|
|
|
+ query: to.query
|
|
|
+ }
|
|
|
+ store.commit('setLastRoute', lastRoute)
|
|
|
+ let ssoServer = 'http://10.199.143.85:7003'
|
|
|
+ let redirectUrl = window.location.protocol + '//' + window.location.host + '/auth'
|
|
|
+ window.location.href = `${ssoServer}/login?redirectUrl=${redirectUrl}`
|
|
|
}
|
|
|
- store.commit('setLastRoute', lastRoute)
|
|
|
- let ssoServer = 'http://10.199.143.85:7003'
|
|
|
- let redirectUrl = window.location.protocol + '//' + window.location.host + '/auth'
|
|
|
- window.location.href = `${ssoServer}/login?redirectUrl=${redirectUrl}`
|
|
|
+
|
|
|
}
|
|
|
+
|
|
|
})
|
|
|
|
|
|
export default router
|