Authored by 王水玲

Merge branch 'master' into feature/passport

... ... @@ -57,19 +57,19 @@ exports.getNewArrival = (req, res, next) => {
}).catch(next);
};
exports.getIndexGuide = (req, res,next) => {
exports.getIndexGuide = (req, res, next) => {
channelModel.getIndexGuideData().then(data => {
if(data.code !== 200){
if (data.code !== 200) {
const err = new Error('异常');
throw err;
}
return channelModel.formatIndexGuideData(data.data);
}).then(data => {
return channelModel.getResourceData(data);
}).then(data => {
console.log(data);
data.layout = false;
res.render('guide', {list: data});
let result = {list: data, layout: false};
}).catch(next);
}
res.render('guide', result);
}).catch(next);
};
... ...
... ... @@ -33,12 +33,16 @@ const _getShelveTime = duration => {
const _getText = data => {
let text = data.split(' ')[0];
const regResult = /\w+/.exec(text);
const titleWithoutChinese = /^(?=.*[A-Za-z0-9])[A-Za-z0-9 _]*$/;
if (data === 'GIRL KIDS' || data === 'BOY KIDS') {
// 对于不含中文的标题,直接返回
if (titleWithoutChinese.test(data)) {
return data;
}
if (regResult) {
// 去掉标题中的英文部分
text = text.replace(regResult[0], '');
}
... ... @@ -51,7 +55,9 @@ const sortMap = dataMap.sort;
// 构建url
const _httpBuildQuery = data => {
return searchApi.get('/search.json', data);
return searchApi.get('/search.json', data, {
cache: true
});
};
/**
... ... @@ -195,6 +201,9 @@ const _getPreBrandTopData = (args, type) => {
};
data.preferenceBrands.imgBrand = item;
if (type === 'kids') {
data.preferenceBrands.sliderColor = '#7AD3F8';
}
_setChannelType(data.preferenceBrands, type);
... ... @@ -295,6 +304,12 @@ const _getBoysSingleHot = (args, type) => {
list.push(val);
}
_.forEach(list, (item, index) => {
if (index === 1 || index === list.length - 1) {
item.big = true;
}
});
data.singlehot.imgHot = list;
_setChannelType(data.singlehot, type);
floorDatas.push(data);
... ... @@ -313,14 +328,17 @@ const _getBoysSingleHot = (args, type) => {
* @param {String} type 频道类型
* @return {Object}
*/
const _getGirlsSingleHot = args => {
let goods = args[2].data;
const _getGirlsSingleHot = (args, type) => {
let goods = args[2] && args[2].data;
let skns = '';
_.forEach(goods, good => {
skns += good.id + ' ';
});
if (goods) {
_.forEach(goods, good => {
skns += good.id + ' ';
});
} else {
return;
}
return searchApi.get('/search.json', {
client_type: 'web',
... ... @@ -331,7 +349,10 @@ const _getGirlsSingleHot = args => {
attribute_not: '2',
stocknumber: 1,
page: 1,
gender: channelMap[type].gender,
viewNum: 60
}, {
cache: true
});
};
... ... @@ -353,12 +374,13 @@ const _getSingleHotFloorData = (args, type) => {
/**
* 处理异步获取的人气单品数据
* @param {[Object]} args 参数列表
* @param {String} originQuery 原始skns
* @param {Object} queryResult 异步获取的数据
* @param {String} type 频道类型
* @return {Object}
*/
const _getSingehotViaResult = (args, queryResult, type) => {
const data = {
const _getSingehotViaResult = (args, originQuery, queryResult, type) => {
let data = {
singlehot: {
name: args[0].data.text,
navs: [],
... ... @@ -367,28 +389,65 @@ const _getSingehotViaResult = (args, queryResult, type) => {
}
};
let pos = 0;
const getIndex = skn => {
let index;
if (originQuery) {
const originQueryArr = originQuery.split(' ');
let setFlag = false;
_.forEach(originQueryArr, (query, idx) => {
if (!setFlag && query.toString() === skn.toString()) {
index = idx;
setFlag = true;
}
});
}
return index;
};
if (args[3].template_name === 'app_icon_list') {
data.singlehot.brands = args[3].data;
}
if (queryResult.data) {
_.forEach(queryResult.data.product_list || [], (it, index) => {
_.forEach(queryResult.data.product_list || [], it => {
const formatData = processProduct(it, {
width: 280,
height: 373
height: 373,
gender: channelMap[type].gender
});
if (index > 12) {
if (pos > 11) {
return;
}
if (index < 3) {
formatData.tip = 'TOP' + (index + 1);
if (it.product_id) {
formatData.idx = getIndex(it.product_skn);
if (formatData.idx === 0 || formatData.idx) {
data.singlehot.imgHot.push(formatData);
pos += 1;
}
}
data.singlehot.imgHot.push(formatData);
});
}
data.singlehot.imgHot = _.sortBy(data.singlehot.imgHot, item => {
return item.idx;
});
pos = 1;
_.forEach(data.singlehot.imgHot, item => {
if (pos < 4 && item) {
item.tip = 'TOP' + pos;
pos += 1;
}
});
data.singlehot.navs = args[1].data;
_setChannelType(data.singlehot, type);
return data;
... ... @@ -398,19 +457,21 @@ const _getSingehotViaResult = (args, queryResult, type) => {
* 异步获取人气单品
* @param {[Object]} rawData 接口返回的原始数据
* @param {[Object]} floorData 已经经过处理的楼层数据
* @param {String} originQuery 原始的query数据
* @param {Object} queryResult 接口中用于请求人气单品的数据
* @param {String} title 人气单品楼层的标题
* @param {Type} type 人气单品楼层的类型
* @return {Object}
*/
const _processFloorDataWithQueryReusult = (rawData, queryResult, title, type) => {
const _processFloorDataWithQueryReusult = (rawData, originQuery, queryResult, title, type) => {
let data = {};
_.forEach(rawData, (subData, index) => {
const text = subData.data.text && _getText(subData.data.text);
if (text === title) {
data = _getSingehotViaResult(rawData.slice(index, index + 4), queryResult, type);
data = _getSingehotViaResult(rawData.slice(index, index + 4), originQuery, queryResult, type);
}
});
... ... @@ -489,7 +550,9 @@ const _requestContent = type => {
limit: 1000
};
return serviceApi.get('operations/api/v5/resource/home', data).then(res => {
return serviceApi.get('operations/api/v5/resource/home', data, {
cache: true
}).then(res => {
if (res.code === 200) {
return res;
} else {
... ... @@ -506,6 +569,7 @@ const floorMap = {
人气单品: _getSingleHotFloorData,
'GIRL KIDS': _getSingleHotFloorData,
'BOY KIDS': _getSingleHotFloorData,
ACCESSORIES: _getSingleHotFloorData,
优选品牌: _getPreBrandTopData,
最新上架: _getNewGoodsFloorData,
ad: _getadbannerData,
... ... @@ -515,12 +579,33 @@ const floorMap = {
};
const needQuery = {
'GIRL KIDS': true,
'BOY KIDS': true,
人气单品: true,
ACCESSORIES: true
};
const getQuery = args => {
let goods = args[2] && args[2].data;
let skns = '';
if (goods) {
_.forEach(goods, good => {
skns += good.id + ' ';
});
}
return skns;
};
const _processFloorData = (rawData, type) => {
let floorList = [];
let searchPromise = [];
let singlehotFloorIndex = [];
let singlehotFloorTitle = [];
let params = [];
// 定义各种楼层需要用到的接口返回的数组中元素的个数
const bigFloorLength = 5;
... ... @@ -530,13 +615,14 @@ const _processFloorData = (rawData, type) => {
_.forEach(rawData, (data, index) => {
let floorData = null;
let queryParam = '';
if (data.template_name === 'recommend_content_three' ||
(data.template_intro === '焦点图' && index === 0)) { // 处理banner
floorData = floorMap.slide.call(null, data.data);
} else if (data.template_intro === '热门品类') { // 处理热门品类
floorData = floorMap.hot.call(null, rawData.slice(index, index + hotCategoryLength), type);
} else if (data.data.text) { // 处理一般楼层
} else if (data.data && data.data.text) { // 处理一般楼层
let text = _getText(data.data.text);
let lastIndex = index + bigFloorLength < rawData.length ?
index + bigFloorLength : index + (rawData.length - index - 1);
... ... @@ -545,6 +631,13 @@ const _processFloorData = (rawData, type) => {
floorData = floorMap[text] &&
floorMap[text].call(null, rawData.slice(index, lastIndex), type);
if (needQuery[text]) {
queryParam = getQuery(rawData.slice(index, lastIndex));
if (queryParam.length > 0) {
params.push(queryParam);
}
}
} else if (data.template_name === 'debrisSlider') { // 处理girls的banner
floorData = floorMap.debrisSlide.call(null, data.data);
}
... ... @@ -583,13 +676,16 @@ const _processFloorData = (rawData, type) => {
return {
floors: floorList,
promise: _.reverse(searchPromise),
queryParams: _.reverse(params),
singlehotFloorTitle: _.reverse(singlehotFloorTitle),
singlehotFloorIndex: _.reverse(singlehotFloorIndex)
};
};
const _formatResourceParams = (channel, code) => {
return serviceApi.get('operations/api/v5/resource/get', {content_code: code}).then(data => {
return serviceApi.get('operations/api/v5/resource/get', {content_code: code}, {
cache: true
}).then(data => {
let result = data && data.data[0] && data.data[0].data[0];
if (result) {
... ... @@ -722,7 +818,7 @@ const getNewArrival = channel => {
sales: 'Y',
attribute_not: 2,
stocknumber: 3,
shelve_time: _getShelveTime(20)
shelve_time: _getShelveTime(2)
};
params.gender = channelMap[channel].gender;
... ... @@ -739,7 +835,9 @@ const getNewArrival = channel => {
result = [];
_.forEach(sortList, (it, index) => {
if (res[index].data.product_list && res[index].data.product_list.length === sortList[index].viewNum) {
if (res[index].data &&
res[index].data.product_list.length === sortList[index].viewNum) {
data = data.concat(res[index].data.product_list);
}
});
... ... @@ -747,7 +845,8 @@ const getNewArrival = channel => {
_.forEach(data, (item) => {
result.push(processProduct(item, {
width: 280,
height: 373
height: 373,
gender: params.gender
}));
});
... ... @@ -787,6 +886,7 @@ const getContent = type => {
searchPromise: processResult.promise,
singlehotFloorIndex: processResult.singlehotFloorIndex,
singlehotFloorTitle: processResult.singlehotFloorTitle,
queryParams: processResult.queryParams,
channelType: type
};
... ... @@ -800,6 +900,7 @@ const getContent = type => {
.splice(result.singlehotFloorIndex[index], 0,
_processFloorDataWithQueryReusult(
result.rawData,
result.queryParams[index],
data,
result.singlehotFloorTitle[index],
result.channelType
... ... @@ -826,7 +927,7 @@ const getbrandFloorDataAjax = type => {
};
_.forEach(contentData, (d, index) => {
if (d.data.text && d.data.text.indexOf('优选品牌') >= 0) {
if (d.data && d.data.text && d.data.text.indexOf('优选品牌') >= 0) {
_.forEach(contentData[index + 2].data, (floorData) => {
let o = {};
... ... @@ -876,7 +977,9 @@ const getIndexGuideData = () => {
private_key: '0ed29744ed318fd28d2c07985d3ba633'
};
return serviceApi.get('operations/api/v6/category/getCategory', params);
return serviceApi.get('operations/api/v6/category/getCategory', params, {
cache: true
});
};
module.exports = {
... ...
... ... @@ -76,3 +76,7 @@
{{/ newArrivls}}
{{/ channel}}
</div>
{{#unless devEnv}}
{{> home-analysis}}
{{/ unless}}
... ...
... ... @@ -5,14 +5,14 @@
{{#list}}
<li class="{{channel}}" >
<dl>
<dt class="tag_img_warpper">
<dt class="tag-img-warpper">
<a href="{{url}}" target="_self">
<img spm-name="homepage_guide_manimg" alt="YOHO!BOYS" src="{{image src 180 168}}"></a>
</dt>
<dd class="block_cn">{{sort_name}}</dd>
<dd class="block_en"> <b>{{sort_name_en}}</b>
<dd class="block-cn">{{sort_name}}</dd>
<dd class="block-en"> <b>{{sort_name_en}}</b>
</dd>
<dd class="block_line">
<dd class="block-line">
</dd>
<dd class="goods-num"> <b>{{num}}+ Items.</b>
</dd>
... ...
... ... @@ -2,7 +2,7 @@
<div class="left-col col">
{{# left}}
<a href="{{url}}" target="_blank">
<img class="lazy" data-original="{{image img 200 265}}">
<img class="lazy" data-original="{{image img 280 265}}">
</a>
{{/ left}}
</div>
... ... @@ -28,7 +28,11 @@
<div class="right-col col">
{{# right}}
<a href="{{url}}" target="_blank">
<img class="lazy" data-original="{{image img 200 265}}">
{{#if @first}}
<img class="lazy" data-original="{{image img 280 449}}">
{{^}}
<img class="lazy" data-original="{{image img 280 265}}">
{{/if}}
</a>
{{/ right}}
</div>
... ...
... ... @@ -4,7 +4,7 @@
{{# imgBrand}}
<li class="img-item">
<a href="{{url}}" target= "_blank">
<img src="{{image src 378 175}}" alt="">
<img class="lazy" data-original="{{image src 378 175}}" alt="">
</a>
</li>
{{/ imgBrand}}
... ...
... ... @@ -5,26 +5,26 @@
<div class="tpl-nav">
<div class="tpl-keywords">
{{#each keyword}}
<a class="keywords{{@index}}" title="{{title}}" href="{{url}}" target= "_blank"><img class="lazy" src="{{image img 185 152}}"/></a>
<a class="keywords{{@index}}" title="{{title}}" href="{{url}}" target= "_blank"><img class="lazy" data-original="{{image img 185 152}}"/></a>
{{/each}}
</div>
<div class="tpl-category clearfix">
{{#each category}}
<a href="{{url}}" target= "_blank">{{title}}</a>
<a href="{{url}}" target= "_blank">{{name}}{{title}}</a>
{{/each}}
</div>
</div>
<div class="tpl-brands imgopacity clearfix">
<ul>
{{#each brands}}
<li><a title="{{title}}" href="{{url}}" target= "_blank"><img class="lazy" src="{{image img 378 248}}"/></a></li>
<li><a title="{{title}}" href="{{url}}" target= "_blank"><img class="lazy" data-original="{{image img 378 248}}"/></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" src="{{image img 185 248}}"/></a></li>
<li><a title="{{title}}" href="{{url}}" target= "_blank"><img class="lazy" data-original="{{image img 185 248}}"/></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" src="{{image src 222 298}}"/></a></li>
<li><a href="{{url}}" title="{{title}}" target= "_blank"><img class="lazy" data-original="{{image src 222 298}}"/></a></li>
{{/each}}
</ul>
</div>
... ...
... ... @@ -2,10 +2,10 @@
{{> common/floor-header}}
<ul class="g-list imgopacity">
{{#each imgHot}}
{{#if @last}}
<li><a class="impo{{@index}}" href="{{url}}" target= "_blank"><img class="lazy" src="{{image src 378 248}}"/></a></li>
{{#if big}}
<li><a class="impo{{@index}}" href="{{url}}" target= "_blank"><img class="lazy" data-original="{{image src 378 248}}"/></a></li>
{{^}}
<li><a class="impo{{@index}}" href="{{url}}" target= "_blank"><img class="lazy" src="{{image src 185 248}}"/></a></li>
<li><a class="impo{{@index}}" href="{{url}}" target= "_blank"><img class="lazy" data-original="{{image src 185 248}}"/></a></li>
{{/if}}
{{/each}}
</ul>
... ...
<div class="commodity clearfix" id="newarrivals">
{{> common/floor-header}}
<div class="goods-container clearfix">
</div>
<div class="loading">
<a href="{{url}}" target= "_blank">Loading...</a>
</div>
</div>
<div class="commodity clearfix" id="newarrivals">
{{> common/floor-header}}
<div class="goods-container clearfix">
</div>
<div class="loading">
{{# navs}}
{{#if @last}}
<a href="{{url}}" target= "_blank">Loading...</a>
{{/if}}
{{/ navs}}
</div>
</div>
... ...
... ... @@ -8,7 +8,7 @@
<ul class="img-list">
{{# imgBrand}}
<li class="img-item">
<a href="{{url}}" target= "_blank"> <img src="{{image src 320 430}}" alt="{{alt}}"></a>
<a href="{{url}}" target= "_blank"> <img class="lazy" data-original="{{image src 320 430}}" alt="{{alt}}"></a>
</li>
{{/ imgBrand}}
</ul>
... ...
... ... @@ -10,7 +10,7 @@
</div>
<div class="tpl-category clearfix">
{{#each category}}
<a href="{{url}}" target= "_blank">{{title}}</a>
<a href="{{url}}" target= "_blank">{{name}}{{title}}</a>
{{/each}}
</div>
</div>
... ...
<script>
window.onload = function() {
var hm = document.createElement("script");
hm.src = "//static.criteo.net/js/ld/ld.js";
hm.async = 1;
var s = document.getElementsByTagName("script")[0];
s.parentNode.insertBefore(hm, s);
var u = _ozuid || "";
u = (u == 0) ? "" : u;
window.criteo_q = window.criteo_q || [];
window.criteo_q.push({event: "setAccount", account: 16184 },{event: "setCustomerId", id: u},{event: "setSiteType", type: "d" },{event: "viewHome" });
};
</script>
... ...
... ... @@ -8,6 +8,8 @@
const mRoot = '../models';
const outlets = require(`${mRoot}/outlets`);
const _ = require('lodash');
/**
* outlets 首页
* @param {[type]} req [description]
... ... @@ -61,8 +63,9 @@ exports.special = (req, res, next) => {
page: 'outlets'
};
if (!params.id) {
resData.pageErr = true;
// 判断活动id是否合法
if (!params.id || !+params.id || !_.isNumber(+params.id)) {
return next();
}
outlets.getOutletsSpecialData(params, channel).then(result => {
... ...
... ... @@ -15,7 +15,7 @@ const sale = require(`${mRoot}/sale`); // sale 页 model
* @param {[type]} res [description]
* @return {[type]} [description]
*/
exports.index = (req, res) => {
exports.index = (req, res, next) => {
let channel = req.query.channel || req.cookies._Channel || 'boys';
let responseData = {
... ... @@ -29,10 +29,7 @@ exports.index = (req, res) => {
responseData.resultShow = JSON.stringify(result, null, 4);
responseData.headerData = result.headerData;
res.render('sale/index', responseData);
}).catch(() => {
responseData.pageErr = true;
res.render('error', responseData);
});
}).catch(next);
};
... ... @@ -42,7 +39,7 @@ exports.index = (req, res) => {
* @param {[type]} res [description]
* @return {[type]} [description]
*/
exports.discount = (req, res) => {
exports.discount = (req, res, next) => {
let params = Object.assign({
saleType: '3'
}, req.query);
... ... @@ -59,12 +56,8 @@ exports.discount = (req, res) => {
responseData.resultShow = JSON.stringify(result, null, 4);
responseData.headerData = result.headerData;
// log.info(result);
res.render('sale/discount', responseData);
}).catch(() => {
responseData.pageErr = true;
res.render('error', responseData);
});
}).catch(next);
};
/**
... ... @@ -73,7 +66,7 @@ exports.discount = (req, res) => {
* @param {[type]} res [description]
* @return {[type]} [description]
*/
exports.vip = (req, res) => {
exports.vip = (req, res, next) => {
let params = Object.assign({
saleType: '2'
}, req.query);
... ... @@ -92,10 +85,7 @@ exports.vip = (req, res) => {
responseData.resultShow = JSON.stringify(result, null, 4);
responseData.headerData = result.headerData;
res.render('sale/other', responseData);
}).catch(() => {
responseData.pageErr = true;
res.render('error', responseData);
});
}).catch(next);
};
... ... @@ -105,7 +95,7 @@ exports.vip = (req, res) => {
* @param {[type]} res [description]
* @return {[type]} [description]
*/
exports.newSale = (req, res) => {
exports.newSale = (req, res, next) => {
let params = Object.assign({
order: 's_t_desc'
}, req.query);
... ... @@ -122,10 +112,7 @@ exports.newSale = (req, res) => {
responseData.resultShow = JSON.stringify(result, null, 4);
responseData.headerData = result.headerData;
res.render('sale/other', responseData);
}).catch(() => {
responseData.pageErr = true;
res.render('error', responseData);
});
}).catch(next);
};
/**
... ... @@ -134,7 +121,7 @@ exports.newSale = (req, res) => {
* @param {[type]} res [description]
* @return {[type]} [description]
*/
exports.breakingYards = (req, res) => {
exports.breakingYards = (req, res, next) => {
let params = Object.assign({
saleType: '5'
}, req.query);
... ... @@ -151,10 +138,7 @@ exports.breakingYards = (req, res) => {
responseData.resultShow = JSON.stringify(result, null, 4);
responseData.headerData = result.headerData;
res.render('sale/other', responseData);
}).catch(() => {
responseData.pageErr = true;
res.render('error', responseData);
});
}).catch(next);
};
/**
... ... @@ -163,7 +147,7 @@ exports.breakingYards = (req, res) => {
* @param {[type]} res [description]
* @return {[type]} [description]
*/
exports.getGoodsList = (req, res) => {
exports.getGoodsList = (req, res, next) => {
let params = req.query;
params.uid = req.user.uid || 0;
... ... @@ -176,5 +160,5 @@ exports.getGoodsList = (req, res) => {
responseData.result = result;
res.render('goods', responseData);
});
}).catch(next);
};
... ...
... ... @@ -132,7 +132,7 @@ exports.getOutletsIndexData = (params, channel) => {
exports.getOutletsChannelData = (params, channel) => {
// 频道资源位不存在
if (!channelCode[channel]) {
throw new Error('outlets channel resource not found');
return Promise.reject(`outlets channel-(${channel}) resource not found`);
}
let channelData = {};
... ... @@ -240,7 +240,7 @@ exports.getOutletsSpecialData = (params, channel) => {
// 活动信息获取异常
if (result[1].code !== 200) {
throw new Error('outlets special info not found-(ID:' + params.id + ')');
return Promise.reject(`outlets special info not found-(ID:${params.id})`);
}
Object.assign(specialData,
... ...
... ... @@ -555,7 +555,7 @@ exports.handleSaleFilterData = (origin, params) => {
// 尺码处理
if (!_.isEmpty(origin.size)) {
if (params.saleType === '1') {
if (params.saleType === '5') {
// 断码区尺码处理
dest.size = handleSalebreakingYardsSortData(origin.size, params);
... ...
... ... @@ -113,20 +113,20 @@ exports.getSaleGoodsData = (params) => {
switch (params.saleType) {
case '5':
finalResult.goods.push({
thumb: 'http://img02.yohoboys.com/staticimg/2016/06/06/15/027f2ebe0f35a0f6dc29ffb11d40d58c68.jpg?imageMogr2/thumbnail/{width}x{height}/extent/{width}x{height}/background/d2hpdGU=/position/center/quality/90',
thumb: '//cdn.yoho.cn/yohobuy-node/assets/img/sale/all-broken.jpg',
url: '/product/sale/breakingYards?channel=' + params.channel
});
break;
case '2':
finalResult.goods.push({
thumb: 'http://img02.yohoboys.com/staticimg/2016/06/06/15/02c513694df76e78449781997d1ae2a67e.jpg?imageMogr2/thumbnail/{width}x{height}/extent/{width}x{height}/background/d2hpdGU=/position/center/quality/90',
thumb: '//cdn.yoho.cn/yohobuy-node/assets/img/sale/all-vip.jpg',
url: '/product/sale/vip?channel=' + params.channel,
vipPicture: true // 为了处理首页最后一张图片
});
break;
case '0':
finalResult.goods.push({
thumb: 'http://img02.yohoboys.com/staticimg/2016/06/06/15/02161115728d763520bd4695d2530b2132.jpg?imageMogr2/thumbnail/{width}x{height}/extent/{width}x{height}/background/d2hpdGU=/position/center/quality/90',
thumb: '//cdn.yoho.cn/yohobuy-node/assets/img/sale/all-sale.jpg',
url: '/product/sale/newSale?channel=' + params.channel
});
break;
... ... @@ -195,7 +195,9 @@ exports.getSaleIndexData = (channel) => {
return api.all([saleApi.getSaleGoodsList({
channel: channel,
saleType: '5', // app 与 pc 有冲突,为 PC 加一个 5 的选项
limit: '1'
limit: '1',
breakSize: breakingSizeSort.breakSize,
breakSort: breakingSizeSort.breakSort
})]).then(subResult => {
if (subResult[0].code === 200) {
finalResult.saleCategory.push(
... ... @@ -249,7 +251,7 @@ exports.getSaleOthersData = (params, channel) => {
promiseObject = [
headerModel.requestHeaderData(channel),
saleApi.getSaleGoodsList(params),
saleApi.getSaleBannerList(contentCode[channel].vip),
saleApi.getSaleBannerList(contentCode[channel].newSale),
saleApi.getSaleGoodsList({limit: '1', channel: channel})
];
}
... ...
... ... @@ -64,7 +64,8 @@ if (isProduction) {
appName: 'www.yohobuy.com',
domains: {
api: 'http://api.yoho.yohoops.org/',
service: 'http://service.yoho.yohoops.org/'
service: 'http://service.yoho.yohoops.org/',
search: 'http://search.yohoops.org/yohosearch/'
},
memcache: {
master: ['memcache1.yohoops.org:12111', 'memcache2.yohoops.org:12111', 'memcache3.yohoops.org:12111'],
... ...
... ... @@ -17,97 +17,94 @@ const channelMap = {
},
kids: {
code: 'd71f4b27f2a7229fbb31a4bc490a6f36',
gender: '2,3'
gender: ''
},
lifestyle: {
code: '8a341ca7eacc069ba80f02dec80eaf34',
// code: '380c38155fd8beee10913a3f5b462da6',
// code: '665f7c2fb9d037ee820766953ee34bf7',
gender: '2,3'
gender: ''
}
};
const sortMap = {
boys: [
{sort: 147, viewNum: 5}, // 休闲运动鞋
{sort: 129, viewNum: 5}, // 休闲裤
{sort: 152, viewNum: 5}, // 双肩包
{misort: 44, viewNum: 5}, // 休闲运动鞋
{misort: 11, viewNum: 5}, // T恤
{sort: 115, viewNum: 5}, // 衬衫
{sort: 130, viewNum: 5}, // 牛仔裤
{misort: 28, viewNum: 5}, // 短裤
{misort: 61, viewNum: 5}, // 太阳镜/眼睛
{misort: 26, viewNum: 5}, // 休闲裤
{misort: 27, viewNum: 5}, // 牛仔裤
{misort: 49, viewNum: 5}, // 双肩包
{misort: 12, viewNum: 5}, // 衬衫
{misort: 13, viewNum: 5}, // polo
{misort: 60, viewNum: 5}, // 帽子
{sort: 124, viewNum: 5}, // 夹克
{sort: 119, viewNum: 5}, // 卫衣
{sort: 162, viewNum: 5}, // 手表
{sort: 148, viewNum: 5}, // 靴子
{misort: 65, viewNum: 5}, // 首饰
{sort: 151, viewNum: 5}, // 时装鞋
{misort: 61, viewNum: 5}, // 太阳镜
{misort: 39, viewNum: 5}, // 袜子
{sort: 346, viewNum: 5}, // 运动裤
{sort: 131, viewNum: 5}, // 短裤
{misort: 46, viewNum: 5}, // 凉鞋/拖鞋
{misort: 66, viewNum: 5}, // 配饰
{misort: 65, viewNum: 5}, // 首饰
{misort: 59, viewNum: 5}, // 手表
{misort: 48, viewNum: 5}, // 时装鞋
{misort: 14, viewNum: 5}, // 背心
{misort: 19, viewNum: 5}, // 西装
{misort: 309, viewNum: 5}, // 内裤
{misort: 30, viewNum: 5}, // 打底裤/紧身裤
{sort: 342, viewNum: 5} // 邮差包
{misort: 259, viewNum: 5}, // 美妆
{misort: 237, viewNum: 5} // 钱包/手包/卡包/钥匙包
],
girls: [
{misort: 16, viewNum: 4}, // 卫衣
{misort: 12, viewNum: 4}, // 衬衫
{misort: 44, viewNum: 4}, // 休闲/运动鞋
{misort: 11, viewNum: 4}, // T恤
{misort: 21, viewNum: 4}, // 夹克
{misort: 257, viewNum: 4}, // 毛衣/针织
{misort: 22, viewNum: 4}, // 大衣/风衣
{misort: 44, viewNum: 4}, // 休闲/运动鞋
{misort: 31, viewNum: 4}, // 连衣裙
{misort: 26, viewNum: 4}, // 休闲裤
{misort: 27, viewNum: 4}, // 牛仔裤
{misort: 31, viewNum: 4}, // 连衣裙
{misort: 12, viewNum: 4}, // 衬衫
{misort: 32, viewNum: 4}, // 半身裙
{misort: 28, viewNum: 4}, // 短裤
{misort: 14, viewNum: 4}, // 背心
{misort: 46, viewNum: 4}, // 凉鞋/拖鞋
{misort: 48, viewNum: 4}, // 时装鞋
{misort: 50, viewNum: 4}, // 单肩/手拎包
{misort: 49, viewNum: 4}, // 双肩包
{misort: 50, viewNum: 4}, // 手拎包/单肩包
{misort: 61, viewNum: 4}, // 太阳镜/眼镜
{misort: 60, viewNum: 4}, // 帽子
{misort: 65, viewNum: 4}, // 首饰
{misort: 59, viewNum: 4}, // 手表
{misort: 61, viewNum: 4}, // 太阳镜
{misort: 66, viewNum: 4} // 配饰
{misort: 65, viewNum: 4}, // 首饰
{misort: 363, viewNum: 4}, // 文胸
{misort: 309, viewNum: 4}, // 内裤
{misort: 259, viewNum: 4} // 美妆
],
kids: [
{misort: 366, viewNum: 4}, // T恤
{misort: 367, viewNum: 4}, // 衬衫
{misort: 396, viewNum: 4}, // 卫衣
{misort: 400, viewNum: 4}, // // 毛衣/针织
{misort: 404, viewNum: 4}, // 夹克
{misort: 369, viewNum: 4}, // 休闲裤
{misort: 388, viewNum: 4}, // 牛仔裤
{misort: 451, viewNum: 4}, // POLO
{misort: 371, viewNum: 4}, // 连衣裙
{misort: 370, viewNum: 4}, // 半身裙
{misort: 368, viewNum: 4}, // 休闲/运动鞋
{misort: 392, viewNum: 4}, // 双肩包
{misort: 414, viewNum: 4}, // 帽子
{misort: 369, viewNum: 4}, // 休闲裤
{misort: 388, viewNum: 4}, // 牛仔裤
{misort: 372, viewNum: 4}, // 短裤
{misort: 384, viewNum: 4}, // 打底裤/紧身裤
{misort: 368, viewNum: 4}, // 休闲/运动鞋
{misort: 382, viewNum: 4}, // 凉鞋/拖鞋
{misort: 402, viewNum: 4}, // 马甲
{misort: 392, viewNum: 4}, // 双肩包
{misort: 429, viewNum: 4}, // 太阳镜/眼镜
{misort: 464, viewNum: 4}, // 雨伞/雨衣
{misort: 386, viewNum: 4}, // 背心
{misort: 406, viewNum: 4}, // 大衣/风衣
{misort: 430, viewNum: 4}, // 羽绒服
{misort: 423, viewNum: 4}, // 棉衣
{misort: 384, viewNum: 4}, // 打底裤/紧身裤
{misort: 448, viewNum: 4}, // 玩具娱乐
{misort: 414, viewNum: 4}, // 帽子
{misort: 380, viewNum: 4}, // 泳衣
{misort: 419, viewNum: 4}, // 配饰
{misort: 417, viewNum: 4} // 套装
],
lifestyle: [
{sort: 171, viewNum: 5}, // 耳机
{sort: 398, viewNum: 5}, // 只能装备
{sort: 185, viewNum: 5}, // 相机
{misort: 259, viewNum: 5}, // 美妆
{misort: 266, viewNum: 5}, // 雨伞
{sort: 171, viewNum: 5}, // 耳机
{sort: 267, viewNum: 5}, // 杯子/水壶
{sort: 313, viewNum: 5}, // 手机/ipad壳套
{sort: 211, viewNum: 5}, // 数码配件
{sort: 292, viewNum: 5}, // 玩偶
{sort: 272, viewNum: 5}, // 储物收纳
{sort: 183, viewNum: 5}, // 启用家居
{sort: 273, viewNum: 5}, // 厨具/餐具
{misort: 103, viewNum: 5}, // 数码配件
{misort: 280, viewNum: 5}, // 玩具娱乐
{sort: 185, viewNum: 5}, // 相机
{misort: 101, viewNum: 5}, // 文具
{sort: 271, viewNum: 5} // 靠枕/靠垫/抱枕
]
};
... ...
... ... @@ -28,12 +28,13 @@
{{{body}}}
{{/if}}
{{> footer}}
{{#if devEnv}}
<script src="//localhost:5002/libs.js"></script>
{{#if devEnv}}
<script src="//localhost:5002/libs.js"></script>
<script src="//localhost:5002/{{module}}.{{page}}.js"></script>
{{^}}
<script src="//cdn.yoho.cn/yohobuy-node/{{version}}/libs.js"></script>
{{^}}
<script src="//cdn.yoho.cn/yohobuy-node/{{version}}/libs.js"></script>
<script src="//cdn.yoho.cn/yohobuy-node/{{version}}/{{module}}.{{page}}.js"></script>
{{> analysis}}
{{/if}}
</body>
</html>
... ...
<!-- Google Tag Manager -->
<noscript><iframe src="//www.googletagmanager.com/ns.html?id=GTM-W958MG" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
<script>
var _hmt = _hmt || [];
var _gaq = _gaq || [];
(function() {
function async_load(){
(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
'//www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
})(window,document,'script','dataLayer','GTM-W958MG');
(function() {
_gaq.push(['_setAccount', 'UA-48997038-32']);
_gaq.push(['_trackPageview']);
var ga = document.createElement('script');
ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
}
if (window.addEventListener) {
window.addEventListener('load', async_load, false);
} else if (window.attachEvent) {
window.attachEvent('onload', async_load);
}
})();
</script>
<script>
window._py = window._py||[];
window._py.push(['a', 'MC..o8vMMWxEXDCiqYckD81lUX']);
window._py.push(['domain','stats.ipinyou.com']);
window._py.push(['e','']);
if(typeof _goodsData!='undefined'){
window._py.push(['pi',_goodsData]);
}
-function(d){
var f = 'https:' == d.location.protocol;var c = d.createElement('script');c.type='text/javascript';c.async=1;
c.src=(f ? 'https' : 'http') + '://'+(f?'fm.ipinyou.com':'fm.p0y.cn')+'/j/t/adv.js';
var h = d.getElementsByTagName("script")[0];h.parentNode.insertBefore(c, h);
}(document);
</script>
\ No newline at end of file
... ...
... ... @@ -17,15 +17,15 @@
{{#if devEnv}}
<img class="dim-img lazy" data-original="http://localhost:5002/img/layout/qr-app.png">
{{^}}
<img class="dim-img lazy" data-original="http://cdn.yoho.cn/yohobuy-node/assets/img/layout/qr-app.png">
<img class="dim-img lazy" data-original="//cdn.yoho.cn/yohobuy-node/assets/img/layout/qr-app.png">
{{/if}}
<p>YOHO!BUY 有货</p>
<p>YOHO!BUY有货</p>
</li>
<li class="left">
{{#if devEnv}}
<img class="dim-img lazy" data-original="http://localhost:5002/img/layout/qr-weixin.png">
{{^}}
<img class="dim-img lazy" data-original="http://cdn.yoho.cn/yohobuy-node/assets/img/layout/qr-weibo.png">
<img class="dim-img lazy" data-original="//cdn.yoho.cn/yohobuy-node/assets/img/layout/qr-weibo.png">
{{/if}}
<p>微信</p>
</li>
... ... @@ -33,7 +33,7 @@
{{#if devEnv}}
<img class="dim-img lazy" data-original="http://localhost:5002/img/layout/qr-weibo.png">
{{^}}
<img class="dim-img lazy" data-original="http://cdn.yoho.cn/yohobuy-node/assets/img/layout/qr-weixin.png">
<img class="dim-img lazy" data-original="//cdn.yoho.cn/yohobuy-node/assets/img/layout/qr-weixin.png">
{{/if}}
<p>微博</p>
</li>
... ... @@ -141,7 +141,7 @@
{{#if devEnv}}
<img class="lazy" data-original="http://localhost:5002/img/layout/mars.png">
{{^}}
<img class="lazy" data-original="http://cdn.yoho.cn/yohobuy-node/assets/img/layout/mars.png">
<img class="lazy" data-original="//cdn.yoho.cn/yohobuy-node/assets/img/layout/mars.png">
{{/if}}
</a>
</li>
... ... @@ -150,7 +150,7 @@
{{#if devEnv}}
<img class="lazy" data-original="http://localhost:5002/img/layout/show.png">
{{^}}
<img class="lazy" data-original="http://cdn.yoho.cn/yohobuy-node/assets/img/layout/show.png">
<img class="lazy" data-original="//cdn.yoho.cn/yohobuy-node/assets/img/layout/show.png">
{{/if}}
</a>
</li>
... ... @@ -159,7 +159,7 @@
{{#if devEnv}}
<img class="lazy" data-original="http://localhost:5002/img/layout/yoho.png">
{{^}}
<img class="lazy" data-original="http://cdn.yoho.cn/yohobuy-node/assets/img/layout/yoho.png">
<img class="lazy" data-original="//cdn.yoho.cn/yohobuy-node/assets/img/layout/yoho.png">
{{/if}}
</a>
</li>
... ... @@ -209,16 +209,16 @@
<span>新手指南</span>
</p>
<p>
<a href="http://www.yohobuy.com/help/?category_id=81#help_b00reg" target="_blank">注册登录</a>
<a href="//www.yohobuy.com/help/?category_id=81#help_b00reg" target="_blank">注册登录</a>
</p>
<p>
<a href="http://www.yohobuy.com/help/?category_id=83" target="_blank">选购商品</a>
<a href="//www.yohobuy.com/help/?category_id=83" target="_blank">选购商品</a>
</p>
<p>
<a href="http://www.yohobuy.com/help/?category_id=103" target="_blank">订单支付</a>
<a href="//www.yohobuy.com/help/?category_id=103" target="_blank">订单支付</a>
</p>
<p>
<a href="http://www.yohobuy.com/help/?category_id=85" target="_blank">收货退款</a>
<a href="//www.yohobuy.com/help/?category_id=85" target="_blank">收货退款</a>
</p>
</li>
<li class="left">
... ... @@ -226,16 +226,16 @@
<span>会员中心</span>
</p>
<p>
<a href="http://www.yohobuy.com/help/?category_id=87" target="_blank">YOHO币</a>
<a href="//www.yohobuy.com/help/?category_id=87" target="_blank">YOHO币</a>
</p>
<p>
<a href="http://www.yohobuy.com/help/?category_id=91" target="_blank">会员制度</a>
<a href="//www.yohobuy.com/help/?category_id=91" target="_blank">会员制度</a>
</p>
<p>
<a href="http://www.yohobuy.com/help/?category_id=89" target="_blank">账户管理</a>
<a href="//www.yohobuy.com/help/?category_id=89" target="_blank">账户管理</a>
</p>
<p>
<a href="http://www.yohobuy.com/help/?category_id=93" target="_blank">密码管理</a>
<a href="//www.yohobuy.com/help/?category_id=93" target="_blank">密码管理</a>
</p>
</li>
<li class="left">
... ... @@ -243,16 +243,16 @@
<span>购物指南</span>
</p>
<p>
<a href="http://www.yohobuy.com/help/?category_id=95" target="_blank">全球购专区</a>
<a href="//www.yohobuy.com/help/?category_id=95" target="_blank">全球购专区</a>
</p>
<p>
<a href="http://www.yohobuy.com/help/?category_id=97" target="_blank">尺码选择</a>
<a href="//www.yohobuy.com/help/?category_id=97" target="_blank">尺码选择</a>
</p>
<p>
<a href="http://www.yohobuy.com/help/?category_id=99" target="_blank">发票</a>
<a href="//www.yohobuy.com/help/?category_id=99" target="_blank">发票</a>
</p>
<p>
<a href="http://www.yohobuy.com/help/?category_id=101" target="_blank">商品咨询</a>
<a href="//www.yohobuy.com/help/?category_id=101" target="_blank">商品咨询</a>
</p>
</li>
<li class="left">
... ... @@ -260,16 +260,16 @@
<span>支付方式</span>
</p>
<p>
<a href="http://www.yohobuy.com/help/?category_id=105" target="_blank">在线支付</a>
<a href="//www.yohobuy.com/help/?category_id=105" target="_blank">在线支付</a>
</p>
<p>
<a href="http://www.yohobuy.com/help/?category_id=107" target="_blank">货到付款</a>
<a href="//www.yohobuy.com/help/?category_id=107" target="_blank">货到付款</a>
</p>
<p>
<a href="http://www.yohobuy.com/help/?category_id=109" target="_blank">优惠券</a>
<a href="//www.yohobuy.com/help/?category_id=109" target="_blank">优惠券</a>
</p>
<p>
<a href="http://www.yohobuy.com/help/?category_id=111" target="_blank">YOHO币支付</a>
<a href="//www.yohobuy.com/help/?category_id=111" target="_blank">YOHO币支付</a>
</p>
</li>
<li class="left">
... ... @@ -277,16 +277,16 @@
<span>配送方式</span>
</p>
<p>
<a href="http://www.yohobuy.com/help/?category_id=113" target="_blank">配送时间</a>
<a href="//www.yohobuy.com/help/?category_id=113" target="_blank">配送时间</a>
</p>
<p>
<a href="http://www.yohobuy.com/help/?category_id=115" target="_blank">配送范围</a>
<a href="//www.yohobuy.com/help/?category_id=115" target="_blank">配送范围</a>
</p>
<p>
<a href="http://www.yohobuy.com/help/?category_id=119" target="_blank">顺丰速运</a>
<a href="//www.yohobuy.com/help/?category_id=119" target="_blank">顺丰速运</a>
</p>
<p>
<a href="http://www.yohobuy.com/help/?category_id=117" target="_blank">商品验收与签收</a>
<a href="//www.yohobuy.com/help/?category_id=117" target="_blank">商品验收与签收</a>
</p>
</li>
<li class="left">
... ... @@ -294,16 +294,16 @@
<span>售后服务</span>
</p>
<p>
<a href="http://www.yohobuy.com/help/?category_id=121" target="_blank">退换货政策</a>
<a href="//www.yohobuy.com/help/?category_id=121" target="_blank">退换货政策</a>
</p>
<p>
<a href="http://www.yohobuy.com/help/?category_id=123" target="_blank">退换货流程</a>
<a href="//www.yohobuy.com/help/?category_id=123" target="_blank">退换货流程</a>
</p>
<p>
<a href="http://www.yohobuy.com/help/?category_id=125" target="_blank">退款方式与时效</a>
<a href="//www.yohobuy.com/help/?category_id=125" target="_blank">退款方式与时效</a>
</p>
<p>
<a href="http://www.yohobuy.com/help/?category_id=127" target="_blank">投诉与建议</a>
<a href="//www.yohobuy.com/help/?category_id=127" target="_blank">投诉与建议</a>
</p>
</li>
<li class="left">
... ... @@ -311,16 +311,16 @@
<span>APP常见问题</span>
</p>
<p>
<a href="http://www.yohobuy.com/help/?category_id=133" target="_blank">IPhone版</a>
<a href="//www.yohobuy.com/help/?category_id=133" target="_blank">IPhone版</a>
</p>
<p>
<a href="http://www.yohobuy.com/help/?category_id=135" target="_blank">Android版</a>
<a href="//www.yohobuy.com/help/?category_id=135" target="_blank">Android版</a>
</p>
<p>
<a href="http://www.yohobuy.com/help/?category_id=137" target="_blank">wap版</a>
<a href="//www.yohobuy.com/help/?category_id=137" target="_blank">wap版</a>
</p>
<p>
<a href="http://www.yohobuy.com/help/?category_id=139" target="_blank">IPAD版</a>
<a href="//www.yohobuy.com/help/?category_id=139" target="_blank">IPAD版</a>
</p>
</li>
</ul>
... ... @@ -331,27 +331,27 @@
<div class="center-content clearfix">
<div class="left right-flag">
<a href="https://ss.knet.cn/verifyseal.dll?sn=e14021832010046477dka7000000&amp;ct=df&amp;a=1&amp;pa=0.5902942178957805" target="_blank" rel="nofollow">
<img src="http://static.yohobuy.com/images/v3/icon/credit-flag3.png">
<img src="//static.yohobuy.com/images/v3/icon/credit-flag3.png">
</a>
<a href="http://www.isc.org.cn/" target="_blank" rel="nofollow">
<img src="http://static.yohobuy.com/images/v3/icon/isc2.png">
<img src="//static.yohobuy.com/images/v3/icon/isc2.png">
</a>
</div>
<div class="left about-us">
<p>
<a href="http://www.yohobuy.com">返回首页</a>
<a href="//www.yohobuy.com">返回首页</a>
<span>|</span>
<a href="http://www.yohobuy.com">YOHO!BUY 有货</a>
<a href="//www.yohobuy.com">YOHO!BUY 有货</a>
<span>|</span>
<a href="http://www.yohobuy.com/newpower.html">新力传媒</a>
<a href="//www.yohobuy.com/newpower.html">新力传媒</a>
<span>|</span>
<a href="http://www.yohobuy.com/contact.html">联系我们</a>
<a href="//www.yohobuy.com/contact.html">联系我们</a>
<span>|</span>
<a href="http://shop.yohobuy.com/settled">商家入驻</a>
<a href="//shop.yohobuy.com/settled">商家入驻</a>
<span>|</span>
<a href="http://www.yohobuy.com/privacy.html">隐私条款</a>
<a href="//www.yohobuy.com/privacy.html">隐私条款</a>
<span>|</span>
<a href="http://www.yohobuy.com/link.html">友情链接</a>
<a href="//www.yohobuy.com/link.html">友情链接</a>
</p>
<p>
CopyRight © 2007-2016 南京新与力文化传播有限公司
... ...
... ... @@ -4,7 +4,7 @@
<div class="center-content">
<div class="yoho-group-map left">
<span class="icon-hamburger"></span>
<a href="http://www.yohobuy.com">YOHO!BUY 有货</a>
<a href="//www.yohobuy.com">YOHO!BUY 有货</a>
{{#if yohoGroup}}
<ul class="yoho-group-list">
{{# yohoGroup}}
... ... @@ -19,40 +19,40 @@
<ul>
<li id="loginBox">
<span class="hi">Hi~</span>
[ <a href="http://www.yohobuy.com/signin.html" class="loginbar">请登录</a> ]
[ <a href="http://www.yohobuy.com/reg.html" class="registbar">免费注册</a> ]
[ <a href="//www.yohobuy.com/signin.html" class="loginbar">请登录</a> ]
[ <a href="//www.yohobuy.com/reg.html" class="registbar">免费注册</a> ]
</li>
<li class="myyoho" id="myYohoBox">
<span class="tag-seprate"></span>
<a href="http://www.yohobuy.com/home?t=1453340799.4986">MY有货</a>
<a href="//www.yohobuy.com/home?t=1453340799.4986">MY有货</a>
<span class="icon-bottomarrow"></span>
<div class="simple-user-center"></div>
</li>
<li class="myorder">
<span class="tag-seprate"></span>
<span class="icon-papers"></span>
<a href="http://www.yohobuy.com/home/orders?t=1453168898.0176">我的订单</a>
<a href="//www.yohobuy.com/home/orders?t=1453168898.0176">我的订单</a>
</li>
<li class="mycollect">
<span class="tag-seprate"></span>
<span class="icon-heart"></span>
<a href="http://www.yohobuy.com/home/favorite?t=1453168898.0176">我的收藏</a>
<a href="//www.yohobuy.com/home/favorite?t=1453168898.0176">我的收藏</a>
</li>
<li class="message">
<span class="tag-seprate"></span>
<span class="icon-mail"></span>
<a href="http://www.yohobuy.com/home/message?t=1453168898.0176">消息</a>
<a href="//www.yohobuy.com/home/message?t=1453168898.0176">消息</a>
</li>
<li class="phoneapp">
<span class="tag-seprate"></span>
<span class="icon-phone"></span>
<a href="http://www.yohobuy.com/download/app">手机版</a>
<a href="//www.yohobuy.com/download/app">手机版</a>
<div class="download-app-box">
<div class="qr-img"></div>
<h3 class="qr-words">扫描二维码</h3>
<h3 class="qr-words">下载有货手机客户端</h3>
<h3 class="qr-more">
<a href="http://www.yohobuy.com/download/app">更多客户端下载</a>
<a href="//www.yohobuy.com/download/app">更多客户端下载</a>
</h3>
</div>
</li>
... ... @@ -63,7 +63,7 @@
<div class="head-wrapper clearfix">
<div class="center-content">
<div class="outlets-logo"></div>
<div class="main-logo"><a href="http://www.yohobuy.com/" class="main-link"></a></div>
<div class="main-logo"><a href="//www.yohobuy.com/" class="main-link"></a></div>
<ul class="main-nav-list">
{{# navbars}}
<li {{#if active}} class="cure"{{/if}}{{#if ico}} style="background: url({{image ico 54 32}}) no-repeat center center"{{/if}}>
... ... @@ -83,13 +83,13 @@
<div class="func-area">
<ul class="search-suggest"></ul>
<div class="search-2016">
<form action="http://search.yohobuy.com" method="get" id="search-form">
<form action="//search.yohobuy.com" method="get" id="search-form">
<input type="text" name="query" class="search-key" autocomplete="off">
<a class="search-btn"></a>
</form>
</div>
<div class="go-cart">
<a href="http://www.yohobuy.com/shopping/cart">
<a href="//www.yohobuy.com/shopping/cart">
<span class="iconfont ">&#xe600;</span>
<span class="goods-num-tip">0</span>
</a>
... ... @@ -109,7 +109,7 @@
<div class="center-content">
<ul class="sub-nav-list">
{{# subNav}}
<li{{#if thirdNav}} class="contain-third"{{/if}}>
<li {{#if thirdNav}}class="contain-third"{{/if}}>
<a href="{{link}}">{{name}}
{{#if isNew}}
<span class="newlogo"></span>
... ... @@ -154,7 +154,7 @@
<img src="\{{head_ico}}">
</div>
<div class="user-name">
<a href="http://www.yohobuy.com/home?t=\{{random}}">\{{profile_name}}</a>
<a href="//www.yohobuy.com/home?t=\{{random}}">\{{profile_name}}</a>
</div>
<h3 class="user-level">
VIP: <span>\{{vip.curVipInfo.title}}</span>
... ... @@ -173,28 +173,28 @@
</div>
<ul class="account-info-content">
<li>
<a href="http://www.yohobuy.com/home/orders?t=\{{timestamp}}">待处理的订单</a>
<a href="//www.yohobuy.com/home/orders?t=\{{timestamp}}">待处理的订单</a>
<span class="right">\{{orderCount}}</span>
</li>
<li>
<a href="http://www.yohobuy.com/home/favorite?t=\{{timestamp}}">我的收藏</a>
<a href="//www.yohobuy.com/home/favorite?t=\{{timestamp}}">我的收藏</a>
<span class="right"></span>
</li>
<li>
<a href="http://www.yohobuy.com/home/coupons?t=\{{timestamp}}">我的优惠券</a>
<a href="//www.yohobuy.com/home/coupons?t=\{{timestamp}}">我的优惠券</a>
<span class="right">\{{couponCount}}</span>
</li>
<li>
<a href="http://www.yohobuy.com/home/currency?t=\{{timestamp}}">我的YOHO币</a>
<a href="//www.yohobuy.com/home/currency?t=\{{timestamp}}">我的YOHO币</a>
<span class="right">\{{YohocoinCount}}</span>
</li>
<li>
<a href="http://www.yohobuy.com/home/returns?t=\{{timestamp}}">我的退货换货</a>
<a href="//www.yohobuy.com/home/returns?t=\{{timestamp}}">我的退货换货</a>
<span class="right">\{{refundCount}}</span>
</li>
</ul>
<div class="account-info-footer">
<a href="http://www.yohobuy.com/home/user?t=\{{timestamp}}">完善资料</a>
<a href="//www.yohobuy.com/home/user?t=\{{timestamp}}">完善资料</a>
</div>
</script>
<script type="text/html" id="mini-cart-tpl">
... ... @@ -221,7 +221,7 @@
<div class="goods-price">
<p>\{{show_price}} x \{{buy_number}}</p>
<p>
<a href="javascript:void(0)" class="cart-goods-del" data-id=\{{goods_incart_id}} data-cheapest=\{{is_cheapest_free}}>删除</a>
<a href="javascript:void(0)" class="cart-goods-del" data-id="\{{goods_incart_id}}" data-cheapest="\{{is_cheapest_free}}" data-sku="\{{product_sku}}" data-proid="\{{promotion_id}}" data-num="\{{buy_number}}">删除</a>
</p>
</div>
</div>
... ... @@ -261,4 +261,4 @@
</div>
<input id="api-domain" type="hidden" value="{{apiDomain}}">
{{/ headerData}}
{{/ headerData}}
\ No newline at end of file
... ...
/**
* Handlebars helpers
* bikai kai.bi@yoho.cn
* 2016-05-10
*/
'use strict';
const querystring = require('querystring');
const _ = require('lodash');
const moment = require('moment');
const config = require('../config/common');
/**
* 七牛图片路径处理
* @param {[string]} url
* @param {[string]} width
* @param {[string]} height
* @param {[string]} mode
* @return {[string]}
*/
exports.image = (url, width, height, mode) => {
mode = _.isNumber(mode) ? mode : 2;
url = url || '';
url = url.replace(/{width}/g, width).replace(/{height}/g, height).replace(/{mode}/g, mode);
return url.replace('http:', '');
};
/**
* 条件判断
* @param {[string]} v1
* @param {[string]} v2
* @param {[object]} options 上下文环境,一般不手动传
* @return {[boolen]}
*/
exports.isEqual = (v1, v2, _options) => {
if (_.isEqual(v1, v2)) {
return _options.fn(this); // eslint-disable-line
}
return _options.inverse(this); // eslint-disable-line
};
/**
* 站内地址格式化
* @param {[string]} uri 路径
* @param {[object]} qs 查询字符串
* @param {[string]} module 模块
* @return {[string]}
*/
exports.urlFormat = (uri, qs, module) => {
const subDomain = '.yohobuy.com';
const subName = {
default: config.siteUrl,
guang: `//guang${subDomain}`,
list: `//list${subDomain}`,
search: `//search${subDomain}`,
huodong: `//huodong${subDomain}`,
activity: '//activity.yohobuy.com',
index: config.siteUrl
};
let url;
module = module || 'default';
if (subName[module]) {
url = subName[module];
} else {
url = `//${module}${subDomain}`; // 规则没匹配到就把模块当作子域名
}
url += uri;
if (qs) {
url += `?${querystring.stringify(qs)}`;
}
return url;
};
/**
* 站内地址格式化
* @param {[string]} uri 路径
* @param {[object]} qs 查询字符串
* @param {[string]} module 模块
* @return {[string]}
*/
exports.fakeUrlFormat = (uri, qs, module) => {
const subDomain = 'http://localhost:6001';
const subName = {
default: subDomain,
guang: `${subDomain}`,
list: `${subDomain}`,
search: `${subDomain}`,
huodong: `${subDomain}`,
index: subDomain
};
let url;
module = module || 'default';
if (subName[module]) {
url = subName[module];
} else {
url = `//${module}${subDomain}`; // 规则没匹配到就把模块当作子域名
}
url += uri;
if (qs) {
url += `?${querystring.stringify(qs)}`;
}
return url;
};
/**
* 大写转小写处理
* @param {[string]} str 转换字符
*/
exports.lowerCase = (str) => {
str = str || '';
return str.toLowerCase();
};
/**
* 小写转大写处理
* @param {[string]} str 转换字符
*/
exports.upperCase = (str) => {
str = str || '';
return str.toUpperCase();
};
/**
* 四舍五入
* @param {[type]} num 数字
* @param {[type]} precision 精度
* @return {[type]}
*/
exports.round = (num, precision) => {
precision = _.isNumber(precision) ? precision : 2;
num = _.isInteger(num) ? (+num).toFixed(precision) : _.round(num, precision);
return num;
};
/**
* 时间格式化
* @param format 格式化token @see{http://momentjs.cn/docs/#/displaying/format/}
* @param date 日期或者数字
* @return string
*
*/
exports.dateFormat = (format, date) => {
if (typeof format !== 'string' || typeof date === 'undefined') {
return '';
} else {
if (date instanceof Date) {
return moment(date).format(format);
} else {
const d = moment.unix(date);
return moment(d).utc().format(format);
}
}
};
/**
* 时间差格式化
* @param {[string]} format 格式化字符串
* @param {[number]} diff 相差值
* @param {[string]} type diff时间类型 默认ms
*
* Key Shorthand
* years y
* quarters Q
* months M
* weeks w
* days d
* hours h
* minutes m
* seconds s
* milliseconds ms
*
* @example
* let diff = 60 * 60 * 24 * (1.3) + 2;
*
* let s = helpers.dateDiffFormat('{d}天{h}小时', diff, 's');
* >>> 1天7小时
*/
exports.dateDiffFormat = (format, diff, type) => {
if (typeof format !== 'string' || typeof diff === 'undefined') {
return '';
} else {
type = type || 'ms';
const m = moment.duration(diff, type);
format.match(/(\{.*?\})/g).forEach((s) => {
format = format.replace(s, m.get(s.substring(1, s.length - 1)));
});
return format;
}
};
/**
* 验证邮箱是否合法
*
* @param string email
* @return boolean
*/
exports.verifyEmail = (email) => {
if (!email) {
return false;
}
const emailRegExp = /^[a-zA-Z0-9_-]+@[a-zA-Z0-9_-]+(\.[a-zA-Z0-9_-]+)+$/;
return emailRegExp.test(email);
};
/**
* 各国手机号规则
*/
function areaMobileVerify(phone, area) {
area = area || '86';
phone = phone.trim();
let verify = {
86: {
name: '中国',
match: /^1[3|4|5|8|7][0-9]{9}$/.test(phone)
},
852: {
name: '中国香港',
match: /^[9|6|5][0-9]{7}$/.test(phone)
},
853: {
name: '中国澳门',
match: /^[0-9]{8}$/.test(phone)
},
886: {
name: '中国台湾',
match: /^[0-9]{10}$/.test(phone)
},
65: {
name: '新加坡',
match: /^[9|8][0-9]{7}$/.test(phone)
},
60: {
name: '马来西亚',
match: /^1[1|2|3|4|6|7|9][0-9]{8}$/.test(phone)
},
1: {
name: '加拿大&美国',
match: /^[0-9]{10}$/.test(phone)
},
82: {
name: '韩国',
match: /^01[0-9]{9}$/.test(phone)
},
44: {
name: '英国',
match: /^7[7|8|9][0-9]{8}$/.test(phone)
},
81: {
name: '日本',
match: /^0[9|8|7][0-9]{9}$/.test(phone)
},
61: {
name: '澳大利亚',
match: /^[0-9]{11}$/.test(phone)
}
};
if (verify[area]) {
return verify[area].match;
} else {
return false;
}
}
/**
* 验证国际手机号是否合法
*/
exports.isAreaMobile = (areaMobile) => {
if (!areaMobile) {
return false;
}
let mobile = {
area: '86',
phone: ''
};
let splitMobile = areaMobile.split('-');
if (splitMobile.length === 2) {
mobile.area = splitMobile[0];
mobile.phone = splitMobile[1];
} else {
mobile.phone = splitMobile[0];
}
return areaMobileVerify(mobile.phone, mobile.area);
};
/**
* 验证手机是否合法
*/
exports.verifyMobile = (phone) => {
if (!phone) {
return false;
}
return /^1[3|4|5|8|7][0-9]{9}$/.test(phone);
};
/**
* 组合国际手机号
*/
exports.makeAreaMobile = (area, mobile) => {
if (!area || area === '86') {
return mobile;
}
return `${area}-${mobile}`;
};
exports.isPassword = (pwd) => {
if (!pwd) {
return false;
}
let pwdRegexp = /^([a-zA-Z0-9\-\+_!@\#$%\^&\*\(\)\:\;\.=\[\]\\\',\?]){6,20}$/;
return pwdRegexp.test(_.trim(pwd));
};
... ...
{
"name": "yohobuy-node",
"version": "0.1.1",
"version": "1.0.0",
"private": true,
"description": "A New Yohobuy Project With Express",
"repository": {
... ... @@ -59,7 +59,7 @@
"uuid": "^2.0.2",
"winston": "^2.2.0",
"winston-daily-rotate-file": "^1.1.4",
"yoho-node-lib": "0.0.11"
"yoho-node-lib": "0.0.16"
},
"devDependencies": {
"autoprefixer": "^6.3.6",
... ...
var $ = require('yoho-jquery');
var $ = require('yoho-jquery'),
lazyLoad = require('yoho-jquery-lazyload');
require('yoho-slider');
exports.init = function(selector) {
var $imgBrand = $(selector);
var slider = $imgBrand.unslider({
autoplay: true,
delay: 5000,
arrows: false,
nav: false
});
var imgBrandNum = $imgBrand.find('li').length;
var cols = imgBrandNum / 3;
var changeSliderTimeout;
if (!($imgBrand.find('li').length % 3)) {
cols -= 1;
... ... @@ -20,13 +19,18 @@ exports.init = function(selector) {
$imgBrand.find('li:nth-child(3n)').css('margin-right', 0);
slider.on('unslider.change', function(event, index) {
clearTimeout(changeSliderTimeout);
if (index >= cols) {
changeSliderTimeout = setTimeout(function() {
slider.unslider('animate:first');
}, 4999);
}
slider.on('unslider.change', function() {
setTimeout(function() {
var $lazyImg = $('.img-item img.lazy');
$lazyImg.each(function(idx, item) {
var $item = $(item);
if ($item.attr('src').match('data:image') || $item.attr('src').length === 0) {
lazyLoad($item);
}
});
}, 1000);
});
$('.img-brand-switch').on('click', '.prev', function() {
... ...
... ... @@ -98,7 +98,7 @@ function getShoppingKey() {
a.async = 1;
a.src = j;
m.parentNode.insertBefore(a, m);
}(window, document, 'script', 'http://cdn.yoho.cn/yas-jssdk/1.0.17/yas.js', '_yas'));
}(window, document, 'script', '//cdn.yoho.cn/yas-jssdk/1.0.17/yas.js', '_yas'));
(function() {
var uid = getUid();
... ...
... ... @@ -36,7 +36,7 @@ function actionSubscription() {
if (email !== '' && emailReg.test(email)) {
try {
$.ajax({
url: 'http://new.yohobuy.com/common/emailsubscriber',
url: '//new.yohobuy.com/common/emailsubscriber',
dataType: 'jsonp',
data: {
email: email,
... ... @@ -97,7 +97,7 @@ function actionhomeFootChange() {
});
$.ajax({
url: 'http://new.yohobuy.com/common/suggestfeedback',
url: '//new.yohobuy.com/common/suggestfeedback',
dataType: 'jsonp',
data: {
feedback_id: _feedback || 0,
... ...
... ... @@ -32,6 +32,43 @@ var logoAngle = 0,
var dataLayer = [];
// banner和地址的映射
var bannerMap = {
listboys: '4f78b0f418fc42314d8b6e791cfb7fa8',
listgirls: '00c1f025a51b6b597dc37925951ea27d',
listkids: 'b02df11184727701ade1b6de9737d08c',
listlifestyle: 'fd35c52dced0c880976ba858346d1fc5',
searchboys: '9fb8986ea700cc27a8057361c3924394',
searchgirls: 'e3e207a1443ca60c8037fe52a5560c18',
searchkids: '620fc77f479da8feaeb06f2324e5d0bb',
searchlifestyle: 'a3c93301c6ffaf3ed0f36a4a451be36d',
uniquebrandboys: '2ebb0810c0d1a67e5229149c9c3aba7d',
uniquebrandgirls: '99e23385f4ba4b65f406b7e2968ac821',
uniquebrandkids: 'a74ebc9b17840c91b9ea46568111fe6b',
uniquebrandlifestyle: '0e8c81ead53f56302baa4d0ad967f527',
brandsboys: '77b352db07129c76a9d532acad149f9f',
brandsgirls: 'bf047f16e52ebc38be5ce9c7623831e6',
brandskids: 'e3ae1ce9b5e13c6d271ef3eccb831652',
brandslifestyle: 'e4ac8029c30f65d7f1af030980d140fe',
newboys: '869d3c5f3b450fb52101d00a61ce87cb',
newgirls: 'd953b6dfdac02483d1dcce8d96055954',
newkids: '0874cb6d75df8e0e78f2d475e53ecc08',
newlifestyle: '43e8fc8e178115c262bbce2bd0012db7',
saleboys: 'c846e3165c994769b4201d8c32f3ae9b',
salegirls: '52b1d389edcbc62d65de71b80c4d6ad0',
salekids: 'ad8b1703c761ba00973868ab5199cc27',
salelifestyle: '7acc64905c70ac91846f43fb2cec4bbd',
homeboys: 'b0856a771ef1b59ab1234c74688fa42d',
homegirls: '2bd61fa12e4933211518f70fe5ce3c48',
homekids: '895c59e8c64b40399c9533509507320c',
homelifestyle: '2e037d4e25d2767352ca3e0a4627f7bd',
indexboys: '0c911d3000f52e8ca7cffb74f5864c29',
indexgirls: 'b645b8980c423ab30485e0a9d08c2ef7',
indexkids: '17f6d5d5d454d2c507bc5fcbc90f7756',
indexlifestyle: '735cd393e841762af8793c346abbbc36'
},
cookieMap = {};
// handlebars模板
centerFn = handlebars.compile($('#simple-account-info-tpl').html() || '');
loginFn = handlebars.compile($('#header-login-info-tpl').html() || '');
... ... @@ -60,6 +97,117 @@ function closeCover() {
$cover.remove();
}
// 设置头部banner
function setTopBanner(data) {
var topbanner = '';
if (data && data.url !== '') {
topbanner = '<a target="_blank" href="' + data.url + '" class="page-top-banner"' +
'style="height:36px;border:none;background-image:url(' + window.unescape(data.src) + ');' +
'background-position: center;display:block;">&nbsp;</a>';
} else {
topbanner = '<div class="yoho-notice">' +
'<div class="notice-container center-content">' +
'<h1 class="notice-title">关于系统升级的公告</h1>' +
'<div class="notice-content">' +
'<p class="tips">尊敬的顾客:</p>' +
'<p class="detail">您好!为了向您提供更优质的服务,目前系统正在升级,请耐心等待。</p>' +
'<p class="detail">系统升级期间,部分地区用户体验会有暂时中断,如遇紧急事宜,欢迎垂询客服热线:' +
'400-889-9646 09:00-22:30(周一至周日)。稍后系统将恢复正常' +
'使用,欢迎您继续光顾YOHO!BUY有货!带来不便之处深表歉意,请您谅解!</p>' +
'</div>' +
'</div>' +
'</div>';
}
$('body').prepend(topbanner);
}
// cookie集合
function exeCookieMap() {
var cookies = document.cookie;
var cookiearr = cookies.split(';');
var i;
var temparr;
var key;
for (i = 0; i < cookiearr.length; i++) {
temparr = cookiearr[i].split('=');
if (typeof temparr[0] !== 'undefined') {
key = temparr[0].replace(/\s/g, '');
cookieMap[key] = temparr[1];
}
}
}
/**
* 获得banner & 异常通知
* @return {[type]} [description]
*/
function getBannerAndNotice() {
var INDEXKIDS = 'indexkids',
INDEXLIFESTYLE = 'indexlifestyle',
INDEXBOYS = 'indexboys',
INDEXWOMAN = 'indexgirls',
UNIQUEBRAND = 'uniquebrand';
var url = window.location.href;
var host = window.location.host;
var code = '';
var firstarea;
exeCookieMap();
if (url.indexOf('search') !== -1) {
code = bannerMap['search' + cookieMap._Channel];
}
if (url.indexOf('list') !== -1) {
code = bannerMap['list' + cookieMap._Channel];
}
if (url.indexOf('brands') !== -1) {
code = bannerMap['brands' + cookieMap._Channel];
}
if (url.indexOf('new') !== -1) {
code = bannerMap['new' + cookieMap._Channel];
}
if (url.indexOf('sale') !== -1) {
code = bannerMap['sale' + cookieMap._Channel];
}
if (url.indexOf('home') !== -1) {
code = bannerMap['home' + cookieMap._Channel];
}
if (url.indexOf('kids') !== -1) {
code = bannerMap[INDEXKIDS];
}
if (url.indexOf('woman') !== -1 || url.indexOf('girls') !== -1) {
code = bannerMap[INDEXWOMAN];
}
if (url.indexOf('lifestyle') !== -1) {
code = bannerMap[INDEXLIFESTYLE];
}
if (url.indexOf('www.yohobuy.com') !== -1 && window.location.pathname === '/') {
code = bannerMap[INDEXBOYS];
}
firstarea = host.split('.')[0];
if (firstarea !== 'list' && firstarea !== 'search' && firstarea !== 'www' &&
firstarea !== 'new' && firstarea !== 'item' && firstarea !== 'guang') {
code = bannerMap[UNIQUEBRAND + cookieMap._Channel];
}
$.getJSON('//new.yohobuy.com/common/getbanner?callback=?', {
client_type: 'web',
content_code: code
}, function(JsonData) {
if (+JsonData.code === 200) {
if (typeof JsonData.data === 'object') {
if (JsonData.data.url !== '') {
setTopBanner(JsonData.data);
} else {
setTopBanner();
}
}
}
});
}
// 格式化三级菜单
function formatThirdMenu() {
$subNav.each(function() {
... ... @@ -89,9 +237,9 @@ function formatThirdMenu() {
// 更新头部登陆信息
function updateLoginInfo(data) {
var info = {
usercenter: 'http://www.yohobuy.com/home?t=' + new Date().getTime(),
usercenter: '//www.yohobuy.com/home?t=' + new Date().getTime(),
nickname: data.profile_name,
signout: 'http://www.yohobuy.com/logout.html'
signout: '//www.yohobuy.com/logout.html'
};
if (data.vip.curVipInfo.curLevel * 1 === 3) {
... ... @@ -109,7 +257,7 @@ function syncLoginInfo() {
method: 'open.passport.get'
};
$.getJSON('http://www.yohobuy.com/common/passport/?callback=?', param, function(jsonData) {
$.getJSON('//www.yohobuy.com/common/passport/?callback=?', param, function(jsonData) {
if (jsonData && jsonData.data && jsonData.data.result !== -1) {
updateLoginInfo(jsonData.data.data);
} else {
... ... @@ -129,7 +277,7 @@ function searchSuggest(key) {
query: key
};
$.getJSON('http://search.yohobuy.com/api/suggest?callback=?', param, function(jsonData) {
$.getJSON('//search.yohobuy.com/api/suggest?callback=?', param, function(jsonData) {
if (jsonData.code === 200) {
if (jsonData.data && jsonData.data.length) {
$searchSug.html(jsonData.data).show();
... ... @@ -169,7 +317,7 @@ function loadCartDetail(key) {
shopping_key: key
};
$.getJSON('http://www.yohobuy.com/common/shoppingCart/?callback=?', param, function(jsonData) {
$.getJSON('//www.yohobuy.com/common/shoppingCart/?callback=?', param, function(jsonData) {
var totalGoods = [],
infoArr = [
'main_goods',
... ... @@ -209,11 +357,12 @@ function delCartGoods(data, callback) {
product_num: data.num
};
$.getJSON('http://www.yohobuy.com/common/delCartGoods/?callback=?', param, function(jsonData) {
$.getJSON('//www.yohobuy.com/common/delCartGoods/?callback=?', param, function(jsonData) {
var strG = '';
if (jsonData.code === 200) {
if (jsonData.data && jsonData.data.total_goods_num !== undefined) {
if (jsonData.data &&
typeof jsonData.data.total_goods_num !== 'undefined') {
strG = '{"_k":"' + data.key + '","_nac":' +
jsonData.data.total_goods_num + ',"_ac":0,"_r":0}';
syncCratInfo(strG);
... ... @@ -333,9 +482,10 @@ if (isSupportCss3Animation()) {
} else {
window.setTimeout(fadeAnimate, 3000);
}
syncLoginInfo();
formatThirdMenu();
setInterval(syncCratInfo, 2000);
getBannerAndNotice(); // 获取头部banner
syncLoginInfo(); // 同步登陆信息
formatThirdMenu(); // 格式化三级菜单
setInterval(syncCratInfo, 2000); // 定时同步购物车数量
$yohoGroup.hover(function() {
var data = $(this).data();
... ... @@ -440,7 +590,7 @@ $subNav.on({
param.width = 337;
param.height = 250;
param._ = new Date();
$.getJSON('http://new.yohobuy.com/common/getbanner?callback=?', param, function(JsonData) {
$.getJSON('//new.yohobuy.com/common/getbanner?callback=?', param, function(JsonData) {
if (JsonData.code === 200) {
$show.addClass('show');
$show.find('img').attr('src', JsonData.data.src);
... ... @@ -464,14 +614,13 @@ $subNav.on({
* @return {[type]} [description]
*/
function actionCover() {
// var gender = window.cookie('_Gender');
var gender = window.cookie('_Gender');
var newMask = '';
var windowheight = '';
var selfheight = '';
var containertop;
var length = '';
if (window.location.href === 'http://www.yohobuy.com/' &&
(typeof gender === 'undefined' || gender === '' || gender === null)) {
$.get('/guide', function(data) {
... ... @@ -487,64 +636,71 @@ function actionCover() {
width: (200 * length) + 'px',
top: containertop + 'px'
});
window.setCookie('_Channel', 'boys', {
path: '/',
domain: '.yohobuy.com',
expires: 7
});
closeCover();
});
$('#cover .guide-box .close').bind('click', function() {
getSource('弹窗', 'CLOSE', 'homepage_man');
window.setCookie('_Gender', '1,3', {
path: '/',
domain: '.yohobuy.com',
expires: 90
});
window.setCookie('_Channel', 'boys', {
path: '/',
domain: '.yohobuy.com',
expires: 7
$('#cover').bind('click', function() {
window.setCookie('_Gender', '1,3', {
path: '/',
domain: '.yohobuy.com',
expires: 90
});
window.setCookie('_Channel', 'boys', {
path: '/',
domain: '.yohobuy.com',
expires: 7
});
closeCover();
});
closeCover();
});
$('.boys img , .boys .go').bind('click', function() {
getSource('弹窗', 'BOYS', 'homepage_man');
window.setCookie('_Gender', '1,3', {
path: '/',
domain: '.yohobuy.com',
expires: 90
$('#cover .guide-box .close').bind('click', function() {
getSource('弹窗', 'CLOSE', 'homepage_man');
window.setCookie('_Gender', '1,3', {
path: '/',
domain: '.yohobuy.com',
expires: 90
});
window.setCookie('_Channel', 'boys', {
path: '/',
domain: '.yohobuy.com',
expires: 7
});
closeCover();
});
window.setCookie('_Channel', 'boys', {
path: '/',
domain: '.yohobuy.com',
expires: 7
$('.boys img , .boys .go').bind('click', function() {
getSource('弹窗', 'BOYS', 'homepage_man');
window.setCookie('_Gender', '1,3', {
path: '/',
domain: '.yohobuy.com',
expires: 90
});
window.setCookie('_Channel', 'boys', {
path: '/',
domain: '.yohobuy.com',
expires: 7
});
closeCover();
});
closeCover();
});
$('.girls img, .girls .go').bind('click', function() {
getSource('弹窗', 'GIRLS', 'homepage_woman');
window.setCookie('_Gender', '2,3', {
path: '/',
domain: '.yohobuy.com',
expires: 90
$('.girls img, .girls .go').bind('click', function() {
getSource('弹窗', 'GIRLS', 'homepage_woman');
window.setCookie('_Gender', '2,3', {
path: '/',
domain: '.yohobuy.com',
expires: 90
});
window.setCookie('_Channel', 'girls', {
path: '/',
domain: '.yohobuy.com',
expires: 7
});
});
window.setCookie('_Channel', 'girls', {
path: '/',
domain: '.yohobuy.com',
expires: 7
$('.lifestyle img, .lifestyle .go').bind('click', function() {
window.setCookie('_Channel', 'lifestyle', {
path: '/',
domain: '.yohobuy.com',
expires: 7
});
getSource('弹窗', 'LIEFSTYLE', 'homepage_lifestyle');
});
});
$('.lifestyle img, .lifestyle .go').bind('click', function() {
window.setCookie('_Channel', 'lifestyle', {
path: '/',
domain: '.yohobuy.com',
expires: 7
$('#cover .guide-box').bind('click', function(event) {
event.stopPropagation();
});
getSource('弹窗', 'LIEFSTYLE', 'homepage_lifestyle');
});
$('#cover .guide-box').bind('click', function(e) {
e.stopPropagation();
});
}
}
... ...
... ... @@ -473,7 +473,7 @@
.logo-brand-switch {
position: relative;
background: resolve(img/index/logo-brand-line.png) no-repeat center center;
background: resolve(index/logo-brand-line.png) no-repeat center center;
line-height: normal;
.iconfont {
... ...
.yoho-notice {
width: 100%;
height: 100px;
font-size: 12px;
background-color: #555;
font-family: '微软雅黑';
.notice-title {
height: 100px;
line-height: 100px;
font-size: 27px;
font-weight: bold;
color: #fff;
width: 245px;
position: absolute;
}
.notice-content {
padding: 16px 0 0 300px;
color: #e8e8e8;
.tips {
margin-bottom: 10px;
}
.detail {
line-height: 16px;
}
}
}
.yoho-header {
.tool-wrapper {
width: 100%;
... ... @@ -8,6 +39,7 @@
.yoho-group-map {
padding: 0 5px;
position: relative;
.yoho-group-list {
position: absolute;
... ... @@ -44,6 +76,7 @@
li {
float: left;
padding-right: 10px;
position: relative;
span {
display: inline-block;
... ... @@ -283,6 +316,7 @@
li {
float: left;
padding: 8px 22px 5px;
text-align: center;
a {
font-size: 12px;
... ... @@ -292,13 +326,18 @@
.name-cn a {
font-size: 16px;
}
.name-en a {
color: #8e8e8e;
}
}
.cure {
color: #fff;
background-color: #3a3a3a;
a {
.name-cn > a,
.name-en > a {
color: #fff;
}
}
... ... @@ -794,8 +833,8 @@
}
#cover {
left: 0px;
top: 0px;
left: 0;
top: 0;
width: 100%;
height: 100%;
position: fixed;
... ... @@ -803,8 +842,8 @@
.con {
background: rgba(0, 0, 0, 0.6) !important;
left: 0px;
top: 0px;
left: 0;
top: 0;
width: 100%;
height: 100%;
position: absolute;
... ... @@ -812,115 +851,115 @@
opacity: 0.5;
}
.tag_img_warpper {
margin: 0px auto;
.tag-img-warpper {
margin: 0 auto;
width: 180px;
height: 168px;
img {
width: 100%;
height: 100%;
}
img {
width: 100%;
height: 100%;
}
}
.guide-box {
background: rgb(255, 255, 255);
margin: 0px auto;
margin: 0 auto;
height: 400px;
position: relative;
z-index: 1003;
.close {
top: -15px;
text-align: center;
right: -15px;
color: rgb(255, 255, 255);
line-height: 22px;
font-size: 24px;
position: absolute;
background: rgb(0, 0, 0);
border-radius: 50px;
border: currentColor;
border-image: none;
width: 28px;
height: 28px;
line-height: 25px;
display: block;
}
.close {
top: -15px;
text-align: center;
right: -15px;
color: rgb(255, 255, 255);
line-height: 22px;
font-size: 24px;
position: absolute;
background: rgb(0, 0, 0);
border-radius: 50px;
border: currentColor;
border-image: none;
width: 28px;
height: 28px;
line-height: 25px;
display: block;
}
li {
padding: 10px;
width: 200px;
height: 400px;
float: left;
box-sizing: border-box;
li {
padding: 10px;
width: 200px;
height: 400px;
float: left;
box-sizing: border-box;
&.girls {
border-left-color: rgb(238, 238, 238);
border-left-width: 1px;
border-left-style: solid;
&.girls {
border-left-color: rgb(238, 238, 238);
border-left-width: 1px;
border-left-style: solid;
.goods-num {
text-align: center;
color: rgb(187, 187, 187);
line-height: 12px;
font-size: 12px;
margin-top: 16px;
}
}
.goods-num {
text-align: center;
color: rgb(187, 187, 187);
line-height: 12px;
font-size: 12px;
margin-top: 16px;
}
}
&.lifestyle {
border-left-color: rgb(238, 238, 238);
border-left-width: 1px;
border-left-style: solid;
&.lifestyle {
border-left-color: rgb(238, 238, 238);
border-left-width: 1px;
border-left-style: solid;
.goods-num {
text-align: center;
color: rgb(187, 187, 187);
line-height: 12px;
font-size: 12px;
margin-top: 16px;
}
}
.goods-num {
text-align: center;
color: rgb(187, 187, 187);
line-height: 12px;
font-size: 12px;
margin-top: 16px;
}
}
&.kids {
border-left-color: rgb(238, 238, 238);
border-left-width: 1px;
border-left-style: solid;
&.kids {
border-left-color: rgb(238, 238, 238);
border-left-width: 1px;
border-left-style: solid;
.goods-num {
text-align: center;
color: rgb(187, 187, 187);
line-height: 12px;
font-size: 12px;
margin-top: 16px;
}
}
.goods-num {
text-align: center;
color: rgb(187, 187, 187);
line-height: 12px;
font-size: 12px;
margin-top: 16px;
}
}
&.boys .goods-num {
text-align: center;
color: rgb(187, 187, 187);
line-height: 12px;
font-size: 12px;
margin-top: 16px;
}
&.boys .goods-num {
text-align: center;
color: rgb(187, 187, 187);
line-height: 12px;
font-size: 12px;
margin-top: 16px;
}
.go {
margin: 26px auto 0px;
width: 100%;
height: 18px;
text-align: center;
color: rgb(176, 176, 176);
line-height: 18px;
font-size: 18px;
font-style: italic;
font-weight: lighter;
display: block;
}
}
.go {
margin: 26px auto 0;
width: 100%;
height: 18px;
text-align: center;
color: rgb(176, 176, 176);
line-height: 18px;
font-size: 18px;
font-style: italic;
font-weight: lighter;
display: block;
}
}
}
.boys .block_cn {
.boys .block-cn {
text-align: center;
line-height: 26px;
font-size: 26px;
... ... @@ -928,7 +967,7 @@
margin-top: 30px;
}
.girls .block_cn {
.girls .block-cn {
text-align: center;
line-height: 26px;
font-size: 26px;
... ... @@ -936,7 +975,7 @@
margin-top: 30px;
}
.kids .block_cn {
.kids .block-cn {
text-align: center;
line-height: 26px;
font-size: 26px;
... ... @@ -944,7 +983,7 @@
margin-top: 30px;
}
.lifestyle .block_cn {
.lifestyle .block-cn {
text-align: center;
line-height: 26px;
font-size: 26px;
... ... @@ -952,7 +991,7 @@
margin-top: 30px;
}
.boys .block_en {
.boys .block-en {
text-align: center;
line-height: 26px;
font-size: 26px;
... ... @@ -960,7 +999,7 @@
margin-top: 19px;
}
.girls .block_en {
.girls .block-en {
text-align: center;
line-height: 26px;
font-size: 26px;
... ... @@ -968,7 +1007,7 @@
margin-top: 19px;
}
.kids .block_en {
.kids .block-en {
text-align: center;
line-height: 26px;
font-size: 26px;
... ... @@ -976,7 +1015,7 @@
margin-top: 19px;
}
.lifestyle .block_en {
.lifestyle .block-en {
text-align: center;
line-height: 26px;
font-size: 26px;
... ... @@ -984,57 +1023,57 @@
margin-top: 19px;
}
.boys .block_cn,
.boys .block_en {
.boys .block-cn,
.boys .block-en {
color: #000;
}
.girls .block_cn,
.girls .block_en {
.girls .block-cn,
.girls .block-en {
color: rgb(255, 136, 174);
}
.kids .block_cn,
.kids .block_en {
.kids .block-cn,
.kids .block-en {
color: rgb(122, 217, 248);
}
.lifestyle .block_cn,
.lifestyle .block_en {
.lifestyle .block-cn,
.lifestyle .block-en {
color: rgb(79, 64, 55) !important;
}
.boys .block_line {
margin: 20px auto 0px;
.boys .block-line {
margin: 20px auto 0;
width: 50px;
height: 0px;
height: 0;
border-bottom-color: rgb(204, 204, 204);
border-bottom-width: 1px;
border-bottom-style: solid;
}
.girls .block_line {
margin: 20px auto 0px;
.girls .block-line {
margin: 20px auto 0;
width: 50px;
height: 0px;
height: 0;
border-bottom-color: rgb(204, 204, 204);
border-bottom-width: 1px;
border-bottom-style: solid;
}
.kids .block_line {
margin: 20px auto 0px;
.kids .block-line {
margin: 20px auto 0;
width: 50px;
height: 0px;
height: 0;
border-bottom-color: rgb(204, 204, 204);
border-bottom-width: 1px;
border-bottom-style: solid;
}
.lifestyle .block_line {
margin: 20px auto 0px;
.lifestyle .block-line {
margin: 20px auto 0;
width: 50px;
height: 0px;
height: 0;
border-bottom-color: rgb(204, 204, 204);
border-bottom-width: 1px;
border-bottom-style: solid;
... ...
... ... @@ -439,14 +439,7 @@
}
.good-info {
.good-detail-img {
width: 100%;
height: 100%;
position: relative;
}
.good-detail-text {
> a {
margin-top: 16px;
line-height: 1.5;
... ... @@ -485,6 +478,10 @@
margin-bottom: 100px;
}
.good-detail-img {
height: 100%;
}
.good-detail-text {
> a {
... ... @@ -532,6 +529,8 @@
margin-left: 30px;
width: 20px;
height: 15px;
line-height: 16px;
padding-right: 7px;
}
.vip-1 {
... ...
... ... @@ -39,6 +39,30 @@ const handleGoodsListData = (origin) => {
};
/**
* 根据性别来决定 默认图片获取字段 如果是 2、3
*
* 2、3: cover2 --> images_url -> cover1
* 1,3 :cover1 --> images_url -> cover2
* 其他: cover1 --> cover2 --> images_url
*
* @param array $images
* @return string 商品图片
*/
const procProductImgs = (item, gender) => {
let imgUrl = item.images_url ? item.images_url : '',
cover1 = item.cover_1 ? item.cover_1 : '',
cover2 = item.cover_2 ? item.cover_2 : '';
if (gender === '2,3') {
return cover2 ? cover2 : (imgUrl ? imgUrl : cover1);// eslint-disable-line
} else if (gender === '1,3') {
return cover1 ? cover1 : (imgUrl ? imgUrl : cover2);// eslint-disable-line
} else {
return cover1 ? cover1 : (cover2 ? cover2 : imgUrl);// eslint-disable-line
}
};
/**
* 商品搜索商品数据处理
*/
exports.processProductList = (list, options) => {
... ... @@ -273,7 +297,8 @@ exports.processFilter = (list, options) => {
// 处理单个商品
exports.processProduct = (productData, options) => {
let result = {};
let result = {},
flag = false;
options = Object.assign({
showTags: true,
... ... @@ -297,12 +322,13 @@ exports.processProduct = (productData, options) => {
// 设置默认图片
_.forEach(productData.goods_list, item => {
if (item.is_default === 'Y') {
productData.default_images = item.images_url;
productData.default_images = procProductImgs(item, options.gender);
flag = true;
}
});
if (!productData.default_images) {
productData.default_images = productData.goods_list[0].images_url;
if (!flag) {
productData.default_images = procProductImgs(productData.goods_list[0], options.gender);
}
result.id = productData.product_skn;
... ...