Authored by 郝肖肖

首页频道 其余楼层 事件绑定

@@ -3,7 +3,7 @@ @@ -3,7 +3,7 @@
3 {{#data}} 3 {{#data}}
4 <div class="banner-list"> 4 <div class="banner-list">
5 <a href="{{url}}"> 5 <a href="{{url}}">
6 - <img src="{{image src 640 200}}" alt=""> 6 + <img class="lazy" data-original="{{image src 640 200}}" alt="">
7 </a> 7 </a>
8 </div> 8 </div>
9 {{/data}} 9 {{/data}}
@@ -12,7 +12,7 @@ @@ -12,7 +12,7 @@
12 {{#data}} 12 {{#data}}
13 <li class="swiper-slide"> 13 <li class="swiper-slide">
14 <a href="{{url}}"> 14 <a href="{{url}}">
15 - <img src="{{image src 640 200}}" alt=""> 15 + <img class="lazy" data-original="{{image src 640 200}}" alt="">
16 </a> 16 </a>
17 </li> 17 </li>
18 {{/data}} 18 {{/data}}
1 {{#data}} 1 {{#data}}
2 - <div style="background-image:url({{src}})" class="divide-image"></div> 2 + <div style="background-image:url({{image src 640 30}})" class="divide-image"></div>
3 {{/data}} 3 {{/data}}
@@ -2,7 +2,7 @@ @@ -2,7 +2,7 @@
2 <div class="hot-single"> 2 <div class="hot-single">
3 {{> ../common/floor-header-more}} 3 {{> ../common/floor-header-more}}
4 {{> ./new-floor-banner}} 4 {{> ./new-floor-banner}}
5 - <div class="hot-single-goods-list" {{#background}}style="background-image: url({{src}})"{{/background}}> 5 + <div class="hot-single-goods-list" {{#background}}style="background-image: url({{image src 640 200}})"{{/background}}>
6 <ul> 6 <ul>
7 {{#list}} 7 {{#list}}
8 <li class="hot-single-goods"> 8 <li class="hot-single-goods">
@@ -3,27 +3,27 @@ @@ -3,27 +3,27 @@
3 {{> ../common/floor-header-more}} 3 {{> ../common/floor-header-more}}
4 {{#list.[0]}} 4 {{#list.[0]}}
5 <a href="{{url}}" class="float-container"> 5 <a href="{{url}}" class="float-container">
6 - <img src="{{image src 268 360}}" alt="left" class="left" /> 6 + <img class="lazy left" data-original="{{image src 268 360}}" alt="left">
7 </a> 7 </a>
8 {{/list.[0]}} 8 {{/list.[0]}}
9 {{#list.[1]}} 9 {{#list.[1]}}
10 <a href="{{url}}" class="float-container"> 10 <a href="{{url}}" class="float-container">
11 - <img src="{{image src 186 180}}" alt="right1" class="right" /> 11 + <img class="lazy right" data-original="{{image src 186 180}}" alt="right1">
12 </a> 12 </a>
13 {{/list.[1]}} 13 {{/list.[1]}}
14 {{#list.[2]}} 14 {{#list.[2]}}
15 <a href="{{url}}" class="float-container"> 15 <a href="{{url}}" class="float-container">
16 - <img src="{{image src 186 180}}" alt="right2" class="right" /> 16 + <img class="lazy right" data-original="{{image src 186 180}}" alt="right2">
17 </a> 17 </a>
18 {{/list.[2]}} 18 {{/list.[2]}}
19 {{#list.[3]}} 19 {{#list.[3]}}
20 <a href="{{url}}" class="float-container"> 20 <a href="{{url}}" class="float-container">
21 - <img src="{{image src 186 180}}" alt="right3" class="right" /> 21 + <img class="lazy right" data-original="{{image src 186 180}}" alt="right3">
22 </a> 22 </a>
23 {{/list.[3]}} 23 {{/list.[3]}}
24 {{#list.[4]}} 24 {{#list.[4]}}
25 <a href="{{url}}" class="float-container"> 25 <a href="{{url}}" class="float-container">
26 - <img src="{{image src 186 180}}" alt="right4" class="right" /> 26 + <img class="lazy right" data-original="{{image src 186 180}}" alt="right4">
27 </a> 27 </a>
28 {{/list.[4]}} 28 {{/list.[4]}}
29 </div> 29 </div>
@@ -3,7 +3,7 @@ @@ -3,7 +3,7 @@
3 {{> ../common/floor-header-more}} 3 {{> ../common/floor-header-more}}
4 <div class="new-user-icon">新人专享</div> 4 <div class="new-user-icon">新人专享</div>
5 {{> ./new-floor-banner}} 5 {{> ./new-floor-banner}}
6 - <div class="new-user-goods-container" {{#background}} style="background-image: url({{src}})" {{/background}}> 6 + <div class="new-user-goods-container" {{#background}} style="background-image: url({{image src 640 200}})" {{/background}}>
7 <ul> 7 <ul>
8 {{#list}} 8 {{#list}}
9 <li class="new-user-good"> 9 <li class="new-user-good">
@@ -5,7 +5,7 @@ @@ -5,7 +5,7 @@
5 5
6 {{#list.[0]}} 6 {{#list.[0]}}
7 <a href="{{url}}" class="float-container time-floor"> 7 <a href="{{url}}" class="float-container time-floor">
8 - <img src="{{image src 269 360}}" alt="sale-limit" class="sale-floor-limit"> 8 + <img data-original="{{image src 269 360}}" alt="sale-limit" class="lazy sale-floor-limit">
9 <div class="sale-floor-time" data-time={{end_time}}> 9 <div class="sale-floor-time" data-time={{end_time}}>
10 <p class="limit-title"><i class="icon"></i>限时特卖</p> 10 <p class="limit-title"><i class="icon"></i>限时特卖</p>
11 <div class="limit"> 11 <div class="limit">
@@ -19,22 +19,22 @@ @@ -19,22 +19,22 @@
19 19
20 {{#list.[1]}} 20 {{#list.[1]}}
21 <a href="{{url}}" class="float-container"> 21 <a href="{{url}}" class="float-container">
22 - <img src="{{image src 284 180}}" alt="sale-break" class="sale-floor-break"> 22 + <img data-original="{{image src 284 180}}" alt="sale-break" class="lazy sale-floor-break">
23 </a> 23 </a>
24 {{/list.[1]}} 24 {{/list.[1]}}
25 {{#list.[2]}} 25 {{#list.[2]}}
26 <a href="{{url}}" class="sale-floor-entry"> 26 <a href="{{url}}" class="sale-floor-entry">
27 - <img src="{{image src 87 180}}" alt="sale-break" > 27 + <img data-original="{{image src 87 180}}" alt="sale-break" class="lazy" >
28 </a> 28 </a>
29 {{/list.[2]}} 29 {{/list.[2]}}
30 {{#list.[3]}} 30 {{#list.[3]}}
31 <a href="{{url}}" class="float-container"> 31 <a href="{{url}}" class="float-container">
32 - <img src="{{image src 284 180}}" alt="sale-discount" class="sale-floor-discount"> 32 + <img data-original="{{image src 284 180}}" alt="sale-discount" class="lazy sale-floor-discount">
33 </a> 33 </a>
34 {{/list.[3]}} 34 {{/list.[3]}}
35 {{#list.[4]}} 35 {{#list.[4]}}
36 <a href="{{url}}" class="sale-floor-entry"> 36 <a href="{{url}}" class="sale-floor-entry">
37 - <img src="{{image src 87 180}}" alt="sale-break" > 37 + <img data-original="{{image src 87 180}}" alt="sale-break" class="lazy">
38 </a> 38 </a>
39 {{/list.[4]}} 39 {{/list.[4]}}
40 </div> 40 </div>
@@ -2,7 +2,7 @@ @@ -2,7 +2,7 @@
2 <div class="three-picture clearfix"> 2 <div class="three-picture clearfix">
3 {{#list}} 3 {{#list}}
4 <a href="{{url}}"> 4 <a href="{{url}}">
5 - <img src="{{image src 210 280}}"> 5 + <img class="lazy" data-original="{{image src 210 280}}">
6 </a> 6 </a>
7 {{/list}} 7 {{/list}}
8 </div> 8 </div>
@@ -4,7 +4,7 @@ @@ -4,7 +4,7 @@
4 4
5 {{> ./new-floor-banner}} 5 {{> ./new-floor-banner}}
6 6
7 - <div class="vip-only-goods-list" {{#background}} style="background-image: url({{src}})" {{/background}}> 7 + <div class="vip-only-goods-list" {{#background}} style="background-image: url({{image src 640 400}})" {{/background}}>
8 <ul> 8 <ul>
9 {{#list}} 9 {{#list}}
10 <a href="//m.yohobuy.com/product/show_{{product_skn}}"> 10 <a href="//m.yohobuy.com/product/show_{{product_skn}}">
@@ -132,47 +132,85 @@ $('.banner-center-swiper').each(function() { @@ -132,47 +132,85 @@ $('.banner-center-swiper').each(function() {
132 } 132 }
133 }); 133 });
134 134
135 -// 异步获取首屏其余楼层  
136 -var getResourceContent = function() { 135 +
  136 +// 店铺推荐人数和收藏初始查询
  137 +var checkShop = function() {
  138 + var shopIds = [];
  139 +
  140 + $('.recom-shop').each(function() {
  141 + shopIds.push($(this).attr('shopId'));
  142 + });
  143 + shopIds.length &&
137 $.ajax({ 144 $.ajax({
138 - type: 'GET',  
139 - url: '/channel/getResourceContent',  
140 - async: false, // 改为false,否则下面初始化会找不到元素对象 145 + type: 'POST',
  146 + url: '/channel/shopRecom',
141 data: { 147 data: {
142 - gender: $mobileWrap.data('channel') 148 + shopIds: shopIds.join(','),
143 }, 149 },
144 }).then(function(result) { 150 }).then(function(result) {
145 - var resourceTemplate = channelContentHbs({content: result}); 151 + if (result.code === 200) {
  152 + for (var i = 0, elem;
  153 + (elem = result.data[i]) != null; i++) {
  154 + var a = $('.recom-shop[shopId = ' + elem.id + ']');
146 155
147 - $resourceContent.append(resourceTemplate);  
148 - lazyLoad($resourceContent.find('img.lazy:not([src])')); 156 + a.find('.faved-num').text(elem.collectionNum + '人已收藏');
  157 + if (elem.favorite) {
  158 + a.find('.fav-no').hide();
  159 + a.find('.fav-yes').show();
  160 + }
  161 + }
  162 + }
149 }); 163 });
150 }; 164 };
151 165
152 -getResourceContent(); 166 +// sale倒计时
  167 +var saleTime = function(elem, offsetTime) {
  168 + var hour = parseInt(offsetTime / (60 * 60), 10),
  169 + minute = parseInt(offsetTime % (60 * 60) / 60, 10),
  170 + second = offsetTime % 60;
  171 +
  172 + if (offsetTime <= -1) { // 结束倒计时刷新状态
  173 + $(elem).find('.limit').hide();
  174 + }
  175 +
  176 + if (offsetTime >= -1) {
  177 + $(elem).find('.hour').text(hour < 0 ? '00' : (hour < 10 ? ('0' + hour) : hour));
  178 + $(elem).find('.minute').text(minute < 0 ? '00' : (minute < 10 ? ('0' + minute) : minute));
  179 + $(elem).find('.second').text(second < 0 ? '00' : (second < 10 ? ('0' + second) : second));
  180 +
  181 + if (offsetTime <= -1) { // 结束倒计时刷新状态
  182 + $(elem).find('.limit').hide();
  183 + } else {
  184 + setTimeout(function() {
  185 + saleTime(elem, --offsetTime);
  186 + }, 1000);
  187 + }
  188 + }
  189 +};
153 190
154 -// 热门品牌滑动  
155 -if ($('.brands-swiper').find('li').length > 1) { 191 +function ajaxResource() {
  192 + // 热门品牌滑动
  193 + if ($('.brands-swiper').find('li').length > 1) {
156 new Swiper('.brands-swiper', { 194 new Swiper('.brands-swiper', {
157 grabCursor: true, 195 grabCursor: true,
158 slidesPerView: 'auto', 196 slidesPerView: 'auto',
159 wrapperClass: 'brands-list', 197 wrapperClass: 'brands-list',
160 slideElement: 'li' 198 slideElement: 'li'
161 }); 199 });
162 -} 200 + }
163 201
164 -// 推荐搭配滑动  
165 -if ($('.recommend-swiper').find('li').length > 1) { 202 + // 推荐搭配滑动
  203 + if ($('.recommend-swiper').find('li').length > 1) {
166 new Swiper('.recommend-swiper', { 204 new Swiper('.recommend-swiper', {
167 grabCursor: true, 205 grabCursor: true,
168 slidesPerView: 'auto', 206 slidesPerView: 'auto',
169 wrapperClass: 'recommend-list', 207 wrapperClass: 'recommend-list',
170 slideElement: 'li' 208 slideElement: 'li'
171 }); 209 });
172 -} 210 + }
173 211
174 -// 潮品话题轮播  
175 -if ($('.trend-topic-swiper').find('li').size() > 1) { 212 + // 潮品话题轮播
  213 + if ($('.trend-topic-swiper').find('li').size() > 1) {
176 new Swiper('.trend-topic-swiper', { 214 new Swiper('.trend-topic-swiper', {
177 loop: true, 215 loop: true,
178 autoplay: 3000, 216 autoplay: 3000,
@@ -181,10 +219,10 @@ if ($('.trend-topic-swiper').find('li').size() > 1) { @@ -181,10 +219,10 @@ if ($('.trend-topic-swiper').find('li').size() > 1) {
181 slideElement: 'li', 219 slideElement: 'li',
182 pagination: '.trend-topic-content .pagination-inner' 220 pagination: '.trend-topic-content .pagination-inner'
183 }); 221 });
184 -} 222 + }
185 223
186 -// 新人专享轮播  
187 -if ($('.fresh-list-swiper').find('li').size() > 1) { 224 + // 新人专享轮播
  225 + if ($('.fresh-list-swiper').find('li').size() > 1) {
188 new Swiper('.fresh-list-swiper', { 226 new Swiper('.fresh-list-swiper', {
189 lazyLoading: true, 227 lazyLoading: true,
190 lazyLoadingInPrevNext: true, 228 lazyLoadingInPrevNext: true,
@@ -193,10 +231,10 @@ if ($('.fresh-list-swiper').find('li').size() > 1) { @@ -193,10 +231,10 @@ if ($('.fresh-list-swiper').find('li').size() > 1) {
193 slideElement: 'li', 231 slideElement: 'li',
194 watchSlidesVisibility: true 232 watchSlidesVisibility: true
195 }); 233 });
196 -} 234 + }
197 235
198 -// 潮流上装/经典裤装等轮播  
199 -$('.category-swiper').each(function(i) { 236 + // 潮流上装/经典裤装等轮播
  237 + $('.category-swiper').each(function(i) {
200 swiperClass = 'category-swiper' + i; 238 swiperClass = 'category-swiper' + i;
201 $(this).addClass(swiperClass); 239 $(this).addClass(swiperClass);
202 if ($('.' + swiperClass).find('.swiper-slide').size() > 1) { 240 if ($('.' + swiperClass).find('.swiper-slide').size() > 1) {
@@ -209,112 +247,29 @@ $('.category-swiper').each(function(i) { @@ -209,112 +247,29 @@ $('.category-swiper').each(function(i) {
209 pagination: '.' + swiperClass + ' .pagination-inner' 247 pagination: '.' + swiperClass + ' .pagination-inner'
210 }); 248 });
211 } 249 }
212 -});  
213 -  
214 -// logo动画  
215 -function tsAnimate() {  
216 - start = start + 10;  
217 - $logotrans.css({  
218 - transform: 'rotateX(' + start + 'deg)',  
219 - '-webkit-transform': 'rotateX(' + start + 'deg)',  
220 - '-moz-transform': 'rotateX(' + start + 'deg)'  
221 }); 250 });
222 - if (start / 90 % 2 === 1) {  
223 - if (isen) {  
224 - $logotrans.addClass('animate');  
225 - isen = false;  
226 - } else {  
227 - $logotrans.removeClass('animate');  
228 - isen = true;  
229 - }  
230 - }  
231 - if (start / 90 % 2 === 0 && start % 360 !== 0) {  
232 - window.setTimeout(tsAnimate, 3000);  
233 - } else {  
234 - if (start % 360 === 0) {  
235 - window.setTimeout(tsAnimate, 60 * 1000);  
236 - } else {  
237 - window.requestAnimationFrame(tsAnimate);  
238 - }  
239 - }  
240 -}  
241 -  
242 -setTimeout(tsAnimate, 3000);  
243 -  
244 -$('.home-header .iconfont').on('touchstart', function() {  
245 - $(this).addClass('highlight');  
246 -}).on('touchend touchcancel', function() {  
247 - $(this).removeClass('highlight');  
248 -});  
249 -  
250 -// 底部留出tab 的高度  
251 -window.reMarginFooter('.footer-tab');  
252 -  
253 -// 原有项目 _Channel 写错位置,这里清理掉  
254 -window.setCookie('_Channel', $mobileWrap.data('channel'), {  
255 - expires: -1,  
256 - domain: '.m.yohobuy.com'  
257 -});  
258 251
259 -// 记录当前 _Channel  
260 -window.setCookie('_Channel', $mobileWrap.data('channel'), {  
261 - expires: 30,  
262 - domain: '.yohobuy.com'  
263 -});  
264 -  
265 -// 店铺推荐滑动效果  
266 -if ($('.shop-recom-swiper-container').find('li').length > 1) { 252 + // 店铺推荐滑动效果
  253 + if ($('.shop-recom-swiper-container').find('li').length > 1) {
267 new Swiper('.shop-recom-swiper-container', { 254 new Swiper('.shop-recom-swiper-container', {
268 centeredSlides: true, 255 centeredSlides: true,
269 slidesPerView: 'auto', 256 slidesPerView: 'auto',
270 paginationClickable: true, 257 paginationClickable: true,
271 slideActiveClass: 'recom-active', 258 slideActiveClass: 'recom-active',
272 }); 259 });
273 -}  
274 -  
275 -// 店铺推荐人数和收藏初始查询  
276 -var checkShop = function() {  
277 - var shopIds = [];  
278 -  
279 - $('.recom-shop').each(function() {  
280 - shopIds.push($(this).attr('shopId'));  
281 - });  
282 - shopIds.length &&  
283 - $.ajax({  
284 - type: 'POST',  
285 - url: '/channel/shopRecom',  
286 - data: {  
287 - shopIds: shopIds.join(','),  
288 - },  
289 - }).then(function(result) {  
290 - if (result.code === 200) {  
291 - for (var i = 0, elem;  
292 - (elem = result.data[i]) != null; i++) {  
293 - var a = $('.recom-shop[shopId = ' + elem.id + ']');  
294 -  
295 - a.find('.faved-num').text(elem.collectionNum + '人已收藏');  
296 - if (elem.favorite) {  
297 - a.find('.fav-no').hide();  
298 - a.find('.fav-yes').show();  
299 - }  
300 } 260 }
301 - }  
302 - });  
303 -};  
304 -  
305 -checkShop();  
306 261
307 -// 店铺收藏 || 取消收藏  
308 -var $collect = $('.fav-container'); 262 + // 店铺收藏 || 取消收藏
  263 + var $collect = $('.fav-container');
309 264
310 -$collect.on('touchstart', function() { 265 + $collect.on('touchstart', function() {
311 var opt = $(this).hasClass('fav-yes') ? 'cancel' : 'ok'; 266 var opt = $(this).hasClass('fav-yes') ? 'cancel' : 'ok';
312 var self = $(this); 267 var self = $(this);
313 var num = parseInt(self.parent().find('.faved-num').html()); 268 var num = parseInt(self.parent().find('.faved-num').html());
314 269
315 $.ajax({ 270 $.ajax({
316 method: 'get', 271 method: 'get',
317 - url: location.protocol + '//m.yohobuy.com' + '/product/opt/favoriteBrand', 272 + url: location.protocol + '//m.yohobuy.com/product/opt/favoriteBrand',
318 data: { 273 data: {
319 id: self.parent().attr('shopId'), 274 id: self.parent().attr('shopId'),
320 opt: opt, 275 opt: opt,
@@ -352,10 +307,10 @@ $collect.on('touchstart', function() { @@ -352,10 +307,10 @@ $collect.on('touchstart', function() {
352 tip.show('网络断开连接了~'); 307 tip.show('网络断开连接了~');
353 } 308 }
354 }); 309 });
355 -}); 310 + });
356 311
357 -// vip专属等级查询  
358 -$.ajax({ 312 + // vip专属等级查询
  313 + $.ajax({
359 method: 'POST', 314 method: 'POST',
360 url: location.protocol + '//m.yohobuy.com/channel/userVip', 315 url: location.protocol + '//m.yohobuy.com/channel/userVip',
361 data: { 316 data: {
@@ -372,43 +327,93 @@ $.ajax({ @@ -372,43 +327,93 @@ $.ajax({
372 error: function() { 327 error: function() {
373 tip.show('网络断开连接了~'); 328 tip.show('网络断开连接了~');
374 } 329 }
375 -}); 330 + });
376 331
377 -// sale倒计时  
378 -var saleTime = function(elem, offsetTime) {  
379 - var hour = parseInt(offsetTime / (60 * 60), 10),  
380 - minute = parseInt(offsetTime % (60 * 60) / 60, 10),  
381 - second = offsetTime % 60; 332 + checkShop();
382 333
383 - if (offsetTime <= -1) { // 结束倒计时刷新状态  
384 - $(elem).find('.limit').hide();  
385 - } 334 + var limitFloor = $('.sale-floor-time');
386 335
387 - if (offsetTime >= -1) {  
388 - $(elem).find('.hour').text(hour < 0 ? '00' : (hour < 10 ? ('0' + hour) : hour));  
389 - $(elem).find('.minute').text(minute < 0 ? '00' : (minute < 10 ? ('0' + minute) : minute));  
390 - $(elem).find('.second').text(second < 0 ? '00' : (second < 10 ? ('0' + second) : second)); 336 + limitFloor.each(function() {
  337 + var endTime = $(this).attr('data-time'),
391 338
392 - if (offsetTime <= -1) { // 结束倒计时刷新状态  
393 - $(elem).find('.limit').hide(); 339 + // ~~两次取反位运算就是取整
  340 + limit = ~~((endTime * 1000 - Date.now()) / 1000);
  341 +
  342 + saleTime(this, limit);
  343 + });
  344 +}
  345 +
  346 +// 异步获取首屏其余楼层
  347 +var getResourceContent = function() {
  348 + $.ajax({
  349 + type: 'GET',
  350 + url: '/channel/getResourceContent',
  351 + data: {
  352 + gender: $mobileWrap.data('channel')
  353 + },
  354 + }).then(function(result) {
  355 + var resourceTemplate = channelContentHbs({content: result});
  356 +
  357 + $resourceContent.append(resourceTemplate);
  358 + lazyLoad($resourceContent.find('img.lazy:not([src])'));
  359 +
  360 + ajaxResource();
  361 + });
  362 +};
  363 +
  364 +setTimeout(function() {
  365 + getResourceContent();
  366 +}, 50);
  367 +
  368 +// logo动画
  369 +function tsAnimate() {
  370 + start = start + 10;
  371 + $logotrans.css({
  372 + transform: 'rotateX(' + start + 'deg)',
  373 + '-webkit-transform': 'rotateX(' + start + 'deg)',
  374 + '-moz-transform': 'rotateX(' + start + 'deg)'
  375 + });
  376 + if (start / 90 % 2 === 1) {
  377 + if (isen) {
  378 + $logotrans.addClass('animate');
  379 + isen = false;
394 } else { 380 } else {
395 - setTimeout(function() {  
396 - saleTime(elem, --offsetTime);  
397 - }, 1000); 381 + $logotrans.removeClass('animate');
  382 + isen = true;
398 } 383 }
399 } 384 }
  385 + if (start / 90 % 2 === 0 && start % 360 !== 0) {
  386 + window.setTimeout(tsAnimate, 3000);
  387 + } else {
  388 + if (start % 360 === 0) {
  389 + window.setTimeout(tsAnimate, 60 * 1000);
  390 + } else {
  391 + window.requestAnimationFrame(tsAnimate);
  392 + }
  393 + }
  394 +}
400 395
401 -}; 396 +setTimeout(tsAnimate, 3000);
402 397
403 -var limitFloor = $('.sale-floor-time'); 398 +$('.home-header .iconfont').on('touchstart', function() {
  399 + $(this).addClass('highlight');
  400 +}).on('touchend touchcancel', function() {
  401 + $(this).removeClass('highlight');
  402 +});
404 403
405 -limitFloor.each(function() {  
406 - var endTime = $(this).attr('data-time'), 404 +// 底部留出tab 的高度
  405 +window.reMarginFooter('.footer-tab');
407 406
408 - // ~~两次取反位运算就是取整  
409 - limit = ~~((endTime * 1000 - Date.now()) / 1000); 407 +// 原有项目 _Channel 写错位置,这里清理掉
  408 +window.setCookie('_Channel', $mobileWrap.data('channel'), {
  409 + expires: -1,
  410 + domain: '.m.yohobuy.com'
  411 +});
410 412
411 - saleTime(this, limit); 413 +// 记录当前 _Channel
  414 +window.setCookie('_Channel', $mobileWrap.data('channel'), {
  415 + expires: 30,
  416 + domain: '.yohobuy.com'
412 }); 417 });
413 418
414 require('./maybe-like')(); 419 require('./maybe-like')();