Authored by 周少峰

Merge branch 'master' into feature/captch-change

... ... @@ -189,7 +189,7 @@ const formatCartGoods = (cartGoods, isAdvanceCart, inValid, isOffShelves, analys
// 分析用: 商品ID列表
if (_.isArray(_.get(analysis, 'ids'))) {
analysis.ids.push(it.product_id);
analysis.ids.push(it.product_skn);
}
// 分析用: CRITEO
... ... @@ -203,7 +203,7 @@ const formatCartGoods = (cartGoods, isAdvanceCart, inValid, isOffShelves, analys
} else {
// 分析用: 商品ID列表
if (_.isArray(_.get(analysis, 'ids'))) {
analysis.ids.push(it.product_id);
analysis.ids.push(it.product_skn);
}
// 分析用: CRITEO
... ... @@ -460,13 +460,13 @@ const formatPoolPromotionInfos = (infoList, selectedGiftsList) => {
/**
* 格式化子优惠池信息,返回商品列表,子优惠列表放在每个商品中
*/
const formatSubPromotionPools = (pools, selectedGiftsList, isAdvance) => {
const formatSubPromotionPools = (pools, selectedGiftsList, isAdvance, analysis) => {
let goodsListPool = _.map(pools, p => {
let pool = {
poolType: p.pool_type,
isBrandGroup: Number(p.pool_type) === 1,
goodsList: formatCartGoods(p.goods_list, isAdvance),
goodsList: formatCartGoods(p.goods_list, isAdvance, false, false, analysis),
promotionInfos: formatPoolPromotionInfos(p.promotion_list, selectedGiftsList)
};
... ... @@ -492,19 +492,19 @@ const formatSubPromotionPools = (pools, selectedGiftsList, isAdvance) => {
* giftsList, priceGifts 已选择的赠品和加价购,判断可选的赠品和加价购是否被选中
* 优惠池
*/
const formatPromotionPools = (pools, selectedGiftsList, isAdvance) => {
const formatPromotionPools = (pools, selectedGiftsList, isAdvance, analysis) => {
return _.map(pools, p => {
let pool = {
poolTitle: p.pool_title,
poolType: p.pool_type,
isBrandGroup: Number(p.pool_type) === 1,
goodsList: formatCartGoods(p.goods_list, isAdvance),
goodsList: formatCartGoods(p.goods_list, isAdvance, false, false, analysis),
promotionInfos: formatPoolPromotionInfos(p.promotion_list, selectedGiftsList)
};
if (p.sub_pool) {
pool.subs = formatSubPromotionPools(p.sub_pool, selectedGiftsList, isAdvance);
pool.subs = formatSubPromotionPools(p.sub_pool, selectedGiftsList, isAdvance, analysis);
/*
if (_.isArray(goodsWithPromotion) && goodsWithPromotion.length) {
... ... @@ -560,7 +560,7 @@ const formatCart = (cartDataRet, uid, shoppingKey, cartDelList) => {
result.advanceCart = {
// 未参加活动的商品
// goodsList: chelper.formatCartGoods(_.get(advCartData, 'goods_list'), true, false, false, analysisData),
pools: formatPromotionPools(_.get(advCartData, 'goods_pool_list'), null, true),
pools: formatPromotionPools(_.get(advCartData, 'goods_pool_list'), null, true, analysisData),
offShelves: formatOffShelves(_.get(advCartData, 'off_shelves_goods_list'), true, analysisData),
soldOuts: formatSoldOuts(_.get(advCartData, 'sold_out_goods_list'), true, analysisData),
promotionInfos: formatPromotionInfos(_.get(advCartData, 'promotion_info')),
... ... @@ -585,7 +585,7 @@ const formatCart = (cartDataRet, uid, shoppingKey, cartDelList) => {
// 已选择的全场加价购和赠品
goodsList: goodsList,
pools: formatPromotionPools(_.get(ordCartData, 'goods_pool_list'), goodsList),
pools: formatPromotionPools(_.get(ordCartData, 'goods_pool_list'), goodsList, false, analysisData),
offShelves: formatOffShelves(_.get(ordCartData, 'off_shelves_goods_list'), false, analysisData),
soldOuts: formatSoldOuts(_.get(ordCartData, 'sold_out_goods_list'), false, analysisData),
... ...
... ... @@ -68,39 +68,4 @@
</div>
</div>
<!-- 商品详细信息窗口 -->
<!--
<script type="text/javascript">
(function (d) {
window.bd_cpro_rtid = "P1fsPWc";
var s = d.createElement("script");
s.type = "text/javascript";
s.async = true;
s.src = location.protocol + "//cpro.baidu.com/cpro/ui/rt.js";
var s0 = d.getElementsByTagName("script")[0];
s0.parentNode.insertBefore(s, s0);
})(document);
</script>
<script type="text/javascript" src="//static.criteo.net/js/ld/ld.js" async="true"></script>
<script type="text/javascript">
window.criteo_q = window.criteo_q || [];
window.criteo_q.push(
{event: "setAccount", account: 16184},
{event: "setCustomerId", id: "{{uid}}"},
{event: "setSiteType", type: "d"},
{event: "viewBasket", item: {{{cart.criteo}}} }
);
</script>
-->
<!-- 聚效 -->
<!--
<script type="text/javascript">
var _mvq = window._mvq || [];
window._mvq = _mvq;
_mvq.push(['$setAccount', 'm-23428-1']);
_mvq.push(['$setGeneral', 'cartview', '', /*用户名*/ '', '{{uid}}']);
_mvq.push(['$logConversion']);
_mvq.push(['$addItem', '', /*商品id*/ '{{cart.ids}}', '', '']);
_mvq.push(['$logData']);
</script>
-->
{{> cart-analysis}}
... ...
<!-- 商品详细信息窗口 -->
<script type="text/javascript">
(function (d) {
window.bd_cpro_rtid = "P1fsPWc";
var s = d.createElement("script");
s.type = "text/javascript";
s.async = true;
s.src = location.protocol + "//cpro.baidu.com/cpro/ui/rt.js";
var s0 = d.getElementsByTagName("script")[0];
s0.parentNode.insertBefore(s, s0);
})(document);
</script>
<script type="text/javascript" src="//static.criteo.net/js/ld/ld.js" async="true"></script>
<script type="text/javascript">
window.criteo_q = window.criteo_q || [];
window.criteo_q.push(
{event: "setAccount", account: 16184},
{event: "setCustomerId", id: "{{uid}}"},
{event: "setSiteType", type: "d"},
{event: "viewBasket", item: [
{{# cart.criteo}}
{"id":"{{id}}","quantity":"{{quantity}}","price":"{{price}}"},
{{/ cart.criteo}}
]}
);
</script>
<!-- 聚效 -->
<script type="text/javascript">
var _mvq = window._mvq || [];
window._mvq = _mvq;
_mvq.push(['$setAccount', 'm-23428-1']);
_mvq.push(['$setGeneral', 'cartview', '', /*用户名*/ '', '{{uid}}']);
_mvq.push(['$logConversion']);
_mvq.push(['$addItem', '', /*商品id*/ '{{cart.ids}}', '', '']);
_mvq.push(['$logData']);
</script>
... ...
<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>
... ...
... ... @@ -11,8 +11,8 @@ const request = require('request');
// 对比函数
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);
};
// 中间件
... ...
... ... @@ -79,7 +79,7 @@ const shop = (shopId, req, res, next, brandInfo) => {
*/
exports.index = (req, res, next) => {
let resData = {};
let qs = req._parsedOriginalUrl.query || '';
let qs = decodeURIComponent(req._parsedOriginalUrl.query || '');
list.getListData(Object.assign(req.query, {uid: req.user.uid}), req.yoho.channel).then(result => {
Object.assign(resData, result);
... ... @@ -127,7 +127,42 @@ exports.new = (req, res, next) => {
res.render('list/index', resData);
}).catch(next);
};
/**
* 新品到着(带频道)
* @param {[type]} req [description]
* @param {[type]} res [description]
* @return {[type]} [description]
*/
exports.newWithChannel = (req, res, next) => {
let channel = req.params[0];
req.query = req.query || {};
// 根据 XXXX-new 中的频道处理查询参数
switch (channel) {
case 'boys':
req.yoho.channel = 'boys';
req.query = Object.assign({gender: '1,3', msort: '1,3,4,6,7,8,308,360'}, req.query);
break;
case 'girls':
req.yoho.channel = 'girls';
req.query = Object.assign({gender: '2,3', msort: '1,3,4,6,7,8,308,360'}, req.query);
break;
case 'kids':
req.yoho.channel = 'kids';
req.query = Object.assign({gender: '1,2,3', msort: '365'}, req.query);
break;
case 'lifestyle':
req.yoho.channel = 'lifestyle';
req.query = Object.assign({gender: '1,2,3', msort: '10'}, req.query);
break;
default:
break;
}
this.new(req, res, next);
};
/**
... ...
... ... @@ -9,6 +9,8 @@
const mRoot = '../models';
const sale = require(`${mRoot}/sale`); // sale model
const channelList = ['boys', 'girls', 'kids', 'lifestyle'];
/**
* sale 首页
* @param {[type]} req [description]
... ... @@ -18,6 +20,11 @@ const sale = require(`${mRoot}/sale`); // sale 页 model
exports.index = (req, res, next) => {
let channel = req.yoho.channel;
// SEO url 改造
if (req.params && req.params[0] && channelList.indexOf(req.params[0]) > -1) {
channel = req.params[0];
}
// 真实数据输出
sale.getSaleIndexData(channel).then(result => {
res.render('sale/index', Object.assign({
... ...
... ... @@ -471,7 +471,7 @@ const getShopAbout = (shopId, uid, channel) => {
shopId: shopId,
bannerHeight: 150,
shopHome: `/?shopId=${shopId}`,
shopIntro: `/about?shopId=${shopId}`,
shopIntro: `/shop${shopId}-about`,
coled: _.get(result, '[2].data.is_favorite', 'N') === 'Y'
});
_.set(resData, 'brand.shopBanner', decorator.shopTopBannerBase);
... ... @@ -928,7 +928,7 @@ const getBaseShopData = (params, extra, channel, shopId) => {
shopId: shopId,
bannerHeight: 150,
shopHome: `/?shopId=${shopId}`,
shopIntro: `/about?shopId=${shopId}`,
shopIntro: `/shop${shopId}-about`,
coled: _.get(result[2], 'data.is_favorite', 'N') === 'Y'
});
... ...
... ... @@ -24,6 +24,21 @@ const checksName = {
limited: '限量'
};
const sortFilterParam = (param) => {
let resData = [];
_.forEach(param, (value, key) => {
resData.push({
key: key,
value: value
});
});
return _.sortBy(resData, [o => {
return o.key;
}]);
};
/**
* 处理用于筛选的 URL , 拼接 URL 参数
* @param originParam 当前 URL 中的参数
... ... @@ -39,10 +54,13 @@ const handleFilterUrl = (originParam, newParam, delParam) => {
tempOriginParam = Object.assign(tempOriginParam, originParam, newParam);
delete tempOriginParam.uid;
_.forEach(tempOriginParam, function(value, key) {
if (!delParam[key] && value) {
_.forEach(sortFilterParam(tempOriginParam), info => {
if (!delParam[info.key] && info.value) {
// NOTE: 这里会对 query 进行编码,因为 query 有可以能是中文
dest += key === 'query' ? `${key}=${encodeURIComponent(value)}&` : `${key}=${value}&`;
if (info.key === 'query') {
info.value = encodeURIComponent(info.value);
}
dest += `${info.key}=${info.value}&`;
}
});
... ... @@ -65,7 +83,12 @@ const handleCheckedData = (params, origin, param) => {
let tempPatam = _.cloneDeep(params);
// 删除选中
delete tempPatam[param];
if (param === 'gender') {
// 某些特殊带频道信息页面,清除性别,需将gender设为1,2,3 (2017-3 配合SEO进行URL改造)
tempPatam[param] = '1,2,3';
} else {
delete tempPatam[param];
}
dest.push({
name: value.name,
... ... @@ -779,7 +802,8 @@ exports.handleFilterData = (origin, params, total) => {
}
// 清除所有选中数据
let remainParams = {};
// 某些特殊带频道信息页面,清除性别,需将gender设为1,2,3 (2017-3 配合SEO进行URL改造)
let remainParams = {gender: '1,2,3'};
if (params.id) {
remainParams.id = params.id;
... ...
... ... @@ -67,6 +67,22 @@ exports.studentsNum = (data) => {
*/
exports.studentResource = (data) => {
let dest = {couponObj: {}};
let rightsTextObj = [{
rightName: '认证立赠100有货币',
rightContent: '认证成功,立即赠送100有货币。'
},{
rightName: '新品立享9折',
rightContent: '学生购买指定原价新品时,可立即享受9折优惠,此折扣与VIP折扣不可同时享受。'
},{
rightName: '每1元返1个有货币',
rightContent: '学生购买指定商品时,每1元返1个有货币(以商品的实际成交金额计算);<br>' +
'有货币返还时间:确认收货7日后,系统自动将对应数量的有货币返还至购买账户;<br>' +
'有货币有效期:获得当日至次年12月31日,逾期自动作废;<br>' +
'查看有货币:登录后,点击“个人中心”在“我的有货币”中可以查看有货币余额及明细。'
},{
rightName: '分期付款',
rightContent: '开通有货分期后,可享受部分商品30天延后付款,最长6个月的分期付款,开启任性购物模式。'
}];
_.forEach(data, (value) => {
switch (value.template_name) {
... ... @@ -77,6 +93,10 @@ exports.studentResource = (data) => {
Object.assign(dest.couponObj, {couponItem: getCoupon(value.data), floorId: value.template_id});
break;
case 'recommend_content_five':
Object.assign(value.data.list[0], rightsTextObj[0]);
Object.assign(value.data.list[1], rightsTextObj[1]);
Object.assign(value.data.list[2], rightsTextObj[2]);
Object.assign(value.data.list[3], rightsTextObj[3]);
Object.assign(dest, {rightsObj: {rightsItem: value.data.list || {}, floorId: value.template_id}});
break;
case 'image_list':
... ... @@ -99,6 +119,7 @@ exports.studentResource = (data) => {
break;
}
});
_.isEmpty(dest.couponObj) ? delete dest.couponObj : '';
return dest;
};
... ...
... ... @@ -46,6 +46,7 @@ const newArrive = require(`${cRoot}/newArrive`);
// 商品促销routers
router.get('/sale', sale.index); // sale 首页
router.get(/\/(.*)-sale/, sale.index); // sale 首页(SEO改造)
router.get('/sale/discount/detail', sale.discount); // 折扣专场详情页
router.get('/sale/vip', sale.vip); // VIP 活动专区
router.get('/sale/breakingYards', sale.breakingYards); // 断码区
... ... @@ -93,6 +94,7 @@ router.get('/list/index', gbk2utf, list.index);
// 新品到着
router.get('/list/new', list.new);
router.get(/\/list\/(.*)-new/, list.newWithChannel);
// 品牌店铺
router.get('/index/brand', list.brand); // 品牌店铺页
... ...
... ... @@ -3,6 +3,10 @@
<div class="stu-rights-item">
<img class="" src="{{image2 src w=300 h=300}}">
</img>
<div class="item-content hide">
<p class="item-title">{{rightName}}</p>
<p class="item-detail">{{{rightContent}}}</p>
</div>
</div>
{{/rightsItem}}
</div>
... ...
... ... @@ -28,44 +28,45 @@ const channelMap = {
const sortMap = {
boys: [
{misort: 16, viewNum: 5}, // 卫衣
{misort: 21, viewNum: 5}, // 夹克
{misort: 44, viewNum: 5}, // 休闲运动鞋
{misort: 22, viewNum: 5}, // 大衣/风衣
{misort: 12, viewNum: 5}, // 衬衫
{misort: 11, viewNum: 5}, // T恤
{misort: 16, viewNum: 5}, // 卫衣
{misort: 21, viewNum: 5}, // 大衣/风衣
{misort: 44, viewNum: 5}, // 休闲/运动鞋
{misort: 26, viewNum: 5}, // 休闲裤
{misort: 27, viewNum: 5}, // 牛仔裤
{misort: 48, viewNum: 5}, // 时装鞋
{misort: 20, viewNum: 5}, // 棉衣
{misort: 257, viewNum: 5}, // 毛衣/针织
{misort: 172, viewNum: 5}, // 皮衣
{misort: 45, viewNum: 5}, // 靴子
{misort: 226, viewNum: 5}, // 防风外套
{misort: 18, viewNum: 5}, // 羽绒服
{misort: 13, viewNum: 5}, // POLO
{misort: 28, viewNum: 5}, // 短裤
{misort: 49, viewNum: 5}, // 双肩包
{misort: 60, viewNum: 5}, // 帽子
{misort: 59, viewNum: 5}, // 手表
{misort: 66, viewNum: 5}, // 配饰
{misort: 50, viewNum: 5}, // 手拎包/单肩包
{misort: 65, viewNum: 5}, // 首饰
{misort: 309, viewNum: 5}, // 内裤
{misort: 259, viewNum: 5} // 美妆
{misort: 237, viewNum: 5}, // 钱包/卡包/手包/钥匙包
{misort: 61, viewNum: 5} // 太阳镜/眼镜
],
girls: [
{misort: 31, viewNum: 4}, // 连衣裙
{misort: 11, viewNum: 4}, // T恤
{misort: 32, viewNum: 4}, // 半身裙
{misort: 16, viewNum: 4}, // 卫衣
{misort: 257, viewNum: 4}, // 毛衣/针织
{misort: 21, viewNum: 4}, // 夹克
{misort: 12, viewNum: 4}, // 衬衫
{misort: 44, viewNum: 4}, // 休闲/运动鞋
{misort: 22, viewNum: 4}, // 大衣/风衣
{misort: 31, viewNum: 4}, // 连衣裙
{misort: 48, viewNum: 4}, // 时装鞋
{misort: 257, viewNum: 4}, // 毛衣/针织
{misort: 172, viewNum: 4}, // 皮衣
{misort: 226, viewNum: 4}, // 防风外套
{misort: 20, viewNum: 4}, // 棉服
{misort: 26, viewNum: 4}, // 休闲裤
{misort: 27, viewNum: 4}, // 牛仔裤
{misort: 18, viewNum: 4}, // 羽绒服
{misort: 12, viewNum: 4}, // 衬衫
{misort: 28, viewNum: 4}, // 短裤
{misort: 48, viewNum: 4}, // 时装鞋
{misort: 49, viewNum: 4}, // 双肩包
{misort: 50, viewNum: 4}, // 手拎包/单肩包
{misort: 39, viewNum: 4}, // 袜子
{misort: 60, viewNum: 4}, // 帽子
{misort: 61, viewNum: 4}, // 太阳镜/眼镜
{misort: 65, viewNum: 4}, // 首饰
... ... @@ -76,21 +77,25 @@ const sortMap = {
kids: [
{misort: 396, viewNum: 4}, // 卫衣
{misort: 368, viewNum: 4}, // 休闲/运动鞋
{misort: 369, viewNum: 4}, // 休闲裤
{misort: 366, viewNum: 4}, // T恤
{misort: 404, viewNum: 4}, // 夹克
{misort: 400, viewNum: 4}, // 毛衣/针织
{misort: 369, viewNum: 4}, // 休闲裤
{misort: 371, viewNum: 4}, // 连衣裙
{misort: 367, viewNum: 4}, // 衬衫
{misort: 462, viewNum: 4}, // 靴子
{misort: 406, viewNum: 4}, // 大衣/风衣
{misort: 390, viewNum: 4}, // 运动裤
{misort: 368, viewNum: 4}, // 休闲/运动鞋
{misort: 423, viewNum: 4}, // 棉衣
{misort: 392, viewNum: 4}, // 双肩包
{misort: 402, viewNum: 4}, // 马甲
{misort: 470, viewNum: 4}, // 连体裤
{misort: 448, viewNum: 4}, // 玩具娱乐
{misort: 382, viewNum: 4}, // 凉鞋/凉拖
{misort: 388, viewNum: 4}, // 牛仔裤
{misort: 417, viewNum: 4}, // 套装
{misort: 408, viewNum: 4}, // 袜子
{misort: 367, viewNum: 4}, // 衬衫
{misort: 371, viewNum: 4}, // 连衣裙
{misort: 429, viewNum: 4}, // 太阳镜/眼镜
{misort: 414, viewNum: 4} // 帽子
{misort: 470, viewNum: 4}, // 连体裤
{misort: 372, viewNum: 4}, // 短裤
{misort: 370, viewNum: 4}, // 半身裙
{misort: 460, viewNum: 4} // 时装鞋
],
lifestyle: [
... ...
... ... @@ -4,6 +4,24 @@
'use strict';
module.exports = [
const helpers = global.yoho.helpers;
const TYPE = require('../type');
module.exports = [
{
type: TYPE.redirect,
origin: /\/about\?shopId=([\d]+)/,
target: (req, match, id) => {
return helpers.urlFormat(`/shop${id}-about`, null, req.subdomains[0]);
}
},
{
type: TYPE.rewrite,
origin: /\/shop([\d]+)-about/,
target: (req, match, id) => {
req.query.domain = req.subdomains[0];
req.query.shopId = id;
return '/product/index/about';
}
}
];
... ...
/**
* Created by YanQing.Yang on 2017/3/9.
*/
'use strict';
const _ = require('lodash');
const helpers = global.yoho.helpers;
const mapSort = require(`${global.utils}/map-sort`);
const TYPE = require('../type');
module.exports = [
// 老版newURL
{
type: TYPE.redirect,
origin: '/new?gender=1,3&order=s_t_desc&msort=1,3,4,6,7,8,308,360',
target: helpers.urlFormat('/boys-new/', null, 'list')
},
{
type: TYPE.redirect,
origin: '/new?gender=2,3&order=s_t_desc&msort=1,3,4,6,7,8,308,360',
target: helpers.urlFormat('/girls-new/', null, 'list')
},
{
type: TYPE.redirect,
origin: '/new?order=s_t_desc&msort=365',
target: helpers.urlFormat('/kids-new/', null, 'list')
},
{
type: TYPE.redirect,
origin: '/new?order=s_t_desc&msort=10',
target: helpers.urlFormat('/lifestyle-new/', null, 'list')
},
// 筛选参数排序匹配
{
type: TYPE.redirect,
origin: req => {
if (_.isEmpty(req.query)) {
return false;
}
let sorts = mapSort(req.query);
let queryKeys = _.keys(req.query);
let index = 0;
let matched = _.map(sorts, (val, key) => {
return key === queryKeys[index++];
});
if (_.every(matched, match => match)) {
return false;
}
return true;
},
target: req => helpers.urlFormat(req.path, mapSort(req.query), 'list')
},
{
type: TYPE.rewrite,
origin: req => {
return !req.path || req.path === '/';
},
target: '/product/list/index'
},
{
type: TYPE.rewrite,
origin: /\/(.*)-new/,
target: (req, match, channel) => {
return `/product/list/${channel}-new`;
}
},
{
type: TYPE.rewrite,
origin: req => req.path === '/new',
target: '/product/list/new'
}
];
... ...
... ... @@ -10,6 +10,18 @@ const helpers = global.yoho.helpers;
const TYPE = require('../type');
module.exports = [
{
type: TYPE.redirect,
origin: /\/product\/sale\/\?channel=(.*)/,
target: (req, match, channel) => {
return helpers.urlFormat(`/product/${channel}-sale/`);
}
},
{
type: TYPE.redirect,
origin: '/product/sale/?msort=10',
target: helpers.urlFormat('/product/lifestyle-sale/')
},
// 商品详情页老链接,形试一
{
type: TYPE.redirect,
... ...
... ... @@ -42,37 +42,37 @@ const seoMap = {
keywords: '配饰其他,女士配饰,女士时尚配饰,YOHO!BUY有货',
description: 'YOHO!BUY有货配饰其他频道提供新款女士配饰,时尚帽子、围巾、耳钉手链、腰带胸针等女士潮流配饰搭配商品。购买女士配饰就到YOHO!BUY有货,100%正品保证!'
},
'msort=365&gender=1,3&order=s_t_desc': {
'gender=1,3&msort=365&order=s_t_desc': {
title: '男童服饰|男童上衣外套,下装,时尚男童鞋包配饰|YOHO!BUY有货 100%正品保证',
keywords: '男童服饰,男童上衣外套,男童下装,时尚男童鞋包配饰,YOHO!BUY有货',
description: 'YOHO!BUY有货男童服饰提供时尚男童上衣外套,下装,时尚男童鞋包配饰,教你穿出可爱,搭出时尚.购买当季最新款男童服饰就到YOHO!BUY有货,100%正品保证'
},
'msort=365&order=s_t_desc&gender=2,3': {
'gender=2,3&msort=365&order=s_t_desc': {
title: '女童服饰|女童上衣外套,下装,时尚女童鞋包配饰|YOHO!BUY有货 100%正品保证',
keywords: '女童服饰,女童上衣外套,女童下装,时尚女童鞋包配饰,YOHO!BUY有货',
description: 'YOHO!BUY有货女童服饰提供时尚女童上衣外套,下装,时尚女童鞋包配饰,教你穿出可爱,搭出时尚.购买当季最新款女童服饰就到YOHO!BUY有货,100%正品保证'
},
'msort=365&misort=368,392,414,421,429,419,408': {
'misort=368,392,414,421,429,419,408&msort=365': {
title: '潮童鞋包配饰|儿童鞋,儿童包,时尚潮童配饰|YOHO!BUY有货 100%正品保证',
keywords: '潮童鞋包配饰,儿童鞋,儿童包,时尚潮童配饰',
description: 'YOHO!BUY有货潮童鞋包配饰提供儿童鞋,儿童包,时尚潮童配饰,教你穿出可爱,搭出时尚.购买当季最新款潮童鞋包配饰就到YOHO!BUY有货,100%正品保证'
},
'msort=10&misort=103': {
'misort=103&msort=10': {
title: '数码3c|数码,3c,数码产品配件|YOHO!BUY有货 100%正品保证',
keywords: '数码,3c,3c数码,数码产品配件,YOHO!BUY有货',
description: 'YOHO!BUY有货数码3c汇集数码产品配件,提供手机/ipad壳套,数码配件,耳机,手机配件,相机,智能装备,U盘,电脑架.购买3c数码就到YOHO!BUY有货,100%正品保证'
},
'msort=10&misort=266': {
'misort=266&msort=10': {
title: '居家用品|居家生活,居家装修装饰购物|YOHO!BUY有货 100%正品保证',
keywords: '居家,居家用品,居家装修,居家装饰,居家生活',
description: 'YOHO!BUY有货居家频道提供家装修装饰购物,居家生活日用品、居家饰品,汇集家居饰品,杯子,储物收纳,雨伞,抱枕,香薰,床上用品等。购买居家日用品就到YOHO!BUY有货,100%正品保证!'
},
'msort=10&misort=101,280': {
'misort=101,280&msort=10': {
title: '玩具娱乐|玩具,玩偶,DIY,文具,毛绒玩具|YOHO!BUY有货 100%正品保证',
keywords: '玩具娱乐,玩具,玩偶,DIY,文具,毛绒玩具',
description: 'YOHO!BUY有货玩具娱乐频道提供玩具娱乐,玩具,玩偶,DIY,文具,毛绒玩具等,购买娱乐玩具就到YOHO!BUY有货,100%正品保证!'
},
'msort=10&misort=259': {
'misort=259&msort=10': {
title: '美妆|美白化妆品,日系美妆,美妆新品|YOHO!BUY有货 100%正品保证',
keywords: '美妆,美白化妆品,日系美妆,美妆新品',
description: 'YOHO!BUY有货美妆频道提供美白化妆品,日系美妆,美妆新品,汇集彩妆,香水,个人护理,纹身贴,面部护肤,美体瘦身等商品。购买美妆产品就到YOHO!BUY有货,100%正品保证!'
... ...
... ... @@ -67,12 +67,11 @@ module.exports = () => {
}
default: // 其它(识别为品牌)
{ // eslint-disable-line
req.query.domain = req.subdomains[0];
if (!req.path || req.path === '/') {
req.url = `/product/index/brand?domain=${req.subdomains[0]}`;
req.query.domain = req.subdomains[0];
} else if (req.path === '/about') {
req.url = `/product/index/about?domain=${req.subdomains[0]}`;
req.query.domain = req.subdomains[0];
}
break;
}
... ...
... ... @@ -4,11 +4,11 @@
<ul>
{{# list}}
<li style="{{#if bgColor}}background:{{bgColor}}{{/if}}">
<a href="{{url}}" target= "_blank">
<a href="{{url}}" target= "_blank" title="{{title}}">
{{#if @first}}
<img src="{{image2 src w=1150 h=450}}">
{{^}}
<img class="lazy" data-original="{{image2 src w=1150 h=450}}" alt="">
<img class="lazy" data-original="{{image2 src w=1150 h=450}}" alt="{{alt}}">
{{/if}}
</a>
{{# tips}}
... ... @@ -27,8 +27,8 @@
<ul class="clearfix">
{{# pagination}}
<li>
<a href="{{url}}" target="_blank"></a>
<img src="{{image2 src w=138 h=54}}" alt="">
<a href="{{url}}" target="_blank" title="{{title}}"></a>
<img src="{{image2 src w=138 h=54}}" alt="{{alt}}">
</li>
{{/ pagination}}
</ul>
... ...
{
"name": "yohobuy-node",
"version": "5.4.18",
"version": "5.4.20",
"private": true,
"description": "A New Yohobuy Project With Express",
"repository": {
... ... @@ -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",
... ...
... ... @@ -17,7 +17,9 @@ var $sortItem = $('.sort-item'),
$stuYear = $('#stu-entrance-year-show'),
$stuYearWrap = $stuYear.parent(),
$identityForm = $('#identity-form'),
$identityWrap = $('#identity-wrap');
$identityWrap = $('#identity-wrap'),
$rightsItem = $('#stuRights .stu-rights-item'),
rightsText = '';
var $rightDia = $('#rights-dia'),
$couponDia = $('#coupon-dia');
... ... @@ -444,21 +446,17 @@ $couponDia.on('click', function() {
createStuDialog('stu-agree-dialog', cont);
});
$rightsItem.each(function(index,ele) {
var title = $(ele).find('.item-title').html(),
detail = $(ele).find('.item-detail').html(),
i = Number(index) + 1;
rightsText += '<p>权益' + i + ':' + title + '</p><p>' + detail + '</p>';
i !== $rightsItem.length ? rightsText+='<br>' : '';
});
$rightDia.on('click', function() {
var cont = '<h3 class="dia-title">特权详细说明</h3>' +
'<p>权益1:新品立享9折</p>' +
'<p>学生购买指定原价新品时,可立即享受9折优惠,与VIP折扣不可同时享受。</p><br>' +
'<p>权益2:每1元返1个有货币</p>' +
'<p>学生购买指定商品时,以商品的实际成交金额计算,每1元返1个有货币;</p>' +
'<p>返有货币时间:确认收货7日后,系统将自动将对应数量的有货币返至购买账户;</p>' +
'<p>有货币有效期:获得当日至次年12月31日,逾期自动作废;</p>' +
'<p>查看有货币:登录后,点击“个人中心”在“我的有货币”中可以查看有货币余额及明细。</p><br>' +
'<p>权益3:免单抽奖</p>' +
'<p>每月将在累计购物金额最高的学校中,抽取3名幸运学生用户,获得免单资格;</p>' +
'<p>免单用户名单将在每月第1个工作日公布在有货微信公众号上,可关注【有货YOHOBUY】;</p>' +
'<p>免单用户将在中奖次日获得与实付金额等额的现金券,使用时间:中奖当月。</p><br>' +
'<p>权益4:学生专享活动</p>' +
'<p>每月不定期的开展学生专享活动,可打开有货APP推送,及时查收学生专享活动通知。</p>';
var cont = '<h3 class="dia-title">特权详细说明</h3>' + rightsText;
createStuDialog('stu-rights-dialog', cont);
... ... @@ -660,28 +658,6 @@ $(function() {
}, 100);
var rightsFirst = '<div class="item-content hide">' +
'<p class="item-title">新品立享9折</p>' +
'<p>学生购买指定原价新品时,可立即享受9折优惠,与VIP折扣不可同时享受。</p></div>';
var rightsSecond = '<div class="item-content hide">' +
'<p class="item-title">每1元返1个有货币</p>' +
'<p>学生购买指定商品时,以商品的实际成交金额计算,每1元返1个有货币;</p>' +
'<p>返有货币时间:确认收货7日后,系统将自动将对应数量的有货币返至购买账户;</p>' +
'<p>有货币有效期:获得当日至次年12月31日,逾期自动作废;</p>' +
'<p>查看有货币:登录后,点击“个人中心”在“我的有货币”中可以查看有货币余额及明细。</p></div>';
var rightsThird = '<div class="item-content hide">' +
'<p class="item-title">免单抽奖</p>' +
'<p>每月将在累计购物金额最高的学校中,抽取3名幸运学生用户,获得免单资格;</p>' +
'<p>免单用户名单将在每月第1个工作日公布在有货微信公众号上,可关注【有货YOHOBUY】;</p>' +
'<p>免单用户将在中奖次日获得与实付金额等额的现金券,使用时间:中奖当月。</p></div>';
var rightsFourth = '<div class="item-content hide">' +
'<p class="item-title">学生专享活动</p>' +
'<p>每月不定期的开展学生专享活动,可打开有货APP推送,及时查收学生专享活动通知。</p></div>';
$('.coupon > a').each(function() {
couponIds.push($(this).attr('data-id'));
});
... ... @@ -815,14 +791,9 @@ $(function() {
});
// 学生权益,悬浮显示内容
$('#stuRights .stu-rights-item:eq(0)').append(rightsFirst);
$('#stuRights .stu-rights-item:eq(1)').append(rightsSecond);
$('#stuRights .stu-rights-item:eq(2)').append(rightsThird);
$('#stuRights .stu-rights-item:eq(3)').append(rightsFourth);
// 悬浮效果
$('#stuRights .stu-rights-item:eq(0), #stuRights .stu-rights-item:eq(1),' +
'#stuRights .stu-rights-item:eq(2), #stuRights .stu-rights-item:eq(3)').hover(function() {
$rightsItem.hover(function() {
var content = $(this).find('.item-content');
var gapHeight;
... ...
... ... @@ -469,6 +469,7 @@
.stu-good-detail {
position: relative;
overflow: visible;
height: auto;
}
.good-detail-text > .price .stu-tag {
... ...
/**
* 参数排序
* @author: yyq<yanqing.yang@yoho.cn>
* @date: 2017/3/9
*/
'use strict';
/**
* 对象字段排序
*/
module.exports = obj => {
if (!obj) {
return {};
}
let data = {};
Object.keys(obj).sort().forEach(k => {
data[k] = obj[k];
});
return data;
};
... ...
... ... @@ -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;
... ...