Showing
4 changed files
with
137 additions
and
11 deletions
@@ -9,18 +9,17 @@ const mRoot = '../models'; | @@ -9,18 +9,17 @@ const mRoot = '../models'; | ||
9 | const plustarModel = require(`${mRoot}/plustar`); | 9 | const plustarModel = require(`${mRoot}/plustar`); |
10 | const headerModel = require('../../../doraemon/models/header'); // 头部model | 10 | const headerModel = require('../../../doraemon/models/header'); // 头部model |
11 | let channels = { | 11 | let channels = { |
12 | - boys: 1, | ||
13 | - girl: 2, | ||
14 | - kids: 3, | ||
15 | - lifestyle: 4 | 12 | + boys: '1,3', |
13 | + girl: '2,3', | ||
14 | + kids: '3,3', | ||
15 | + lifestyle: '4' | ||
16 | }; | 16 | }; |
17 | 17 | ||
18 | const getListData = (req, res, next) => { | 18 | const getListData = (req, res, next) => { |
19 | let gender = req.query.gender || req.cookies._Channel && channels[req.cookies._Channel] || 1; | 19 | let gender = req.query.gender || req.cookies._Channel && channels[req.cookies._Channel] || 1; |
20 | let recom = '4'; | 20 | let recom = '4'; |
21 | let all = '1'; | 21 | let all = '1'; |
22 | - | ||
23 | - // console.log(gender); | 22 | + console.log(gender) |
24 | 23 | ||
25 | plustarModel.getListData(gender, recom, all).then((result) => { | 24 | plustarModel.getListData(gender, recom, all).then((result) => { |
26 | 25 | ||
@@ -41,6 +40,36 @@ const getListData = (req, res, next) => { | @@ -41,6 +40,36 @@ const getListData = (req, res, next) => { | ||
41 | }).catch(next); | 40 | }).catch(next); |
42 | }; | 41 | }; |
43 | 42 | ||
43 | +const getDetailData = (req, res, next) => { | ||
44 | + let id = req.query.id || 342; | ||
45 | + let uid = req.user.uid; | ||
46 | + let udid = req.sessionID; | ||
47 | + let gender = req.query.gender || req.cookies._Channel && channels[req.cookies._Channel] || '1,3'; | ||
48 | + let isApp = req.query.app_version || req.query.appVersion || false; | ||
49 | + let clientType = req.body.client_type || ''; | ||
50 | + | ||
51 | + if (clientType.toLowerCase() === 'ios' && version) { | ||
52 | + clientType = 'iphone'; | ||
53 | + } else if (clientType.toLowerCase() === 'android' && version) { | ||
54 | + clientType = 'android'; | ||
55 | + } else { | ||
56 | + clientType = 'h5'; | ||
57 | + } | ||
58 | + | ||
59 | + plustarModel.getDetailData(id, uid, udid, gender, isApp, clientType).then((result) => { | ||
60 | + res.render('plustar/detail', { | ||
61 | + module: 'guang', | ||
62 | + page: 'plustar-detail', | ||
63 | + pageHeader: headerModel.setNav({ | ||
64 | + navTitle: '品牌介绍' | ||
65 | + }), | ||
66 | + pageFooter: true, | ||
67 | + ps: result | ||
68 | + }); | ||
69 | + }).catch(next); | ||
70 | +}; | ||
71 | + | ||
44 | module.exports = { | 72 | module.exports = { |
45 | - getListData | 73 | + getListData, |
74 | + getDetailData | ||
46 | }; | 75 | }; |
@@ -3,6 +3,8 @@ const api = global.yoho.API; | @@ -3,6 +3,8 @@ const api = global.yoho.API; | ||
3 | const serviceAPI = global.yoho.ServiceAPI; | 3 | const serviceAPI = global.yoho.ServiceAPI; |
4 | const _ = require('lodash'); | 4 | const _ = require('lodash'); |
5 | const productProcess = require('../../../utils/product-process'); | 5 | const productProcess = require('../../../utils/product-process'); |
6 | +const logger = global.yoho.logger; | ||
7 | +const camelCase = global.yoho.camelCase; | ||
6 | 8 | ||
7 | const formaData = (data, gender) => { | 9 | const formaData = (data, gender) => { |
8 | let build = []; | 10 | let build = []; |
@@ -64,8 +66,6 @@ const getContentData = (gender, type) => { | @@ -64,8 +66,6 @@ const getContentData = (gender, type) => { | ||
64 | }); | 66 | }); |
65 | }; | 67 | }; |
66 | 68 | ||
67 | - | ||
68 | - | ||
69 | const getListData = (gender, recom, all) => { | 69 | const getListData = (gender, recom, all) => { |
70 | return Promise.all([getContentData(gender, recom), getContentData(gender, all)]).then((result) => { | 70 | return Promise.all([getContentData(gender, recom), getContentData(gender, all)]).then((result) => { |
71 | return { | 71 | return { |
@@ -75,7 +75,37 @@ const getListData = (gender, recom, all) => { | @@ -75,7 +75,37 @@ const getListData = (gender, recom, all) => { | ||
75 | }); | 75 | }); |
76 | }; | 76 | }; |
77 | 77 | ||
78 | +const getRelatedEditorial = () => { | ||
79 | + | ||
80 | +}; | ||
81 | + | ||
82 | +const getBrandData = (id, clientType) => { | ||
83 | + | ||
84 | + return serviceAPI.get('guang/api/v1/plustar/getbrandinfo', { | ||
85 | + id: id, | ||
86 | + client_type: clientType | ||
87 | + }).then((result) => { | ||
88 | + if (result && result.code === 200) { | ||
89 | + //console.log(result.data) | ||
90 | + | ||
91 | + return camelCase(result.data); | ||
92 | + } else { | ||
93 | + logger.error('detail data return code is not 200'); | ||
94 | + return {}; | ||
95 | + } | ||
96 | + }); | ||
97 | +}; | ||
98 | + | ||
99 | +const getDetailData = (id, uid, udid, gender, isApp, clientType) => { | ||
100 | + return Promise.all([getBrandData(id, clientType), getRelatedEditorial(gender)]).then((result) => { | ||
101 | + return result; | ||
102 | + }); | ||
103 | +}; | ||
104 | + | ||
105 | + | ||
106 | + | ||
78 | module.exports = { | 107 | module.exports = { |
79 | getListData, | 108 | getListData, |
80 | - getContentData | 109 | + getContentData, |
110 | + getDetailData | ||
81 | }; | 111 | }; |
@@ -41,6 +41,7 @@ router.get('/info/index', info.index); // 逛详情页 | @@ -41,6 +41,7 @@ router.get('/info/index', info.index); // 逛详情页 | ||
41 | router.get('/info/mini', info.mini); // 逛mini内容页 | 41 | router.get('/info/mini', info.mini); // 逛mini内容页 |
42 | router.get('/info/foryoho', info.foryoho); // 逛foryoho内容页 | 42 | router.get('/info/foryoho', info.foryoho); // 逛foryoho内容页 |
43 | 43 | ||
44 | -router.get('/plustar', plustar.getListData); // 国际优选 | 44 | +router.get('/plustar', plustar.getListData); // 国际优选列表页 |
45 | +router.get('/plustar/brandinfo', plustar.getDetailData); // 国际优选详情页 | ||
45 | 46 | ||
46 | module.exports = router; | 47 | module.exports = router; |
apps/guang/views/action/plustar/detail.hbs
0 → 100644
1 | +<div class="ps-detail-page ps-page yoho-page"> | ||
2 | + {{# ps}} | ||
3 | + <div id="brand-info" class="header brand-info ps-block" data-id="{{brandId}}"> | ||
4 | + <img class="banner lazy" src="{{image coverImg 640 309}}"> | ||
5 | + <img class="logo lazy" data-original="{{brandIco}}"> | ||
6 | + <div class="header-content clearfix"> | ||
7 | + <p class="name-islike-container"> | ||
8 | + <span class="name">{{brandName}}</span> | ||
9 | + <a id="brand-like" class="brand-islike iconfont {{# isLike}}like{{/ isLike}}" href="{{likeUrl}}"> | ||
10 | +  | ||
11 | + </a> | ||
12 | + </p> | ||
13 | + <div id="more-intro-click-range" class="clearfix"> | ||
14 | + <p id="intro" class="intro"> | ||
15 | + {{{brandIntro}}} | ||
16 | + </p> | ||
17 | + {{#if brandIntro}} | ||
18 | + <span id="more-intro" class="more-intro"> | ||
19 | + <span id="intro-more-txt">more</span> | ||
20 | + <i class="icon iconfont"></i> | ||
21 | + </span> | ||
22 | + {{/if}} | ||
23 | + </div> | ||
24 | + </div> | ||
25 | + </div> | ||
26 | + {{# newArrival}} | ||
27 | + <div class="new-arrival ps-block"> | ||
28 | + <div class="floor-header-more"> | ||
29 | + <h2>NEW ARRIVAL</h2> | ||
30 | + <a class="more-btn iconfont buriedpoint" href="{{moreUrl}}" data-bp-id="shop_more_btn_0"></a> | ||
31 | + </div> | ||
32 | + <div class="new-arrival-content clearfix"> | ||
33 | + {{# naList}} | ||
34 | + {{> good}} | ||
35 | + {{/ naList}} | ||
36 | + </div> | ||
37 | + <div class="more-goods-container"> | ||
38 | + <a class="mg-text" href="{{moreUrl}}"> | ||
39 | + 更多商品 | ||
40 | + <span class="more-prods iconfont"></span> | ||
41 | + </a> | ||
42 | + </div> | ||
43 | + </div> | ||
44 | + {{/ newArrival}} | ||
45 | + {{#if infos}} | ||
46 | + <div class="related-infos ps-block"> | ||
47 | + <div> | ||
48 | + <h2 class="related-info-title">相关资讯</h2> | ||
49 | + </div> | ||
50 | + <div id="related-infos-container" class="related-infos-container"> | ||
51 | + {{# infos}} | ||
52 | + {{> guang/info}} | ||
53 | + {{/ infos}} | ||
54 | + </div> | ||
55 | + </div> | ||
56 | + {{/if}} | ||
57 | + | ||
58 | + <input id="jump-to-app" type="hidden" value="{{jumpToApp}}"> | ||
59 | + | ||
60 | + {{!-- wx-share --}} | ||
61 | + <input id="shareLink" type="hidden" value="{{shareLink}}"> | ||
62 | + <input id="shareImg" type="hidden" value="{{shareImg}}"> | ||
63 | + <input id="shareTitle" type="hidden" value="{{shareTitle}}"> | ||
64 | + <input id="shareDesc" type="hidden" value="{{shareDesc}}"> | ||
65 | + {{/ ps}} | ||
66 | +</div> |
-
Please register or login to post a comment