Merge branch 'develop' of http://git.yoho.cn/fe/yohobuywap-node into develop
Showing
11 changed files
with
59 additions
and
49 deletions
@@ -63,11 +63,12 @@ exports.index = (req, res) => { | @@ -63,11 +63,12 @@ exports.index = (req, res) => { | ||
63 | * @param {[object]} res | 63 | * @param {[object]} res |
64 | * @return {[type]} | 64 | * @return {[type]} |
65 | */ | 65 | */ |
66 | -exports.breakCode = (req, res) => { | 66 | +exports.breakingYards = (req, res) => { |
67 | let headerData = headerModel.setNavHeader('断码区'); | 67 | let headerData = headerModel.setNavHeader('断码区'); |
68 | let renderData = { | 68 | let renderData = { |
69 | module: 'product', | 69 | module: 'product', |
70 | page: 'break-code', | 70 | page: 'break-code', |
71 | + title: '断码区', | ||
71 | pageHeader: headerData, | 72 | pageHeader: headerData, |
72 | pageFooter: true | 73 | pageFooter: true |
73 | }; | 74 | }; |
@@ -87,17 +88,17 @@ exports.breakCode = (req, res) => { | @@ -87,17 +88,17 @@ exports.breakCode = (req, res) => { | ||
87 | * @param {[object]} res | 88 | * @param {[object]} res |
88 | * @return {[type]} | 89 | * @return {[type]} |
89 | */ | 90 | */ |
90 | -exports.special = (req, res) => { | 91 | +exports.discount = (req, res) => { |
91 | let headerData = headerModel.setNavHeader('折扣专场'); | 92 | let headerData = headerModel.setNavHeader('折扣专场'); |
92 | let renderData = { | 93 | let renderData = { |
93 | module: 'product', | 94 | module: 'product', |
94 | - page: 'special', | 95 | + page: 'discount', |
95 | pageHeader: headerData, | 96 | pageHeader: headerData, |
96 | pageFooter: true | 97 | pageFooter: true |
97 | }; | 98 | }; |
98 | 99 | ||
99 | - saleModel.getSpecialData().then((result) => { | ||
100 | - res.render('sale/special', Object.assign(renderData, result)); | 100 | + saleModel.getDiscountData().then((result) => { |
101 | + res.render('sale/discount', Object.assign(renderData, result)); | ||
101 | }).catch((err) => { | 102 | }).catch((err) => { |
102 | saleLogger(err, res); | 103 | saleLogger(err, res); |
103 | }); | 104 | }); |
@@ -110,19 +111,19 @@ exports.special = (req, res) => { | @@ -110,19 +111,19 @@ exports.special = (req, res) => { | ||
110 | * @param {[object]} res | 111 | * @param {[object]} res |
111 | * @return {[type]} | 112 | * @return {[type]} |
112 | */ | 113 | */ |
113 | -exports.specialDetail = (req, res) => { | 114 | +exports.discountDetail = (req, res) => { |
114 | let headerData = headerModel.setNavHeader(); | 115 | let headerData = headerModel.setNavHeader(); |
115 | let id = req.query.id; | 116 | let id = req.query.id; |
116 | let renderData = { | 117 | let renderData = { |
117 | module: 'product', | 118 | module: 'product', |
118 | - page: 'special-detail', | 119 | + page: 'discount-detail', |
119 | pageFooter: true | 120 | pageFooter: true |
120 | }; | 121 | }; |
121 | 122 | ||
122 | - saleModel.getSpecialDetailData(id).then((result) => { | 123 | + saleModel.getDiscountDetailData(id).then((result) => { |
123 | headerData.navTitle = result.title; | 124 | headerData.navTitle = result.title; |
124 | renderData.pageHeader = headerData; | 125 | renderData.pageHeader = headerData; |
125 | - res.render('sale/special-detail', Object.assign(renderData, result)); | 126 | + res.render('sale/discount-detail', Object.assign(renderData, result)); |
126 | }).catch((err) => { | 127 | }).catch((err) => { |
127 | saleLogger(err, res); | 128 | saleLogger(err, res); |
128 | }); | 129 | }); |
@@ -139,6 +140,7 @@ exports.vip = (req, res) => { | @@ -139,6 +140,7 @@ exports.vip = (req, res) => { | ||
139 | let renderData = { | 140 | let renderData = { |
140 | module: 'product', | 141 | module: 'product', |
141 | page: 'vip', | 142 | page: 'vip', |
143 | + title: '会员专享', | ||
142 | pageHeader: headerData, | 144 | pageHeader: headerData, |
143 | pageFooter: true | 145 | pageFooter: true |
144 | }; | 146 | }; |
@@ -75,7 +75,7 @@ const processTime = (time) => { | @@ -75,7 +75,7 @@ const processTime = (time) => { | ||
75 | * @param {[array]} list | 75 | * @param {[array]} list |
76 | * @return {[array]} | 76 | * @return {[array]} |
77 | */ | 77 | */ |
78 | -const processSpecial = (list) => { | 78 | +const processDiscount = (list) => { |
79 | const formatData = []; | 79 | const formatData = []; |
80 | let flag = true; | 80 | let flag = true; |
81 | 81 | ||
@@ -88,7 +88,7 @@ const processSpecial = (list) => { | @@ -88,7 +88,7 @@ const processSpecial = (list) => { | ||
88 | 88 | ||
89 | _.forEach(list, (data) => { | 89 | _.forEach(list, (data) => { |
90 | if (flag === true) { | 90 | if (flag === true) { |
91 | - data.specialUrl = `/product/specialDetail?id=${data.id}`; | 91 | + data.specialUrl = `/product/sale/discount/detail?id=${data.id}`; |
92 | _.merge(data, processTime(data.leftTime)); | 92 | _.merge(data, processTime(data.leftTime)); |
93 | } | 93 | } |
94 | 94 | ||
@@ -103,13 +103,13 @@ const processSpecial = (list) => { | @@ -103,13 +103,13 @@ const processSpecial = (list) => { | ||
103 | * @param {[object]} params | 103 | * @param {[object]} params |
104 | * @return {[array]} | 104 | * @return {[array]} |
105 | */ | 105 | */ |
106 | -const special = (params) => { | 106 | +const discount = (params) => { |
107 | params = params || {}; | 107 | params = params || {}; |
108 | 108 | ||
109 | return api.get('', sign.apiSign(Object.assign({ | 109 | return api.get('', sign.apiSign(Object.assign({ |
110 | method: 'app.activity.get', | 110 | method: 'app.activity.get', |
111 | sort: 2, | 111 | sort: 2, |
112 | - plateform: 3 | 112 | + plateform: 2 |
113 | }, params))); | 113 | }, params))); |
114 | }; | 114 | }; |
115 | 115 | ||
@@ -307,13 +307,13 @@ exports.getBreakCodeData = (params) => { | @@ -307,13 +307,13 @@ exports.getBreakCodeData = (params) => { | ||
307 | * @param {[object]} params | 307 | * @param {[object]} params |
308 | * @return {[object]} | 308 | * @return {[object]} |
309 | */ | 309 | */ |
310 | -exports.getSpecialData = (params) => { | ||
311 | - const specialData = {}; | 310 | +exports.getDiscountData = (params) => { |
311 | + const discountData = {}; | ||
312 | 312 | ||
313 | - return special(params).then((result) => { | 313 | + return discount(params).then((result) => { |
314 | if (result && result.code === 200) { | 314 | if (result && result.code === 200) { |
315 | - specialData.data = processSpecial(result.data); | ||
316 | - return specialData; | 315 | + discountData.data = processDiscount(result.data); |
316 | + return discountData; | ||
317 | } else { | 317 | } else { |
318 | logger.error('折扣专场专题列表返回 code 不是 200'); | 318 | logger.error('折扣专场专题列表返回 code 不是 200'); |
319 | return {}; | 319 | return {}; |
@@ -327,16 +327,16 @@ exports.getSpecialData = (params) => { | @@ -327,16 +327,16 @@ exports.getSpecialData = (params) => { | ||
327 | * @param {[string]} id | 327 | * @param {[string]} id |
328 | * @return {[object]} | 328 | * @return {[object]} |
329 | */ | 329 | */ |
330 | -exports.getSpecialDetailData = (id) => { | 330 | +exports.getDiscountDetailData = (id) => { |
331 | let res = {}; | 331 | let res = {}; |
332 | let param = { | 332 | let param = { |
333 | id: id | 333 | id: id |
334 | }; | 334 | }; |
335 | 335 | ||
336 | - return special(param).then((result) => { | 336 | + return discount(param).then((result) => { |
337 | if (result && result.code === 200) { | 337 | if (result && result.code === 200) { |
338 | - res = processSpecial(result.data); | ||
339 | - console.log(res); | 338 | + res = processDiscount(result.data); |
339 | + | ||
340 | return { | 340 | return { |
341 | title: res[0].title, | 341 | title: res[0].title, |
342 | activity: { | 342 | activity: { |
@@ -22,10 +22,10 @@ router.get(/\/pro_([\d]+)_([\d]+)\/(.*)/, detail.index); | @@ -22,10 +22,10 @@ router.get(/\/pro_([\d]+)_([\d]+)\/(.*)/, detail.index); | ||
22 | router.get('/detail/intro/:productskn', detail.intro); | 22 | router.get('/detail/intro/:productskn', detail.intro); |
23 | router.get('/detail/preference/:productskn/:yhchannel/:brandId', detail.preference); | 23 | router.get('/detail/preference/:productskn/:yhchannel/:brandId', detail.preference); |
24 | 24 | ||
25 | -router.get('/sale', sale.index); | ||
26 | -router.get('/sale/special', sale.special); | ||
27 | -router.get('/sale/special/detail', sale.specialDetail); | ||
28 | -router.get('/sale/breakCode', sale.breakCode); | 25 | +router.get('/sale/index', sale.index); |
26 | +router.get('/sale/discount', sale.discount); | ||
27 | +router.get('/sale/discount/detail', sale.discountDetail); | ||
28 | +router.get('/sale/breakingYards', sale.breakingYards); | ||
29 | router.get('/sale/vip', sale.vip); | 29 | router.get('/sale/vip', sale.vip); |
30 | 30 | ||
31 | router.get('/sale/search', sale.search); | 31 | router.get('/sale/search', sale.search); |
@@ -30,7 +30,7 @@ exports.setNavHeader = (title, navBack, backUrl, navBtn) => { | @@ -30,7 +30,7 @@ exports.setNavHeader = (title, navBack, backUrl, navBtn) => { | ||
30 | return _.merge({ | 30 | return _.merge({ |
31 | navTitle: '', | 31 | navTitle: '', |
32 | backUrl: true, | 32 | backUrl: true, |
33 | - navBack: true, | 33 | + navBack: 'history.go(-1);', |
34 | navBtn: true, | 34 | navBtn: true, |
35 | boys: true | 35 | boys: true |
36 | }, header); | 36 | }, header); |
@@ -9,30 +9,35 @@ var $ = require('yoho-jquery'), | @@ -9,30 +9,35 @@ var $ = require('yoho-jquery'), | ||
9 | var $activityTime = $('.activity-time'), | 9 | var $activityTime = $('.activity-time'), |
10 | endTime = $activityTime.data('time-ms'); | 10 | endTime = $activityTime.data('time-ms'); |
11 | 11 | ||
12 | -var anHour = 3600000, | ||
13 | - aMinute = 60000, | ||
14 | - aSecond = 1000; | 12 | +var params = { |
13 | + anHour: 3600000, // 1小时=?毫秒 | ||
14 | + aMinute: 60000, // 1分钟=?毫秒 | ||
15 | + aSecond: 1000, // 1秒=?毫秒 | ||
16 | + timeDom: $activityTime, // 时间对象数组 | ||
17 | + endTime: [endTime] // 时间差数组 | ||
18 | +}; | ||
15 | 19 | ||
16 | require('./sale/search'); | 20 | require('./sale/search'); |
17 | 21 | ||
18 | lazyLoad($('img.lazy')); | 22 | lazyLoad($('img.lazy')); |
19 | 23 | ||
20 | - | ||
21 | // 倒计时 | 24 | // 倒计时 |
22 | -function getRTime() { | 25 | +function getRTime(conf) { |
23 | var showTime = '', | 26 | var showTime = '', |
24 | d = 0, | 27 | d = 0, |
25 | h = 0, | 28 | h = 0, |
26 | m = 0, | 29 | m = 0, |
27 | s = 0; | 30 | s = 0; |
28 | 31 | ||
29 | - endTime = endTime - 1000; | 32 | + conf.timeDom.each(function(key, item) { |
33 | + showTime = ''; | ||
34 | + conf.endTime[key] = conf.endTime[key] - 1000; | ||
30 | 35 | ||
31 | - if (endTime > 1000) { | ||
32 | - d = Math.floor(endTime / anHour / 24); | ||
33 | - h = Math.floor(endTime / anHour % 24); | ||
34 | - m = Math.floor(endTime / aMinute % 60); | ||
35 | - s = Math.floor(endTime / aSecond % 60); | 36 | + if (conf.endTime[key] > 1000) { |
37 | + d = Math.floor(conf.endTime[key] / conf.anHour / 24); | ||
38 | + h = Math.floor(conf.endTime[key] / conf.anHour % 24); | ||
39 | + m = Math.floor(conf.endTime[key] / conf.aMinute % 60); | ||
40 | + s = Math.floor(conf.endTime[key] / conf.aSecond % 60); | ||
36 | 41 | ||
37 | showTime += d > 0 ? d + '天' : ''; | 42 | showTime += d > 0 ? d + '天' : ''; |
38 | showTime += h > 0 ? h + '小时' : ''; | 43 | showTime += h > 0 ? h + '小时' : ''; |
@@ -43,12 +48,14 @@ function getRTime() { | @@ -43,12 +48,14 @@ function getRTime() { | ||
43 | showTime = '剩' + showTime; | 48 | showTime = '剩' + showTime; |
44 | } | 49 | } |
45 | 50 | ||
46 | - $activityTime.find('span').html(showTime); | ||
47 | - | ||
48 | - $activityTime.attr('data-time-ms', endTime); | 51 | + $(item).find('span').html(showTime); |
52 | + $(item).fadeIn(); | ||
49 | } else { | 53 | } else { |
50 | - $activityTime.hide(); | 54 | + $(item).hide(); |
51 | } | 55 | } |
56 | + }); | ||
52 | } | 57 | } |
53 | 58 | ||
54 | -setInterval(getRTime, 1000); | 59 | +setInterval(function() { |
60 | + getRTime(params); | ||
61 | +}, 1000); |
1 | -.sale-channel-page { | 1 | +.discount-detail-page { |
2 | .banner { | 2 | .banner { |
3 | position: relative; | 3 | position: relative; |
4 | overflow: hidden; | 4 | overflow: hidden; |
@@ -18,6 +18,7 @@ | @@ -18,6 +18,7 @@ | ||
18 | text-align: right; | 18 | text-align: right; |
19 | font-size: 22px; | 19 | font-size: 22px; |
20 | line-height: 50px; | 20 | line-height: 50px; |
21 | + display: none; | ||
21 | 22 | ||
22 | .time-ico { | 23 | .time-ico { |
23 | margin-right: 15px; | 24 | margin-right: 15px; |
-
Please register or login to post a comment