|
|
@@ -1,24 +1,30 @@
|
|
|
import router from '../router/index.js'
|
|
|
import store from '@/store'
|
|
|
+import {hasMobile} from "@/utils/tools";
|
|
|
|
|
|
|
|
|
const routeList = ['/Home','/Tourism','/Team','/Recharge','/Draw','/Me']
|
|
|
router.beforeEach((to, from, next) => {
|
|
|
- let userToken = window.localStorage.getItem('userToken')
|
|
|
- let active = routeList.findIndex((item) => item === to.path)
|
|
|
+ if(hasMobile()){
|
|
|
+ document.location.href = 'http://wap.gmcyy.com'
|
|
|
+ }else {
|
|
|
+ let userToken = window.localStorage.getItem('userToken')
|
|
|
+ let active = routeList.findIndex((item) => item === to.path)
|
|
|
|
|
|
- if (active > -1) {
|
|
|
- active++
|
|
|
- }
|
|
|
- if (userToken) {
|
|
|
- store.commit('user/setNavActive', active)
|
|
|
- next()
|
|
|
- } else {
|
|
|
- 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') {
|
|
|
+ if (active > -1) {
|
|
|
+ active++
|
|
|
+ }
|
|
|
+ if (userToken) {
|
|
|
+ store.commit('user/setNavActive', active)
|
|
|
next()
|
|
|
} else {
|
|
|
- next('/login')
|
|
|
+ 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 {
|
|
|
+ next('/login')
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
})
|