Authored by 郭成尧

'code-error-modified'

... ... @@ -118,8 +118,10 @@ const _pageArticleContent = (articleContent, isApp, gender) => {
let arr = [];
goods.list.forEach((mini) => {
skns.push(mini.id);
arr[mini.id] = mini.src;
if (mini) {
skns.push(mini.id);
arr[mini.id] = mini.src;
}
});
// 通过SKN获取商品信息
... ...
... ... @@ -139,12 +139,9 @@ exports.intro = (req, res, next) => {
exports.preference = (req, res, next) => {
preferenceModel({
productskn: req.query.productSkn,
yhchannel: req.yoho.channel,
brandId: req.query.brandId
limit: '20' // 后期值需要修改的话得手动改
}).then((result) => {
res.render('detail/preference', Object.assign({
layout: false
}, result));
res.send(result);
}).catch(next);
};
... ...
... ... @@ -48,18 +48,11 @@ const _formatProduct = (data) => {
};
module.exports = (data) => {
let finalResult = {};
return api.get('', {
method: 'h5.preference.Search',
productskn: data.productskn,
yhchannel: yhchannelMap[data.yhchannel],
brandId: data.brandId
method: 'app.product.preference',
product_skn: data.productskn,
limit: data.limit || '20'
}).then(result => {
if (result) {
finalResult.recommendList = _formatProduct(result);
}
return finalResult;
return result;
});
};
... ...
... ... @@ -62,7 +62,12 @@ const cachePage = {
// 品牌一览
'/brands': 5 * MINUTE,
'/brands/search': 1 * MINUTE
'/brands/search': 1 * MINUTE,
//活动
'/activity/single-day': 1 * MINUTE,
'/activity/shopCollect': 1 * MINUTE,
'/activity/live': 1 * MINUTE
};
... ...
... ... @@ -64,8 +64,9 @@ module.exports = {
},
loggers: {
infoFile: {
close: true,
name: 'info',
level: 'info',
level: 'error',
filename: 'logs/info.log',
maxFiles: 7
},
... ... @@ -78,12 +79,12 @@ module.exports = {
},
udp: { // send by udp
measurement: 'yohobuy_wap_node_log',
level: 'debug', // logger level
level: 'error', // logger level
host: 'influxdblog.web.yohoops.org', // influxdb host
port: '4444' // influxdb port
},
console: {
level: 'debug',
level: 'error',
colorize: 'all',
prettyPrint: true
}
... ...
{
"name": "m-yohobuy-node",
"version": "5.1.5",
"version": "5.1.7",
"private": true,
"description": "A New Yohobuy Project With Express",
"repository": {
... ...
... ... @@ -19,7 +19,7 @@ var singleDay = {
opt = {
$productList: $('.product-list'),
$swiper: $('.swiper-tab'),
getFlag: false,
getFlag: [],
previousScrollTop: 0,
winH: $(window).height(),
noResult: '<p class="no-result">未找到相关商品</p>',
... ... @@ -113,6 +113,7 @@ var singleDay = {
for (i; i < data[1].length; i++) {
self.$productList.append('<ul class="product-tab" data-page="0"></ul>');
self.getFlag[i] = false;
}
self.$productTab = $('.product-tab');
... ... @@ -130,6 +131,9 @@ var singleDay = {
if (self.$productTab.eq(index).find('li').length > 0) {
self.$productTab.hide().eq(index).fadeIn();
$('img.lazy').lazyload({
effect: 'fadeIn'
});
} else {
self.getProductData({
index: index,
... ... @@ -154,12 +158,12 @@ var singleDay = {
var page;
var curProductTab = self.$productTab.eq(params.index);
if (self.getFlag) {
if (self.getFlag[params.index]) {
return false;
}
page = +curProductTab.attr('data-page') + 1;
self.getFlag = true;
self.getFlag[params.index] = true;
loading.showLoadingMask();
$.ajax({
... ... @@ -175,15 +179,15 @@ var singleDay = {
curProductTab.find('.no-result').hide();
curProductTab.append(product(data));
curProductTab.attr('data-page', page);
self.getFlag = false;
self.getFlag[params.index] = false;
} else {
if (page === 1) {
if (curProductTab.find('.no-result').length === 0) {
curProductTab.append(self.noResult);
}
self.getFlag = false;
self.getFlag[params.index] = false;
} else {
self.getFlag = true;
self.getFlag[params.index] = true;
}
}
... ... @@ -199,7 +203,7 @@ var singleDay = {
error: function() {
tip.show('网络断开连接了~');
loading.hideLoadingMask();
self.getFlag = false;
self.getFlag[params.index] = false;
}
});
}
... ...
... ... @@ -5,7 +5,7 @@
*/
var Swiper = require('yoho-swiper'),
var lazyLoad = require('yoho-jquery-lazyload'),
$ = require('yoho-jquery');
var $recommendForYou = $('.recommend-for-you'),
... ... @@ -14,6 +14,40 @@ var $recommendForYou = $('.recommend-for-you'),
end = false,
requesting = false;
var RECID = (new Date().getTime() + '_H5_YOHOBUY_' + Math.floor(Math.random() * 1000000 + 1000000) +
'_' + Math.floor(Math.random() * 1000000 + 1000000));
var getChannel, C_ID, uuidVal, goodid, goodIds = [], prdLoad;
getChannel = function functionName() {
var name = window.cookie('_Channel');
return {
boys: 1,
girls: 2,
kids: 3,
lifestyle: 4
}[name] || 1;
};
C_ID = getChannel();
function yasRequest(PRD_ID, PRD_NUM, ACTION_ID) {
if (window._yas && window._yas.sendCustomInfo) {
window._yas.sendCustomInfo({
op: 'YB_CHOOSE_FOR_YOU_Y',
param: JSON.stringify({
REC_POSE: 100013,
REC_ID: RECID,
PRD_ID: PRD_ID,
PRD_NUM: PRD_NUM,
C_ID: C_ID,
ACTION_ID: ACTION_ID,
PAGE_NUM: 1
})
}, true);
}
}
function request() {
if (requesting || end) {
... ... @@ -24,25 +58,32 @@ function request() {
if (preferenceUrl) {
$.get(preferenceUrl).then(function(html) {
if ($(html).find('.swiper-slide').length < 5) {
$recommendForYou.hide();
} else {
$recommendForYou.html(html).show();
if ($('#swiper-recommend').length) {
new Swiper('#swiper-recommend', {
slidesPerView: 'auto',
grabCursor: true,
slideElement: 'a',
lazyLoading: true,
watchSlidesVisibility: true
});
$recommendForYou.html(html).show();
lazyLoad($recommendForYou.find('img.lazy'));
// 为你优选埋点- 加载
$('.goods-container').find('.good-info').each(function() {
goodid = $(this).data('good-id');
if (goodid) {
goodIds.push(goodid);
}
}
});
prdLoad = JSON.stringify(goodIds).replace(/\[|\]|/g, '');
yasRequest(prdLoad, goodIds.length, 0);
requesting = false;
end = true;
// 点击商品
$('.good-info').on('click', function() {
var PRD_ID = $(this).data('good-id'),
PRD_NUM = $(this).index();
window.rePosFooter();
yasRequest(PRD_ID, PRD_NUM, 1);
// return false;
});
}).fail(function() {
$recommendForYou.hide();
... ... @@ -59,3 +100,5 @@ function scrollHandler() {
$(window).scroll(function() {
window.requestAnimationFrame(scrollHandler);
});
... ...
... ... @@ -6,7 +6,6 @@
background: #fff;
box-sizing: border-box;
overflow: hidden;
background: #fff;
margin-bottom: 30px;
li {
... ... @@ -33,6 +32,7 @@
.shop-area {
background: #fff;
border-bottom: 1px solid #e0e0e0;
min-width: 750px;
}
}
... ...
... ... @@ -917,6 +917,13 @@ $basicBtnC: #eb0313;
.recommend-for-you {
border-bottom: none;
.tag-container {
overflow: hidden;
width: 100%;
height: 0.7rem;
position: static;
}
}
.yoho-tip {
... ...