...
|
...
|
@@ -94,7 +94,7 @@ function getListData(params, channel) { |
|
|
}
|
|
|
});
|
|
|
|
|
|
finalResult.list = listHandler.handlePathNavData(result[1].data, params, 'sort', channel, baseUrl);
|
|
|
// finalResult.list = listHandler.handlePathNavData(result[1].data, params, 'sort', channel, baseUrl);
|
|
|
|
|
|
finalResult.list.leftContent = listHandler.handleSortData(result[1].data, dps, params, baseUrl);
|
|
|
}
|
...
|
...
|
@@ -133,37 +133,24 @@ function getListData(params, channel) { |
|
|
Object.assign(finalResult.list.leftContent, searchHandler.handleSortAds(result[4].data));
|
|
|
}
|
|
|
|
|
|
let seo = searchHandler.getListSeo(channel,
|
|
|
_.get(finalResult, 'list.leftContent.allSort.list'),
|
|
|
_.get(finalResult, 'list.filters.checkedConditions.conditions'));
|
|
|
|
|
|
// 通过pathNav获取选中品类
|
|
|
let pathNav = _.get(finalResult, 'list.pathNav', []);
|
|
|
let checkedBrand = _.find(_.get(finalResult, 'list.filters.checkedConditions.conditions', []),
|
|
|
['itemType', 'brand']);
|
|
|
let shopUrl = _.get(finalResult, 'list.goods[0].brandUrl');
|
|
|
let sortName;
|
|
|
|
|
|
if (pathNav.length > 1) {
|
|
|
sortName = _.last(pathNav).name;
|
|
|
}
|
|
|
|
|
|
// 当选中品类且只选中一个品牌时导航栏展示品牌信息 for seo
|
|
|
if (shopUrl && !_.isEmpty(checkedBrand) && _.indexOf(checkedBrand.totalName, ',') === -1) {
|
|
|
pathNav.push({
|
|
|
href: shopUrl,
|
|
|
name: checkedBrand.totalName,
|
|
|
pathTitle: checkedBrand.totalName
|
|
|
});
|
|
|
|
|
|
if (sortName) {
|
|
|
pathNav.push({
|
|
|
href: `${shopUrl}?category_id=${params.category_id}`,
|
|
|
name: `${checkedBrand.totalName}${sortName}`,
|
|
|
pathTitle: `${checkedBrand.totalName}${sortName}`
|
|
|
});
|
|
|
const sortList = params.category_id ? _.get(finalResult, 'list.leftContent.allSort.list') : [];
|
|
|
const checkedList = _.get(finalResult, 'list.filters.checkedConditions.conditions');
|
|
|
|
|
|
// 面包屑导航
|
|
|
Object.assign(finalResult.list, listHandler.handleListPathNavData(sortList, checkedList,
|
|
|
params, channel, baseUrl));
|
|
|
|
|
|
_.map(finalResult.list.pathNav, nav => {
|
|
|
if (nav.type === 'brand') {
|
|
|
nav.href = _.get(finalResult, 'list.goods[0].brandUrl') || nav.href;
|
|
|
} else if (nav.type === 'sort') {
|
|
|
sortName = nav.name;
|
|
|
}
|
|
|
}
|
|
|
})
|
|
|
|
|
|
// seo
|
|
|
const seo = searchHandler.getListSeo(channel, sortList, checkedList);
|
|
|
|
|
|
if (sortName) {
|
|
|
return redis.all([
|
...
|
...
|
@@ -173,13 +160,16 @@ function getListData(params, channel) { |
|
|
|
|
|
if (desc) {
|
|
|
_.set(finalResult, 'list.pageIntro', {title: sortName, intro: desc});
|
|
|
|
|
|
// 有配置pageIntro时取消面包屑导航h1
|
|
|
_.last(finalResult.list.pathNav).useH1 = false;
|
|
|
}
|
|
|
|
|
|
return Object.assign({}, seo, finalResult);
|
|
|
});
|
|
|
}
|
|
|
|
|
|
return Object.assign({}, seo, finalResult);
|
|
|
return Object.assign(finalResult, seo);
|
|
|
});
|
|
|
}
|
|
|
|
...
|
...
|
@@ -218,7 +208,6 @@ function getListNewData(params, channel) { |
|
|
|
|
|
// 获取左侧类目数据
|
|
|
if (result[1].code === 200) {
|
|
|
finalResult.list = listHandler.handlePathNavData(result[1].data, params, 'new', channel, baseUrl);
|
|
|
finalResult.list.leftContent = listHandler.handleSortData(result[1].data, dps, params, baseUrl);
|
|
|
}
|
|
|
|
...
|
...
|
@@ -254,12 +243,22 @@ function getListNewData(params, channel) { |
|
|
|
|
|
finalResult.criteo = {skn: searchHandler.getCriteo(_.get(finalResult.list, 'goods'))};
|
|
|
|
|
|
let seo = searchHandler.getNewSeo(channel,
|
|
|
params.category_id ? _.get(finalResult, 'list.leftContent.allSort.list') : [],
|
|
|
_.get(finalResult, 'list.filters.checkedConditions.conditions'),
|
|
|
params.shelveTime);
|
|
|
const sortList = params.category_id ? _.get(finalResult, 'list.leftContent.allSort.list') : [];
|
|
|
const checkedList = _.get(finalResult, 'list.filters.checkedConditions.conditions');
|
|
|
|
|
|
return Object.assign({}, seo, finalResult);
|
|
|
Object.assign(finalResult.list, listHandler.handleListPathNavData(sortList, checkedList,
|
|
|
params, channel, baseUrl));
|
|
|
|
|
|
if (finalResult.list.pathNav && finalResult.list.pathNav.length < 2) { // 无参数添加新品到着
|
|
|
finalResult.list.pathNav.push({
|
|
|
name: '新品到着',
|
|
|
useH1: true
|
|
|
});
|
|
|
}
|
|
|
|
|
|
let seo = searchHandler.getNewSeo(channel, checkedList, checkedList, params.shelveTime);
|
|
|
|
|
|
return Object.assign(finalResult, seo);
|
|
|
});
|
|
|
}
|
|
|
|
...
|
...
|
|