Authored by 周少峰

Merge branch 'feature/seoUrl302' into release/5.5

<div class="floor-ad">
<a href="{{url}}" target= "_blank"><img class="lazy" data-original="{{image2 src w=1150 h=129}}"/></a>
<a href="{{url}}" target= "_blank" title="{{title}}"><img class="lazy" data-original="{{image2 src w=1150 h=129}}" alt="{{alt}}"/></a>
</div>
... ...
<div class="debris-slider clearfix">
<div class="left-col col">
{{# left}}
<a href="{{url}}" target="_blank">
<img class="lazy" data-original="{{image2 img w=280 h=265}}">
<a href="{{url}}" target="_blank" title="{{title}}">
<img class="lazy" data-original="{{image2 img w=280 h=265}}" alt="{{alt}}">
</a>
{{/ left}}
</div>
... ... @@ -10,8 +10,8 @@
<ul class="slide-wrapper">
{{# center}}
<li>
<a href="{{url}}" target="_blank">
<img class="lazy" data-original="{{image2 img w=570 h=633}}">
<a href="{{url}}" target="_blank" title="{{title}}">
<img class="lazy" data-original="{{image2 img w=570 h=633}}" alt="{{alt}}">
</a>
</li>
{{/ center}}
... ... @@ -27,11 +27,11 @@
</div>
<div class="right-col col">
{{# right}}
<a href="{{url}}" target="_blank">
<a href="{{url}}" target="_blank" title="{{title}}">
{{#if @first}}
<img class="lazy" data-original="{{image2 img w=280 h=449}}">
<img class="lazy" data-original="{{image2 img w=280 h=449}}" alt="{{alt}}">
{{^}}
<img class="lazy" data-original="{{image2 img w=280 h=265}}">
<img class="lazy" data-original="{{image2 img w=280 h=265}}" alt="{{alt}}">
{{/if}}
</a>
{{/ right}}
... ...
... ... @@ -3,8 +3,8 @@
<ul class="img-list imgopacity clearfix">
{{# imgBrand}}
<li class="img-item">
<a href="{{url}}" target= "_blank">
<img data-original="{{image src 378 175}}" src="{{image2 src w=378 h=175}}" alt="">
<a href="{{url}}" target= "_blank" title="{{title}}">
<img data-original="{{image src 378 175}}" src="{{image2 src w=378 h=175}}" alt="{{alt}}">
</a>
</li>
{{/ imgBrand}}
... ...
... ... @@ -17,14 +17,14 @@
<div class="tpl-brands imgopacity clearfix">
<ul>
{{#each brands}}
<li><a title="{{title}}" href="{{url}}" target= "_blank"><img class="lazy" data-original="{{image2 img w=378 h=248}}"/></a></li>
<li><a title="{{title}}" href="{{url}}" target= "_blank"><img class="lazy" data-original="{{image2 img w=378 h=248}}" alt="{{alt}}"/></a></li>
{{/each}}
</ul>
</div>
<div class="tpl-types imgopacity clearfix">
<ul>
{{#each types}}
<li><a title="{{title}}" href="{{url}}" target= "_blank"><img class="lazy" data-original="{{image2 img w=185 h=248}}"/></a></li>
<li><a title="{{title}}" href="{{url}}" target= "_blank"><img class="lazy" data-original="{{image2 img w=185 h=248}}" alt="{{alt}}"/></a></li>
{{/each}}
</ul>
</div>
... ... @@ -32,7 +32,7 @@
<div class="tpl-products imgopacity clearfix">
<ul>
{{#each products}}
<li><a href="{{url}}" title="{{title}}" target= "_blank"><img class="lazy" data-original="{{image2 src w=222 h=298}}"/></a></li>
<li><a href="{{url}}" title="{{title}}" target= "_blank"><img class="lazy" data-original="{{image2 src w=222 h=298}}" alt="{{alt}}"/></a></li>
{{/each}}
</ul>
</div>
... ...
... ... @@ -3,9 +3,9 @@
<ul class="g-list imgopacity">
{{#each imgHot}}
{{#if big}}
<li><a class="impo{{@index}}" href="{{url}}" target= "_blank"><img class="lazy" data-original="{{image2 src w=378 h=248}}"/></a></li>
<li><a class="impo{{@index}}" href="{{url}}" target= "_blank" title="{{title}}"><img class="lazy" data-original="{{image2 src w=378 h=248}}" alt="{{alt}}"/></a></li>
{{^}}
<li><a class="impo{{@index}}" href="{{url}}" target= "_blank"><img class="lazy" data-original="{{image2 src w=185 h=248}}"/></a></li>
<li><a class="impo{{@index}}" href="{{url}}" target= "_blank" title="{{title}}"><img class="lazy" data-original="{{image2 src w=185 h=248}}" alt="{{alt}}"/></a></li>
{{/if}}
{{/each}}
</ul>
... ...
... ... @@ -2,8 +2,8 @@
{{#brandLogos}}
{{#if isBrand}}
<li data-page="{{pageNum}}">
<a href="{{href}}" target="_blank">
<img class="lazy" data-original="{{image2 img}}" alt="">
<a href="{{href}}" target="_blank" title="{{title}}">
<img class="lazy" data-original="{{image2 img}}" alt="{{alt}}">
</a>
</li>
{{/if}}
... ... @@ -13,8 +13,8 @@
<a class="next iconfont" href="javascript:;">&#xe608;</a>
</li>
<li data-page="{{pageNum}}">
<a href="{{href}}" target="_blank">
<img class="lazy" data-original="{{image2 img}}" alt="">
<a href="{{href}}" target="_blank" title="{{title}}">
<img class="lazy" data-original="{{image2 img}}" alt="{{alt}}">
</a>
</li>
{{/if}}
... ... @@ -24,8 +24,8 @@
</li>
{{#if hasNext}}
<li data-page="{{pageNum}}">
<a href="{{href}}" target="_blank">
<img class="lazy" data-original="{{image2 img}}" alt="">
<a href="{{href}}" target="_blank" title="{{title}}">
<img class="lazy" data-original="{{image2 img}}" alt="{{alt}}">
</a>
</li>
{{/if}}
... ...
... ... @@ -3,8 +3,8 @@
<ul class="clearfix">
{{# list}}
<li class="cate-item{{@index}}">
<a href="{{url}}" target= "_blank">
<img class="lazy" data-original="{{image2 src w=w h=h}}" alt="">
<a href="{{url}}" target= "_blank" title="{{title}}">
<img class="lazy" data-original="{{image2 src w=w h=h}}" alt="{{alt}}">
</a>
</li>
{{/ list}}
... ...
... ... @@ -8,7 +8,7 @@
<ul class="img-list">
{{# imgBrand}}
<li class="img-item">
<a href="{{url}}" target= "_blank">
<a href="{{url}}" target= "_blank" title="{{title}}">
<img data-original="{{image2 src w=320 h=430}}" src="{{image2 src w=320 h=430}}" alt="{{alt}}">
</a>
</li>
... ...
... ... @@ -5,7 +5,7 @@
<div class="tpl-nav">
<div class="tpl-keywords">
{{#each keyword}}
<a class="keywords{{@index}}" title="{{title}}" href="{{url}}" target= "_blank"><img class="lazy" data-original="{{image2 img w=185 h=76}}"/></a>
<a class="keywords{{@index}}" title="{{title}}" href="{{url}}" target= "_blank"><img class="lazy" data-original="{{image2 img w=185 h=76}}" alt="{{alt}}"/></a>
{{/each}}
</div>
<div class="tpl-category clearfix">
... ... @@ -16,13 +16,13 @@
</div>
<div class="tpl-brands imgopacity clearfix">
{{#each brands}}
<a title="{{title}}" href="{{url}}" target= "_blank"><img class="lazy" data-original="{{image2 img w=377 h=504}}"/></a>
<a title="{{title}}" href="{{url}}" target= "_blank"><img class="lazy" data-original="{{image2 img w=377 h=504}}" alt="{{alt}}"/></a>
{{/each}}
</div>
<div class="tpl-types imgopacity clearfix">
<ul>
{{#each types}}
<li><a title="{{title}}" href="{{url}}" target= "_blank"><img class="lazy" data-original="{{image2 img w=185 h=504}}"/></a></li>
<li><a title="{{title}}" href="{{url}}" target= "_blank"><img class="lazy" data-original="{{image2 img w=185 h=504}}" alt="{{alt}}"/></a></li>
{{/each}}
</ul>
</div>
... ...
... ... @@ -4,11 +4,11 @@
<ul class="g-list imgopacity clearfix">
{{#each imgHot}}
<li>
<a href="{{url}}" target= "_blank"><div class="commodity-img">
<a href="{{url}}" target= "_blank"><div class="commodity-img" title="{{title}}">
{{# tip}}
<i class="top">{{.}}</i>
{{/ tip}}
<img class="lazy" data-original="{{image2 thumb w=280 h=373}}"/></div>
<img class="lazy" data-original="{{image2 thumb w=280 h=373}}" alt="{{alt}}"/></div>
<p class="commodity-name">{{name}}</p>
<p class="commodity-price"><span>¥{{salePrice}}</span></p>
</a>
... ... @@ -18,7 +18,7 @@
</div>
<div class="commodity-brands imgopacity clearfix">
{{#each brands}}
<a href="{{url}}" title="{{title}}" target= "_blank"><img class="lazy" data-original="{{image2 src w=185 h=86}}"/></a>
<a href="{{url}}" title="{{title}}" target= "_blank"><img class="lazy" data-original="{{image2 src w=185 h=86}}" alt="{{alt}}"/></a>
{{/each}}
</div>
</div>
... ...
... ... @@ -6,11 +6,11 @@
{{#unless @last}}
<li>
<a href="{{url}}" target= "_blank">
<a href="{{url}}" target= "_blank" title="{{title}}">
{{#if @first}}
<img class="lazy" data-original="{{image2 src w=377 h=504}}" alt="" >
<img class="lazy" data-original="{{image2 src w=377 h=504}}" alt="{{alt}}">
{{^}}
<img class="lazy" data-original="{{image2 src w=185 h=248}}" alt="" >
<img class="lazy" data-original="{{image2 src w=185 h=248}}" alt="{{alt}}">
{{/if}}
</a>
</li>
... ... @@ -21,8 +21,8 @@
{{# list}}
{{#if @last}}
<div class="last-item">
<a href="{{url}}" target= "_blank">
<img class="lazy" data-original="{{image2 src w=377 h=504}}" alt="">
<a href="{{url}}" target= "_blank" title="{{title}}">
<img class="lazy" data-original="{{image2 src w=377 h=504}}" alt="{{alt}}">
</a>
</div>
{{/if}}
... ...
... ... @@ -2,8 +2,8 @@
{{> common/floor-header}}
{{# bannerImage}}
<a class="good-thumb new-user-banner" href="{{url}}" target="_blank">
<img class="lazy" data-original="{{image2 src w=1150 h=368}}" alt="{{title}}">
<a class="good-thumb new-user-banner" href="{{url}}" target="_blank" title="{{title}}">
<img class="lazy" data-original="{{image2 src w=1150 h=368}}" alt="{{alt}}">
</a>
{{/bannerImage}}
<div class="new-user-proList">
... ...
... ... @@ -2,7 +2,7 @@
<div class="tpl-products imgopacity clearfix tpl-list" floorId="{{floorId}}">
<ul>
{{#each categorys}}
<li><a href="{{url}}" title="{{title}}" target= "_blank"><img class="lazy" data-original="{{image2 src w=222 h=298}}"/></a></li>
<li><a href="{{url}}" title="{{title}}" target= "_blank"><img class="lazy" data-original="{{image2 src w=222 h=298}}" alt="{{alt}}"/></a></li>
{{/each}}
</ul>
</div>
... ...
... ... @@ -2,7 +2,7 @@
<div class="slide-accordion clearfix">
<ul>
{{#each slide}}
<li><a title="{{title}}" href="{{url}}" target= "_blank"><div class="g-mask"></div><img class="lazy" data-original="{{image2 src w=650 h=400}}"/></a></li>
<li><a title="{{title}}" href="{{url}}" target= "_blank"><div class="g-mask"></div><img class="lazy" data-original="{{image2 src w=650 h=400}}" alt="{{alt}}"/></a></li>
{{/each}}
</ul>
</div>
... ...
... ... @@ -5,13 +5,13 @@
{{/ title}}
<div class="tpl-leftPic imgopacity clearfix">
{{#bigPic}}
<a title="{{title}}" href="{{url}}" target= "_blank"><img class="lazy" data-original="{{image2 src w=512 h=504}}"/></a>
<a title="{{title}}" href="{{url}}" target= "_blank"><img class="lazy" data-original="{{image2 src w=512 h=504}}" alt="{{alt}}"/></a>
{{/bigPic}}
</div>
<div class="tpl-types imgopacity clearfix">
<ul>
{{#each types}}
<li><a title="{{title}}" href="{{url}}" target= "_blank"><img class="lazy" data-original="{{image2 src w=185 h=248}}"/></a></li>
<li><a title="{{title}}" href="{{url}}" target= "_blank"><img class="lazy" data-original="{{image2 src w=185 h=248}}" alt="{{alt}}"/></a></li>
{{/each}}
</ul>
</div>
... ...
... ... @@ -10,8 +10,8 @@ const CAPTCHA = 'yoho4946abcdef#$%&!@';
// 对比函数
const _mustEqual = (req) => {
return req.body.verifyCode === req.session.captcha ||
req.body.verifyCode === CAPTCHA;
return req.session.captcha && (req.body.verifyCode === req.session.captcha ||
req.body.verifyCode === CAPTCHA);
};
// 中间件
... ...
... ... @@ -63,7 +63,7 @@
"uuid": "^2.0.2",
"yoho-express-session": "^2.0.0",
"yoho-node-lib": "0.2.8",
"yoho-zookeeper": "^1.0.6"
"yoho-zookeeper": "^1.0.8"
},
"devDependencies": {
"autoprefixer": "^6.3.6",
... ...
... ... @@ -4,16 +4,15 @@ const _ = require('lodash');
const camelCase = global.yoho.camelCase;
const helpers = global.yoho.helpers;
// const images = require(`${global.utils}/images`);
const itemFromBase = {
search: {domain: 'search', module: 's'}, // 搜索页search.yohobuy.com
list: {domain: 'list', module: 'c'}, // list.yohobuy.com
listSale: {domain: 'list', module: 's'}, // list.yohobuy.com/sale
listNew: {domain: 'list', module: 'n'}, // list.yohobuy.com/new
brand: {domain: 'brand', module: 'b'}, // xxx.yohobuy.com[品牌域名]
saleSpecial: {domain: 'sale', module: 's'}// sale.yohobuy.com
};
// TODO 删除from参数,暂时保留注释
// const itemFromBase = {
// search: {domain: 'search', module: 's'}, // 搜索页search.yohobuy.com
// list: {domain: 'list', module: 'c'}, // list.yohobuy.com
// listSale: {domain: 'list', module: 's'}, // list.yohobuy.com/sale
// listNew: {domain: 'list', module: 'n'}, // list.yohobuy.com/new
// brand: {domain: 'brand', module: 'b'}, // xxx.yohobuy.com[品牌域名]
// saleSpecial: {domain: 'sale', module: 's'}// sale.yohobuy.com
// };
/**
* 根据性别来决定 默认图片获取字段 如果是 2、3
... ... @@ -112,8 +111,10 @@ const procCnAlphabetName = (nameStr) => {
*/
exports.processProductList = (list, options) => {
const pruductList = [];
let itemNum = 0,
itemFrom;
// TODO 删除from参数,暂时保留注释
// let itemNum = 0,
// itemFrom;
options = Object.assign({
showTags: true,
... ... @@ -131,24 +132,25 @@ exports.processProductList = (list, options) => {
from: {} // 来源
}, options);
// TODO 删除from参数,暂时保留注释
// 处理item from
if (!_.isEmpty(options.from) && itemFromBase[options.from.type]) {
let f = {domain: '', module: '', key: ''};
let params = options.from.params || {};
f.page = params.page || 1;
Object.assign(f, itemFromBase[options.from.type], {
page: params.page || 1,
key: params.misort || params.msort || ''
});
if (options.from.type === 'search') {
f.key = params.query || '';
}
itemFrom = `from=${f.domain}-${f.module}-${f.key}_${f.page}_`;
}
// if (!_.isEmpty(options.from) && itemFromBase[options.from.type]) {
// let f = {domain: '', module: '', key: ''};
// let params = options.from.params || {};
//
// f.page = params.page || 1;
//
// Object.assign(f, itemFromBase[options.from.type], {
// page: params.page || 1,
// key: params.misort || params.msort || ''
// });
//
// if (options.from.type === 'search') {
// f.key = params.query || '';
// }
//
// itemFrom = `from=${f.domain}-${f.module}-${f.key}_${f.page}_`;
// }
_.forEach(list, (product) => {
... ... @@ -204,15 +206,13 @@ exports.processProductList = (list, options) => {
// tar add 1606071146 品牌链接处理
product.brandUrl = helpers.urlFormat('', '', product.brand_domain);
// APP访问需要加附加的参数
// 备注:如果以后APP的接口太多,可以把这边参数提取出来,变成一个公共的方法来生成,便于以后管理维护
if (options.isApp) {
product.url += `?openby:yohobuy={"action":"go.productDetail","params":{"product_skn":'${product.product_id}'}}`; // eslint-disable-line
} else if (itemFrom) {
// 累加商品数量
itemNum++;
product.url += `?${itemFrom}${itemNum}`;
}
// TODO 删除from参数,暂时保留注释
// if (itemFrom) {
// // 累加商品数量
// itemNum++;
// product.url += `?${itemFrom}${itemNum}`;
// }
if (options.showTags) {
let tags = [],
isfew = false;
... ...