diff --git a/src/router/config.ts b/src/router/config.ts index f836e55..1274171 100644 --- a/src/router/config.ts +++ b/src/router/config.ts @@ -5,7 +5,7 @@ export const LOGIN_STRATEGY_MAP = { DEFAULT_NEED_LOGIN: 1, // 白名单策略,默认不可以进入APP,需要强制登录 } // 登录策略,默认使用`无需登录策略`,即默认不需要登录就可以访问 -export const LOGIN_STRATEGY = LOGIN_STRATEGY_MAP.DEFAULT_NO_NEED_LOGIN +export const LOGIN_STRATEGY = LOGIN_STRATEGY_MAP.DEFAULT_NEED_LOGIN export const isNeedLoginMode = LOGIN_STRATEGY === LOGIN_STRATEGY_MAP.DEFAULT_NEED_LOGIN export const HOME_PAGE = '/pages/index/index' diff --git a/src/router/interceptor.ts b/src/router/interceptor.ts index 4291fa5..7bb0090 100644 --- a/src/router/interceptor.ts +++ b/src/router/interceptor.ts @@ -80,6 +80,9 @@ export const navigateToInterceptor = { } // 否则需要重定向到登录页 else { + if (path === LOGIN_PAGE) { + return true // 明确表示允许路由继续执行 + } FG_LOG_ENABLE && console.log('1 isNeedLogin(白名单策略) redirectUrl:', redirectUrl) uni.navigateTo({ url: redirectUrl }) return false // 明确表示阻止原路由继续执行