Showing
8 changed files
with
124 additions
and
24 deletions
@@ -72,7 +72,32 @@ const _newGoods = (req, res, next) => { | @@ -72,7 +72,32 @@ const _newGoods = (req, res, next) => { | ||
72 | let banner = _.get(result, 'ads[0]', {}); | 72 | let banner = _.get(result, 'ads[0]', {}); |
73 | let handPick = _.get(result, 'ads[1]', {}); | 73 | let handPick = _.get(result, 'ads[1]', {}); |
74 | 74 | ||
75 | - // console.log(handPick) | 75 | + console.log(handPick); |
76 | + | ||
77 | + // handPick.data = [ | ||
78 | + // // { | ||
79 | + // // src: 'http://img10.static.yhbimg.com/yhb-img01/2017/01/09/13/01da40539b33823497bde77bcfdb6d94b5.jpg?imageView2/{mode}/w/{width}/h/{height}', | ||
80 | + // // alt: '', | ||
81 | + // // title: '', | ||
82 | + // // url: 'https://m.yohobuy.com/product/new' | ||
83 | + // // }, | ||
84 | + // { | ||
85 | + // src: 'http://img10.static.yhbimg.com/yhb-img01/2017/01/13/14/012d3366259d5afe4c4d4bf6d5a23278f7.jpg?imageView2/{mode}/w/{width}/h/{height}', | ||
86 | + // alt: '', | ||
87 | + // title: '', | ||
88 | + // url: 'http://www.yohobuy.com' | ||
89 | + // } | ||
90 | + // ]; | ||
91 | + | ||
92 | + if (handPick.data) { | ||
93 | + if (handPick.data.length > 2) { | ||
94 | + handPick.three = true; | ||
95 | + } else if (handPick.data.length === 2) { | ||
96 | + handPick.two = true; | ||
97 | + } else if (handPick.data.length === 1) { | ||
98 | + handPick.one = true; | ||
99 | + } | ||
100 | + } | ||
76 | 101 | ||
77 | res.render('new/index', { | 102 | res.render('new/index', { |
78 | module: 'product', | 103 | module: 'product', |
@@ -38,8 +38,14 @@ | @@ -38,8 +38,14 @@ | ||
38 | {{/if}} | 38 | {{/if}} |
39 | 39 | ||
40 | {{!--精选抢先看--}} | 40 | {{!--精选抢先看--}} |
41 | - {{#if handPick.data}} | ||
42 | - {{> 'new/handpick' swiper=handPick.data}} | 41 | + {{#if handPick.three}} |
42 | + {{> 'new/handpick-three' swiper=handPick.data}} | ||
43 | + {{/if}} | ||
44 | + {{#if handPick.two}} | ||
45 | + {{> 'new/handpick-two' swiper=handPick.data}} | ||
46 | + {{/if}} | ||
47 | + {{#if handPick.one}} | ||
48 | + {{> 'new/handpick-one' swiper=handPick.data}} | ||
43 | {{/if}} | 49 | {{/if}} |
44 | 50 | ||
45 | {{!--最新上架--}} | 51 | {{!--最新上架--}} |
@@ -8,17 +8,17 @@ | @@ -8,17 +8,17 @@ | ||
8 | </header> | 8 | </header> |
9 | <main class="panel-body"> | 9 | <main class="panel-body"> |
10 | <!-- Slider main container --> | 10 | <!-- Slider main container --> |
11 | - <div class="handpick-swiper swiper-container"> | 11 | + <div class="handpick-swiper-one swiper-container"> |
12 | <!-- Additional required wrapper --> | 12 | <!-- Additional required wrapper --> |
13 | <div class="swiper-wrapper"> | 13 | <div class="swiper-wrapper"> |
14 | <!-- Slides --> | 14 | <!-- Slides --> |
15 | - {{#each swiper}} | 15 | + {{# swiper}} |
16 | <div class="swiper-slide"> | 16 | <div class="swiper-slide"> |
17 | <a href="{{url}}"> | 17 | <a href="{{url}}"> |
18 | - <img class="swiper-lazy" data-src="{{image2 src w=332 h=194 q=60}}" alt=""> | 18 | + <img src="{{image2 src w=690 h=220 q=60}}" alt=""> |
19 | </a> | 19 | </a> |
20 | </div> | 20 | </div> |
21 | - {{/each}} | 21 | + {{/swiper}} |
22 | </div> | 22 | </div> |
23 | </div> | 23 | </div> |
24 | </main> | 24 | </main> |
1 | +{{!-- 新品到着: 精选 --}} | ||
2 | +<div id="handpick" class="panel handpick"> | ||
3 | + <header class="panel-header"> | ||
4 | + <h4>精选抢先看</h4> | ||
5 | + {{!--<a href="#javascript" class="panel-header-r more"> | ||
6 | + <i class="iconfont"></i> | ||
7 | + </a>--}} | ||
8 | + </header> | ||
9 | + <main class="panel-body"> | ||
10 | + <!-- Slider main container --> | ||
11 | + <div class="handpick-swiper-three swiper-container"> | ||
12 | + <!-- Additional required wrapper --> | ||
13 | + <div class="swiper-wrapper"> | ||
14 | + <!-- Slides --> | ||
15 | + {{# swiper}} | ||
16 | + <div class="swiper-slide"> | ||
17 | + <a href="{{url}}"> | ||
18 | + <img class="swiper-lazy" data-src="{{image2 src w=330 h=220 q=60}}" alt=""> | ||
19 | + </a> | ||
20 | + </div> | ||
21 | + {{/swiper}} | ||
22 | + </div> | ||
23 | + </div> | ||
24 | + </main> | ||
25 | +</div> |
1 | +{{!-- 新品到着: 精选 --}} | ||
2 | +<div id="handpick" class="panel handpick"> | ||
3 | + <header class="panel-header"> | ||
4 | + <h4>精选抢先看</h4> | ||
5 | + {{!--<a href="#javascript" class="panel-header-r more"> | ||
6 | + <i class="iconfont"></i> | ||
7 | + </a>--}} | ||
8 | + </header> | ||
9 | + <main class="panel-body"> | ||
10 | + <!-- Slider main container --> | ||
11 | + <div class="handpick-swiper-two swiper-container"> | ||
12 | + <!-- Additional required wrapper --> | ||
13 | + <div class="swiper-wrapper"> | ||
14 | + <!-- Slides --> | ||
15 | + {{# swiper}} | ||
16 | + <div class="swiper-slide"> | ||
17 | + <a href="{{url}}"> | ||
18 | + <img src="{{image2 src w=330 h=220 q=60}}" alt=""> | ||
19 | + </a> | ||
20 | + </div> | ||
21 | + {{/swiper}} | ||
22 | + </div> | ||
23 | + </div> | ||
24 | + </main> | ||
25 | +</div> |
@@ -17,21 +17,21 @@ module.exports = { | @@ -17,21 +17,21 @@ module.exports = { | ||
17 | assetUrl: '//127.0.0.1:5001', | 17 | assetUrl: '//127.0.0.1:5001', |
18 | testCode: 'yoho4946abcdef#$%&!@', | 18 | testCode: 'yoho4946abcdef#$%&!@', |
19 | domains: { | 19 | domains: { |
20 | - // api: 'http://api-test3.yohops.com:9999/', | ||
21 | - // service: 'http://service-test3.yohops.com:9999/', | ||
22 | - // liveApi: 'http://testapi.live.yohops.com:9999/', | ||
23 | - // singleApi: 'http://api-test3.yohops.com:9999/', | ||
24 | - // imSocket: 'ws://im.yohobuy.com:10240', | ||
25 | - // imCs: 'http://im.yohobuy.com/api', | ||
26 | - // imServer: 'http://im.yohobuy.com/server' | 20 | + api: 'http://api-test3.yohops.com:9999/', |
21 | + service: 'http://service-test3.yohops.com:9999/', | ||
22 | + liveApi: 'http://testapi.live.yohops.com:9999/', | ||
23 | + singleApi: 'http://api-test3.yohops.com:9999/', | ||
24 | + imSocket: 'ws://im.yohobuy.com:10240', | ||
25 | + imCs: 'http://im.yohobuy.com/api', | ||
26 | + imServer: 'http://im.yohobuy.com/server' | ||
27 | 27 | ||
28 | - api: 'http://api.yoho.cn/', | ||
29 | - service: 'http://service.yoho.cn/', | ||
30 | - liveApi: 'http://api.live.yoho.cn/', | ||
31 | - singleApi: 'http://single.yoho.cn/', | ||
32 | - imSocket: 'wss://imsocket.yohobuy.com:443', | ||
33 | - imCs: 'https://imhttp.yohobuy.com/api', | ||
34 | - imServer: 'https://imhttp.yohobuy.com/server' | 28 | + // api: 'http://api.yoho.cn/', |
29 | + // service: 'http://service.yoho.cn/', | ||
30 | + // liveApi: 'http://api.live.yoho.cn/', | ||
31 | + // singleApi: 'http://single.yoho.cn/', | ||
32 | + // imSocket: 'wss://imsocket.yohobuy.com:443', | ||
33 | + // imCs: 'https://imhttp.yohobuy.com/api', | ||
34 | + // imServer: 'https://imhttp.yohobuy.com/server' | ||
35 | }, | 35 | }, |
36 | subDomains: { | 36 | subDomains: { |
37 | host: '.m.yohobuy.com', | 37 | host: '.m.yohobuy.com', |
@@ -14,7 +14,7 @@ let $callback = $.Callbacks(); // eslint-disable-line | @@ -14,7 +14,7 @@ let $callback = $.Callbacks(); // eslint-disable-line | ||
14 | // 是否继续加载数据 | 14 | // 是否继续加载数据 |
15 | let isScroll = true; | 15 | let isScroll = true; |
16 | 16 | ||
17 | -new Swiper('.handpick-swiper', { | 17 | +new Swiper('.handpick-swiper-three', { |
18 | // Optional parameters | 18 | // Optional parameters |
19 | lazyLoading: true, | 19 | lazyLoading: true, |
20 | lazyLoadingInPrevNext: true, | 20 | lazyLoadingInPrevNext: true, |
1 | /* 精选抢先看 */ | 1 | /* 精选抢先看 */ |
2 | .handpick { | 2 | .handpick { |
3 | + .panel-body { | ||
4 | + padding-top: 30px; | ||
5 | + padding-bottom: 30px; | ||
6 | + } | ||
7 | + | ||
3 | .swiper-wrapper { | 8 | .swiper-wrapper { |
4 | align-items: center; | 9 | align-items: center; |
5 | } | 10 | } |
6 | 11 | ||
7 | .swiper-container { | 12 | .swiper-container { |
8 | - height: 220px; | 13 | + height: 185px; |
9 | } | 14 | } |
10 | 15 | ||
11 | .swiper-slide { | 16 | .swiper-slide { |
12 | width: 300px; | 17 | width: 300px; |
13 | - height: 173px; | 18 | + height: 185px; |
14 | background-color: #444; | 19 | background-color: #444; |
15 | border-radius: 6px; | 20 | border-radius: 6px; |
16 | overflow: hidden; | 21 | overflow: hidden; |
17 | } | 22 | } |
18 | } | 23 | } |
24 | + | ||
25 | +.handpick-swiper-two { | ||
26 | + .swiper-slide { | ||
27 | + margin-left: 30px; | ||
28 | + width: 277px; | ||
29 | + } | ||
30 | +} | ||
31 | + | ||
32 | +.handpick-swiper-one { | ||
33 | + .swiper-slide { | ||
34 | + width: 580px; | ||
35 | + margin-left: 30px; | ||
36 | + } | ||
37 | +} |
-
Please register or login to post a comment