overview统计
This commit is contained in:
@@ -7,6 +7,7 @@
|
||||
import type { Router, NavigationGuardNext, RouteLocationNormalized } from 'vue-router';
|
||||
import type { Store } from 'vuex';
|
||||
import { AuthState } from '@/store/modules/auth';
|
||||
import { systemOverviewApi } from '@/apis/system/overview';
|
||||
|
||||
/**
|
||||
* 白名单路由 - 无需登录即可访问
|
||||
@@ -42,13 +43,19 @@ export function setupRouterGuards(router: Router, store: Store<any>) {
|
||||
});
|
||||
|
||||
// 全局后置钩子
|
||||
|
||||
router.afterEach((to) => {
|
||||
// 结束页面加载进度条
|
||||
finishProgress();
|
||||
|
||||
// 设置页面标题
|
||||
setPageTitle(to.meta?.title as string);
|
||||
|
||||
// 统计PV:对path以"/"开头的路由进行统计
|
||||
if (to.path.startsWith('/')) {
|
||||
systemOverviewApi.trackVisit().catch(() => {
|
||||
// 统计失败不影响正常页面使用
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
// 全局解析守卫(在导航被确认之前,同时在所有组件内守卫和异步路由组件被解析之后调用)
|
||||
|
||||
Reference in New Issue
Block a user