|
|
@@ -5,16 +5,16 @@ import store from '@/store'
|
|
|
const routeList = ['/Home','/Tourism','/Team','/Recharge','/Draw','/Me']
|
|
|
router.beforeEach((to, from, next) => {
|
|
|
let userToken = window.localStorage.getItem('userToken')
|
|
|
- if (userToken) {
|
|
|
- let active = routeList.findIndex((item) => item === to.path)
|
|
|
+ let active = routeList.findIndex((item) => item === to.path)
|
|
|
|
|
|
- if (active > -1) {
|
|
|
- active++
|
|
|
- }
|
|
|
+ if (active > -1) {
|
|
|
+ active++
|
|
|
+ }
|
|
|
+ if (userToken) {
|
|
|
store.commit('user/setNavActive', active)
|
|
|
next()
|
|
|
} else {
|
|
|
- store.commit('user/setNavActive', 1)
|
|
|
+ store.commit('user/setNavActive', active)
|
|
|
if (to.path == '/Home'||to.path == '/Tourism'||to.path == '/Team'||to.path == '/login'||to.path == '/register'||to.path == '/forget-password') {
|
|
|
next()
|
|
|
} else {
|