浏览代码

fix(router): 在小程序中使用微信登录时跳过拦截逻辑

当在小程序环境中配置使用微信登录时,避免执行后续的拦截检查逻辑
feige996 8 月之前
父节点
当前提交
6aef7b85c4
共有 1 个文件被更改,包括 6 次插入1 次删除
  1. 6 1
      src/router/interceptor.ts

+ 6 - 1
src/router/interceptor.ts

@@ -6,7 +6,7 @@
 import { useTokenStore } from '@/store/token'
 import { isPageTabbar, tabbarStore } from '@/tabbar/store'
 import { getAllPages, getLastPage, HOME_PAGE, parseUrlToObj } from '@/utils/index'
-import { EXCLUDE_LOGIN_PATH_LIST, isNeedLoginMode, LOGIN_PAGE } from './config'
+import { EXCLUDE_LOGIN_PATH_LIST, IS_USE_WX_LOGIN_IN_MP, isNeedLoginMode, LOGIN_PAGE } from './config'
 
 export const FG_LOG_ENABLE = false
 export function judgeIsExcludePath(path: string) {
@@ -45,6 +45,11 @@ export const navigateToInterceptor = {
     // 处理直接进入路由非首页时,tabbarIndex 不正确的问题
     tabbarStore.setAutoCurIdx(path)
 
+    // 小程序里面使用平台自带的登录,则不走下面的逻辑
+    if (IS_USE_WX_LOGIN_IN_MP) {
+      return true
+    }
+
     const tokenStore = useTokenStore()
     FG_LOG_ENABLE && console.log('tokenStore.hasLogin:', tokenStore.hasLogin)