Showing
6 changed files
with
108 additions
and
17 deletions
@@ -7,15 +7,23 @@ | @@ -7,15 +7,23 @@ | ||
7 | 'use strict'; | 7 | 'use strict'; |
8 | const _ = require('lodash'); | 8 | const _ = require('lodash'); |
9 | const helpers = global.yoho.helpers; | 9 | const helpers = global.yoho.helpers; |
10 | +const mRoot = '../models'; | ||
11 | +const brandModel = require(`${mRoot}/brand`); | ||
10 | 12 | ||
11 | /** | 13 | /** |
12 | - * 频道选择页 | 14 | + * 品牌,品类,店铺相关页面 |
13 | */ | 15 | */ |
14 | const component = { | 16 | const component = { |
17 | + | ||
18 | + /* 品牌店铺页面 */ | ||
15 | brand: (req, res, next) => { | 19 | brand: (req, res, next) => { |
16 | - res.render('brand/index', { | ||
17 | - module: 'brand', | ||
18 | - page: 'index' | 20 | + let params = req.query; |
21 | + brandModel.getBrandData(params).then(result => { | ||
22 | + res.render('brand/index', { | ||
23 | + module: 'brand', | ||
24 | + page: 'index', | ||
25 | + result: result | ||
26 | + }); | ||
19 | }); | 27 | }); |
20 | } | 28 | } |
21 | }; | 29 | }; |
apps/channel/models/brand-api.js
0 → 100644
apps/channel/models/brand.js
0 → 100644
1 | +/** | ||
2 | + * Created by PhpStorm. | ||
3 | + * User: Targaryen | ||
4 | + * Date: 2016/7/19 | ||
5 | + * Time: 13:51 | ||
6 | + */ | ||
7 | +'use strict'; | ||
8 | +const api = global.yoho.API; | ||
9 | +const brandApi = require('./brand-api'); | ||
10 | + | ||
11 | +const getBrandData = params => { | ||
12 | + let finalResult = {}; | ||
13 | + | ||
14 | + return api.all([brandApi.getBrandData]).then(result => { | ||
15 | + Object.assign(finalResult, { | ||
16 | + brandBg: 'http://7xwj52.com1.z0.glb.clouddn.com/brandbg.jpg', | ||
17 | + brandLogo: '', | ||
18 | + brandName: ' A.Dorad', | ||
19 | + brandIntro: `Dora毕业于中国美术学院的珠宝设计专业。毕业之后,Dora便开始游走于各国,吸收各地首饰设计的精髓,之后又在首尔修学了3年,A.Dorad饰品系列诞生于首尔, 设计师Dora将首尔设为起点并逐步推向国际。2013年,A.Dorad将旗下主力设计师带领进军广州,并以此为基地,以国际化的标准,设计出全新概念饰品。A.Dorad给人们提供高品质的服务,并且拥有独有的工艺。多样的珠宝首饰产品造型更衬托出其前卫、高雅的设计理念。珍贵的矿石搭配流行的创意理念,启迪了人类艺术。A.Dorad饰品符合现代年轻人对珠宝的追求与热爱,充满个性与时尚.它可以满足不同人的需求独家定制专属于自己的水晶饰品。A.Dorad将继续发挥无与伦比的创造力并开启通往浪漫梦幻的大门。`, | ||
20 | + showMore: false | ||
21 | + }); | ||
22 | + | ||
23 | + return finalResult; | ||
24 | + }); | ||
25 | +}; | ||
26 | + | ||
27 | +module.exports = { | ||
28 | + getBrandData | ||
29 | +}; |
1 | -<div class="brand-top-box"> | ||
2 | - <div class="brand-bottom"> | ||
3 | - {{#if brandLogo}} | 1 | +{{# result}} |
2 | + <div class="brand-top-box" style="background: url({{brandBg}})"> | ||
3 | + <div class="brand-bottom"> | ||
4 | + {{#if brandLogo}} | ||
4 | <img src="{{brandLogo}}" alt="{{brandName}}"> | 5 | <img src="{{brandLogo}}" alt="{{brandName}}"> |
5 | - {{^}} | ||
6 | - <div class="brand-title">brandName</div> | ||
7 | - {{/if}} | ||
8 | - <hr> | ||
9 | - <div class="brand-intro">brandIntro brandIntro brandIntro brandIntro brandIntro brandIntro brandIntro brandIntro brandIntro brandIntro </div> | 6 | + {{^}} |
7 | + <div class="brand-title">{{brandName}}</div> | ||
8 | + {{/if}} | ||
9 | + <hr> | ||
10 | + <div class="brand-intro line-clamp">{{brandIntro}}</div> | ||
11 | + </div> | ||
12 | + <div class="expand"></div> | ||
13 | + <div class="collapse"></div> | ||
10 | </div> | 14 | </div> |
11 | - <div class="expand"></div> | ||
12 | -</div> | ||
15 | +{{/ result}} |
@@ -4,5 +4,21 @@ | @@ -4,5 +4,21 @@ | ||
4 | * Date: 2016/7/19 | 4 | * Date: 2016/7/19 |
5 | * Time: 10:16 | 5 | * Time: 10:16 |
6 | */ | 6 | */ |
7 | +var $ = require('yoho-jquery'); | ||
7 | 8 | ||
8 | -console.log('ddd'); | 9 | +var $expand = $('.expand'), |
10 | + $collapse = $('.collapse'), | ||
11 | + $brandIntro = $('.brand-intro'), | ||
12 | + exCoTm = 6; // 展开隐藏的倍数 | ||
13 | + | ||
14 | +$expand.on('click', function () { | ||
15 | + $brandIntro.removeClass("line-clamp").animate({height: $brandIntro.height() * exCoTm}); | ||
16 | + $expand.hide(); | ||
17 | + $collapse.show(); | ||
18 | +}); | ||
19 | + | ||
20 | +$collapse.on('click', function () { | ||
21 | + $brandIntro.addClass("line-clamp").animate({height: $brandIntro.height() / exCoTm}); | ||
22 | + $collapse.hide(); | ||
23 | + $expand.show(); | ||
24 | +}); |
1 | .brand-top-box { | 1 | .brand-top-box { |
2 | width: 100%; | 2 | width: 100%; |
3 | - height: 400px; | 3 | + height: 468px; |
4 | color: $white; | 4 | color: $white; |
5 | background-color: $black; | 5 | background-color: $black; |
6 | position: relative; | 6 | position: relative; |
@@ -23,8 +23,19 @@ | @@ -23,8 +23,19 @@ | ||
23 | 23 | ||
24 | .brand-intro { | 24 | .brand-intro { |
25 | margin-left: 5%; | 25 | margin-left: 5%; |
26 | - width: 82%; | 26 | + width: 90%; |
27 | + height: 60px; | ||
27 | font-size: 16px; | 28 | font-size: 16px; |
29 | + line-height: 32px; | ||
30 | + overflow : hidden; | ||
31 | + text-overflow: ellipsis; | ||
32 | + } | ||
33 | + | ||
34 | + .line-clamp { | ||
35 | + width: 82%; | ||
36 | + display: -webkit-box; | ||
37 | + -webkit-line-clamp: 2; | ||
38 | + -webkit-box-orient: vertical; | ||
28 | } | 39 | } |
29 | } | 40 | } |
30 | 41 | ||
@@ -36,4 +47,14 @@ | @@ -36,4 +47,14 @@ | ||
36 | bottom: 20px; | 47 | bottom: 20px; |
37 | right: 5%; | 48 | right: 5%; |
38 | } | 49 | } |
50 | + | ||
51 | + .collapse { | ||
52 | + width: 60px; | ||
53 | + height: 60px; | ||
54 | + background-color: $black; | ||
55 | + position: absolute; | ||
56 | + bottom: 20px; | ||
57 | + right: 5%; | ||
58 | + display: none; | ||
59 | + } | ||
39 | } | 60 | } |
-
Please register or login to post a comment