路由修正

This commit is contained in:
2025-11-14 19:17:49 +08:00
parent 9e4cfc1200
commit cb401eebe1
8 changed files with 54 additions and 98 deletions

View File

@@ -8,6 +8,7 @@ import type { Router, NavigationGuardNext, RouteLocationNormalized } from 'vue-r
import type { Store } from 'vuex';
import { AuthState } from '@/store/modules/auth';
import { systemOverviewApi } from '@/apis/system/overview';
import { routes as staticRoutes } from '@/router';
/**
* 白名单路由 - 无需登录即可访问
@@ -50,8 +51,9 @@ export function setupRouterGuards(router: Router, store: Store<any>) {
// 设置页面标题
setPageTitle(to.meta?.title as string);
// 统计PV对path以"/"开头的路由进行统计
if (to.path.startsWith('/')) {
// 统计PV对path以"/"开头的路由进行统计 非静态路由
const isStaticRoute = staticRoutes.some(route => route.path === to.matched[0]?.path);
if (!isStaticRoute && to.path.startsWith('/')) {
systemOverviewApi.trackVisit().catch(() => {
// 统计失败不影响正常页面使用
});