Merge branch 'develop' of http://git.dev.yoho.cn/web/yohobuy into develop
Showing
14 changed files
with
119 additions
and
26 deletions
@@ -63,6 +63,11 @@ | @@ -63,6 +63,11 @@ | ||
63 | //header | 63 | //header |
64 | { | 64 | { |
65 | pageHeader: { | 65 | pageHeader: { |
66 | + //页面主题标识 | ||
67 | + boys: true, | ||
68 | + girls: true, | ||
69 | + kids: true, | ||
70 | + lifeStyle: true, | ||
66 | //对应页面有就传,没有就不传 | 71 | //对应页面有就传,没有就不传 |
67 | navBack: true, | 72 | navBack: true, |
68 | navTitle: '', | 73 | navTitle: '', |
static/img/loading.gif
0 → 100644
8.37 KB
static/js/plugin/loading.js
0 → 100644
1 | +/** | ||
2 | + * Loading mask | ||
3 | + * @author: xuqi<qi.xu@yoho.cn> | ||
4 | + * @date: 2015/10/29 | ||
5 | + */ | ||
6 | + | ||
7 | +var $ = require('yoho.zepto'); | ||
8 | + | ||
9 | +var $page = $('.yoho-page'); | ||
10 | + | ||
11 | +var $loading; | ||
12 | + | ||
13 | +/** | ||
14 | + * 初始化loading mask | ||
15 | + * @param $container loading容器, position:relative | ||
16 | + */ | ||
17 | +function initLoadingMask() { | ||
18 | + var html = '<div class="loading-mask hide"><div class="loading"></div></div>'; | ||
19 | + | ||
20 | + $page.append(html); | ||
21 | + | ||
22 | + $loading = $page.children('.loading-mask'); | ||
23 | +} | ||
24 | + | ||
25 | +//显示loading | ||
26 | +function showLoadingMask() { | ||
27 | + $loading.removeClass('hide'); | ||
28 | +} | ||
29 | + | ||
30 | +//隐藏loading | ||
31 | +function hideLoadingMask() { | ||
32 | + $loading.addClass('hide'); | ||
33 | +} | ||
34 | + | ||
35 | +exports.initLoadingMask = initLoadingMask; | ||
36 | +exports.showLoadingMask = showLoadingMask; | ||
37 | +exports.hideLoadingMask = hideLoadingMask; |
@@ -14,6 +14,7 @@ var $brandHeader = $('#brand-header'), | @@ -14,6 +14,7 @@ var $brandHeader = $('#brand-header'), | ||
14 | var filter = require('../plugin/filter'); | 14 | var filter = require('../plugin/filter'); |
15 | 15 | ||
16 | var tip = require('../plugin/tip'); | 16 | var tip = require('../plugin/tip'); |
17 | +var loading = require('../plugin/loading'); | ||
17 | 18 | ||
18 | var $goodsContainer = $('#goods-container'), | 19 | var $goodsContainer = $('#goods-container'), |
19 | $ngc = $goodsContainer.children('.new-goods'), | 20 | $ngc = $goodsContainer.children('.new-goods'), |
@@ -40,8 +41,8 @@ var $listNav = $('#list-nav'), | @@ -40,8 +41,8 @@ var $listNav = $('#list-nav'), | ||
40 | navInfo = { | 41 | navInfo = { |
41 | newest: { | 42 | newest: { |
42 | order: 1, | 43 | order: 1, |
43 | - reload: false, | ||
44 | - page: 1, | 44 | + reload: true, |
45 | + page: 0, | ||
45 | end: false | 46 | end: false |
46 | }, | 47 | }, |
47 | price: { | 48 | price: { |
@@ -72,6 +73,10 @@ function search(opt) { | @@ -72,6 +73,10 @@ function search(opt) { | ||
72 | nav, navType, | 73 | nav, navType, |
73 | page; | 74 | page; |
74 | 75 | ||
76 | + if (searching) { | ||
77 | + return; | ||
78 | + } | ||
79 | + | ||
75 | if (opt) { | 80 | if (opt) { |
76 | 81 | ||
77 | //筛选项变更则重置reload为true | 82 | //筛选项变更则重置reload为true |
@@ -126,10 +131,6 @@ function search(opt) { | @@ -126,10 +131,6 @@ function search(opt) { | ||
126 | $.extend(defaultOpt, ext); //扩展筛选项 | 131 | $.extend(defaultOpt, ext); //扩展筛选项 |
127 | } | 132 | } |
128 | 133 | ||
129 | - if (searching) { | ||
130 | - return; | ||
131 | - } | ||
132 | - | ||
133 | //导航类别 | 134 | //导航类别 |
134 | if ($pre.hasClass('new')) { | 135 | if ($pre.hasClass('new')) { |
135 | navType = 'newest'; | 136 | navType = 'newest'; |
@@ -157,6 +158,7 @@ function search(opt) { | @@ -157,6 +158,7 @@ function search(opt) { | ||
157 | }); | 158 | }); |
158 | 159 | ||
159 | searching = true; | 160 | searching = true; |
161 | + loading.showLoadingMask(); | ||
160 | 162 | ||
161 | $.ajax({ | 163 | $.ajax({ |
162 | type: 'GET', | 164 | type: 'GET', |
@@ -198,6 +200,7 @@ function search(opt) { | @@ -198,6 +200,7 @@ function search(opt) { | ||
198 | nav.page = page; | 200 | nav.page = page; |
199 | 201 | ||
200 | searching = false; | 202 | searching = false; |
203 | + loading.hideLoadingMask(); | ||
201 | } | 204 | } |
202 | }); | 205 | }); |
203 | 206 | ||
@@ -206,6 +209,7 @@ function search(opt) { | @@ -206,6 +209,7 @@ function search(opt) { | ||
206 | lazyLoad($('.lazy')); | 209 | lazyLoad($('.lazy')); |
207 | 210 | ||
208 | filter.registerCbFn(search); | 211 | filter.registerCbFn(search); |
212 | +loading.initLoadingMask(); | ||
209 | 213 | ||
210 | //导航栏点击逻辑说明: | 214 | //导航栏点击逻辑说明: |
211 | //1.点击非active项时切换active状态 | 215 | //1.点击非active项时切换active状态 |
@@ -356,3 +360,6 @@ $brandHeader.children('.btn-col').bind('tap', function() { | @@ -356,3 +360,6 @@ $brandHeader.children('.btn-col').bind('tap', function() { | ||
356 | } | 360 | } |
357 | }); | 361 | }); |
358 | }); | 362 | }); |
363 | + | ||
364 | +//初始请求最新第一页数据 | ||
365 | +search(); |
static/sass/_loading.scss
0 → 100644
1 | +.loading-mask { | ||
2 | + position: absolute; | ||
3 | + background: rgba(0,0,0,.3); | ||
4 | + top: 0; | ||
5 | + bottom: 0; | ||
6 | + right: 0; | ||
7 | + left: 0; | ||
8 | + | ||
9 | + .loading { | ||
10 | + position: absolute; | ||
11 | + width: 100rem / $pxConvertRem; | ||
12 | + height: 40rem / $pxConvertRem; | ||
13 | + background: image-url('loading.gif') no-repeat; | ||
14 | + background-size: 100% 100%; | ||
15 | + top: 50%; | ||
16 | + left: 50%; | ||
17 | + margin-left: -50rem / $pxConvertRem; | ||
18 | + margin-top: -20rem / $pxConvertRem; | ||
19 | + } | ||
20 | +} |
@@ -93,4 +93,4 @@ a { | @@ -93,4 +93,4 @@ a { | ||
93 | } | 93 | } |
94 | 94 | ||
95 | 95 | ||
96 | -@import "layout/header", "layout/footer", "good", "filter", "passport/index", "guang/index", "home/index", "category/index", "product/index", "index/index", "shopping-cart/index"; | 96 | +@import "layout/header", "layout/footer", "good", "filter", "loading", "passport/index", "guang/index", "home/index", "category/index", "product/index", "index/index", "shopping-cart/index"; |
@@ -26,6 +26,19 @@ | @@ -26,6 +26,19 @@ | ||
26 | line-height: 44px; | 26 | line-height: 44px; |
27 | color: white; | 27 | color: white; |
28 | } | 28 | } |
29 | + | ||
30 | + .yoho-icon { | ||
31 | + float: left; | ||
32 | + margin-right: 10px; | ||
33 | + font-size: 22px; | ||
34 | + line-height: 44px; | ||
35 | + width: 44px; | ||
36 | + height: 44px; | ||
37 | + text-align: center; | ||
38 | + color: #fff; | ||
39 | + background-color: #000; | ||
40 | + border-radius: 10px; | ||
41 | + } | ||
29 | } | 42 | } |
30 | 43 | ||
31 | } | 44 | } |
@@ -7,6 +7,22 @@ | @@ -7,6 +7,22 @@ | ||
7 | height: 88rem / $pxConvertRem; | 7 | height: 88rem / $pxConvertRem; |
8 | line-height: 88rem / $pxConvertRem; | 8 | line-height: 88rem / $pxConvertRem; |
9 | 9 | ||
10 | + &.boys { | ||
11 | + @include background-image(linear-gradient(#323232, #414141)); | ||
12 | + } | ||
13 | + | ||
14 | + &.girls { | ||
15 | + background: #ff88ae; | ||
16 | + } | ||
17 | + | ||
18 | + &.kids { | ||
19 | + background: #7ad9f9; | ||
20 | + } | ||
21 | + | ||
22 | + &.life-style { | ||
23 | + background: #4f4138; | ||
24 | + } | ||
25 | + | ||
10 | .nav-back { | 26 | .nav-back { |
11 | position: absolute; | 27 | position: absolute; |
12 | left: 34rem / $pxConvertRem; | 28 | left: 34rem / $pxConvertRem; |
1 | -<div class="good-info" data-id="{{id}}"> | 1 | +{{#if .}} {{!-- 剔除值为false的项 --}} |
2 | + <div class="good-info" data-id="{{id}}"> | ||
2 | <div class="tag-container clearfix"> | 3 | <div class="tag-container clearfix"> |
3 | {{# tags}} | 4 | {{# tags}} |
4 | {{# is_new}} | 5 | {{# is_new}} |
@@ -37,4 +38,5 @@ | @@ -37,4 +38,5 @@ | ||
37 | {{/price}} | 38 | {{/price}} |
38 | </div> | 39 | </div> |
39 | </div> | 40 | </div> |
40 | -</div> | 41 | + </div> |
42 | +{{/if}} |
@@ -10,7 +10,13 @@ | @@ -10,7 +10,13 @@ | ||
10 | </ul> | 10 | </ul> |
11 | 11 | ||
12 | <div id="goods-list"> | 12 | <div id="goods-list"> |
13 | - {{> product/goods_container}} | 13 | + {{# goodsContainer}} |
14 | + <div class="goods-list {{^show}}hide{{/show}}"> | ||
15 | + {{# goods}} | ||
16 | + {{> good}} | ||
17 | + {{/ goods}} | ||
18 | + </div> | ||
19 | + {{/ goodsContainer}} | ||
14 | </div> | 20 | </div> |
15 | 21 | ||
16 | <div id="load-more-info" class="load-more-info"> | 22 | <div id="load-more-info" class="load-more-info"> |
@@ -20,5 +26,3 @@ | @@ -20,5 +26,3 @@ | ||
20 | <span class="no-more status hide">没有更多啦</span> | 26 | <span class="no-more status hide">没有更多啦</span> |
21 | </div> | 27 | </div> |
22 | </div> | 28 | </div> |
23 | - | ||
24 | - |
1 | {{#showDownloadApp}} | 1 | {{#showDownloadApp}} |
2 | <div class="float-layer hide" id="float-layer-app"> | 2 | <div class="float-layer hide" id="float-layer-app"> |
3 | <div class="float-layer-left"> | 3 | <div class="float-layer-left"> |
4 | - <img src="http://static.yohobuy.com/m/v1/img/yohobuy_new.png" alt=""> | 4 | + <span class="yoho-icon iconfont"></span> |
5 | <p>新用户首单减10元</p> | 5 | <p>新用户首单减10元</p> |
6 | </div> | 6 | </div> |
7 | <a href="javascript:void(0);" id="float-layer-close" > | 7 | <a href="javascript:void(0);" id="float-layer-close" > |
1 | {{#pageHeader}} | 1 | {{#pageHeader}} |
2 | -<header class="yoho-header"> | 2 | +<header class="yoho-header{{#if boys}} boys{{/if}}{{#if girls}} girls{{/if}}{{#if kids}} kids{{/if}}{{#if lifeStyle}} life-style{{/if}}"> |
3 | {{#if navBack}} | 3 | {{#if navBack}} |
4 | <a href="javascript:history.go(-1);" class="nav-back"></a> | 4 | <a href="javascript:history.go(-1);" class="nav-back"></a> |
5 | {{/if}} | 5 | {{/if}} |
@@ -82,11 +82,7 @@ | @@ -82,11 +82,7 @@ | ||
82 | </li> | 82 | </li> |
83 | </ul> | 83 | </ul> |
84 | <div id="goods-container" class="goods-container"> | 84 | <div id="goods-container" class="goods-container"> |
85 | - <div class="new-goods container clearfix"> | ||
86 | - {{# new}} | ||
87 | - {{> good}} | ||
88 | - {{/ new}} | ||
89 | - </div> | 85 | + <div class="new-goods container clearfix"></div> |
90 | <div class="price-goods container clearfix hide"></div> | 86 | <div class="price-goods container clearfix hide"></div> |
91 | <div class="discount-goods container clearfix hide"></div> | 87 | <div class="discount-goods container clearfix hide"></div> |
92 | 88 |
-
Please register or login to post a comment