Commit dede2a4f authored by 李纪文's avatar 李纪文

fix: 增加功能访问埋点

parent 38fcb4f2
Pipeline #78489 waiting for manual action with stages
......@@ -619,6 +619,41 @@ const Layout = props => {
)
}
// 菜单比对方法
const querySkipUrl = (data, url) => {
let res = null;
// eslint-disable-next-line no-plusplus
for (let i = 0; i < data.length; i++) {
if (url.indexOf(data[i].url) > -1) {
res = data[i];
return data[i];
}
if (data[i].widgets && data[i].widgets.length > 0) {
res = querySkipUrl(data[i].widgets, url);
}
if (res) break;
}
return res;
};
// 功能访问记录
const menuJumpLogs = data => {
const { pathname = '' } = data;
const pathList = querySkipUrl(window?.globalConfig?.widgets || [], pathname);
if (pathname && pathList) {
appService.pvLogs({
origin: window.location.origin,
client: window?.globalConfig.client,
site: window?.globalConfig?.userInfo?.site || '',
widgetUrl: pathList?.url || '',
widgetRoute: pathList?.widgetId || '',
widgetName: pathList?.label || '',
isHomepage: 'false',
userName: window?.globalConfig?.userInfo?.fullName || '',
});
}
};
return (
<SecurityLayout {...props}>
<BasicLayout
......@@ -642,7 +677,12 @@ const Layout = props => {
logo={logo}
topMenuActiveKey={Number(sessionStorage.getItem(currentProduct)) || 0}
rightContentRender={() => <RightContent />}
onPageChange={() => {
onPageChange={data => {
try {
menuJumpLogs(data);
} catch (err) {
// console.log(err);
}
// if(!props.global.token) {
// history.push('/user/login')
// }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment