Showing
5 changed files
with
73 additions
and
39 deletions
@@ -24,7 +24,6 @@ function index(req, res, next) { | @@ -24,7 +24,6 @@ function index(req, res, next) { | ||
24 | 24 | ||
25 | 25 | ||
26 | function groupListIndex(req, res, next) { | 26 | function groupListIndex(req, res, next) { |
27 | - | ||
28 | req.ctx(GroupService).groupList() | 27 | req.ctx(GroupService).groupList() |
29 | .then(result => { | 28 | .then(result => { |
30 | return res.render('group/group-list', { | 29 | return res.render('group/group-list', { |
@@ -13,5 +13,5 @@ | @@ -13,5 +13,5 @@ | ||
13 | </div> | 13 | </div> |
14 | </div> | 14 | </div> |
15 | 15 | ||
16 | -<a class="my-group my-group-handler" href="/activity/group/progress">我的拼团</a> | 16 | +<a class="my-group my-group-handler" href="/activity/group/order">我的拼团</a> |
17 | <div class='my-share'></div> | 17 | <div class='my-share'></div> |
1 | <div class="group"> | 1 | <div class="group"> |
2 | <div class="resources"> | 2 | <div class="resources"> |
3 | + <div class="floors"> | ||
3 | {{#each floors}} | 4 | {{#each floors}} |
4 | {{#ifcond template_name "==" 'focus'}} | 5 | {{#ifcond template_name "==" 'focus'}} |
5 | {{> group/resources/focus}} | 6 | {{> group/resources/focus}} |
@@ -20,23 +21,17 @@ | @@ -20,23 +21,17 @@ | ||
20 | {{> group/resources/collage-buy-prd-list}} | 21 | {{> group/resources/collage-buy-prd-list}} |
21 | {{/ifcond}} | 22 | {{/ifcond}} |
22 | {{/each}} | 23 | {{/each}} |
23 | - | 24 | + </div> |
24 | <div id='fixedTab' class="tab-filter"> | 25 | <div id='fixedTab' class="tab-filter"> |
25 | {{!-- {{#if floatTab}} float{{/if}}{{#if !tabs.showTab}} only-filter{{/if}} --}} | 26 | {{!-- {{#if floatTab}} float{{/if}}{{#if !tabs.showTab}} only-filter{{/if}} --}} |
26 | {{#if tabs.showTab}} | 27 | {{#if tabs.showTab}} |
27 | - <div class="tab"> | 28 | + <div class="tab group-tab"> |
28 | <div class="tab-item"> | 29 | <div class="tab-item"> |
29 | <div class="tiptext active" data-channel="newGroup">邀新团</div> | 30 | <div class="tiptext active" data-channel="newGroup">邀新团</div> |
30 | - {{!-- {{#if isNewGroup}} --}} | ||
31 | - <div class="tab-line"></div> | ||
32 | - {{!-- {{/if}} --}} | ||
33 | - | ||
34 | </div> | 31 | </div> |
35 | <div class="tab-item"> | 32 | <div class="tab-item"> |
36 | <div class="tiptext" data-channel="normalGroup">普通团</div> | 33 | <div class="tiptext" data-channel="normalGroup">普通团</div> |
37 | - {{!-- {{#if !isNewGroup}} --}} | ||
38 | - {{!-- <div class="tab-line"></div> --}} | ||
39 | - {{!-- {{/if}} --}} | 34 | + |
40 | </div> | 35 | </div> |
41 | </div> | 36 | </div> |
42 | {{/if}} | 37 | {{/if}} |
@@ -52,5 +47,5 @@ | @@ -52,5 +47,5 @@ | ||
52 | {{/if}} | 47 | {{/if}} |
53 | 48 | ||
54 | </div> | 49 | </div> |
55 | - <a class="bottom" href="/activity/group/progress">我的拼团</a> | 50 | + <a class="bottom" href="/activity/group/order">我的拼团</a> |
56 | </div> | 51 | </div> |
@@ -8,11 +8,61 @@ class Group extends Page { | @@ -8,11 +8,61 @@ class Group extends Page { | ||
8 | constructor() { | 8 | constructor() { |
9 | super(); | 9 | super(); |
10 | 10 | ||
11 | - this.selector = {}; | 11 | + this.selector = { |
12 | + tabSection: $('#fixedTab'), | ||
13 | + floorsContentHeight: $('.floors').height(), | ||
14 | + groupTab: $('.group-tab'), | ||
15 | + filterTab: $('.filter-nav'), | ||
16 | + groupListContent: $('.group-list') | ||
17 | + }; | ||
18 | + this.bindEvents(); | ||
12 | this.swiperTop(); | 19 | this.swiperTop(); |
20 | + | ||
21 | + $(window).scroll(() => { | ||
22 | + window.requestAnimationFrame(this.scrollHandler.bind(this)); | ||
23 | + }); | ||
24 | + } | ||
25 | + scrollHandler() { | ||
26 | + // 滚动固定tab | ||
27 | + let floorsContentHeight = this.selector.floorsContentHeight + 5; | ||
28 | + | ||
29 | + console.log(floorsContentHeight); | ||
30 | + if ($(window).scrollTop() > floorsContentHeight) { | ||
31 | + this.selector.tabSection.addClass('float'); | ||
32 | + this.selector.groupListContent.addClass('mrt'); | ||
33 | + } else { | ||
34 | + this.selector.tabSection.removeClass('float'); | ||
35 | + this.selector.groupListContent.removeClass('mrt'); | ||
13 | } | 36 | } |
37 | + } | ||
38 | + bindEvents() { | ||
39 | + this.selector.tabSection.on('click', this.fixedTab.bind(this)); | ||
40 | + this.selector.groupTab.on('click', this.groupTabChange.bind(this)); | ||
14 | 41 | ||
15 | - bindEvents() {} | 42 | + } |
43 | + fixedTab() { | ||
44 | + let listHeight = this.selector.groupListContent.height(); | ||
45 | + let windowHeight = $(window).height(); | ||
46 | + | ||
47 | + // 商品列表超过一屏时 | ||
48 | + if (listHeight > windowHeight || listHeight === windowHeight) { | ||
49 | + if (!this.selector.tabSection.hasClass('float')) { | ||
50 | + this.selector.tabSection.addClass('float'); | ||
51 | + $(window).scrollTop(this.selector.floorsContentHeight + 10); | ||
52 | + } | ||
53 | + } | ||
54 | + | ||
55 | + } | ||
56 | + groupTabChange(e) { | ||
57 | + let target = $(e.target); | ||
58 | + let channel = target.data('channel'); | ||
59 | + | ||
60 | + if (!target.hasClass('active')) { | ||
61 | + this.selector.groupTab.find('.tiptext').removeClass('active'); | ||
62 | + target.addClass('active'); | ||
63 | + } | ||
64 | + console.log(channel); | ||
65 | + } | ||
16 | 66 | ||
17 | // 顶部swiper | 67 | // 顶部swiper |
18 | swiperTop() { | 68 | swiperTop() { |
@@ -29,6 +79,8 @@ class Group extends Page { | @@ -29,6 +79,8 @@ class Group extends Page { | ||
29 | }); | 79 | }); |
30 | } | 80 | } |
31 | } | 81 | } |
82 | + | ||
83 | + // | ||
32 | } | 84 | } |
33 | 85 | ||
34 | $(() => { | 86 | $(() => { |
@@ -27,16 +27,21 @@ | @@ -27,16 +27,21 @@ | ||
27 | border-top: 1px solid #e0e0e0; | 27 | border-top: 1px solid #e0e0e0; |
28 | } | 28 | } |
29 | 29 | ||
30 | + .mrt { | ||
31 | + margin-top: 230px; | ||
32 | + } | ||
33 | + | ||
34 | + .floors { | ||
35 | + border-bottom: 10px solid #f0f0f0; | ||
36 | + } | ||
37 | + | ||
30 | .tab { | 38 | .tab { |
31 | width: 100%; | 39 | width: 100%; |
32 | - height: wrap; | ||
33 | display: flex; | 40 | display: flex; |
34 | - flex-direction: row; | ||
35 | align-items: center; | 41 | align-items: center; |
36 | background-color: white; | 42 | background-color: white; |
37 | z-index: 1000; | 43 | z-index: 1000; |
38 | border-bottom: 1px solid #e0e0e0; | 44 | border-bottom: 1px solid #e0e0e0; |
39 | - border-top: 10px solid #f0f0f0; | ||
40 | 45 | ||
41 | .tab-item { | 46 | .tab-item { |
42 | position: relative; | 47 | position: relative; |
@@ -53,42 +58,25 @@ | @@ -53,42 +58,25 @@ | ||
53 | font-size: 32px; | 58 | font-size: 32px; |
54 | color: #b0b0b0; | 59 | color: #b0b0b0; |
55 | flex: 1; | 60 | flex: 1; |
56 | - width: wrap; | ||
57 | text-align: center; | 61 | text-align: center; |
58 | height: 100%; | 62 | height: 100%; |
59 | - display: flex; | ||
60 | - flex-wrap: wrap; | ||
61 | - align-content: center; | ||
62 | - flex-direction: row; | ||
63 | - align-items: center; | 63 | + width: 60%; |
64 | + line-height: 80px; | ||
65 | + border-bottom: solid 4px transparent; | ||
64 | font-weight: 500; | 66 | font-weight: 500; |
65 | } | 67 | } |
66 | 68 | ||
67 | .tiptext.active { | 69 | .tiptext.active { |
68 | color: #444; | 70 | color: #444; |
69 | - } | ||
70 | - | ||
71 | - .tab-line { | ||
72 | - position: absolute; | ||
73 | - bottom: -2px; | ||
74 | - left: 50%; | ||
75 | - background-color: black; | ||
76 | - width: 180px; | ||
77 | - height: 4px; | ||
78 | - transform: translateX(-50%); | 71 | + border-bottom: solid 4px #000; |
79 | } | 72 | } |
80 | 73 | ||
81 | .tab-filter.float { | 74 | .tab-filter.float { |
82 | position: fixed; | 75 | position: fixed; |
83 | - top: -22px; | 76 | + top: 0; |
84 | left: 0; | 77 | left: 0; |
85 | right: 0; | 78 | right: 0; |
86 | - border-top: none; | ||
87 | z-index: 998; | 79 | z-index: 998; |
88 | background-color: #fff; | 80 | background-color: #fff; |
89 | } | 81 | } |
90 | - | ||
91 | - .tab-filter.float.only-filter { | ||
92 | - top: -1px; | ||
93 | - } | ||
94 | } | 82 | } |
-
Please register or login to post a comment