refactor: isNeedLoginMode
This commit is contained in:
@@ -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'
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user