Merge branch 'master' into feature/address4
Showing
17 changed files
with
147 additions
and
54 deletions
@@ -76,7 +76,7 @@ exports.receive = (req, res, next) => { | @@ -76,7 +76,7 @@ exports.receive = (req, res, next) => { | ||
76 | } | 76 | } |
77 | 77 | ||
78 | if (!uid) { | 78 | if (!uid) { |
79 | - return res.json({ | 79 | + return res.jsonp({ |
80 | code: 400, | 80 | code: 400, |
81 | message: '抱歉,您暂未登录!' | 81 | message: '抱歉,您暂未登录!' |
82 | }); | 82 | }); |
@@ -85,6 +85,6 @@ exports.receive = (req, res, next) => { | @@ -85,6 +85,6 @@ exports.receive = (req, res, next) => { | ||
85 | model.receiveCoupon({ | 85 | model.receiveCoupon({ |
86 | couponID: req.query.couponID | 86 | couponID: req.query.couponID |
87 | }, uid).then(result => { | 87 | }, uid).then(result => { |
88 | - res.json(result); | 88 | + res.jsonp(result); |
89 | }).catch(next); | 89 | }).catch(next); |
90 | }; | 90 | }; |
@@ -50,7 +50,7 @@ const index = (req, res, next) => { | @@ -50,7 +50,7 @@ const index = (req, res, next) => { | ||
50 | return res.send(feed.render('atom-1.0')); | 50 | return res.send(feed.render('atom-1.0')); |
51 | } | 51 | } |
52 | return res.send(feed.render('rss-2.0')); | 52 | return res.send(feed.render('rss-2.0')); |
53 | - }); | 53 | + }).catch(next); |
54 | }; | 54 | }; |
55 | const rss = (req, res, next, gmt) => { | 55 | const rss = (req, res, next, gmt) => { |
56 | let gender = req.query.gender || '1,2,3', | 56 | let gender = req.query.gender || '1,2,3', |
@@ -72,7 +72,7 @@ const rss = (req, res, next, gmt) => { | @@ -72,7 +72,7 @@ const rss = (req, res, next, gmt) => { | ||
72 | layout: false, | 72 | layout: false, |
73 | items: result | 73 | items: result |
74 | }); | 74 | }); |
75 | - }); | 75 | + }).catch(next); |
76 | }; | 76 | }; |
77 | 77 | ||
78 | module.exports = { | 78 | module.exports = { |
@@ -295,6 +295,8 @@ const wechat = { | @@ -295,6 +295,8 @@ const wechat = { | ||
295 | 295 | ||
296 | const sina = { | 296 | const sina = { |
297 | login: (req, res, next) => { | 297 | login: (req, res, next) => { |
298 | + // 设置为原链接标识originalUrl | ||
299 | + req.session.originalUrl = 'true'; | ||
298 | req.session.authState = uuid.v4(); | 300 | req.session.authState = uuid.v4(); |
299 | return passport.authenticate('sina', { | 301 | return passport.authenticate('sina', { |
300 | state: req.session.authState | 302 | state: req.session.authState |
@@ -321,6 +323,8 @@ const sina = { | @@ -321,6 +323,8 @@ const sina = { | ||
321 | 323 | ||
322 | const qq = { | 324 | const qq = { |
323 | login: (req, res, next) => { | 325 | login: (req, res, next) => { |
326 | + // 设置为原链接标识originalUrl | ||
327 | + req.session.originalUrl = 'true'; | ||
324 | req.session.authState = uuid.v4(); | 328 | req.session.authState = uuid.v4(); |
325 | return passport.authenticate('qq', { | 329 | return passport.authenticate('qq', { |
326 | state: req.session.authState | 330 | state: req.session.authState |
@@ -348,6 +352,8 @@ const qq = { | @@ -348,6 +352,8 @@ const qq = { | ||
348 | 352 | ||
349 | const alipay = { | 353 | const alipay = { |
350 | login: (req, res, next) => { | 354 | login: (req, res, next) => { |
355 | + // 设置为原链接标识originalUrl | ||
356 | + req.session.originalUrl = 'true'; | ||
351 | return passport.authenticate('alipay')(req, res, next); | 357 | return passport.authenticate('alipay')(req, res, next); |
352 | }, | 358 | }, |
353 | callback: (req, res, next) => { | 359 | callback: (req, res, next) => { |
@@ -388,7 +388,7 @@ exports.password = (req, res, next) => { | @@ -388,7 +388,7 @@ exports.password = (req, res, next) => { | ||
388 | let mobile = _.get(req.session, 'smsLogin.mobile'); | 388 | let mobile = _.get(req.session, 'smsLogin.mobile'); |
389 | let area = _.get(req.session, 'smsLogin.area'); | 389 | let area = _.get(req.session, 'smsLogin.area'); |
390 | let password = (req.body.password || '').trim(); | 390 | let password = (req.body.password || '').trim(); |
391 | - let registerCode = +req.body.registerCode || 0; | 391 | + let registerCode = req.body.registerCode || ''; |
392 | 392 | ||
393 | if (!password) { | 393 | if (!password) { |
394 | data.message = PASSWORD_REQUIRED; | 394 | data.message = PASSWORD_REQUIRED; |
@@ -72,7 +72,15 @@ const _newGoods = (req, res, next) => { | @@ -72,7 +72,15 @@ const _newGoods = (req, res, next) => { | ||
72 | let banner = _.get(result, 'ads[0]', {}); | 72 | let banner = _.get(result, 'ads[0]', {}); |
73 | let handPick = _.get(result, 'ads[1]', {}); | 73 | let handPick = _.get(result, 'ads[1]', {}); |
74 | 74 | ||
75 | - // console.log(handPick) | 75 | + if (handPick.data) { |
76 | + if (handPick.data.length > 2) { | ||
77 | + handPick.three = true; | ||
78 | + } else if (handPick.data.length === 2) { | ||
79 | + handPick.two = true; | ||
80 | + } else if (handPick.data.length === 1) { | ||
81 | + handPick.one = true; | ||
82 | + } | ||
83 | + } | ||
76 | 84 | ||
77 | res.render('new/index', { | 85 | res.render('new/index', { |
78 | module: 'product', | 86 | module: 'product', |
@@ -38,8 +38,14 @@ | @@ -38,8 +38,14 @@ | ||
38 | {{/if}} | 38 | {{/if}} |
39 | 39 | ||
40 | {{!--精选抢先看--}} | 40 | {{!--精选抢先看--}} |
41 | - {{#if handPick.data}} | ||
42 | - {{> 'new/handpick' swiper=handPick.data}} | 41 | + {{#if handPick.three}} |
42 | + {{> 'new/handpick-three' swiper=handPick.data}} | ||
43 | + {{/if}} | ||
44 | + {{#if handPick.two}} | ||
45 | + {{> 'new/handpick-two' swiper=handPick.data}} | ||
46 | + {{/if}} | ||
47 | + {{#if handPick.one}} | ||
48 | + {{> 'new/handpick-one' swiper=handPick.data}} | ||
43 | {{/if}} | 49 | {{/if}} |
44 | 50 | ||
45 | {{!--最新上架--}} | 51 | {{!--最新上架--}} |
@@ -8,17 +8,17 @@ | @@ -8,17 +8,17 @@ | ||
8 | </header> | 8 | </header> |
9 | <main class="panel-body"> | 9 | <main class="panel-body"> |
10 | <!-- Slider main container --> | 10 | <!-- Slider main container --> |
11 | - <div class="handpick-swiper swiper-container"> | 11 | + <div class="handpick-swiper-one swiper-container"> |
12 | <!-- Additional required wrapper --> | 12 | <!-- Additional required wrapper --> |
13 | <div class="swiper-wrapper"> | 13 | <div class="swiper-wrapper"> |
14 | <!-- Slides --> | 14 | <!-- Slides --> |
15 | - {{#each swiper}} | 15 | + {{# swiper}} |
16 | <div class="swiper-slide"> | 16 | <div class="swiper-slide"> |
17 | <a href="{{url}}"> | 17 | <a href="{{url}}"> |
18 | - <img class="swiper-lazy" data-src="{{image2 src w=332 h=194 q=60}}" alt=""> | 18 | + <img src="{{image2 src w=690 h=220 q=60}}" alt=""> |
19 | </a> | 19 | </a> |
20 | </div> | 20 | </div> |
21 | - {{/each}} | 21 | + {{/swiper}} |
22 | </div> | 22 | </div> |
23 | </div> | 23 | </div> |
24 | </main> | 24 | </main> |
1 | +{{!-- 新品到着: 精选 --}} | ||
2 | +<div id="handpick" class="panel handpick"> | ||
3 | + <header class="panel-header"> | ||
4 | + <h4>精选抢先看</h4> | ||
5 | + {{!--<a href="#javascript" class="panel-header-r more"> | ||
6 | + <i class="iconfont"></i> | ||
7 | + </a>--}} | ||
8 | + </header> | ||
9 | + <main class="panel-body"> | ||
10 | + <!-- Slider main container --> | ||
11 | + <div class="handpick-swiper-three swiper-container"> | ||
12 | + <!-- Additional required wrapper --> | ||
13 | + <div class="swiper-wrapper"> | ||
14 | + <!-- Slides --> | ||
15 | + {{# swiper}} | ||
16 | + <div class="swiper-slide"> | ||
17 | + <a href="{{url}}"> | ||
18 | + <img class="swiper-lazy" data-src="{{image2 src w=330 h=220 q=60}}" alt=""> | ||
19 | + </a> | ||
20 | + </div> | ||
21 | + {{/swiper}} | ||
22 | + </div> | ||
23 | + </div> | ||
24 | + </main> | ||
25 | +</div> |
1 | +{{!-- 新品到着: 精选 --}} | ||
2 | +<div id="handpick" class="panel handpick"> | ||
3 | + <header class="panel-header"> | ||
4 | + <h4>精选抢先看</h4> | ||
5 | + {{!--<a href="#javascript" class="panel-header-r more"> | ||
6 | + <i class="iconfont"></i> | ||
7 | + </a>--}} | ||
8 | + </header> | ||
9 | + <main class="panel-body"> | ||
10 | + <!-- Slider main container --> | ||
11 | + <div class="handpick-swiper-two swiper-container"> | ||
12 | + <!-- Additional required wrapper --> | ||
13 | + <div class="swiper-wrapper"> | ||
14 | + <!-- Slides --> | ||
15 | + {{# swiper}} | ||
16 | + <div class="swiper-slide"> | ||
17 | + <a href="{{url}}"> | ||
18 | + <img src="{{image2 src w=330 h=220 q=60}}" alt=""> | ||
19 | + </a> | ||
20 | + </div> | ||
21 | + {{/swiper}} | ||
22 | + </div> | ||
23 | + </div> | ||
24 | + </main> | ||
25 | +</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', |
@@ -76,7 +76,7 @@ module.exports = { | @@ -76,7 +76,7 @@ module.exports = { | ||
76 | port: '4444' // influxdb port | 76 | port: '4444' // influxdb port |
77 | }, | 77 | }, |
78 | console: { | 78 | console: { |
79 | - level: 'debug', | 79 | + level: 'info', |
80 | colorize: 'all', | 80 | colorize: 'all', |
81 | prettyPrint: true | 81 | prettyPrint: true |
82 | } | 82 | } |
@@ -12,7 +12,7 @@ | @@ -12,7 +12,7 @@ | ||
12 | a.async = 1; | 12 | a.async = 1; |
13 | a.src = j; | 13 | a.src = j; |
14 | m.parentNode.insertBefore(a, m); | 14 | m.parentNode.insertBefore(a, m); |
15 | - }(window, document, 'script', (document.location.protocol === 'https:' ? 'https:' : 'http:') + '//cdn.yoho.cn/yas-jssdk/2.2.2/yas.js', '_yas')); | 15 | + }(window, document, 'script', (document.location.protocol === 'https:' ? 'https:' : 'http:') + '//cdn.yoho.cn/yas-jssdk/2.2.4/yas.js', '_yas')); |
16 | 16 | ||
17 | var _hmt = _hmt || []; | 17 | var _hmt = _hmt || []; |
18 | 18 | ||
@@ -59,23 +59,20 @@ | @@ -59,23 +59,20 @@ | ||
59 | window._yas(1 * new Date(), '2.2.2', 'yohobuy_m', uid, '', ''); | 59 | window._yas(1 * new Date(), '2.2.2', 'yohobuy_m', uid, '', ''); |
60 | } | 60 | } |
61 | 61 | ||
62 | - // 非登录状态,加载百度统计 | ||
63 | - if (!uid) { | ||
64 | - setTimeout(function() { | ||
65 | - (function() { | ||
66 | - var hm = document.createElement("script"); | ||
67 | - hm.src = "https://hm.baidu.com/hm.js?65dd99e0435a55177ffda862198ce841"; | ||
68 | - var s = document.getElementsByTagName("script")[0]; | ||
69 | - s.parentNode.insertBefore(hm, s); | ||
70 | - })(); | ||
71 | - (function() { | ||
72 | - var hm = document.createElement("script"); | ||
73 | - hm.src = "https://hm.baidu.com/hm.js?e5b83a487a4458aa5abca43f5779b764"; | ||
74 | - var s = document.getElementsByTagName("script")[0]; | ||
75 | - s.parentNode.insertBefore(hm, s); | ||
76 | - })(); | ||
77 | - }, 1000); | ||
78 | - } | 62 | + setTimeout(function() { |
63 | + (function() { | ||
64 | + var hm = document.createElement("script"); | ||
65 | + hm.src = "https://hm.baidu.com/hm.js?65dd99e0435a55177ffda862198ce841"; | ||
66 | + var s = document.getElementsByTagName("script")[0]; | ||
67 | + s.parentNode.insertBefore(hm, s); | ||
68 | + })(); | ||
69 | + (function() { | ||
70 | + var hm = document.createElement("script"); | ||
71 | + hm.src = "https://hm.baidu.com/hm.js?e5b83a487a4458aa5abca43f5779b764"; | ||
72 | + var s = document.getElementsByTagName("script")[0]; | ||
73 | + s.parentNode.insertBefore(hm, s); | ||
74 | + })(); | ||
75 | + }, 1000); | ||
79 | }()); | 76 | }()); |
80 | </script> | 77 | </script> |
81 | 78 |
@@ -147,6 +147,13 @@ page = { | @@ -147,6 +147,13 @@ page = { | ||
147 | 147 | ||
148 | if (res.newer) { | 148 | if (res.newer) { |
149 | res.redirect = res.redirect + '®isterCode=' + res.registerCode; | 149 | res.redirect = res.redirect + '®isterCode=' + res.registerCode; |
150 | + | ||
151 | + // 暂时跳注册 TODO | ||
152 | + // tip.show('请先注册!'); | ||
153 | + // setTimeout(function(){ | ||
154 | + // location.href = '//m.yohobuy.com/reg.html'; | ||
155 | + // }, 2000); | ||
156 | + // return; | ||
150 | } | 157 | } |
151 | 158 | ||
152 | location.href = res.redirect; | 159 | location.href = res.redirect; |
@@ -20,7 +20,7 @@ setTimeout(function() { | @@ -20,7 +20,7 @@ setTimeout(function() { | ||
20 | }, 3000); | 20 | }, 3000); |
21 | 21 | ||
22 | page = { | 22 | page = { |
23 | - smsCode: window.queryString.smsCode, | 23 | + registerCode: window.queryString.registerCode, |
24 | init: function() { | 24 | init: function() { |
25 | this.domInit(); | 25 | this.domInit(); |
26 | this.bindEvent(); | 26 | this.bindEvent(); |
@@ -40,7 +40,7 @@ page = { | @@ -40,7 +40,7 @@ page = { | ||
40 | }); | 40 | }); |
41 | 41 | ||
42 | $nextBtn.on('click', function() { | 42 | $nextBtn.on('click', function() { |
43 | - if (!self.smsCode) { | 43 | + if (!self.registerCode) { |
44 | return tip.show('非法请求'); | 44 | return tip.show('非法请求'); |
45 | } | 45 | } |
46 | self.setPasswordAndLogin(); | 46 | self.setPasswordAndLogin(); |
@@ -82,7 +82,7 @@ page = { | @@ -82,7 +82,7 @@ page = { | ||
82 | $nextBtn.prop('disabled', true); | 82 | $nextBtn.prop('disabled', true); |
83 | $.post('/passport/sms_login/password.json', { | 83 | $.post('/passport/sms_login/password.json', { |
84 | password: password, | 84 | password: password, |
85 | - smsCode: self.smsCode | 85 | + registerCode: self.registerCode |
86 | }) | 86 | }) |
87 | .done(function(res) { | 87 | .done(function(res) { |
88 | if (res.code === 200) { | 88 | if (res.code === 200) { |
@@ -14,7 +14,7 @@ let $callback = $.Callbacks(); // eslint-disable-line | @@ -14,7 +14,7 @@ let $callback = $.Callbacks(); // eslint-disable-line | ||
14 | // 是否继续加载数据 | 14 | // 是否继续加载数据 |
15 | let isScroll = true; | 15 | let isScroll = true; |
16 | 16 | ||
17 | -new Swiper('.handpick-swiper', { | 17 | +new Swiper('.handpick-swiper-three', { |
18 | // Optional parameters | 18 | // Optional parameters |
19 | lazyLoading: true, | 19 | lazyLoading: true, |
20 | lazyLoadingInPrevNext: true, | 20 | lazyLoadingInPrevNext: true, |
1 | /* 精选抢先看 */ | 1 | /* 精选抢先看 */ |
2 | .handpick { | 2 | .handpick { |
3 | + .panel-body { | ||
4 | + padding-top: 30px; | ||
5 | + padding-bottom: 30px; | ||
6 | + } | ||
7 | + | ||
3 | .swiper-wrapper { | 8 | .swiper-wrapper { |
4 | align-items: center; | 9 | align-items: center; |
5 | } | 10 | } |
6 | 11 | ||
7 | .swiper-container { | 12 | .swiper-container { |
8 | - height: 220px; | 13 | + height: 185px; |
9 | } | 14 | } |
10 | 15 | ||
11 | .swiper-slide { | 16 | .swiper-slide { |
12 | width: 300px; | 17 | width: 300px; |
13 | - height: 173px; | 18 | + height: 185px; |
14 | background-color: #444; | 19 | background-color: #444; |
15 | border-radius: 6px; | 20 | border-radius: 6px; |
16 | overflow: hidden; | 21 | overflow: hidden; |
17 | } | 22 | } |
18 | } | 23 | } |
24 | + | ||
25 | +.handpick-swiper-two { | ||
26 | + .swiper-slide { | ||
27 | + margin-left: 30px; | ||
28 | + width: 277px; | ||
29 | + } | ||
30 | +} | ||
31 | + | ||
32 | +.handpick-swiper-one { | ||
33 | + .swiper-slide { | ||
34 | + width: 580px; | ||
35 | + margin-left: 30px; | ||
36 | + } | ||
37 | +} |
@@ -18,7 +18,7 @@ const removeHtml = (str) => { | @@ -18,7 +18,7 @@ const removeHtml = (str) => { | ||
18 | * [html转为转义] | 18 | * [html转为转义] |
19 | */ | 19 | */ |
20 | const htmlToEscape = (html) => { | 20 | const htmlToEscape = (html) => { |
21 | - return html.replace(/[<>&"]/g, (e) => { | 21 | + return (html || '').replace(/[<>&"]/g, (e) => { |
22 | return _htmlMap[e]; | 22 | return _htmlMap[e]; |
23 | }); | 23 | }); |
24 | }; | 24 | }; |
@@ -27,7 +27,7 @@ const htmlToEscape = (html) => { | @@ -27,7 +27,7 @@ const htmlToEscape = (html) => { | ||
27 | * [转义符转为html] | 27 | * [转义符转为html] |
28 | */ | 28 | */ |
29 | const escapeToHtml = (str) => { | 29 | const escapeToHtml = (str) => { |
30 | - return str.replace(/&(lt|gt|nbsp|amp|quot);/g, (match, e) => { | 30 | + return (str || '').replace(/&(lt|gt|nbsp|amp|quot);/g, (match, e) => { |
31 | return _EscapeMap[e]; | 31 | return _EscapeMap[e]; |
32 | }); | 32 | }); |
33 | }; | 33 | }; |
-
Please register or login to post a comment