feat(web): report page views via sendBeacon and show stats on system page
This commit is contained in:
1 parent
3c16caac1a
commit
b215f8eb09
4 files changed
+154
-3
No files matched your search
@@ -1,4 +1,4 @@
|
||||
import { session } from "./api.js";
|
||||
import { session, visit } from "./api.js";
|
||||
import { disposeAll } from "./charts.js";
|
||||
import { onRoute, parseLocation, startRouter } from "./router.js";
|
||||
import { renderCandidates } from "./views/candidates.js";
|
||||
@@ -153,9 +153,15 @@ async function boot() {
|
||||
toast("无法连接看板服务", "error");
|
||||
}
|
||||
renderNav();
|
||||
let lastVisitPath = null;
|
||||
onRoute(({ path, route }) => {
|
||||
disposeAll();
|
||||
setTitle(route, path);
|
||||
// 访问统计:仅在路由路径变化时上报(排序/筛选等同路径重渲染不计 PV)。
|
||||
if (path !== lastVisitPath) {
|
||||
lastVisitPath = path;
|
||||
visit(path);
|
||||
}
|
||||
});
|
||||
startRouter({
|
||||
root: document.querySelector("#app"),
|
||||
|
||||
Reference in new issue
Block a user