Authored by Zhang

Merge branch 'release/5.9.1' of git.yoho.cn:fe/yohobuywap-node into release/5.9.1

... ... @@ -25,7 +25,7 @@ let couponSum = $('.coupon-money').find('span').text();
let shareData = {
title: '【YOHO!BUY有货】送你' + couponSum + '元专享福利啦!速来领~',
link: location.href,
desc: '400+潮流品牌每日上新,等你来BUY!',
desc: '1400+潮流品牌每日上新,等你来BUY!',
imgUrl: 'http://img11.static.yhbimg.com/yhb-img01/2017/05/10/16/011568a808f9b10e098b6542d3a8cb3d6b.png'
};
... ... @@ -33,6 +33,10 @@ let appVersion, link;
let couponId = $('.coupon-info').data('id');
let initial = true;
let beforeScroll = document.body.scrollTop; // 滚动前位置记录
let listEnd = false;
require('common/share')(shareData);
require('common');
... ... @@ -41,6 +45,10 @@ if (yoho.isApp) {
shareData.link = link;
if (yoho.isAndroid) {
shareData.desc = encodeURIComponent('1400+潮流品牌每日上新,等你来BUY!');
}
yoho.ready(function() {
yoho.invokeMethod('set.shareInfo', shareData);
});
... ... @@ -110,6 +118,10 @@ function productData() {
noLazy: true,
};
if (listEnd) {
return false;
}
if (appVersion) {
setting.app_version = appVersion;
}
... ... @@ -124,6 +136,7 @@ function productData() {
if (!onloading) {
onloading = true;
page = page + 1;
$.ajax({
type: 'GET',
... ... @@ -132,20 +145,28 @@ function productData() {
xhrFields: {
withCredentials: true
},
complete: function() {
onloading = false;
},
success: function(data) {
if (data === '' || (data.list && data.list.length <= 0)) {
if (initial) {
$('.commodity').hide();
}
listEnd = true;
return false;
} else {
$container.append(data);
}
onloading = false;
initial = false;
}
});
}
page = page + 1;
}
// 滚动加载
... ... @@ -159,7 +180,16 @@ function scrollHandler() {
}
$(window).scroll(function() {
setTimeout(function() {
let afterScroll = document.body.scrollTop;
if (afterScroll - beforeScroll > 0) {
window.requestAnimationFrame(scrollHandler);
beforeScroll = afterScroll;
} else {
return false;
}
}, 5);
});
$(function() {
... ...