Houjie
2025-04-18 ae3855638dba0c927236c1a1b1a85d5b048c40e2
common/router/index.js
@@ -1,12 +1,17 @@
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]//路由表
});
@@ -33,7 +38,9 @@
      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()
@@ -41,7 +48,9 @@
      }else{
         // 如果当前是在OAuth2APP环境,就跳转到OAuth2登录页面
         let path = isOAuth2AppEnv() ? '/pages/login/loginOauth2' : '/pages/login/login';
         next({ path: path })
         next({
            path: path
         })
      }
   } 
})