| | |
| | | import modules from './modules' |
| | | import Vue from 'vue' |
| | | import Router from '@/plugin/uni-simple-router/index.js' |
| | | import {ACCESS_TOKEN} from '@/common/util/constants.js' |
| | | import {isOAuth2AppEnv} from '@/common/util/util.js' |
| | | import { |
| | | ACCESS_TOKEN |
| | | } from '@/common/util/constants.js' |
| | | import { |
| | | isOAuth2AppEnv |
| | | } from '@/common/util/util.js' |
| | | |
| | | Vue.use(Router) |
| | | //初始化 |
| | | const router = new Router({ |
| | | |
| | | encodeURI:true, |
| | | routes: [...modules]//路由表 |
| | | }); |
| | |
| | | if (whiteList.indexOf(to.path) !== -1) { |
| | | // 在免登录白名单,如果进入的页面是login页面并且当前是OAuth2app环境,就进入OAuth2登录页面 |
| | | if (to.path === '/pages/login/login' && isOAuth2AppEnv()) { |
| | | next({path: '/pages/login/loginOauth2'}) |
| | | next({ |
| | | path: '/pages/login/loginOauth2' |
| | | }) |
| | | } else { |
| | | // 在免登录白名单,直接进入 |
| | | next() |
| | |
| | | }else{ |
| | | // 如果当前是在OAuth2APP环境,就跳转到OAuth2登录页面 |
| | | let path = isOAuth2AppEnv() ? '/pages/login/loginOauth2' : '/pages/login/login'; |
| | | next({ path: path }) |
| | | next({ |
| | | path: path |
| | | }) |
| | | } |
| | | } |
| | | }) |