...
|
...
|
@@ -61,7 +61,8 @@ const handleCheckedData = (params, origin, param) => { |
|
|
|
|
|
dest.push({
|
|
|
name: value.name,
|
|
|
href: handleFilterUrl(tempPatam)
|
|
|
href: handleFilterUrl(tempPatam),
|
|
|
itemType: param
|
|
|
});
|
|
|
}
|
|
|
});
|
...
|
...
|
@@ -120,6 +121,7 @@ const handleBrandCheckedData = (params, origin) => { |
|
|
};
|
|
|
|
|
|
checked.href = handleFilterUrl(params, tempParam);
|
|
|
checked.itemType = 'brand';
|
|
|
if (checkedCount === 0) {
|
|
|
dest[0] = checked;
|
|
|
} else if (checkedCount === 1) {
|
...
|
...
|
@@ -383,11 +385,13 @@ exports.handleSortData = (origin, params) => { |
|
|
name: `全部${value.sort_name}`,
|
|
|
num: value.count,
|
|
|
href: handleFilterUrl(params, {msort: value.sort_id}, {misort: true}),
|
|
|
childActive: (params.msort === value.sort_id) && !params.misort
|
|
|
childActive: (params.msort === value.sort_id) && !params.misort,
|
|
|
sortId: value.sort_id
|
|
|
}
|
|
|
],
|
|
|
href: handleFilterUrl(params, {msort: value.sort_id}),
|
|
|
active: params.msort === value.sort_id
|
|
|
active: params.msort === value.sort_id,
|
|
|
sortId: value.sort_id
|
|
|
};
|
|
|
|
|
|
allCount += parseInt(value.count, 10);
|
...
|
...
|
@@ -397,7 +401,8 @@ exports.handleSortData = (origin, params) => { |
|
|
name: subValue.sort_name,
|
|
|
num: subValue.count,
|
|
|
href: handleFilterUrl(params, {msort: value.sort_id, misort: subValue.sort_id}),
|
|
|
childActive: params.misort === subValue.sort_id
|
|
|
childActive: params.misort === subValue.sort_id,
|
|
|
sortId: subValue.sort_id
|
|
|
});
|
|
|
if (params.misort === subValue.sort_id) {
|
|
|
category.active = true;
|
...
|
...
|
@@ -1161,3 +1166,127 @@ exports.handleNextPage = (params, total) => { |
|
|
'imageMogr2/thumbnail/235x314/extent/235x314/background/d2hpdGU=/position/center/quality/90'
|
|
|
};
|
|
|
};
|
|
|
|
|
|
const getChannelName = channel => {
|
|
|
|
|
|
let channelName = '';
|
|
|
|
|
|
switch(channel){
|
|
|
case 'boys':
|
|
|
channelName = '男生';
|
|
|
break;
|
|
|
case 'girls':
|
|
|
channelName = '女生';
|
|
|
break;
|
|
|
case 'kids':
|
|
|
channelName = '潮童';
|
|
|
break;
|
|
|
case 'lifestyle':
|
|
|
channelName = '创意生活';
|
|
|
break;
|
|
|
default:
|
|
|
channelName = '男生';
|
|
|
}
|
|
|
|
|
|
return channelName;
|
|
|
};
|
|
|
|
|
|
/**
|
|
|
* 列表页seo
|
|
|
* @param channel
|
|
|
* @param sorts
|
|
|
* @param checked
|
|
|
* @returns {{title: string, keywords: string, description: string}}
|
|
|
*/
|
|
|
exports.getListSeo = (channel, sorts, checked) => {
|
|
|
let channelName = getChannelName(channel),
|
|
|
brandName = '',
|
|
|
priceName = '',
|
|
|
msortName = '',
|
|
|
misortName = '';
|
|
|
|
|
|
_.forEach(sorts, val => {
|
|
|
if(val.active) {
|
|
|
msortName = val && val.name;
|
|
|
_.forEach(val.childList, sub => {
|
|
|
if(sub.childActive && sub.sortId !== val.sortId) {
|
|
|
misortName = sub && sub.name;
|
|
|
return false;
|
|
|
}
|
|
|
});
|
|
|
return false;
|
|
|
}
|
|
|
});
|
|
|
|
|
|
_.forEach(checked, ck => {
|
|
|
if(ck.itemType === 'price') {
|
|
|
priceName = ck.name;
|
|
|
} else if(ck.itemType === 'brand') {
|
|
|
brandName = ck.name;
|
|
|
}
|
|
|
});
|
|
|
|
|
|
let bmpcm = brandName + misortName + priceName + channelName + msortName,
|
|
|
bm = brandName + misortName,
|
|
|
bmp = brandName + misortName + priceName,
|
|
|
cmbm = channelName + msortName + brandName + misortName,
|
|
|
cm = channelName + msortName;
|
|
|
|
|
|
let title = (bmpcm ? bmpcm + '|' : '') + 'YOHO!BUY 有货 100%正品保证',
|
|
|
keywords = (bm ? bm + ',' : '') + (bmp ? bmp + ',' : '') + cmbm,
|
|
|
description = bmp + '正品网购。' + (cm ? cm + ',' : '') + bm + '官方授权!YOHO! 有货中国最大的潮流商品购物网站。100%品牌正品保证,支持货到付款。';
|
|
|
|
|
|
return {
|
|
|
title: title,
|
|
|
keywords: keywords,
|
|
|
description: description
|
|
|
};
|
|
|
};
|
|
|
|
|
|
/**
|
|
|
* 新品到页 seo
|
|
|
* @param channel
|
|
|
* @param dlist
|
|
|
* @returns {{title: string, keywords: string, description: string}}
|
|
|
*/
|
|
|
exports.getNewSeo = (channel, dlist) => {
|
|
|
|
|
|
let channelName = getChannelName(channel),
|
|
|
nlabel = '';
|
|
|
|
|
|
_.forEach(dlist, d => {
|
|
|
if(d && d.active) {
|
|
|
nlabel = d.name || '';
|
|
|
return false;
|
|
|
}
|
|
|
});
|
|
|
|
|
|
let newTitle = channelName + nlabel;
|
|
|
|
|
|
return {
|
|
|
title: newTitle + '新品上架-YOHO!BUY 有货 100%正品保证',
|
|
|
keywords: newTitle + '新品上架',
|
|
|
description: newTitle + '新品上架,正品网购,官方授权!YOHO! 有货中国最大的潮流商品购物网站。100%品牌正品保证,支持货到付款。'
|
|
|
}
|
|
|
};
|
|
|
|
|
|
exports.getBrandSeo = (channel, brandInfo) => {
|
|
|
|
|
|
let c = getChannelName(channel),
|
|
|
bcn = brandInfo && brandInfo.brandNameCn,
|
|
|
b = brandInfo && brandInfo.brandNameEn,
|
|
|
bb = b + ' ' + bcn,
|
|
|
bc = b + c,
|
|
|
bbc = b + bcn + c,
|
|
|
title = bb || b || '',
|
|
|
keywords = (b ? b + ',' : '') + ((b && bcn) ? (bb + ',') : '') + bc || '' + '品牌',
|
|
|
desc = b + '正品网购。' + bbc || '' + '品牌官方授权!YOHO! 有货中国最大的潮流商品购物网站。100%品牌正品保证,支持货到付款。';
|
|
|
|
|
|
title += (title ? (title + '|') : '') + c + '品牌|YOHO!BUY 有货 100%正品保证';
|
|
|
|
|
|
return {
|
|
|
title: title,
|
|
|
keywords: keywords,
|
|
|
description: desc
|
|
|
};
|
|
|
}; |
...
|
...
|
|