Authored by 郝肖肖

解决冲突

... ... @@ -86,9 +86,7 @@ exports.resourcesGoodsList = (req, res, next) => {
param = {
productSkn: productSkn.split(','),
yh_channel: req.body.yh_channel,
page: req.body.page,
limit: req.body.limit
yh_channel: req.body.yh_channel
};
plusstarModel.getProductBatch(param, {
... ...
... ... @@ -51,8 +51,8 @@ const getProductBatch = (param, options) => {
method: 'h5.product.batch',
productSkn: param.productSkn.join(','),
yh_channel: param.yh_channel,
page: param.page,
limit: param.limit
page: param.page || 1,
limit: param.limit || param.productSkn.length
}).then(result => {
let data = {};
... ... @@ -178,7 +178,7 @@ const getResourcesData = (params, options) => {
let preferSkns = result[1] && result[1].data || [];
if (result[0] && result[0].goods && result[0].goods.productSkns) {
result[0].goods.productSkns = _.uniq(Object.assign(skns, preferSkns));
result[0].goods.productSkns = _.uniq(skns.concat(preferSkns));
}
return result[0];
... ...
var $ = require('yoho-jquery'),
tip = require('../plugin/tip'),
Swiper = require('yoho-swiper'),
loading = require('../plugin/loading'),
debounce = require('lodash/debounce');
var plusstar = {},
$footer = $('#yoho-footer');
var windowHeight = $(window).height();
var scrollFn,
scrollTop,
RECPOSE,
isApp,
searching = false,
speckParamApp = {
udid: '',
apt: '',
... ... @@ -25,9 +21,6 @@ require('../common');
plusstar = {
common: {
codeDefault: '',
page: 1,
pagesize: 20,
pageTotal: 1,
productSkns: []
},
init: function() {
... ... @@ -66,14 +59,16 @@ plusstar = {
window._yas.sendCustomInfo({
op: 'YB_FASHION_TAB_C',
param: JSON.stringify($.extend(speckParamApp, {
TAB_ID: $liDom.index() + 1
TAB_ID: $liDom.index() + 1,
PRD_ID: ''
}))
}, true);
window._yas.sendCustomInfo({
op: 'YB_FASHION_HOME_L',
param: JSON.stringify($.extend(speckParamApp, {
TAB_ID: that.ParentLiDom.index() + 1
TAB_ID: that.ParentLiDom.index() + 1,
PRD_ID: ''
}))
}, true);
}
... ... @@ -115,9 +110,8 @@ plusstar = {
REC_POSE: RECPOSE,
PRD_ID: $dom.data('good-id'),
ORDER_CODE: '',
PRD_NUM: index % that.common.pagesize === 0 ? that.common.pagesize : index % that.common.pagesize,
ACTION_ID: 1,
page_num: Math.ceil(index / that.common.pagesize)
PRD_NUM: index,
ACTION_ID: 1
}));
} else if ($(event.target).closest('.banner-top').length > 0) {
// 头部banner楼层埋点
... ... @@ -129,6 +123,7 @@ plusstar = {
TAB_ID: that.ParentLiDom.index() + 1,
F_ID: $dom.closest('ul').data('id'),
F_NAME: '焦点图',
PRD_ID: '',
F_URL: $dom.find('a').attr('href'),
F_INDEX: 1,
I_INDEX: index % 2 + 1// banner,li是双倍的
... ... @@ -144,6 +139,7 @@ plusstar = {
param: JSON.stringify($.extend(speckParamApp, {
TAB_ID: that.ParentLiDom.index() + 1,
F_ID: $dom.data('fid'),
PRD_ID: '',
F_NAME: $dom.data('name'),
F_URL: $domA.attr('href'),
F_INDEX: $dom.index() + 1,
... ... @@ -157,7 +153,8 @@ plusstar = {
window._yas.sendCustomInfo({
op: 'YB_FASHION_HOME_L',
param: JSON.stringify($.extend(speckParamApp, {
TAB_ID: that.ParentLiDom.index() + 1
TAB_ID: that.ParentLiDom.index() + 1,
PRD_ID: ''
}))
}, true);
},
... ... @@ -165,8 +162,6 @@ plusstar = {
var that = this;
this.common.codeDefault = code;// 记住最后一次的tab code
this.common.page = 1;// 商品列表从第一页开始
searching = false;
$.ajax({
type: 'GET',
... ... @@ -200,6 +195,10 @@ plusstar = {
if (productSkns) {
that.common.productSkns = productSkns.split(',');
}
setTimeout(function() {
plusstar.goodsList();
}, 10);
},
error: function() {
tip.show('网络断开连接了~');
... ... @@ -225,18 +224,6 @@ plusstar = {
var that = this,
skn = [];
if (searching) {
return true;
}
searching = true;
if (that.common.page > that.common.pageTotal) {
return false;
}
loading.showLoadingMask();
$.ajax({
type: 'POST',
url: '/guang/plusstar/resources-goodsList',
... ... @@ -244,24 +231,16 @@ plusstar = {
data: {
productSkn: that.common.productSkns.join(','),
app_version: isApp,
limit: that.common.pagesize,
page: that.common.page,
yh_channel: that.ParentLiDom.index() + 1
},
dataType: 'html',
success: function(data) {
skn = [];
searching = false;
loading.hideLoadingMask();
if (data === '') {
return true;
}
if (that.common.page <= 1) {
that.common.pageTotal = $(data).siblings('.page-total').val();
}
$.each($(data).siblings('.good-info'), function() {
skn.push($(this).data('good-id'));
});
... ... @@ -270,9 +249,8 @@ plusstar = {
REC_POSE: RECPOSE,
PRD_ID: skn.join(','),
ORDER_CODE: '',
PRD_NUM: that.common.pagesize,
ACTION_ID: 0,
page_num: that.common.page++
PRD_NUM: skn.length,
ACTION_ID: 0
}));
$('.plusstar-resources .goods').append(data);
... ... @@ -281,26 +259,16 @@ plusstar = {
$('.resources .goods .page-total').remove();
},
error: function() {
searching = false;
tip.show('网络断开连接了~');
loading.hideLoadingMask();
}
});
}
};
scrollFn = debounce(function() {
scrollTop = $(document).scrollTop();
// 当scroll到最后一列商品的高度后继续请求下一页数据
if (400 + scrollTop >= $(document).height() - windowHeight) {
plusstar.goodsList();
}
if (window.localStorage) {
localStorage.setItem(plusstar.common.codeDefault, $(this).scrollTop());
}
}, 200);
$(function() {
... ...