Authored by 梁志锋

购物车有数据时 不需要请求为你优选数据

@@ -22,9 +22,14 @@ var navHammer, @@ -22,9 +22,14 @@ var navHammer,
22 freebieHammer, 22 freebieHammer,
23 switchChose = false; 23 switchChose = false;
24 24
25 -require('../product/recommend-for-you');  
26 require('./good'); 25 require('./good');
27 26
  27 +if ($('.cart-zero').length > 0) {
  28 + require('../product/recommend-for-you');
  29 +} else {
  30 + require('./good');
  31 +}
  32 +
28 ellipsis.init(); 33 ellipsis.init();
29 34
30 function cartContentShow() { 35 function cartContentShow() {
@@ -106,7 +106,7 @@ function updateConformButtonClassAndText() { @@ -106,7 +106,7 @@ function updateConformButtonClassAndText() {
106 if (2 === $chosed.closest('.zero-stock').length) { 106 if (2 === $chosed.closest('.zero-stock').length) {
107 $('#chose-btn-sure').css('background-color', '#c0c0c0').html('已售罄'); 107 $('#chose-btn-sure').css('background-color', '#c0c0c0').html('已售罄');
108 } else { 108 } else {
109 - $('#chose-btn-sure').css('background-color', '#eb0313').html('确定'); 109 + $('#chose-btn-sure').css('background-color', '#eb0313').html('加入购物车');
110 } 110 }
111 } 111 }
112 112
@@ -28,8 +28,6 @@ var requestFrame, @@ -28,8 +28,6 @@ var requestFrame,
28 28
29 var navHammer; 29 var navHammer;
30 30
31 -require('./maybe-like');  
32 -  
33 lazyLoad($('img.lazy')); 31 lazyLoad($('img.lazy'));
34 32
35 navHammer = new Hammer($('.nav-btn')[0]); 33 navHammer = new Hammer($('.nav-btn')[0]);
@@ -39,13 +37,6 @@ navHammer.on('tap', function(event) { @@ -39,13 +37,6 @@ navHammer.on('tap', function(event) {
39 $overlay.show().css('opacity', 0.3); 37 $overlay.show().css('opacity', 0.3);
40 $sideNav.addClass('on'); 38 $sideNav.addClass('on');
41 39
42 - //设置boy高宽,页面不能上下滑动  
43 - $('body').css({  
44 - height: $(window).height(),  
45 - width: $(window).width(),  
46 - overflow: 'hidden'  
47 - });  
48 -  
49 event.srcEvent.stopPropagation(); 40 event.srcEvent.stopPropagation();
50 return false; 41 return false;
51 }); 42 });
@@ -56,10 +47,6 @@ function hideSideBar() { @@ -56,10 +47,6 @@ function hideSideBar() {
56 $('.overlay').hide(); 47 $('.overlay').hide();
57 $('.sub-nav').removeClass('show'); 48 $('.sub-nav').removeClass('show');
58 $sideNav.removeClass('on'); 49 $sideNav.removeClass('on');
59 - $('body').css({  
60 - height: 'auto',  
61 - overflow: 'auto'  
62 - });  
63 } 50 }
64 } 51 }
65 52
@@ -68,6 +55,11 @@ $('.overlay').on('touchstart', function(e) { @@ -68,6 +55,11 @@ $('.overlay').on('touchstart', function(e) {
68 return false; 55 return false;
69 }); 56 });
70 57
  58 +//禁止在侧边栏可以上下滚动
  59 +$('.side-nav').on('touchmove', function() {
  60 + return false;
  61 +});
  62 +
71 //点击一级导航,弹出二级导航 63 //点击一级导航,弹出二级导航
72 $sideNav.on('touchstart', 'li', function(e) { 64 $sideNav.on('touchstart', 'li', function(e) {
73 if ($(this).find('.sub-nav').size() > 0) { 65 if ($(this).find('.sub-nav').size() > 0) {
@@ -161,28 +153,6 @@ $('.category-swiper').each(function(i, index) { @@ -161,28 +153,6 @@ $('.category-swiper').each(function(i, index) {
161 }); 153 });
162 154
163 //logo动画 155 //logo动画
164 -requestFrame = (function() {  
165 - var tempFunc = null,  
166 - prefixList = ['webkit', 'moz', 'ms'];  
167 -  
168 - for (i = 0; i < prefixList.length; i++) {  
169 - thisFunc = prefixList[i] + 'RequestAnimationFrame';  
170 - if (window[thisFunc]) {  
171 - supportCss3 = true;  
172 - tempFunc = thisFunc;  
173 - }  
174 - }  
175 -  
176 - if (supportCss3) {  
177 - return function(callback) {  
178 - window[tempFunc](callback);  
179 - };  
180 - }  
181 - return function(callback) {  
182 - window.setTimeout(callback, 67);  
183 - };  
184 -})();  
185 -  
186 function tsAnimate() { 156 function tsAnimate() {
187 start = start + 10; 157 start = start + 10;
188 $logotrans.css({ 158 $logotrans.css({
@@ -205,9 +175,7 @@ function tsAnimate() { @@ -205,9 +175,7 @@ function tsAnimate() {
205 if (start % 360 === 0) { 175 if (start % 360 === 0) {
206 window.setTimeout(tsAnimate, 60 * 1000); 176 window.setTimeout(tsAnimate, 60 * 1000);
207 } else { 177 } else {
208 - requestFrame(function() {  
209 - tsAnimate();  
210 - }); 178 + window.requestAnimationFrame(tsAnimate);
211 } 179 }
212 } 180 }
213 } 181 }
@@ -230,3 +198,5 @@ exports.set = function(c) { @@ -230,3 +198,5 @@ exports.set = function(c) {
230 domain: '.m.yohobuy.com' 198 domain: '.m.yohobuy.com'
231 }); 199 });
232 }; 200 };
  201 +
  202 +require('./maybe-like');
@@ -63,7 +63,7 @@ @@ -63,7 +63,7 @@
63 </div> 63 </div>
64 </div> 64 </div>
65 <div class="btn-wrap"> 65 <div class="btn-wrap">
66 - <button id="chose-btn-sure" class="btn btn-sure">确定</button> 66 + <button id="chose-btn-sure" class="btn btn-sure">加入购物车</button>
67 </div> 67 </div>
68 </div> 68 </div>
69 </div> 69 </div>