diff --git a/src/router/config.ts b/src/router/config.ts index f6afeea..7f4da64 100644 --- a/src/router/config.ts +++ b/src/router/config.ts @@ -24,4 +24,4 @@ export const EXCLUDE_LOGIN_PATH_LIST = [ // 在微信小程序里面是否使用小程序默认的登录,默认为true // 如果为 false 则复用 h5 的登录逻辑 -export const IS_USE_WX_LOGIN_IN_MP = true // 暂时还没用到,没想好怎么整合 +export const IS_USE_WX_LOGIN_IN_MP = true diff --git a/src/router/interceptor.ts b/src/router/interceptor.ts index 1daf783..94b6366 100644 --- a/src/router/interceptor.ts +++ b/src/router/interceptor.ts @@ -1,3 +1,4 @@ +import { isMp } from '@uni-helper/uni-env' /** * by 菲鸽 on 2025-08-19 * 路由拦截,通常也是登录拦截 @@ -46,8 +47,8 @@ export const navigateToInterceptor = { tabbarStore.setAutoCurIdx(path) // 小程序里面使用平台自带的登录,则不走下面的逻辑 - if (IS_USE_WX_LOGIN_IN_MP) { - return true + if (isMp && IS_USE_WX_LOGIN_IN_MP) { + return true // 明确表示允许路由继续执行 } const tokenStore = useTokenStore() @@ -67,7 +68,7 @@ export const navigateToInterceptor = { else { uni.navigateTo({ url }) } - return true // 明确表示阻止原路由继续执行 + return true } } let fullPath = path