|
@@ -61,7 +61,8 @@ const handleCheckedData = (params, origin, param) => { |
|
@@ -61,7 +61,8 @@ const handleCheckedData = (params, origin, param) => { |
61
|
|
61
|
|
62
|
dest.push({
|
62
|
dest.push({
|
63
|
name: value.name,
|
63
|
name: value.name,
|
64
|
- href: handleFilterUrl(tempPatam)
|
64
|
+ href: handleFilterUrl(tempPatam),
|
|
|
65
|
+ itemType: param
|
65
|
});
|
66
|
});
|
66
|
}
|
67
|
}
|
67
|
});
|
68
|
});
|
|
@@ -120,6 +121,7 @@ const handleBrandCheckedData = (params, origin) => { |
|
@@ -120,6 +121,7 @@ const handleBrandCheckedData = (params, origin) => { |
120
|
};
|
121
|
};
|
121
|
|
122
|
|
122
|
checked.href = handleFilterUrl(params, tempParam);
|
123
|
checked.href = handleFilterUrl(params, tempParam);
|
|
|
124
|
+ checked.itemType = 'brand';
|
123
|
if (checkedCount === 0) {
|
125
|
if (checkedCount === 0) {
|
124
|
dest[0] = checked;
|
126
|
dest[0] = checked;
|
125
|
} else if (checkedCount === 1) {
|
127
|
} else if (checkedCount === 1) {
|
|
@@ -383,11 +385,13 @@ exports.handleSortData = (origin, params) => { |
|
@@ -383,11 +385,13 @@ exports.handleSortData = (origin, params) => { |
383
|
name: `全部${value.sort_name}`,
|
385
|
name: `全部${value.sort_name}`,
|
384
|
num: value.count,
|
386
|
num: value.count,
|
385
|
href: handleFilterUrl(params, {msort: value.sort_id}, {misort: true}),
|
387
|
href: handleFilterUrl(params, {msort: value.sort_id}, {misort: true}),
|
386
|
- childActive: (params.msort === value.sort_id) && !params.misort
|
388
|
+ childActive: (params.msort === value.sort_id) && !params.misort,
|
|
|
389
|
+ sortId: value.sort_id
|
387
|
}
|
390
|
}
|
388
|
],
|
391
|
],
|
389
|
href: handleFilterUrl(params, {msort: value.sort_id}),
|
392
|
href: handleFilterUrl(params, {msort: value.sort_id}),
|
390
|
- active: params.msort === value.sort_id
|
393
|
+ active: params.msort === value.sort_id,
|
|
|
394
|
+ sortId: value.sort_id
|
391
|
};
|
395
|
};
|
392
|
|
396
|
|
393
|
allCount += parseInt(value.count, 10);
|
397
|
allCount += parseInt(value.count, 10);
|
|
@@ -397,7 +401,8 @@ exports.handleSortData = (origin, params) => { |
|
@@ -397,7 +401,8 @@ exports.handleSortData = (origin, params) => { |
397
|
name: subValue.sort_name,
|
401
|
name: subValue.sort_name,
|
398
|
num: subValue.count,
|
402
|
num: subValue.count,
|
399
|
href: handleFilterUrl(params, {msort: value.sort_id, misort: subValue.sort_id}),
|
403
|
href: handleFilterUrl(params, {msort: value.sort_id, misort: subValue.sort_id}),
|
400
|
- childActive: params.misort === subValue.sort_id
|
404
|
+ childActive: params.misort === subValue.sort_id,
|
|
|
405
|
+ sortId: subValue.sort_id
|
401
|
});
|
406
|
});
|
402
|
if (params.misort === subValue.sort_id) {
|
407
|
if (params.misort === subValue.sort_id) {
|
403
|
category.active = true;
|
408
|
category.active = true;
|
|
@@ -1161,3 +1166,127 @@ exports.handleNextPage = (params, total) => { |
|
@@ -1161,3 +1166,127 @@ exports.handleNextPage = (params, total) => { |
1161
|
'imageMogr2/thumbnail/235x314/extent/235x314/background/d2hpdGU=/position/center/quality/90'
|
1166
|
'imageMogr2/thumbnail/235x314/extent/235x314/background/d2hpdGU=/position/center/quality/90'
|
1162
|
};
|
1167
|
};
|
1163
|
};
|
1168
|
};
|
|
|
1169
|
+
|
|
|
1170
|
+const getChannelName = channel => {
|
|
|
1171
|
+
|
|
|
1172
|
+ let channelName = '';
|
|
|
1173
|
+
|
|
|
1174
|
+ switch(channel){
|
|
|
1175
|
+ case 'boys':
|
|
|
1176
|
+ channelName = '男生';
|
|
|
1177
|
+ break;
|
|
|
1178
|
+ case 'girls':
|
|
|
1179
|
+ channelName = '女生';
|
|
|
1180
|
+ break;
|
|
|
1181
|
+ case 'kids':
|
|
|
1182
|
+ channelName = '潮童';
|
|
|
1183
|
+ break;
|
|
|
1184
|
+ case 'lifestyle':
|
|
|
1185
|
+ channelName = '创意生活';
|
|
|
1186
|
+ break;
|
|
|
1187
|
+ default:
|
|
|
1188
|
+ channelName = '男生';
|
|
|
1189
|
+ }
|
|
|
1190
|
+
|
|
|
1191
|
+ return channelName;
|
|
|
1192
|
+};
|
|
|
1193
|
+
|
|
|
1194
|
+/**
|
|
|
1195
|
+ * 列表页seo
|
|
|
1196
|
+ * @param channel
|
|
|
1197
|
+ * @param sorts
|
|
|
1198
|
+ * @param checked
|
|
|
1199
|
+ * @returns {{title: string, keywords: string, description: string}}
|
|
|
1200
|
+ */
|
|
|
1201
|
+exports.getListSeo = (channel, sorts, checked) => {
|
|
|
1202
|
+ let channelName = getChannelName(channel),
|
|
|
1203
|
+ brandName = '',
|
|
|
1204
|
+ priceName = '',
|
|
|
1205
|
+ msortName = '',
|
|
|
1206
|
+ misortName = '';
|
|
|
1207
|
+
|
|
|
1208
|
+ _.forEach(sorts, val => {
|
|
|
1209
|
+ if(val.active) {
|
|
|
1210
|
+ msortName = val && val.name;
|
|
|
1211
|
+ _.forEach(val.childList, sub => {
|
|
|
1212
|
+ if(sub.childActive && sub.sortId !== val.sortId) {
|
|
|
1213
|
+ misortName = sub && sub.name;
|
|
|
1214
|
+ return false;
|
|
|
1215
|
+ }
|
|
|
1216
|
+ });
|
|
|
1217
|
+ return false;
|
|
|
1218
|
+ }
|
|
|
1219
|
+ });
|
|
|
1220
|
+
|
|
|
1221
|
+ _.forEach(checked, ck => {
|
|
|
1222
|
+ if(ck.itemType === 'price') {
|
|
|
1223
|
+ priceName = ck.name;
|
|
|
1224
|
+ } else if(ck.itemType === 'brand') {
|
|
|
1225
|
+ brandName = ck.name;
|
|
|
1226
|
+ }
|
|
|
1227
|
+ });
|
|
|
1228
|
+
|
|
|
1229
|
+ let bmpcm = brandName + misortName + priceName + channelName + msortName,
|
|
|
1230
|
+ bm = brandName + misortName,
|
|
|
1231
|
+ bmp = brandName + misortName + priceName,
|
|
|
1232
|
+ cmbm = channelName + msortName + brandName + misortName,
|
|
|
1233
|
+ cm = channelName + msortName;
|
|
|
1234
|
+
|
|
|
1235
|
+ let title = (bmpcm ? bmpcm + '|' : '') + 'YOHO!BUY 有货 100%正品保证',
|
|
|
1236
|
+ keywords = (bm ? bm + ',' : '') + (bmp ? bmp + ',' : '') + cmbm,
|
|
|
1237
|
+ description = bmp + '正品网购。' + (cm ? cm + ',' : '') + bm + '官方授权!YOHO! 有货中国最大的潮流商品购物网站。100%品牌正品保证,支持货到付款。';
|
|
|
1238
|
+
|
|
|
1239
|
+ return {
|
|
|
1240
|
+ title: title,
|
|
|
1241
|
+ keywords: keywords,
|
|
|
1242
|
+ description: description
|
|
|
1243
|
+ };
|
|
|
1244
|
+};
|
|
|
1245
|
+
|
|
|
1246
|
+/**
|
|
|
1247
|
+ * 新品到页 seo
|
|
|
1248
|
+ * @param channel
|
|
|
1249
|
+ * @param dlist
|
|
|
1250
|
+ * @returns {{title: string, keywords: string, description: string}}
|
|
|
1251
|
+ */
|
|
|
1252
|
+exports.getNewSeo = (channel, dlist) => {
|
|
|
1253
|
+
|
|
|
1254
|
+ let channelName = getChannelName(channel),
|
|
|
1255
|
+ nlabel = '';
|
|
|
1256
|
+
|
|
|
1257
|
+ _.forEach(dlist, d => {
|
|
|
1258
|
+ if(d && d.active) {
|
|
|
1259
|
+ nlabel = d.name || '';
|
|
|
1260
|
+ return false;
|
|
|
1261
|
+ }
|
|
|
1262
|
+ });
|
|
|
1263
|
+
|
|
|
1264
|
+ let newTitle = channelName + nlabel;
|
|
|
1265
|
+
|
|
|
1266
|
+ return {
|
|
|
1267
|
+ title: newTitle + '新品上架-YOHO!BUY 有货 100%正品保证',
|
|
|
1268
|
+ keywords: newTitle + '新品上架',
|
|
|
1269
|
+ description: newTitle + '新品上架,正品网购,官方授权!YOHO! 有货中国最大的潮流商品购物网站。100%品牌正品保证,支持货到付款。'
|
|
|
1270
|
+ }
|
|
|
1271
|
+};
|
|
|
1272
|
+
|
|
|
1273
|
+exports.getBrandSeo = (channel, brandInfo) => {
|
|
|
1274
|
+
|
|
|
1275
|
+ let c = getChannelName(channel),
|
|
|
1276
|
+ bcn = brandInfo && brandInfo.brandNameCn,
|
|
|
1277
|
+ b = brandInfo && brandInfo.brandNameEn,
|
|
|
1278
|
+ bb = b + ' ' + bcn,
|
|
|
1279
|
+ bc = b + c,
|
|
|
1280
|
+ bbc = b + bcn + c,
|
|
|
1281
|
+ title = bb || b || '',
|
|
|
1282
|
+ keywords = (b ? b + ',' : '') + ((b && bcn) ? (bb + ',') : '') + bc || '' + '品牌',
|
|
|
1283
|
+ desc = b + '正品网购。' + bbc || '' + '品牌官方授权!YOHO! 有货中国最大的潮流商品购物网站。100%品牌正品保证,支持货到付款。';
|
|
|
1284
|
+
|
|
|
1285
|
+ title += (title ? (title + '|') : '') + c + '品牌|YOHO!BUY 有货 100%正品保证';
|
|
|
1286
|
+
|
|
|
1287
|
+ return {
|
|
|
1288
|
+ title: title,
|
|
|
1289
|
+ keywords: keywords,
|
|
|
1290
|
+ description: desc
|
|
|
1291
|
+ };
|
|
|
1292
|
+}; |