Merge branch 'develop' of http://git.dev.yoho.cn/web/yohobuy into develop
Showing
10 changed files
with
164 additions
and
95 deletions
framework @ 119c247f
@@ -15,36 +15,52 @@ var winH = $(window).height(), | @@ -15,36 +15,52 @@ var winH = $(window).height(), | ||
15 | end = false, | 15 | end = false, |
16 | page = 0, | 16 | page = 0, |
17 | gender = $('.mobile-wrap').hasClass('boys-wrap') ? '1,3' : '2,3', | 17 | gender = $('.mobile-wrap').hasClass('boys-wrap') ? '1,3' : '2,3', |
18 | + kidsType = $('.mobile-wrap').hasClass('kids-wrap') ? true : false, | ||
18 | num, | 19 | num, |
20 | + url, | ||
19 | res; | 21 | res; |
20 | 22 | ||
23 | +///recom/maylikekids | ||
24 | +if(kidsType){ | ||
25 | + url = '/product/recom/maylikekids'; | ||
26 | +} | ||
27 | +else | ||
28 | +{ | ||
29 | + url = '/product/recom/maylike?gender=' + gender; | ||
30 | +} | ||
31 | + | ||
21 | //srcoll to load more | 32 | //srcoll to load more |
22 | $(window).scroll(function () { | 33 | $(window).scroll(function () { |
23 | if ($(window).scrollTop() + winH >= $(document).height() - loadMoreH) { | 34 | if ($(window).scrollTop() + winH >= $(document).height() - loadMoreH) { |
35 | + if (loading) { | ||
36 | + return; | ||
37 | + } | ||
24 | loading = true; | 38 | loading = true; |
25 | num = $goodList.children('.good-info').length; | 39 | num = $goodList.children('.good-info').length; |
26 | $.ajax({ | 40 | $.ajax({ |
27 | type: 'GET', | 41 | type: 'GET', |
28 | - url: '/product/recom/maylike?gender=' + gender, | 42 | + url: url, |
29 | data: { | 43 | data: { |
30 | page: page + 1 | 44 | page: page + 1 |
31 | }, | 45 | }, |
32 | success: function(data) { | 46 | success: function(data) { |
33 | - if (data.code === 200) { | ||
34 | - res = data.data; | 47 | + if (data === ' ') { |
48 | + //opt.end = true; | ||
49 | + loading = false; | ||
35 | 50 | ||
36 | - if (res.end) { | ||
37 | - end = res.end; | ||
38 | - } | 51 | + $loading.addClass('hide'); |
52 | + $noMore.removeClass('hide'); | ||
39 | 53 | ||
40 | - $goodList.append(res.product); | 54 | + return; |
55 | + } | ||
56 | + $goodList.append(data); | ||
41 | 57 | ||
42 | - //lazyLoad | ||
43 | - lazyLoad($goodList.children('.good-info:gt(' + (num - 1) + ')').find('img.lazy')); | 58 | + //lazyLoad |
59 | + //lazyLoad($goodList.children('.good-info:gt(' + (num - 1) + ')').find('img.lazy')); | ||
60 | + lazyLoad($('.good-info').find('img.lazy')); | ||
44 | 61 | ||
45 | - loading = false; | ||
46 | - page++; | ||
47 | - } | 62 | + loading = false; |
63 | + page++; | ||
48 | }, | 64 | }, |
49 | error: function() { | 65 | error: function() { |
50 | tip.show('网络断开连接了~'); | 66 | tip.show('网络断开连接了~'); |
@@ -7,6 +7,17 @@ var $curNav, | @@ -7,6 +7,17 @@ var $curNav, | ||
7 | $newArrivalList = $('#newarrival-goods-list'), | 7 | $newArrivalList = $('#newarrival-goods-list'), |
8 | $goods = $newArrivalList.children('.goods-list'); | 8 | $goods = $newArrivalList.children('.goods-list'); |
9 | 9 | ||
10 | +var winH = $(window).height(), | ||
11 | + loadMoreH = $('#load-more').height(), | ||
12 | + $goodList = $('.goods-list'), | ||
13 | + loading = false, | ||
14 | + end = false, | ||
15 | + page = 0, | ||
16 | + index = 0, | ||
17 | + num, | ||
18 | + url, | ||
19 | + res; | ||
20 | + | ||
10 | var swiper; | 21 | var swiper; |
11 | 22 | ||
12 | swiper = new Swiper('.swiper-container', { | 23 | swiper = new Swiper('.swiper-container', { |
@@ -19,8 +30,8 @@ $curNav = $navList.children('.focus'); | @@ -19,8 +30,8 @@ $curNav = $navList.children('.focus'); | ||
19 | 30 | ||
20 | $('#newarrival-nav').delegate('li', 'touchstart', function() { | 31 | $('#newarrival-nav').delegate('li', 'touchstart', function() { |
21 | var $this = $(this), | 32 | var $this = $(this), |
22 | - $content, | ||
23 | - index; | 33 | + $content; |
34 | + | ||
24 | 35 | ||
25 | if ($this.hasClass('focus')) { | 36 | if ($this.hasClass('focus')) { |
26 | return; | 37 | return; |
@@ -38,4 +49,46 @@ $('#newarrival-nav').delegate('li', 'touchstart', function() { | @@ -38,4 +49,46 @@ $('#newarrival-nav').delegate('li', 'touchstart', function() { | ||
38 | $curNav = $this; | 49 | $curNav = $this; |
39 | 50 | ||
40 | $(document).trigger('scroll'); //Trigger lazyLoad | 51 | $(document).trigger('scroll'); //Trigger lazyLoad |
52 | +}); | ||
53 | + | ||
54 | +//srcoll to load more | ||
55 | +$(window).scroll(function () { | ||
56 | + if ($(window).scrollTop() + winH >= $(document).height() - loadMoreH) { | ||
57 | + if (loading) { | ||
58 | + return; | ||
59 | + } | ||
60 | + loading = true; | ||
61 | + num = $goodList.children('.good-info').length; | ||
62 | + $.ajax({ | ||
63 | + type: 'GET', | ||
64 | + url: '/product/newsale/selectNewSale?dayLimit'+(index+1), | ||
65 | + data: { | ||
66 | + page: page + 1 | ||
67 | + }, | ||
68 | + success: function(data) { | ||
69 | + if (data === ' ') { | ||
70 | + //opt.end = true; | ||
71 | + loading = false; | ||
72 | + | ||
73 | + $loading.addClass('hide'); | ||
74 | + $noMore.removeClass('hide'); | ||
75 | + | ||
76 | + return; | ||
77 | + } | ||
78 | + $goodList.append(data); | ||
79 | + | ||
80 | + //lazyLoad | ||
81 | + //lazyLoad($goodList.children('.good-info:gt(' + (num - 1) + ')').find('img.lazy')); | ||
82 | + lazyLoad($('.good-info').find('img.lazy')); | ||
83 | + | ||
84 | + loading = false; | ||
85 | + page++; | ||
86 | + }, | ||
87 | + error: function() { | ||
88 | + tip.show('网络断开连接了~'); | ||
89 | + loading = false; | ||
90 | + } | ||
91 | + }); | ||
92 | + } | ||
93 | + | ||
41 | }); | 94 | }); |
@@ -12,10 +12,6 @@ | @@ -12,10 +12,6 @@ | ||
12 | 12 | ||
13 | {{> home/content}} | 13 | {{> home/content}} |
14 | 14 | ||
15 | - {{! 可能喜欢}} | ||
16 | - {{# maybeLike}} | ||
17 | - {{> home/maybe_like}} | ||
18 | - {{/ maybeLike}} | ||
19 | <div class="overlay"></div> | 15 | <div class="overlay"></div> |
20 | </div> | 16 | </div> |
21 | {{> home/side_nav}} | 17 | {{> home/side_nav}} |
@@ -14,6 +14,13 @@ | @@ -14,6 +14,13 @@ | ||
14 | {{> product/goods_container}} | 14 | {{> product/goods_container}} |
15 | </div> | 15 | </div> |
16 | 16 | ||
17 | + <div id="load-more-info" class="load-more-info"> | ||
18 | + <div class="loading status hide"> | ||
19 | + 正在加载... | ||
20 | + </div> | ||
21 | + <span class="no-more status hide">没有更多啦</span> | ||
22 | + </div> | ||
23 | + | ||
17 | </div> | 24 | </div> |
18 | {{>layout/footer}} | 25 | {{>layout/footer}} |
19 | 26 |
@@ -14,6 +14,13 @@ | @@ -14,6 +14,13 @@ | ||
14 | {{> product/goods_container}} | 14 | {{> product/goods_container}} |
15 | </div> | 15 | </div> |
16 | 16 | ||
17 | + <div id="load-more-info" class="load-more-info"> | ||
18 | + <div class="loading status"> | ||
19 | + 正在加载... | ||
20 | + </div> | ||
21 | + <span class="no-more status hide">没有更多啦</span> | ||
22 | + </div> | ||
23 | + | ||
17 | </div> | 24 | </div> |
18 | {{>layout/footer}} | 25 | {{>layout/footer}} |
19 | 26 |
1 | - | ||
2 | - {{# content}} | ||
3 | - {{! 头部banner}} | ||
4 | - {{# bannerTop}} | ||
5 | - {{> home/banner_top}} | ||
6 | - {{/ bannerTop}} | ||
7 | - | ||
8 | - {{! 图标入口}} | ||
9 | - {{# iconsEnter}} | ||
10 | - {{> home/icons_enter}} | ||
11 | - {{/ iconsEnter}} | ||
12 | - | ||
13 | - {{! 中间banner}} | ||
14 | - {{# banner}} | ||
15 | - {{> home/banner}} | ||
16 | - {{/ banner}} | ||
17 | - | ||
18 | - {{! 热门品类}} | ||
19 | - {{# hotCategory}} | ||
20 | - {{> home/hot_category}} | ||
21 | - {{/ hotCategory}} | ||
22 | - | ||
23 | - {{! 热门品牌}} | ||
24 | - {{# hotBrands}} | ||
25 | - {{> home/hot_brands_list}} | ||
26 | - {{/ hotBrands}} | ||
27 | - | ||
28 | - {{! 热门品牌可滑动}} | ||
29 | - {{# hotBrandsScroll}} | ||
30 | - {{> home/hot_brands_swipe}} | ||
31 | - {{/ hotBrandsScroll}} | ||
32 | - | ||
33 | - {{! 潮人搭配}} | ||
34 | - {{# trendColloaction}} | ||
35 | - {{> home/trendsetter_collocation}} | ||
36 | - {{/trendColloaction}} | ||
37 | - | ||
38 | - {{! 潮流话题}} | ||
39 | - {{# trendTopics}} | ||
40 | - {{> home/trend_topics}} | ||
41 | - {{/ trendTopics}} | ||
42 | - | ||
43 | - {{! 潮流时装/经典裤裙/时尚靴履/潮人配饰/潮流上装}} | ||
44 | - {{# goodsCategory}} | ||
45 | - {{> home/goods_category}} | ||
46 | - {{/ goodsCategory}} | ||
47 | - | ||
48 | - {{! 新入住品牌/品味生活/创意生活}} | ||
49 | - {{# creativeLife}} | ||
50 | - {{> home/creative_life}} | ||
51 | - {{/ creativeLife}} | ||
52 | - | ||
53 | - {{! PLUS}} | ||
54 | - {{# plusStar}} | ||
55 | - {{> home/plus_star}} | ||
56 | - {{/ plusStar}} | ||
57 | - | ||
58 | - {{! 可能喜欢}} | ||
59 | - {{> home/maybe_like}} | ||
60 | - | ||
61 | - | ||
62 | - {{/ content}} | ||
1 | +{{# content}} | ||
2 | + {{! 头部banner}} | ||
3 | + {{# bannerTop}} | ||
4 | + {{> home/banner_top}} | ||
5 | + {{/ bannerTop}} | ||
6 | + | ||
7 | + {{! 图标入口}} | ||
8 | + {{# iconsEnter}} | ||
9 | + {{> home/icons_enter}} | ||
10 | + {{/ iconsEnter}} | ||
11 | + | ||
12 | + {{! 中间banner}} | ||
13 | + {{# banner}} | ||
14 | + {{> home/banner}} | ||
15 | + {{/ banner}} | ||
16 | + | ||
17 | + {{! 热门品类}} | ||
18 | + {{# hotCategory}} | ||
19 | + {{> home/hot_category}} | ||
20 | + {{/ hotCategory}} | ||
21 | + | ||
22 | + {{! 热门品牌}} | ||
23 | + {{# hotBrands}} | ||
24 | + {{> home/hot_brands_list}} | ||
25 | + {{/ hotBrands}} | ||
26 | + | ||
27 | + {{! 热门品牌可滑动}} | ||
28 | + {{# hotBrandsScroll}} | ||
29 | + {{> home/hot_brands_swipe}} | ||
30 | + {{/ hotBrandsScroll}} | ||
31 | + | ||
32 | + {{! 潮人搭配}} | ||
33 | + {{# trendColloaction}} | ||
34 | + {{> home/trendsetter_collocation}} | ||
35 | + {{/trendColloaction}} | ||
36 | + | ||
37 | + {{! 潮流话题}} | ||
38 | + {{# trendTopics}} | ||
39 | + {{> home/trend_topics}} | ||
40 | + {{/ trendTopics}} | ||
41 | + | ||
42 | + {{! 潮流时装/经典裤裙/时尚靴履/潮人配饰/潮流上装}} | ||
43 | + {{# goodsCategory}} | ||
44 | + {{> home/goods_category}} | ||
45 | + {{/ goodsCategory}} | ||
46 | + | ||
47 | + {{! 新入住品牌/品味生活/创意生活}} | ||
48 | + {{# creativeLife}} | ||
49 | + {{> home/creative_life}} | ||
50 | + {{/ creativeLife}} | ||
51 | + | ||
52 | + {{! PLUS}} | ||
53 | + {{# plusStar}} | ||
54 | + {{> home/plus_star}} | ||
55 | + {{/ plusStar}} | ||
56 | +{{/ content}} | ||
57 | + | ||
58 | +{{! 可能喜欢}} | ||
59 | +{{> home/maybe_like}} |
@@ -3,18 +3,13 @@ | @@ -3,18 +3,13 @@ | ||
3 | <i class="icon"></i> | 3 | <i class="icon"></i> |
4 | <span>你可能喜欢</span> | 4 | <span>你可能喜欢</span> |
5 | </p> | 5 | </p> |
6 | - {{# maybeLike}} | ||
7 | - <div class="goods-list clearfix"> | ||
8 | - {{# goods}} | ||
9 | - {{> good}} | ||
10 | - {{/ goods}} | ||
11 | - </div> | ||
12 | - {{/ maybeLike}} | 6 | + |
7 | + <div id="goods-list" class="goods-list clearfix"></div> | ||
13 | 8 | ||
14 | <div id="load-more-info" class="load-more-info"> | 9 | <div id="load-more-info" class="load-more-info"> |
15 | - <div class="loading status"> | ||
16 | - 正在加载... | ||
17 | - </div> | ||
18 | - <span class="no-more status hide">没有更多啦</span> | 10 | + <div class="loading status"> |
11 | + 正在加载... | ||
19 | </div> | 12 | </div> |
13 | + <span class="no-more status hide">没有更多啦</span> | ||
14 | + </div> | ||
20 | </div> | 15 | </div> |
@@ -85,7 +85,7 @@ | @@ -85,7 +85,7 @@ | ||
85 | {{!-- 首页 --}} | 85 | {{!-- 首页 --}} |
86 | {{#if grilsHomePage}} | 86 | {{#if grilsHomePage}} |
87 | <script> | 87 | <script> |
88 | - seajs.use('js/home/home'); | 88 | + seajs.use('js/home/home'); |
89 | </script> | 89 | </script> |
90 | {{/if}} | 90 | {{/if}} |
91 | {{#if boysHomePage}} | 91 | {{#if boysHomePage}} |
@@ -29,8 +29,6 @@ class GirlsController extends AbstractAction | @@ -29,8 +29,6 @@ class GirlsController extends AbstractAction | ||
29 | if (isset($channelData['code']) && $channelData['code'] == 200) { | 29 | if (isset($channelData['code']) && $channelData['code'] == 200) { |
30 | $data['content'] = FloorProcess::getContent($channelData['data'], 2); | 30 | $data['content'] = FloorProcess::getContent($channelData['data'], 2); |
31 | } | 31 | } |
32 | - | ||
33 | - $data['maybeLike'] = true; | ||
34 | 32 | ||
35 | $this->_view->display('index', $data); | 33 | $this->_view->display('index', $data); |
36 | } | 34 | } |
-
Please register or login to post a comment