diff --git a/src/router/config.ts b/src/router/config.ts index 1274171..2f75c68 100644 --- a/src/router/config.ts +++ b/src/router/config.ts @@ -8,7 +8,6 @@ export const LOGIN_STRATEGY_MAP = { export const LOGIN_STRATEGY = LOGIN_STRATEGY_MAP.DEFAULT_NEED_LOGIN export const isNeedLoginMode = LOGIN_STRATEGY === LOGIN_STRATEGY_MAP.DEFAULT_NEED_LOGIN -export const HOME_PAGE = '/pages/index/index' export const LOGIN_PAGE = '/pages/login/login' export const REGISTER_PAGE = '/pages/login/register' diff --git a/src/router/interceptor.ts b/src/router/interceptor.ts index 7bb0090..f924068 100644 --- a/src/router/interceptor.ts +++ b/src/router/interceptor.ts @@ -5,8 +5,8 @@ */ import { useTokenStore } from '@/store/token' import { isPageTabbar, tabbarStore } from '@/tabbar/store' -import { getAllPages, getLastPage, parseUrlToObj } from '@/utils/index' -import { EXCLUDE_LOGIN_PATH_LIST, HOME_PAGE, isNeedLoginMode, LOGIN_PAGE } from './config' +import { getAllPages, getLastPage, HOME_PAGE, parseUrlToObj } from '@/utils/index' +import { EXCLUDE_LOGIN_PATH_LIST, isNeedLoginMode, LOGIN_PAGE } from './config' export const FG_LOG_ENABLE = false export function judgeIsExcludePath(path: string) { diff --git a/src/utils/index.ts b/src/utils/index.ts index 3ff0a40..a1b6ae6 100644 --- a/src/utils/index.ts +++ b/src/utils/index.ts @@ -181,3 +181,9 @@ export function getEnvBaseUploadUrl() { * 是否是双token模式 */ export const isDoubleTokenMode = import.meta.env.VITE_AUTH_MODE === 'double' + +/** + * 首页路径,通过 page.json 里面的 type 为 home 的页面获取,如果没有,则默认是第一个页面 + * 通常为 /pages/index/index + */ +export const HOME_PAGE = `/${pages.find(page => page.type === 'home')?.path || pages[0].path}`