Merge branch 'develop' of http://git.dev.yoho.cn/web/yohobuy into develop
Showing
5 changed files
with
66 additions
and
27 deletions
@@ -85,7 +85,9 @@ likeHammer.on('tap', function(e) { | @@ -85,7 +85,9 @@ likeHammer.on('tap', function(e) { | ||
85 | success: function(data) { | 85 | success: function(data) { |
86 | if (data.code === 200) { | 86 | if (data.code === 200) { |
87 | $this.toggleClass('like'); | 87 | $this.toggleClass('like'); |
88 | - } else if (data.code === 400) { | 88 | + } else if (data.code === 400 || data.code === 412) { |
89 | + | ||
90 | + //code:412 用户ID不正确,即未登录 | ||
89 | tip.show('未登录'); | 91 | tip.show('未登录'); |
90 | } else { | 92 | } else { |
91 | tip.show(data.message); | 93 | tip.show(data.message); |
@@ -17,13 +17,6 @@ var missStatus; //是否忽略选中状态 | @@ -17,13 +17,6 @@ var missStatus; //是否忽略选中状态 | ||
17 | //隐藏筛选界面 | 17 | //隐藏筛选界面 |
18 | function hideFilter() { | 18 | function hideFilter() { |
19 | $filter.addClass('hide'); | 19 | $filter.addClass('hide'); |
20 | - | ||
21 | - if (missStatus) { | ||
22 | - | ||
23 | - //重置一级筛选项选中状态 | ||
24 | - $filter.find('.classify-item.active').removeClass('active'); | ||
25 | - $filter.find('.classify-item:first-child').addClass('active'); | ||
26 | - } | ||
27 | } | 20 | } |
28 | 21 | ||
29 | //显示筛选界面 | 22 | //显示筛选界面 |
@@ -31,6 +24,7 @@ function showFilter() { | @@ -31,6 +24,7 @@ function showFilter() { | ||
31 | $filter.removeClass('hide'); | 24 | $filter.removeClass('hide'); |
32 | } | 25 | } |
33 | 26 | ||
27 | +//主筛选项Tap事件句柄 | ||
34 | function classifyTapEvt($this) { | 28 | function classifyTapEvt($this) { |
35 | if ($this.hasClass('active')) { | 29 | if ($this.hasClass('active')) { |
36 | return; | 30 | return; |
@@ -41,9 +35,8 @@ function classifyTapEvt($this) { | @@ -41,9 +35,8 @@ function classifyTapEvt($this) { | ||
41 | $this.addClass('active'); | 35 | $this.addClass('active'); |
42 | } | 36 | } |
43 | 37 | ||
44 | -function subClassifyTapEvt($this) { | ||
45 | - var id = $this.data('id'); | ||
46 | - | 38 | +//子筛选项选中处理 |
39 | +function setSubClassify($this) { | ||
47 | var $sub = $this.closest('.sub-classify'); | 40 | var $sub = $this.closest('.sub-classify'); |
48 | 41 | ||
49 | var $shower = $sub.siblings('.shower'); | 42 | var $shower = $sub.siblings('.shower'); |
@@ -72,6 +65,17 @@ function subClassifyTapEvt($this) { | @@ -72,6 +65,17 @@ function subClassifyTapEvt($this) { | ||
72 | $shower.removeClass('default'); | 65 | $shower.removeClass('default'); |
73 | } | 66 | } |
74 | 67 | ||
68 | + return $sub; | ||
69 | +} | ||
70 | + | ||
71 | +//子筛选项Tap句柄 | ||
72 | +function subClassifyTapEvt($this) { | ||
73 | + var id = $this.data('id'); | ||
74 | + | ||
75 | + var $sub; | ||
76 | + | ||
77 | + $sub = setSubClassify($this); | ||
78 | + | ||
75 | if (fCbFn) { | 79 | if (fCbFn) { |
76 | fCbFn({ | 80 | fCbFn({ |
77 | type: $sub.data('type'), | 81 | type: $sub.data('type'), |
@@ -80,12 +84,6 @@ function subClassifyTapEvt($this) { | @@ -80,12 +84,6 @@ function subClassifyTapEvt($this) { | ||
80 | } | 84 | } |
81 | 85 | ||
82 | hideFilter(); | 86 | hideFilter(); |
83 | - | ||
84 | - //重置选中状态 | ||
85 | - if (missStatus) { | ||
86 | - $this.removeClass('chosed'); | ||
87 | - $sub.children(':first-child').addClass('chosed'); | ||
88 | - } | ||
89 | } | 87 | } |
90 | 88 | ||
91 | //初始化筛选 | 89 | //初始化筛选 |
@@ -133,8 +131,25 @@ function initFilter(opt) { | @@ -133,8 +131,25 @@ function initFilter(opt) { | ||
133 | }); | 131 | }); |
134 | } | 132 | } |
135 | 133 | ||
134 | +//重置筛选面板 | ||
135 | +function resetFilter() { | ||
136 | + if (typeof $filter === 'undefined') { | ||
137 | + return; | ||
138 | + } | ||
139 | + | ||
140 | + //重置子筛选项 | ||
141 | + $('.sub-classify').each(function() { | ||
142 | + setSubClassify($(this).children(':first-child')); | ||
143 | + }); | ||
144 | + | ||
145 | + //重置主筛选项 | ||
146 | + classifyTapEvt($('.classify > :first-child')); | ||
147 | +} | ||
148 | + | ||
136 | exports.initFilter = initFilter; | 149 | exports.initFilter = initFilter; |
137 | 150 | ||
138 | exports.showFilter = showFilter; | 151 | exports.showFilter = showFilter; |
139 | 152 | ||
140 | exports.hideFilter = hideFilter; | 153 | exports.hideFilter = hideFilter; |
154 | + | ||
155 | +exports.resetFilter = resetFilter; |
@@ -41,6 +41,8 @@ var defaultOpt = { | @@ -41,6 +41,8 @@ var defaultOpt = { | ||
41 | dayLimit: 1 | 41 | dayLimit: 1 |
42 | }; | 42 | }; |
43 | 43 | ||
44 | +var storeOpt = $.extend({}, defaultOpt); //存储默认筛选条件以便重置 | ||
45 | + | ||
44 | var now = new Date(), | 46 | var now = new Date(), |
45 | month = now.getMonth() + 1, | 47 | month = now.getMonth() + 1, |
46 | date = now.getDate(); | 48 | date = now.getDate(); |
@@ -267,8 +269,7 @@ $.ajax({ | @@ -267,8 +269,7 @@ $.ajax({ | ||
267 | //切换active状态到$pre上 | 269 | //切换active状态到$pre上 |
268 | $pre.addClass('active'); | 270 | $pre.addClass('active'); |
269 | $pre.siblings('.filter').removeClass('active'); | 271 | $pre.siblings('.filter').removeClass('active'); |
270 | - }, | ||
271 | - missStatus: true | 272 | + } |
272 | }); | 273 | }); |
273 | } | 274 | } |
274 | }); | 275 | }); |
@@ -343,6 +344,10 @@ navHammer.on('tap', function(e) { | @@ -343,6 +344,10 @@ navHammer.on('tap', function(e) { | ||
343 | $dgc.removeClass('hide'); | 344 | $dgc.removeClass('hide'); |
344 | break; | 345 | break; |
345 | } | 346 | } |
347 | + | ||
348 | + //重置筛选项 | ||
349 | + filter.resetFilter(); | ||
350 | + defaultOpt = $.extend({}, storeOpt); | ||
346 | } | 351 | } |
347 | 352 | ||
348 | $active.removeClass('active'); | 353 | $active.removeClass('active'); |
1 | .good-info { | 1 | .good-info { |
2 | float: left; | 2 | float: left; |
3 | - width: 46.4%; | 3 | + width: 276rem / $pxConvertRem; |
4 | height: 486rem / $pxConvertRem; | 4 | height: 486rem / $pxConvertRem; |
5 | - margin: 28rem / $pxConvertRem 0 0 2.4%; | ||
6 | - | 5 | + margin: 0 (15rem / $pxConvertRem) (28rem / $pxConvertRem); |
7 | 6 | ||
8 | .tag-container { | 7 | .tag-container { |
9 | height: 28rem / $pxConvertRem; | 8 | height: 28rem / $pxConvertRem; |
10 | width: 100%; | 9 | width: 100%; |
10 | + overflow: hidden; | ||
11 | 11 | ||
12 | .good-tag { | 12 | .good-tag { |
13 | display: block; | 13 | display: block; |
@@ -15,23 +15,27 @@ | @@ -15,23 +15,27 @@ | ||
15 | height: 28rem / $pxConvertRem; | 15 | height: 28rem / $pxConvertRem; |
16 | font-size: 18rem / $pxConvertRem; | 16 | font-size: 18rem / $pxConvertRem; |
17 | text-align: center; | 17 | text-align: center; |
18 | - line-height: 32rem / $pxConvertRem; | 18 | + line-height: 28rem / $pxConvertRem; |
19 | + box-sizing: border-box; | ||
19 | margin-right: 4rem / $pxConvertRem; | 20 | margin-right: 4rem / $pxConvertRem; |
20 | 21 | ||
21 | &:last-child { | 22 | &:last-child { |
22 | margin-right: 0; | 23 | margin-right: 0; |
23 | } | 24 | } |
24 | } | 25 | } |
26 | + | ||
25 | .new-tag { | 27 | .new-tag { |
26 | width: 60rem / $pxConvertRem; | 28 | width: 60rem / $pxConvertRem; |
27 | background-color: #78dc7e; | 29 | background-color: #78dc7e; |
28 | color: #fff; | 30 | color: #fff; |
29 | } | 31 | } |
32 | + | ||
30 | .renew-tag { | 33 | .renew-tag { |
31 | width: 90rem / $pxConvertRem; | 34 | width: 90rem / $pxConvertRem; |
32 | background-color: #78dc7e; | 35 | background-color: #78dc7e; |
33 | color: #fff; | 36 | color: #fff; |
34 | } | 37 | } |
38 | + | ||
35 | .sale-tag { | 39 | .sale-tag { |
36 | width: 60rem / $pxConvertRem; | 40 | width: 60rem / $pxConvertRem; |
37 | background-color: #ff575c; | 41 | background-color: #ff575c; |
@@ -43,21 +47,35 @@ | @@ -43,21 +47,35 @@ | ||
43 | color: #fff; | 47 | color: #fff; |
44 | } | 48 | } |
45 | .limit-tag { | 49 | .limit-tag { |
46 | - box-sizing: border-box; | ||
47 | width: 90rem / $pxConvertRem; | 50 | width: 90rem / $pxConvertRem; |
48 | border: 1px solid #000; | 51 | border: 1px solid #000; |
49 | color: #000; | 52 | color: #000; |
50 | - line-height: 24rem / $pxConvertRem; | ||
51 | } | 53 | } |
52 | } | 54 | } |
53 | } | 55 | } |
54 | 56 | ||
55 | .good-detail-img { | 57 | .good-detail-img { |
56 | position: relative; | 58 | position: relative; |
59 | + .good-islike { | ||
60 | + position: absolute; | ||
61 | + width: 60rem / $pxConvertRem; | ||
62 | + height: 60rem / $pxConvertRem; | ||
63 | + top: 0rem / $pxConvertRem; | ||
64 | + right: 0rem / $pxConvertRem; | ||
65 | + line-height: 60rem / $pxConvertRem; | ||
66 | + font-size: 30rem / $pxConvertRem; | ||
67 | + text-align: center; | ||
68 | + color: #b0b0b0; | ||
69 | + text-decoration: none; | ||
70 | + } | ||
71 | + | ||
72 | + .good-like { | ||
73 | + color: #d72928; | ||
74 | + } | ||
57 | img { | 75 | img { |
58 | display: block; | 76 | display: block; |
59 | width: 100%; | 77 | width: 100%; |
60 | - // height: 366rem / $pxConvertRem; | 78 | + height: 366rem / $pxConvertRem; |
61 | } | 79 | } |
62 | 80 | ||
63 | .few-tag { | 81 | .few-tag { |
@@ -17,7 +17,6 @@ | @@ -17,7 +17,6 @@ | ||
17 | height: 192rem / $pxConvertRem; | 17 | height: 192rem / $pxConvertRem; |
18 | border-bottom: 1px solid #e0e0e0; | 18 | border-bottom: 1px solid #e0e0e0; |
19 | border-right: 1px solid #e0e0e0; | 19 | border-right: 1px solid #e0e0e0; |
20 | - border-top: 1px solid #e0e0e0; | ||
21 | &:nth-child(-n+3) { | 20 | &:nth-child(-n+3) { |
22 | border-bottom: none; | 21 | border-bottom: none; |
23 | } | 22 | } |
-
Please register or login to post a comment