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(); @@ -25,7 +25,7 @@ let couponSum = $('.coupon-money').find('span').text();
25 let shareData = { 25 let shareData = {
26 title: '【YOHO!BUY有货】送你' + couponSum + '元专享福利啦!速来领~', 26 title: '【YOHO!BUY有货】送你' + couponSum + '元专享福利啦!速来领~',
27 link: location.href, 27 link: location.href,
28 - desc: '400+潮流品牌每日上新,等你来BUY!', 28 + desc: '1400+潮流品牌每日上新,等你来BUY!',
29 imgUrl: 'http://img11.static.yhbimg.com/yhb-img01/2017/05/10/16/011568a808f9b10e098b6542d3a8cb3d6b.png' 29 imgUrl: 'http://img11.static.yhbimg.com/yhb-img01/2017/05/10/16/011568a808f9b10e098b6542d3a8cb3d6b.png'
30 }; 30 };
31 31
@@ -33,6 +33,10 @@ let appVersion, link; @@ -33,6 +33,10 @@ let appVersion, link;
33 33
34 let couponId = $('.coupon-info').data('id'); 34 let couponId = $('.coupon-info').data('id');
35 35
  36 +let initial = true;
  37 +let beforeScroll = document.body.scrollTop; // 滚动前位置记录
  38 +let listEnd = false;
  39 +
36 require('common/share')(shareData); 40 require('common/share')(shareData);
37 require('common'); 41 require('common');
38 42
@@ -41,6 +45,10 @@ if (yoho.isApp) { @@ -41,6 +45,10 @@ if (yoho.isApp) {
41 45
42 shareData.link = link; 46 shareData.link = link;
43 47
  48 + if (yoho.isAndroid) {
  49 + shareData.desc = encodeURIComponent('1400+潮流品牌每日上新,等你来BUY!');
  50 + }
  51 +
44 yoho.ready(function() { 52 yoho.ready(function() {
45 yoho.invokeMethod('set.shareInfo', shareData); 53 yoho.invokeMethod('set.shareInfo', shareData);
46 }); 54 });
@@ -110,6 +118,10 @@ function productData() { @@ -110,6 +118,10 @@ function productData() {
110 noLazy: true, 118 noLazy: true,
111 }; 119 };
112 120
  121 + if (listEnd) {
  122 + return false;
  123 + }
  124 +
113 if (appVersion) { 125 if (appVersion) {
114 setting.app_version = appVersion; 126 setting.app_version = appVersion;
115 } 127 }
@@ -124,6 +136,7 @@ function productData() { @@ -124,6 +136,7 @@ function productData() {
124 136
125 if (!onloading) { 137 if (!onloading) {
126 onloading = true; 138 onloading = true;
  139 + page = page + 1;
127 140
128 $.ajax({ 141 $.ajax({
129 type: 'GET', 142 type: 'GET',
@@ -132,20 +145,28 @@ function productData() { @@ -132,20 +145,28 @@ function productData() {
132 xhrFields: { 145 xhrFields: {
133 withCredentials: true 146 withCredentials: true
134 }, 147 },
  148 + complete: function() {
  149 + onloading = false;
  150 + },
135 success: function(data) { 151 success: function(data) {
136 152
137 if (data === '' || (data.list && data.list.length <= 0)) { 153 if (data === '' || (data.list && data.list.length <= 0)) {
  154 +
  155 + if (initial) {
  156 + $('.commodity').hide();
  157 + }
  158 +
  159 + listEnd = true;
  160 +
138 return false; 161 return false;
139 } else { 162 } else {
140 $container.append(data); 163 $container.append(data);
141 } 164 }
142 165
143 - onloading = false; 166 + initial = false;
144 } 167 }
145 }); 168 });
146 } 169 }
147 -  
148 - page = page + 1;  
149 } 170 }
150 171
151 // 滚动加载 172 // 滚动加载
@@ -159,7 +180,16 @@ function scrollHandler() { @@ -159,7 +180,16 @@ function scrollHandler() {
159 } 180 }
160 181
161 $(window).scroll(function() { 182 $(window).scroll(function() {
162 - window.requestAnimationFrame(scrollHandler); 183 + setTimeout(function() {
  184 + let afterScroll = document.body.scrollTop;
  185 +
  186 + if (afterScroll - beforeScroll > 0) {
  187 + window.requestAnimationFrame(scrollHandler);
  188 + beforeScroll = afterScroll;
  189 + } else {
  190 + return false;
  191 + }
  192 + }, 5);
163 }); 193 });
164 194
165 $(function() { 195 $(function() {