Merge branch 'gray'
Showing
16 changed files
with
328 additions
and
12 deletions
@@ -187,7 +187,7 @@ const index = (req, res, next) => { | @@ -187,7 +187,7 @@ const index = (req, res, next) => { | ||
187 | let param = { | 187 | let param = { |
188 | uid: req.user.uid || req.query.uid, | 188 | uid: req.user.uid || req.query.uid, |
189 | udid: req.user.udid, | 189 | udid: req.user.udid, |
190 | - type: req.query.type || '0', | 190 | + type: req.query.type || req.query.id || '0', |
191 | gender: req.query.gender || req.query.channel && typeLib.gender[req.query.channel] || '1,3' | 191 | gender: req.query.gender || req.query.channel && typeLib.gender[req.query.channel] || '1,3' |
192 | }; | 192 | }; |
193 | 193 |
@@ -135,7 +135,7 @@ const _article = (param) => { | @@ -135,7 +135,7 @@ const _article = (param) => { | ||
135 | page: param.page || 1, | 135 | page: param.page || 1, |
136 | uid: param.uid, | 136 | uid: param.uid, |
137 | udid: param.udid, | 137 | udid: param.udid, |
138 | - sort_id: 0, | 138 | + sort_id: param.type || 0, |
139 | tag: param.tag ? param.tag : null, | 139 | tag: param.tag ? param.tag : null, |
140 | limit: 4 | 140 | limit: 4 |
141 | 141 | ||
@@ -223,7 +223,7 @@ const getArticle = (param) => { | @@ -223,7 +223,7 @@ const getArticle = (param) => { | ||
223 | 223 | ||
224 | let swp = []; | 224 | let swp = []; |
225 | 225 | ||
226 | - let swiperList = result[1].data.list.adlist; | 226 | + let swiperList = _.get(result[1], 'data.list.adlist', []); |
227 | 227 | ||
228 | 228 | ||
229 | swiperList.forEach(val => { | 229 | swiperList.forEach(val => { |
@@ -7,6 +7,7 @@ | @@ -7,6 +7,7 @@ | ||
7 | 'use strict'; | 7 | 'use strict'; |
8 | 8 | ||
9 | const mRoot = '../models'; | 9 | const mRoot = '../models'; |
10 | +const appSrc = require('../../../config/download'); | ||
10 | const headerModel = require('../../../doraemon/models/header'); // 头部model | 11 | const headerModel = require('../../../doraemon/models/header'); // 头部model |
11 | const detailModel = require(`${mRoot}/detail`); // 商品详情 model | 12 | const detailModel = require(`${mRoot}/detail`); // 商品详情 model |
12 | const introModel = require(`${mRoot}/intro`); // 商品尺码信息 model | 13 | const introModel = require(`${mRoot}/intro`); // 商品尺码信息 model |
@@ -193,6 +194,43 @@ exports.consultsubmit = (req, res, next) => { | @@ -193,6 +194,43 @@ exports.consultsubmit = (req, res, next) => { | ||
193 | }).catch(next); | 194 | }).catch(next); |
194 | }; | 195 | }; |
195 | 196 | ||
197 | + | ||
198 | +/** | ||
199 | + * 限定商品 详情页; | ||
200 | + */ | ||
201 | +exports.limit = (req, res, next) => { | ||
202 | + res.locals.module = 'product'; | ||
203 | + res.locals.page = 'limit'; | ||
204 | + | ||
205 | + const uid = req.user.uid; | ||
206 | + const productCode = (req.query.code || '').trim(); | ||
207 | + | ||
208 | + if (!productCode) { | ||
209 | + return next(/* 404 */); | ||
210 | + } | ||
211 | + | ||
212 | + detailModel.getLimitProductData(uid, productCode) | ||
213 | + .then(result => { | ||
214 | + if (_.isEmpty(result)) { | ||
215 | + return next(); | ||
216 | + } | ||
217 | + | ||
218 | + result.appSrc = appSrc.common; | ||
219 | + result.wxshare = { | ||
220 | + shareLink: helpers.urlFormat('/product/detail/limit', {code: productCode}), | ||
221 | + shareImg: result.banner.replace('//', 'http://'), | ||
222 | + shareTitle: result.name, | ||
223 | + shareDesc: '我在Yoho!Buy有货发现了一个限定发售商品', | ||
224 | + }; | ||
225 | + | ||
226 | + res.render('detail/limit', result); | ||
227 | + }) | ||
228 | + .catch(error => { | ||
229 | + next(error); | ||
230 | + }); | ||
231 | + | ||
232 | +}; | ||
233 | + | ||
196 | /** | 234 | /** |
197 | * 商品基本信息 SKN 进入 pagecache重构 | 235 | * 商品基本信息 SKN 进入 pagecache重构 |
198 | * @param {[type]} req [description] | 236 | * @param {[type]} req [description] |
@@ -310,6 +348,7 @@ exports.indexData = (req, res, next) => { | @@ -310,6 +348,7 @@ exports.indexData = (req, res, next) => { | ||
310 | return res.json(result); | 348 | return res.json(result); |
311 | }).catch(next); | 349 | }).catch(next); |
312 | 350 | ||
351 | + | ||
313 | }; | 352 | }; |
314 | 353 | ||
315 | 354 |
@@ -822,11 +822,80 @@ let _productInfoBySkns = (skns) => { | @@ -822,11 +822,80 @@ let _productInfoBySkns = (skns) => { | ||
822 | }); | 822 | }); |
823 | }; | 823 | }; |
824 | 824 | ||
825 | +const getLimitProductData = (uid, limitProductCode) => { | ||
826 | + const param = { | ||
827 | + method: 'app.limitProduct.limitProductDetail', | ||
828 | + limitProductCode, | ||
829 | + uid | ||
830 | + }; | ||
831 | + | ||
832 | + return api.get('', param).then(result => { | ||
833 | + if (!(result && result.data)) { | ||
834 | + return Promise.reject(result); | ||
835 | + } | ||
836 | + | ||
837 | + let obj = {}; | ||
838 | + | ||
839 | + // if (!result.data.hasOwnProperty('attachment')) { | ||
840 | + // return | ||
841 | + // } | ||
842 | + | ||
843 | + obj.price = result.data.price; | ||
844 | + obj.name = result.data.productName; | ||
845 | + obj.releaseDate = `${result.data.saleTime}发售`; | ||
846 | + obj.banner = helpers.image(result.data.defaultUrl, 750, ''); | ||
847 | + obj.description = result.data.description; | ||
848 | + obj.attaches = []; | ||
849 | + | ||
850 | + result.data.attachment = result.data.attachment || []; | ||
851 | + | ||
852 | + for (let item of result.data.attachment) { | ||
853 | + if (item.isDefault === 1) { // 排除默认图片 | ||
854 | + continue; | ||
855 | + } | ||
856 | + | ||
857 | + let attach = {}; | ||
858 | + | ||
859 | + switch (item.attachType) { | ||
860 | + case 1: | ||
861 | + attach.isImg = true; | ||
862 | + attach.attachUrl = helpers.image(item.attachUrl, 750, ''); | ||
863 | + attach.attachName = item.intro; | ||
864 | + attach.intro = item.intro; | ||
865 | + break; | ||
866 | + case 2: | ||
867 | + attach.isVideo = true; | ||
868 | + attach.attachUrl = item.attachUrl; | ||
869 | + attach.img = helpers.image(item.intro, 750, ''); | ||
870 | + break; | ||
871 | + case 3: | ||
872 | + attach.isText = true; | ||
873 | + attach.intro = item.intro; | ||
874 | + break; | ||
875 | + default: | ||
876 | + break; | ||
877 | + } | ||
878 | + attach.orderBy = item.orderBy; | ||
879 | + | ||
880 | + obj.attaches.push(attach); | ||
881 | + } | ||
882 | + | ||
883 | + if (obj.attaches.length > 1) { | ||
884 | + obj.attaches.sort((v1, v2) => { | ||
885 | + return v1.orderBy - v2.orderBy; | ||
886 | + }); | ||
887 | + } | ||
888 | + | ||
889 | + return obj; | ||
890 | + }); | ||
891 | +}; | ||
892 | + | ||
825 | module.exports = { | 893 | module.exports = { |
826 | getProductData, | 894 | getProductData, |
827 | getProductAsyncData, | 895 | getProductAsyncData, |
828 | getNewProductAsyncData, | 896 | getNewProductAsyncData, |
829 | getUserProfile: _getUserProfile, | 897 | getUserProfile: _getUserProfile, |
830 | productInfoBySkns: _productInfoBySkns, | 898 | productInfoBySkns: _productInfoBySkns, |
831 | - detailDataPkgAsync: _detailDataPkgAsync | 899 | + detailDataPkgAsync: _detailDataPkgAsync, |
900 | + getLimitProductData | ||
832 | }; | 901 | }; |
@@ -75,16 +75,22 @@ router.post('/detail/info', detail.getUser, detail.indexData); // 商å“è¯¦æƒ…é¡ | @@ -75,16 +75,22 @@ router.post('/detail/info', detail.getUser, detail.indexData); // 商å“è¯¦æƒ…é¡ | ||
75 | router.post('/detail/newinfo', detail.getUser, newDetail.indexData); // 商品详情页-异步数据 (优化) | 75 | router.post('/detail/newinfo', detail.getUser, newDetail.indexData); // 商品详情页-异步数据 (优化) |
76 | router.post('/detail/consultsubmit', auth, detail.consultsubmit); // 商品咨询提交接口 | 76 | router.post('/detail/consultsubmit', auth, detail.consultsubmit); // 商品咨询提交接口 |
77 | 77 | ||
78 | + | ||
78 | router.get('/detail/coupon.json', detail.brandCoupon); // 品牌券 | 79 | router.get('/detail/coupon.json', detail.brandCoupon); // 品牌券 |
79 | router.post('/detail/coupon/save.json', auth, detail.getCoupon); // 获得 品牌券 | 80 | router.post('/detail/coupon/save.json', auth, detail.getCoupon); // 获得 品牌券 |
80 | 81 | ||
81 | router.get('/recom/maylike', recom.mayLike); // 你可能喜欢 | 82 | router.get('/recom/maylike', recom.mayLike); // 你可能喜欢 |
83 | + | ||
84 | + | ||
85 | +// 限定商品 | ||
86 | +router.get('/detail/limit', detail.limit); | ||
87 | + | ||
88 | +router.get('/recom/maylike', recom.mayLike);// 你可能喜欢 | ||
82 | router.get('/recom/maylikekids', recom.mayLikeKids); // 潮童你可能喜欢 | 89 | router.get('/recom/maylikekids', recom.mayLikeKids); // 潮童你可能喜欢 |
83 | router.get('/recom/maylikelife', recom.mayLikelife); // 创意生活你可能喜欢 | 90 | router.get('/recom/maylikelife', recom.mayLikelife); // 创意生活你可能喜欢 |
84 | 91 | ||
85 | router.get('/seckillDetail/seckillData/:productskn', seckillDetail.getSeckillData); // 秒杀数据接口 | 92 | router.get('/seckillDetail/seckillData/:productskn', seckillDetail.getSeckillData); // 秒杀数据接口 |
86 | 93 | ||
87 | - | ||
88 | router.post('/detail/consultupvote', detail.consultUpvoteOrUseful); // 商品咨询提交接口 | 94 | router.post('/detail/consultupvote', detail.consultUpvoteOrUseful); // 商品咨询提交接口 |
89 | router.post('/detail/consultuseful', detail.consultUpvoteOrUseful); // 商品咨询提交接口 | 95 | router.post('/detail/consultuseful', detail.consultUpvoteOrUseful); // 商品咨询提交接口 |
90 | 96 |
apps/product/views/action/detail/limit.hbs
0 → 100644
1 | +<div class="limit-good-page yoho-page"> | ||
2 | + <div class="top clearfix"> | ||
3 | + <p>我在Yoho!Buy有货发现了一个限定发售商品</p> | ||
4 | + </div> | ||
5 | + <div class="banner"> | ||
6 | + <img src="{{banner}}" alt=""> | ||
7 | + </div> | ||
8 | + <div class="detail clearfix"> | ||
9 | + <p class="name">{{name}}</p> | ||
10 | + <div class="sale-info"> | ||
11 | + <span class="price">{{price}}</span> | ||
12 | + <span class="date"> | ||
13 | + <span class="iconfont"></span> | ||
14 | + <span class="text">{{releaseDate}}</span> | ||
15 | + </span> | ||
16 | + </div> | ||
17 | + </div> | ||
18 | + | ||
19 | + {{#if attaches}} | ||
20 | + <div class="good-desc"> | ||
21 | + {{# attaches}} | ||
22 | + {{#if isImg}} | ||
23 | + <img src="{{attachUrl}}" alt="{{attachName}}"> | ||
24 | + {{else if isText}} | ||
25 | + <p class="desc">{{intro}}</p> | ||
26 | + {{else}} | ||
27 | + <video poster="{{img}}" controls="controls" controls="controls" preload="metadata" loop="loop" width="100%" name="media"> | ||
28 | + <source src="{{attachUrl}}" type="video/ogg;codecs=" theora,vorbis"" media="screen" /> | ||
29 | + <source src="{{attachUrl}}"/> | ||
30 | + </video> | ||
31 | + {{/if}} | ||
32 | + {{/attaches}} | ||
33 | + </div> | ||
34 | + {{/if}} | ||
35 | + | ||
36 | + <div class="bottom"> | ||
37 | + <div class="logo"></div> | ||
38 | + <div class="left"> | ||
39 | + <a href="{{appSrc}}"> | ||
40 | + <button class="btn"> | ||
41 | + 立即下载 | ||
42 | + </button> | ||
43 | + </a> | ||
44 | + </div> | ||
45 | + <div class="right"> | ||
46 | + <span>下载Yoho!Buy有货APP</span> | ||
47 | + <span>抢购超级限量款</span> | ||
48 | + </div> | ||
49 | + </div> | ||
50 | +{{#wxshare}} | ||
51 | + <input id="shareLink" type="hidden" value="{{shareLink}}"> | ||
52 | + <input id="shareImg" type="hidden" value="{{shareImg}}"> | ||
53 | + <input id="shareTitle" type="hidden" value="{{shareTitle}}"> | ||
54 | + <input id="shareDesc" type="hidden" value="{{shareDesc}}"> | ||
55 | +{{/wxshare}} | ||
56 | +</div> |
config/download.js
0 → 100644
public/img/product/logo-bottom.png
0 → 100644

5.81 KB
public/img/sprite.product.png
0 → 100644

5.12 KB
@@ -63,9 +63,9 @@ setTimeout(function() { | @@ -63,9 +63,9 @@ setTimeout(function() { | ||
63 | info.initInfosEvt($infosContainer); | 63 | info.initInfosEvt($infosContainer); |
64 | 64 | ||
65 | // 文字介绍收起与展开 | 65 | // 文字介绍收起与展开 |
66 | -moreHammer = new Hammer(document.getElementById('more-intro-click-range')); | ||
67 | -moreHammer.on('tap', function(e) { | 66 | +$('#more-intro-click-range').on('click', function(e) { |
68 | var $this = $imt.parent(); | 67 | var $this = $imt.parent(); |
68 | + e.preventDefault(); // 防止收缩后误点到商品产生跳转 | ||
69 | 69 | ||
70 | $this.toggleClass('spread'); | 70 | $this.toggleClass('spread'); |
71 | 71 | ||
@@ -83,7 +83,6 @@ moreHammer.on('tap', function(e) { | @@ -83,7 +83,6 @@ moreHammer.on('tap', function(e) { | ||
83 | $(window).scrollTop(0, 400); // 滑动到顶部 | 83 | $(window).scrollTop(0, 400); // 滑动到顶部 |
84 | } | 84 | } |
85 | 85 | ||
86 | - e.srcEvent.preventDefault(); // 防止收缩后误点到商品产生跳转 | ||
87 | }); | 86 | }); |
88 | 87 | ||
89 | if ($('#brand-like').length) { | 88 | if ($('#brand-like').length) { |
public/js/product/limit.page.js
0 → 100644
@@ -390,11 +390,11 @@ | @@ -390,11 +390,11 @@ | ||
390 | } | 390 | } |
391 | 391 | ||
392 | .hover { | 392 | .hover { |
393 | - position: fixed; | ||
394 | - width: 100%; | 393 | + position: fixed !important; |
394 | + width: 100% !important; | ||
395 | background-color: black; | 395 | background-color: black; |
396 | height: 100%; | 396 | height: 100%; |
397 | - top: 0; | 397 | + top: 0 !important; |
398 | left: 0; | 398 | left: 0; |
399 | right: 0; | 399 | right: 0; |
400 | border: 0; | 400 | border: 0; |
public/scss/product/detail/_limit.css
0 → 100644
1 | +.limit-good-page { | ||
2 | + background-color: #f4f4f4; | ||
3 | + color: #444; | ||
4 | + | ||
5 | + .top { | ||
6 | + font-size: 24px; | ||
7 | + height: 80px; | ||
8 | + line-height: 88px; | ||
9 | + margin-bottom: 4px; | ||
10 | + background-color: #fff; | ||
11 | + padding: 8px 0 8px 20px; | ||
12 | + | ||
13 | + div { | ||
14 | + width: 0%; | ||
15 | + display: inline-block; | ||
16 | + | ||
17 | + img { | ||
18 | + width: 60px; | ||
19 | + position: relative; | ||
20 | + top: 10px; | ||
21 | + } | ||
22 | + } | ||
23 | + | ||
24 | + p { | ||
25 | + display: inline-block; | ||
26 | + width: 80%; | ||
27 | + } | ||
28 | + } | ||
29 | + | ||
30 | + .detail { | ||
31 | + background-color: #fff; | ||
32 | + padding: 24px 32px; | ||
33 | + border-bottom: 1PX solid #e6e6e6; | ||
34 | + margin-bottom: 1rem; | ||
35 | + | ||
36 | + .name { | ||
37 | + font-size: 36px; | ||
38 | + margin-bottom: 20px; | ||
39 | + } | ||
40 | + | ||
41 | + .sale-info { | ||
42 | + height: 40px; | ||
43 | + line-height: 40px; | ||
44 | + } | ||
45 | + | ||
46 | + .price { | ||
47 | + font-size: 32px; | ||
48 | + color: #d0021b; | ||
49 | + float: left; | ||
50 | + } | ||
51 | + | ||
52 | + .date { | ||
53 | + font-size: 24px; | ||
54 | + float: right; | ||
55 | + | ||
56 | + .text { | ||
57 | + position: relative; | ||
58 | + top: 3.2px; | ||
59 | + } | ||
60 | + } | ||
61 | + | ||
62 | + .iconfont { | ||
63 | + vertical-align: middle; | ||
64 | + } | ||
65 | + } | ||
66 | + | ||
67 | + .good-desc { | ||
68 | + padding: 20px; | ||
69 | + border-top: 1PX solid #e6e6e6; | ||
70 | + background-color: #fff; | ||
71 | + | ||
72 | + p { | ||
73 | + font-size: 24px; | ||
74 | + line-height: 40px; | ||
75 | + text-indent: 2em; | ||
76 | + } | ||
77 | + | ||
78 | + img { | ||
79 | + margin: 12px 0; | ||
80 | + max-width: 100%; | ||
81 | + } | ||
82 | + } | ||
83 | + | ||
84 | + .bottom { | ||
85 | + background-color: #fff; | ||
86 | + padding: 20px 80px 80px; | ||
87 | + margin: 0 auto; | ||
88 | + | ||
89 | + .logo { | ||
90 | + height: 100px; | ||
91 | + background-image: resolve("product/logo-bottom.png"); | ||
92 | + background-size: 100%; | ||
93 | + background-repeat: no-repeat; | ||
94 | + background-position: center; | ||
95 | + } | ||
96 | + | ||
97 | + .btn { | ||
98 | + font-size: 32px; | ||
99 | + background-color: #fff; | ||
100 | + border: 1PX solid #444; | ||
101 | + border-radius: 8px; | ||
102 | + padding: 12px 24px; | ||
103 | + } | ||
104 | + | ||
105 | + .btn:active { | ||
106 | + background-color: #ccc; | ||
107 | + } | ||
108 | + | ||
109 | + .left, | ||
110 | + .right { | ||
111 | + float: left; | ||
112 | + } | ||
113 | + | ||
114 | + .left { | ||
115 | + width: 39%; | ||
116 | + } | ||
117 | + | ||
118 | + .right { | ||
119 | + width: 60%; | ||
120 | + font-size: 26px; | ||
121 | + | ||
122 | + span { | ||
123 | + display: block; | ||
124 | + width: 95%; | ||
125 | + margin: 0 auto; | ||
126 | + } | ||
127 | + } | ||
128 | + } | ||
129 | +} |
-
Please register or login to post a comment