Authored by hf

Merge branch 'develop' of http://git.dev.yoho.cn/web/yohobuy into develop

@@ -12,29 +12,22 @@ var winH = $(window).height(), @@ -12,29 +12,22 @@ var winH = $(window).height(),
12 loadMoreH = $('#load-more').height(), 12 loadMoreH = $('#load-more').height(),
13 $goodList = $('#goods-list'), 13 $goodList = $('#goods-list'),
14 loading = false, 14 loading = false,
15 - end = false,  
16 page = 0, 15 page = 0,
17 gender = $('.mobile-wrap').hasClass('boys-wrap') ? '1,3' : '2,3', 16 gender = $('.mobile-wrap').hasClass('boys-wrap') ? '1,3' : '2,3',
18 kidsType = $('.mobile-wrap').hasClass('kids-wrap') ? true : false, 17 kidsType = $('.mobile-wrap').hasClass('kids-wrap') ? true : false,
19 num, 18 num,
20 - url,  
21 - res; 19 + url;
22 20
23 ///recom/maylikekids 21 ///recom/maylikekids
24 -if(kidsType){ 22 +if (kidsType) {
25 url = '/product/recom/maylikekids'; 23 url = '/product/recom/maylikekids';
26 -}  
27 -else  
28 -{ 24 +} else {
29 url = '/product/recom/maylike?gender=' + gender; 25 url = '/product/recom/maylike?gender=' + gender;
30 } 26 }
31 27
32 //srcoll to load more 28 //srcoll to load more
33 $(window).scroll(function () { 29 $(window).scroll(function () {
34 if ($(window).scrollTop() + winH >= $(document).height() - loadMoreH) { 30 if ($(window).scrollTop() + winH >= $(document).height() - loadMoreH) {
35 - if (loading) {  
36 - return;  
37 - }  
38 loading = true; 31 loading = true;
39 num = $goodList.children('.good-info').length; 32 num = $goodList.children('.good-info').length;
40 $.ajax({ 33 $.ajax({
@@ -44,15 +37,6 @@ $(window).scroll(function () { @@ -44,15 +37,6 @@ $(window).scroll(function () {
44 page: page + 1 37 page: page + 1
45 }, 38 },
46 success: function(data) { 39 success: function(data) {
47 - if (data === ' ') {  
48 - //opt.end = true;  
49 - loading = false;  
50 -  
51 - $loading.addClass('hide');  
52 - $noMore.removeClass('hide');  
53 -  
54 - return;  
55 - }  
56 $goodList.append(data); 40 $goodList.append(data);
57 41
58 //lazyLoad 42 //lazyLoad
@@ -60,7 +44,7 @@ $(window).scroll(function () { @@ -60,7 +44,7 @@ $(window).scroll(function () {
60 lazyLoad($('.good-info').find('img.lazy')); 44 lazyLoad($('.good-info').find('img.lazy'));
61 45
62 loading = false; 46 loading = false;
63 - page++; 47 + page++;
64 }, 48 },
65 error: function() { 49 error: function() {
66 tip.show('网络断开连接了~'); 50 tip.show('网络断开连接了~');
1 var $ = require('yoho.zepto'), 1 var $ = require('yoho.zepto'),
  2 + tip = require('../../plugin/tip'),
2 Swiper = require('yoho.iswiper'), 3 Swiper = require('yoho.iswiper'),
3 lazyLoad = require('yoho.zeptolazyload'); 4 lazyLoad = require('yoho.zeptolazyload');
4 5
@@ -11,12 +12,9 @@ var winH = $(window).height(), @@ -11,12 +12,9 @@ var winH = $(window).height(),
11 loadMoreH = $('#load-more').height(), 12 loadMoreH = $('#load-more').height(),
12 $goodList = $('.goods-list'), 13 $goodList = $('.goods-list'),
13 loading = false, 14 loading = false,
14 - end = false,  
15 page = 0, 15 page = 0,
16 index = 0, 16 index = 0,
17 - num,  
18 - url,  
19 - res; 17 + num;
20 18
21 var swiper; 19 var swiper;
22 20
@@ -31,7 +29,7 @@ $curNav = $navList.children('.focus'); @@ -31,7 +29,7 @@ $curNav = $navList.children('.focus');
31 $('#newarrival-nav').delegate('li', 'touchstart', function() { 29 $('#newarrival-nav').delegate('li', 'touchstart', function() {
32 var $this = $(this), 30 var $this = $(this),
33 $content; 31 $content;
34 - 32 +
35 33
36 if ($this.hasClass('focus')) { 34 if ($this.hasClass('focus')) {
37 return; 35 return;
@@ -55,26 +53,24 @@ $('#newarrival-nav').delegate('li', 'touchstart', function() { @@ -55,26 +53,24 @@ $('#newarrival-nav').delegate('li', 'touchstart', function() {
55 $(window).scroll(function () { 53 $(window).scroll(function () {
56 if ($(window).scrollTop() + winH >= $(document).height() - loadMoreH) { 54 if ($(window).scrollTop() + winH >= $(document).height() - loadMoreH) {
57 if (loading) { 55 if (loading) {
58 - return; 56 + return;
59 } 57 }
60 loading = true; 58 loading = true;
61 num = $goodList.children('.good-info').length; 59 num = $goodList.children('.good-info').length;
62 $.ajax({ 60 $.ajax({
63 type: 'GET', 61 type: 'GET',
64 - url: '/product/newsale/selectNewSale?dayLimit'+(index+1), 62 + url: '/product/newsale/selectNewSale?dayLimit' + (index + 1),
65 data: { 63 data: {
66 page: page + 1 64 page: page + 1
67 }, 65 },
68 success: function(data) { 66 success: function(data) {
69 if (data === ' ') { 67 if (data === ' ') {
  68 +
70 //opt.end = true; 69 //opt.end = true;
71 loading = false; 70 loading = false;
72 -  
73 - $loading.addClass('hide');  
74 - $noMore.removeClass('hide');  
75 -  
76 return; 71 return;
77 - } 72 + }
  73 +
78 $goodList.append(data); 74 $goodList.append(data);
79 75
80 //lazyLoad 76 //lazyLoad
@@ -82,7 +78,7 @@ $(window).scroll(function () { @@ -82,7 +78,7 @@ $(window).scroll(function () {
82 lazyLoad($('.good-info').find('img.lazy')); 78 lazyLoad($('.good-info').find('img.lazy'));
83 79
84 loading = false; 80 loading = false;
85 - page++; 81 + page++;
86 }, 82 },
87 error: function() { 83 error: function() {
88 tip.show('网络断开连接了~'); 84 tip.show('网络断开连接了~');