refactor: isNeedLoginMode

This commit is contained in:
feige996
2025-08-22 17:48:25 +08:00
parent e48bf49c35
commit d1b167bfcd
2 changed files with 3 additions and 3 deletions

View File

@@ -4,7 +4,7 @@ export const LOGIN_STRATEGY_MAP = {
}
// 登录策略,默认使用`无需登录策略`,即默认不需要登录就可以访问
export const LOGIN_STRATEGY = LOGIN_STRATEGY_MAP.DEFAULT_NO_NEED_LOGIN
export const isNeedLogin = LOGIN_STRATEGY === LOGIN_STRATEGY_MAP.DEFAULT_NEED_LOGIN
export const isNeedLoginMode = LOGIN_STRATEGY === LOGIN_STRATEGY_MAP.DEFAULT_NEED_LOGIN
export const LOGIN_PAGE = '/pages/login/login'
export const REGISTER_PAGE = '/pages/login/register'

View File

@@ -6,7 +6,7 @@
import { useTokenStore } from '@/store/token'
import { tabbarStore } from '@/tabbar/store'
import { getLastPage, parseUrlToObj } from '@/utils/index'
import { EXCLUDE_PAGE_LIST, isNeedLogin, LOGIN_PAGE, LOGIN_PAGE_LIST } from './config'
import { EXCLUDE_PAGE_LIST, isNeedLoginMode, LOGIN_PAGE, LOGIN_PAGE_LIST } from './config'
// 黑名单登录拦截器 - (适用于大部分页面不需要登录,少部分页面需要登录)
export const navigateToInterceptor = {
@@ -49,7 +49,7 @@ export const navigateToInterceptor = {
console.log('tokenStore.hasLogin:', tokenStore.hasLogin)
// #region 1/2 需要登录的情况 ---------------------------
if (isNeedLogin) {
if (isNeedLoginMode) {
if (tokenStore.hasLogin) {
return
}