Authored by 毕凯

Merge branch 'hotfix/sms-login' into 'master'

Hotfix/sms login

1. 升级 yas 版本
2. 领券支持 jsonp
3. 统计代码全局加载
4. 未注册手机号,快捷登录的时候自动注册问题修改(主要改动)

See merge request !212
@@ -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 };
@@ -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;
@@ -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
1 { 1 {
2 "name": "m-yohobuy-node", 2 "name": "m-yohobuy-node",
3 - "version": "5.4.6", 3 + "version": "5.4.7",
4 "private": true, 4 "private": true,
5 "description": "A New Yohobuy Project With Express", 5 "description": "A New Yohobuy Project With Express",
6 "repository": { 6 "repository": {
@@ -146,13 +146,14 @@ page = { @@ -146,13 +146,14 @@ page = {
146 checkPoint('YB_MOBILE_LOGIN_C'); // 埋点 146 checkPoint('YB_MOBILE_LOGIN_C'); // 埋点
147 147
148 if (res.newer) { 148 if (res.newer) {
149 - //res.redirect = res.redirect + '&registerCode=' + res.registerCode; 149 + res.redirect = res.redirect + '&registerCode=' + res.registerCode;
  150 +
150 // 暂时跳注册 TODO 151 // 暂时跳注册 TODO
151 - tip.show('请先注册!');  
152 - setTimeout(function(){  
153 - location.href = '//m.yohobuy.com/reg.html';  
154 - }, 2000);  
155 - return; 152 + // tip.show('请先注册!');
  153 + // setTimeout(function(){
  154 + // location.href = '//m.yohobuy.com/reg.html';
  155 + // }, 2000);
  156 + // return;
156 } 157 }
157 158
158 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) {