路由修正
This commit is contained in:
@@ -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(() => {
|
||||
// 统计失败不影响正常页面使用
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user