Merge branch 'master' into feature/download_individate
Showing
8 changed files
with
242 additions
and
88 deletions
@@ -2,17 +2,35 @@ | @@ -2,17 +2,35 @@ | ||
2 | * 自定义频道, 临时方案,暂时写死 | 2 | * 自定义频道, 临时方案,暂时写死 |
3 | */ | 3 | */ |
4 | 'use strict'; | 4 | 'use strict'; |
5 | +const customModel = require('../models/custom'); | ||
5 | 6 | ||
6 | -let index = (req, res) => { | ||
7 | - res.render('custom', { | 7 | +let index = (req, res, next) => { |
8 | + let contentCode = req.params.id; | ||
9 | + | ||
10 | + if (!contentCode) { | ||
11 | + return next(); | ||
12 | + } | ||
13 | + | ||
14 | + customModel.getResourceData(contentCode).then(result => { | ||
15 | + res.render('custom', { | ||
16 | + module: 'channel', | ||
17 | + page: 'custom', | ||
18 | + content: result, | ||
19 | + title: req.query.title || 'Yoho!Buy 有货' | ||
20 | + }); | ||
21 | + }).catch(next); | ||
22 | +}; | ||
23 | + | ||
24 | +let zhihui = (req, res) => { | ||
25 | + res.render('zhihui', { | ||
8 | module: 'channel', | 26 | module: 'channel', |
9 | page: 'custom', | 27 | page: 'custom', |
10 | - content_code: req.params.id, // 这是位置码,后边去调用资源位,渲染页面 | ||
11 | title: req.query.title || 'Yoho!Buy 有货', | 28 | title: req.query.title || 'Yoho!Buy 有货', |
12 | downloadLink: 'http://union.yoho.cn/union/downapp.html?union_type=100000000000081' | 29 | downloadLink: 'http://union.yoho.cn/union/downapp.html?union_type=100000000000081' |
13 | }); | 30 | }); |
14 | }; | 31 | }; |
15 | 32 | ||
16 | module.exports = { | 33 | module.exports = { |
17 | - index | 34 | + index, |
35 | + zhihui | ||
18 | }; | 36 | }; |
apps/channel/models/custom.js
0 → 100644
1 | +/** | ||
2 | + * 自定义频道页面 model | ||
3 | + * @author: Bi Kai<kai.bi@yoho.cn> | ||
4 | + * @date: 2016/05/09 | ||
5 | + */ | ||
6 | + | ||
7 | +'use strict'; | ||
8 | +const utils = '../../../utils'; | ||
9 | +const resourcesProcess = require(`${utils}/resources-process`); | ||
10 | +const service = global.yoho.ServiceAPI; | ||
11 | + | ||
12 | +const getResourceData = (code) => { | ||
13 | + return service.get('operations/api/v5/resource/get', { | ||
14 | + content_code: code | ||
15 | + }, { | ||
16 | + cache: true, | ||
17 | + code: 200 | ||
18 | + }).then(result => { | ||
19 | + return resourcesProcess(result.data); | ||
20 | + }); | ||
21 | +}; | ||
22 | + | ||
23 | +module.exports = { | ||
24 | + getResourceData | ||
25 | +} |
@@ -36,6 +36,10 @@ router.get('/brands/delBrandHistory', brandController.delBrandHistory); // 删 | @@ -36,6 +36,10 @@ router.get('/brands/delBrandHistory', brandController.delBrandHistory); // 删 | ||
36 | router.post('/channel/shopRecom', channel.shopRecom); // 店铺推荐收藏状态 | 36 | router.post('/channel/shopRecom', channel.shopRecom); // 店铺推荐收藏状态 |
37 | router.post('/channel/userVip', channel.userVip); | 37 | router.post('/channel/userVip', channel.userVip); |
38 | 38 | ||
39 | +// 自定义频道,市场推广-智汇 | ||
40 | +// 此页面做的早,写死发给市场,与自定义的不兼容,所以需要写死 | ||
41 | +router.get('/channel/2fb054e8315300a1ae1f80c3a4fda862.html', custom.zhihui); | ||
42 | + | ||
39 | // 自定义频道 | 43 | // 自定义频道 |
40 | router.get('/channel/:id.html', custom.index); | 44 | router.get('/channel/:id.html', custom.index); |
41 | 45 |
1 | -{{!-- 临时方案 --}} | ||
2 | - | ||
3 | -<style> | ||
4 | - html,body { | ||
5 | - width: 100%; | ||
6 | - height: 100%; | ||
7 | - margin: 0; | ||
8 | - padding: 0; | ||
9 | - } | ||
10 | - div { | ||
11 | - margin: 0; | ||
12 | - padding: 0; | ||
13 | - } | ||
14 | - .wrapper { | ||
15 | - position: relative; | ||
16 | - width: 100%; | ||
17 | - | ||
18 | - } | ||
19 | - | ||
20 | - .container { | ||
21 | - position: relative; | ||
22 | - margin: 0 auto; | ||
23 | - } | ||
24 | - | ||
25 | - img { | ||
26 | - width:100%; | ||
27 | - float: left; | ||
28 | - } | ||
29 | - | ||
30 | - ul { | ||
31 | - list-style: none; | ||
32 | - overflow: hidden; | ||
33 | - margin: 0; | ||
34 | - padding: 0; | ||
35 | - } | ||
36 | - | ||
37 | - ul li { | ||
38 | - position: relative; | ||
39 | - width:100%; | ||
40 | - overflow: hidden; | ||
41 | - } | ||
42 | - | ||
43 | - #btn_download { | ||
44 | - position: absolute; | ||
45 | - width: 73%; | ||
46 | - height: 14%; | ||
47 | - top: 75.5%; | ||
48 | - left: 13%; | ||
49 | - } | ||
50 | -</style> | ||
51 | -<div class="wrapper"> | ||
52 | - <div class="container"> | ||
53 | - <ul> | ||
54 | - <li> | ||
55 | - <img src="https://feature.yoho.cn/0113/images/01ff33cffc05e280bd701b90801835ad51.jpg?imageView2/2/q/75/"> | ||
56 | - <a id="btn_download" href="{{downloadLink}}" target="_blank"></a> | ||
57 | - </li> | ||
58 | - <li> | ||
59 | - <img src="https://feature.yoho.cn/0113/images/015d6241108a4db156d4153a5645bd283e.jpg?imageView2/2/q/75/"> | ||
60 | - </li> | ||
61 | - <li> | ||
62 | - <img src="https://feature.yoho.cn/0113/images/01651b926f5f22f4b00b6809925e4388a3.jpg?imageView2/2/q/75/"> | ||
63 | - </li> | ||
64 | - <li> | ||
65 | - <img src="https://feature.yoho.cn/0113/images/0157ad8f797d97f10cc21bd30333c5a7c5.jpg?imageView2/2/q/75/"> | ||
66 | - </li> | ||
67 | - </ul> | ||
68 | - </div> | 1 | +{{! 资源位}} |
2 | +<div class="resource-content"> | ||
3 | + {{> channel/content}} | ||
69 | </div> | 4 | </div> |
apps/channel/views/action/zhihui.hbs
0 → 100644
1 | +<style> | ||
2 | + html,body { | ||
3 | + width: 100%; | ||
4 | + height: 100%; | ||
5 | + margin: 0; | ||
6 | + padding: 0; | ||
7 | + } | ||
8 | + div { | ||
9 | + margin: 0; | ||
10 | + padding: 0; | ||
11 | + } | ||
12 | + .wrapper { | ||
13 | + position: relative; | ||
14 | + width: 100%; | ||
15 | + | ||
16 | + } | ||
17 | + | ||
18 | + .container { | ||
19 | + position: relative; | ||
20 | + margin: 0 auto; | ||
21 | + } | ||
22 | + | ||
23 | + img { | ||
24 | + width:100%; | ||
25 | + float: left; | ||
26 | + } | ||
27 | + | ||
28 | + ul { | ||
29 | + list-style: none; | ||
30 | + overflow: hidden; | ||
31 | + margin: 0; | ||
32 | + padding: 0; | ||
33 | + } | ||
34 | + | ||
35 | + ul li { | ||
36 | + position: relative; | ||
37 | + width:100%; | ||
38 | + overflow: hidden; | ||
39 | + } | ||
40 | + | ||
41 | + #btn_download { | ||
42 | + position: absolute; | ||
43 | + width: 73%; | ||
44 | + height: 14%; | ||
45 | + top: 75.5%; | ||
46 | + left: 13%; | ||
47 | + } | ||
48 | +</style> | ||
49 | +<div class="wrapper"> | ||
50 | + <div class="container"> | ||
51 | + <ul> | ||
52 | + <li> | ||
53 | + <img src="https://feature.yoho.cn/0113/images/01ff33cffc05e280bd701b90801835ad51.jpg?imageView2/2/q/75/"> | ||
54 | + <a id="btn_download" href="{{downloadLink}}" target="_blank"></a> | ||
55 | + </li> | ||
56 | + <li> | ||
57 | + <img src="https://feature.yoho.cn/0113/images/015d6241108a4db156d4153a5645bd283e.jpg?imageView2/2/q/75/"> | ||
58 | + </li> | ||
59 | + <li> | ||
60 | + <img src="https://feature.yoho.cn/0113/images/01651b926f5f22f4b00b6809925e4388a3.jpg?imageView2/2/q/75/"> | ||
61 | + </li> | ||
62 | + <li> | ||
63 | + <img src="https://feature.yoho.cn/0113/images/0157ad8f797d97f10cc21bd30333c5a7c5.jpg?imageView2/2/q/75/"> | ||
64 | + </li> | ||
65 | + </ul> | ||
66 | + </div> | ||
67 | +</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', |
@@ -2,7 +2,7 @@ | @@ -2,7 +2,7 @@ | ||
2 | {{#data}} | 2 | {{#data}} |
3 | <div class="banner-list"> | 3 | <div class="banner-list"> |
4 | <a href="{{url}}"> | 4 | <a href="{{url}}"> |
5 | - <img src="{{image2 src w=640 h=200 q=60}}" alt=""> | 5 | + <img src="{{image2 src w=640 h=200 q=60 mode=3}}" alt=""> |
6 | </a> | 6 | </a> |
7 | </div> | 7 | </div> |
8 | {{/data}} | 8 | {{/data}} |
@@ -12,7 +12,7 @@ | @@ -12,7 +12,7 @@ | ||
12 | {{#data}} | 12 | {{#data}} |
13 | <li class="swiper-slide"> | 13 | <li class="swiper-slide"> |
14 | <a href="{{url}}"> | 14 | <a href="{{url}}"> |
15 | - <img src="{{image2 src w=640 h=200 q=60}}" alt=""> | 15 | + <img src="{{image2 src w=640 h=200 q=60 mode=3}}" alt=""> |
16 | </a> | 16 | </a> |
17 | </li> | 17 | </li> |
18 | {{/data}} | 18 | {{/data}} |
1 | +var Swiper = require('yoho-swiper2'); | ||
2 | +var lazyLoad = require('yoho-jquery-lazyload'); | ||
3 | +var fastclick = require('yoho-fastclick'); | ||
4 | +var swiperClass; | ||
5 | + | ||
1 | require('../common'); | 6 | require('../common'); |
7 | + | ||
8 | +$(function () { | ||
9 | + fastclick.attach(document.body); | ||
10 | + lazyLoad($('img.lazy')); | ||
11 | + | ||
12 | + // 头部banner轮播 | ||
13 | + if ($('.banner-swiper').find('li').size() > 1) { | ||
14 | + new Swiper('.banner-swiper', { | ||
15 | + lazyLoading: true, | ||
16 | + lazyLoadingInPrevNext: true, | ||
17 | + loop: true, | ||
18 | + autoplay: 3000, | ||
19 | + autoplayDisableOnInteraction: false, | ||
20 | + paginationClickable: true, | ||
21 | + slideElement: 'li', | ||
22 | + pagination: '.banner-top .pagination-inner' | ||
23 | + }); | ||
24 | + } | ||
25 | + | ||
26 | + // 小 banner | ||
27 | + $('.banner-center-swiper').each(function () { | ||
28 | + if ($(this).find('li').length > 1) { | ||
29 | + new Swiper(this, { | ||
30 | + preloadImages: false, | ||
31 | + lazyLoading: true, | ||
32 | + lazyLoadingInPrevNext: true, | ||
33 | + lazyLoadingOnTransitionStart: true, | ||
34 | + loop: true, | ||
35 | + autoplay: 3000, | ||
36 | + autoplayDisableOnInteraction: false, | ||
37 | + slideElement: 'li', | ||
38 | + paginationHide: true | ||
39 | + }); | ||
40 | + } | ||
41 | + }); | ||
42 | + | ||
43 | + // 热门品牌滑动 | ||
44 | + if ($('.brands-swiper').find('li').length > 1) { | ||
45 | + new Swiper('.brands-swiper', { | ||
46 | + grabCursor: true, | ||
47 | + slidesPerView: 'auto', | ||
48 | + wrapperClass: 'brands-list', | ||
49 | + slideElement: 'li' | ||
50 | + }); | ||
51 | + } | ||
52 | + | ||
53 | + // 推荐搭配滑动 | ||
54 | + if ($('.recommend-swiper').find('li').length > 1) { | ||
55 | + new Swiper('.recommend-swiper', { | ||
56 | + grabCursor: true, | ||
57 | + slidesPerView: 'auto', | ||
58 | + wrapperClass: 'recommend-list', | ||
59 | + slideElement: 'li' | ||
60 | + }); | ||
61 | + } | ||
62 | + | ||
63 | + // 潮品话题轮播 | ||
64 | + if ($('.trend-topic-swiper').find('li').size() > 1) { | ||
65 | + new Swiper('.trend-topic-swiper', { | ||
66 | + loop: true, | ||
67 | + autoplay: 3000, | ||
68 | + autoplayDisableOnInteraction: false, | ||
69 | + paginationClickable: true, | ||
70 | + slideElement: 'li', | ||
71 | + pagination: '.trend-topic-content .pagination-inner' | ||
72 | + }); | ||
73 | + } | ||
74 | + | ||
75 | + // 新人专享轮播 | ||
76 | + if ($('.fresh-list-swiper').find('li').size() > 1) { | ||
77 | + new Swiper('.fresh-list-swiper', { | ||
78 | + lazyLoading: true, | ||
79 | + lazyLoadingInPrevNext: true, | ||
80 | + grabCursor: true, | ||
81 | + slidesPerView: 'auto', | ||
82 | + slideElement: 'li', | ||
83 | + watchSlidesVisibility: true | ||
84 | + }); | ||
85 | + } | ||
86 | + | ||
87 | + // 潮流上装/经典裤装等轮播 | ||
88 | + $('.category-swiper').each(function (i) { | ||
89 | + swiperClass = 'category-swiper' + i; | ||
90 | + $(this).addClass(swiperClass); | ||
91 | + if ($('.' + swiperClass).find('.swiper-slide').size() > 1) { | ||
92 | + new Swiper('.' + swiperClass, { | ||
93 | + preloadImages: false, | ||
94 | + lazyLoading: true, | ||
95 | + lazyLoadingInPrevNext: true, | ||
96 | + lazyLoadingOnTransitionStart: true, | ||
97 | + loop: true, | ||
98 | + autoplay: 3000, | ||
99 | + autoplayDisableOnInteraction: false, | ||
100 | + paginationClickable: true, | ||
101 | + slideElement: 'li', | ||
102 | + pagination: '.' + swiperClass + ' .pagination-inner' | ||
103 | + }); | ||
104 | + } | ||
105 | + }); | ||
106 | +}); |
-
Please register or login to post a comment