Merge branch 'feature/wap323' into 'feature/wap323'
优化品牌一览页面导航切换用户体验。 code review by 张振 优化品牌一览页面导航切换用户体验。 code review by 张振 See merge request !96
Showing
3 changed files
with
53 additions
and
32 deletions
@@ -7,6 +7,7 @@ | @@ -7,6 +7,7 @@ | ||
7 | var $ = require('jquery'), | 7 | var $ = require('jquery'), |
8 | Hammer = require('yoho.hammer'), | 8 | Hammer = require('yoho.hammer'), |
9 | Swiper = require('yoho.iswiper'), | 9 | Swiper = require('yoho.iswiper'), |
10 | + loading = require('../plugin/loading'), | ||
10 | lazyLoad = require('yoho.lazyload'); | 11 | lazyLoad = require('yoho.lazyload'); |
11 | 12 | ||
12 | var swiper, | 13 | var swiper, |
@@ -25,6 +26,8 @@ var brandsData, | @@ -25,6 +26,8 @@ var brandsData, | ||
25 | $keyword, | 26 | $keyword, |
26 | clearTextHammer; | 27 | clearTextHammer; |
27 | 28 | ||
29 | +loading.showLoadingMask(); | ||
30 | + | ||
28 | //热门品牌滑动 | 31 | //热门品牌滑动 |
29 | hotBrandsSwiper = new Swiper('.brands-swiper', { | 32 | hotBrandsSwiper = new Swiper('.brands-swiper', { |
30 | grabCursor: true, | 33 | grabCursor: true, |
@@ -47,9 +50,14 @@ $('.yoho-header').css({ | @@ -47,9 +50,14 @@ $('.yoho-header').css({ | ||
47 | top: 0 | 50 | top: 0 |
48 | }); | 51 | }); |
49 | 52 | ||
50 | -if ($('.banner-top').length > 0) { | ||
51 | - $('.hot-brands').css('padding-top', '0'); | ||
52 | -} | 53 | +(function() { |
54 | + if ($('.banner-top').length > 0) { | ||
55 | + $('.hot-brands').css('padding-top', '0'); | ||
56 | + } | ||
57 | + | ||
58 | + $('.hide-when-loading').show(); | ||
59 | + loading.hideLoadingMask(); | ||
60 | +})(); | ||
53 | 61 | ||
54 | $fixTitleBar = $('<div class="title-bar fixed-title-bar"><h2></h2></div>'); | 62 | $fixTitleBar = $('<div class="title-bar fixed-title-bar"><h2></h2></div>'); |
55 | $fixTitleBar.css({ | 63 | $fixTitleBar.css({ |
@@ -181,8 +189,16 @@ if ($('.brand-search-page').length) { | @@ -181,8 +189,16 @@ if ($('.brand-search-page').length) { | ||
181 | 189 | ||
182 | if ($genderItem.length > 0) { | 190 | if ($genderItem.length > 0) { |
183 | $genderItem.on('touchstart', function() { | 191 | $genderItem.on('touchstart', function() { |
192 | + var index = $(this).data('id') + 1; | ||
193 | + | ||
184 | $('.genderNav ul .active').removeClass('active'); | 194 | $('.genderNav ul .active').removeClass('active'); |
185 | $(this).addClass('active'); | 195 | $(this).addClass('active'); |
186 | - window.location.search = 'channel=' + ($(this).data('id') + 1); | 196 | + $('.hide-when-loading').hide(); |
197 | + loading.showLoadingMask(); | ||
198 | + function reload() { | ||
199 | + window.location.search = 'channel=' + index; | ||
200 | + } | ||
201 | + setTimeout(reload.bind(this), 100); | ||
187 | }); | 202 | }); |
188 | } | 203 | } |
204 | + |
@@ -2,6 +2,9 @@ | @@ -2,6 +2,9 @@ | ||
2 | .re-pos-search { | 2 | .re-pos-search { |
3 | top: 170rem / $pxConvertRem !important; | 3 | top: 170rem / $pxConvertRem !important; |
4 | } | 4 | } |
5 | + .hide-when-loading { | ||
6 | + display: none; | ||
7 | + } | ||
5 | .genderNav { | 8 | .genderNav { |
6 | display: block; | 9 | display: block; |
7 | width: 100%; | 10 | width: 100%; |
@@ -21,38 +21,40 @@ | @@ -21,38 +21,40 @@ | ||
21 | </a> | 21 | </a> |
22 | </div> | 22 | </div> |
23 | </div> | 23 | </div> |
24 | + <div class="hide-when-loading"> | ||
25 | + {{# topData}} | ||
26 | + {{! 头部banner}} | ||
27 | + {{# bannerTop}} | ||
28 | + {{> home/banner_top}} | ||
29 | + {{/ bannerTop}} | ||
24 | 30 | ||
25 | - {{# topData}} | ||
26 | - {{! 头部banner}} | ||
27 | - {{# bannerTop}} | ||
28 | - {{> home/banner_top}} | ||
29 | - {{/ bannerTop}} | 31 | + {{! 热门品牌可滑动}} |
32 | + {{# hotBrandsScroll}} | ||
33 | + {{> home/hot_brands_swipe}} | ||
34 | + {{/ hotBrandsScroll}} | ||
35 | + {{/ topData}} | ||
30 | 36 | ||
31 | - {{! 热门品牌可滑动}} | ||
32 | - {{# hotBrandsScroll}} | ||
33 | - {{> home/hot_brands_swipe}} | ||
34 | - {{/ hotBrandsScroll}} | ||
35 | - {{/ topData}} | ||
36 | - | ||
37 | - {{# brandList}} | ||
38 | - <div class="brand-list bar-{{@index}}"> | ||
39 | - <div class="title-bar"> | ||
40 | - <h2 style="position: static;">{{title}}</h2> | 37 | + {{# brandList}} |
38 | + <div class="brand-list bar-{{@index}}"> | ||
39 | + <div class="title-bar"> | ||
40 | + <h2 style="position: static;">{{title}}</h2> | ||
41 | + </div> | ||
42 | + {{# list}} | ||
43 | + <p> | ||
44 | + <a href="{{url}}">{{name}} | ||
45 | + {{# isHot}} | ||
46 | + <i class="icon-hot">HOT</i> | ||
47 | + {{/ isHot}} | ||
48 | + {{# isNew}} | ||
49 | + <i class="icon-new">NEW</i> | ||
50 | + {{/ isNew}} | ||
51 | + </a> | ||
52 | + </p> | ||
53 | + {{/ list}} | ||
41 | </div> | 54 | </div> |
42 | - {{# list}} | ||
43 | - <p> | ||
44 | - <a href="{{url}}">{{name}} | ||
45 | - {{# isHot}} | ||
46 | - <i class="icon-hot">HOT</i> | ||
47 | - {{/ isHot}} | ||
48 | - {{# isNew}} | ||
49 | - <i class="icon-new">NEW</i> | ||
50 | - {{/ isNew}} | ||
51 | - </a> | ||
52 | - </p> | ||
53 | - {{/ list}} | 55 | + {{/ brandList}} |
54 | </div> | 56 | </div> |
55 | - {{/ brandList}} | 57 | + |
56 | 58 | ||
57 | {{/channel}} | 59 | {{/channel}} |
58 | {{> layout/footer}} | 60 | {{> layout/footer}} |
-
Please register or login to post a comment