feat: 更新 request.ts
This commit is contained in:
@@ -390,6 +390,31 @@ router.beforeEach((to, _from, next) => {
|
||||
}
|
||||
}
|
||||
|
||||
// 路由切换时记录业务模块访问(用于看板用户操作分布统计)
|
||||
const ROUTE_TO_MODULE: Record<string, string> = {
|
||||
'/fine-tune': 'fine-tune',
|
||||
'/model-eval': 'model-eval',
|
||||
'/model-inference': 'model-inference',
|
||||
'/model-compare': 'model-inference',
|
||||
'/data-process': 'data-process',
|
||||
'/data-convert': 'data-convert',
|
||||
'/model-manage': 'model-manage',
|
||||
'/dataset-manage': 'dataset',
|
||||
}
|
||||
for (const [prefix, module] of Object.entries(ROUTE_TO_MODULE)) {
|
||||
if (to.path.startsWith(prefix)) {
|
||||
const key = `route-visit:${module}`
|
||||
const last = Number(sessionStorage.getItem(key) || 0)
|
||||
if (Date.now() - last >= 60000) {
|
||||
sessionStorage.setItem(key, String(Date.now()))
|
||||
import('@/api/modules/audit-visit').then(({ recordModuleVisit }) => {
|
||||
recordModuleVisit(module, to.fullPath).catch(() => {})
|
||||
}).catch(() => {})
|
||||
}
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
next()
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user