| | |
| | | Routees = baseRouter |
| | | } |
| | | return new Router({ |
| | | // mode: 'history', // require service support |
| | | mode: 'history', // require service support |
| | | scrollBehavior: () => ({ y: 0 }), |
| | | routes: Routees |
| | | }) |
| | |
| | | let newRouter = createRouter(getRoutes()) |
| | | router.matcher = newRouter.matcher |
| | | } |
| | | router.beforeEach(async (to, from, next) => { |
| | | router.beforeEach((to, from, next) => { |
| | | /** |
| | | * 委托新增 放行 |
| | | */ |
| | | if (to.path.indexOf("/addCommision/") === 0) { |
| | | next() |
| | | return |
| | | } |
| | | // 1. 判断是不是登录页面 |
| | | // 是登录页面 |
| | | if (to.path === '/login') { |
| | |
| | | // 2. 判断 是否登录过 |
| | | let token = sessionStorage.getItem('user') |
| | | if(token!=null&&token!=undefined){ |
| | | await resetRouter() |
| | | resetRouter() |
| | | } |
| | | token ? next() : next('/login') |
| | | } |