Authored by 李奇
Committed by 李奇

检索页面区分入口上报

... ... @@ -6,8 +6,12 @@ export default {
pathName: 'search'
},
'pages/searchList/index': {
pathName: 'searchList',
paramKey: 'query'
multiEntry: true,
multiName: {
'series': 'seriesList',
'brand': 'brandList',
'query': 'searchList'
}
},
'pages/filter/index': {
pathName: 'filter'
... ...
... ... @@ -140,12 +140,39 @@ export default class yas {
});
});
}
_pageName(path) {
return pathReport[path] ? pathReport[path].pathName : ''
_pageName(options, path) {
let hasConf = pathReport[path];
// 多入口页面依据参数设定上报页面名称
if (hasConf && hasConf.multiEntry) {
let pathName = '';
Object.keys((hasConf.multiName || {})).forEach(key => {
if (options[key]) {
pathName = hasConf.multiName[key];
return false;
}
});
return pathName;
}
return hasConf ? hasConf.pathName : '';
}
_pageParam(options = {}, fromPath) {
if (!options) return '';
let hasConf = pathReport[fromPath];
if (hasConf && hasConf.multiEntry) {
let param = '';
Object.keys((hasConf.multiName || {})).forEach(key => {
if (options[key]) {
param = options[key];
return false;
}
});
return param;
}
if (pathReport[fromPath] && pathReport[fromPath].paramKey) {
return `${decodeURIComponent(options[pathReport[fromPath].paramKey])}` || '';
}
... ... @@ -171,8 +198,8 @@ export default class yas {
Object.assign(info, {
PAGE_PATH: path,
PAGE_PARAM: self._pageParam(options, path),
PAGE_NAME: self._pageName(path),
FROM_PAGE_NAME: self._pageName(fromPath),
PAGE_NAME: self._pageName(options, path),
FROM_PAGE_NAME: self._pageName(options, fromPath),
FROM_PAGE_PARAM: self._pageParam(fromOptions, fromPath)
});
... ...