fix(router): 修复小程序登录逻辑并添加环境判断
在小程序环境中正确判断是否使用微信登录逻辑,避免在非小程序环境误用该逻辑
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user