import Vue from 'vue' import Router from 'vue-router' import Guide from '@/pages/guide/guide' import Login from '@/pages/login' import Regiester from '@/pages/regiester' import PwdForgot from '@/pages/pwd-forgotten' import FingerLogin from '@/pages/finger-login' import Home from '@/pages/home' import Tab from '@/pages/tab' // 我的 import MyInfo from '@/pages/myInfo/my-info' // test工具类 import HlsPopup from '@/pages/hlsPopup' // 用户绑定 import UserBind from '@/pages/userBind/userBind' import NaturePerson from '@/pages/userBind/np/naturePerson' import Enterprise from '@/pages/userBind/org/enterprise' Vue.use(Router) export default new Router({ routes: [ { path: '/', redirect: to => { if (!window.localStorage.needGuid || window.localStorage.needGuid == 'true') { return {name: 'Guide'} } else { if (window.localStorage.isOpenFingerLogin) { return {name: 'FingerLogin'} } else { // if none of the above states are matched, use this as the fallback return {name: 'Login'} } } }, }, { path: '/tab', component: Tab, name: 'Tab', redirect: '/tab/home', meta: {keepAlive: true}, children: [ {path: '/tab/home', component: Home, name: 'Home', meta: {keepAlive: true}}, {path: '/tab/my-info', component: MyInfo, name: 'MyInfo', meta: {keepAlive: true}}, ], }, { path: '/guide', component: Guide, name: 'Guide', meta: {keepAlive: true}, }, { path: '/login', component: Login, name: 'Login', meta: {keepAlive: true}, }, { path: '/regiester', component: Regiester, name: 'Regiester', meta: {keepAlive: false}, }, { path: '/finger-login', component: FingerLogin, name: 'FingerLogin', meta: {keepAlive: true}, }, {path: '/pwd-forgot', component: PwdForgot, name: 'PwdForgot', meta: {keepAlive: true}}, // test工具类 {path: '/hls-popup', component: HlsPopup, name: 'HlsPopup', meta: {keepAlive: false}}, // 用户绑定 {path: '/user-bind', component: UserBind, name: 'UserBind', meta: {keepAlive: false}}, {path: '/nature-person', component: NaturePerson, name: 'NaturePerson', meta: {keepAlive: false}}, {path: '/enterprise', component: Enterprise, name: 'Enterprise', meta: {keepAlive: false}}, ], scrollBehavior (to, from, savedPosition) { if (to.hash) { return { selector: to.hash, } } }, })