|
@@ -15,18 +15,23 @@ import {
|
|
|
|
|
|
router.beforeEach(async(to, from, next) => {
|
|
|
|
|
|
+
|
|
|
+
|
|
|
let hasToken = store.getters['user/accessToken']
|
|
|
|
|
|
if (!loginInterception) hasToken = true
|
|
|
console.log(localStorage.getItem('accessToken'))
|
|
|
console.log(localStorage.getItem('accessToken'))
|
|
|
if (hasToken) {
|
|
|
- if (to.path === '/login') {
|
|
|
|
|
|
|
|
|
+ if (to.path === '/login') {
|
|
|
+
|
|
|
next({ path: '/' })
|
|
|
} else {
|
|
|
|
|
|
+
|
|
|
+
|
|
|
const hasRoles =
|
|
|
store.getters['acl/admin'] ||
|
|
|
store.getters['acl/role'].length > 0 ||
|
|
@@ -41,7 +46,7 @@ router.beforeEach(async(to, from, next) => {
|
|
|
next()
|
|
|
} else {
|
|
|
|
|
|
-
|
|
|
+ store.commit('getMiddleConfig')
|
|
|
|
|
|
try {
|
|
|
if (loginInterception) {
|
|
@@ -59,55 +64,20 @@ router.beforeEach(async(to, from, next) => {
|
|
|
}
|
|
|
|
|
|
accessRoutes.forEach((item) => {
|
|
|
-
|
|
|
router.addRoute(item)
|
|
|
})
|
|
|
|
|
|
console.log('accessRoutes')
|
|
|
console.log(accessRoutes)
|
|
|
|
|
|
- // api.getMiddleConfig().then((requset) => {
|
|
|
- // if (requset.status === 'SUCCESS') {
|
|
|
- // store.state.middleStatus = requset.data[0].middleStatus;
|
|
|
- // if (store.state.middleStatus == 1) {
|
|
|
- // next('/middle')
|
|
|
- // } else {
|
|
|
- // next(accessRoutes[0].children[0].path)
|
|
|
- // }
|
|
|
- // } else {
|
|
|
- // console.log(111)
|
|
|
- // }
|
|
|
- // })
|
|
|
-
|
|
|
+ // alert('判断是否显示中间页的middleStatus值' + store.state.middleStatus)
|
|
|
|
|
|
-
|
|
|
- store.commit('getMiddleConfig')
|
|
|
- // alert('判断是否显示中间页的middleStatus值' + store.state.middleStatus)
|
|
|
if (store.state.middleStatus == 1) {
|
|
|
next('/middle')
|
|
|
} else {
|
|
|
next(accessRoutes[0].children[0].path)
|
|
|
}
|
|
|
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- // if (accessRoutes[1].path != '/') {
|
|
|
-
|
|
|
- // next('/middle')
|
|
|
- // // next(accessRoutes[0].children.path)
|
|
|
- // } else {
|
|
|
- // // router.push({
|
|
|
- // // path: '/middle'
|
|
|
- // // })
|
|
|
-
|
|
|
- // next('/middle')
|
|
|
-
|
|
|
- // // next({...to, replace: true })
|
|
|
-
|
|
|
- // }
|
|
|
-
|
|
|
} catch {
|
|
|
await store.dispatch('user/resetAll')
|
|
|
if (recordRoute)
|