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) => {
}
if (!uid) {
return res.json({
return res.jsonp({
code: 400,
message: '抱歉,您暂未登录!'
});
... ... @@ -85,6 +85,6 @@ exports.receive = (req, res, next) => {
model.receiveCoupon({
couponID: req.query.couponID
}, uid).then(result => {
res.json(result);
res.jsonp(result);
}).catch(next);
};
... ...
... ... @@ -388,7 +388,7 @@ exports.password = (req, res, next) => {
let mobile = _.get(req.session, 'smsLogin.mobile');
let area = _.get(req.session, 'smsLogin.area');
let password = (req.body.password || '').trim();
let registerCode = +req.body.registerCode || 0;
let registerCode = req.body.registerCode || '';
if (!password) {
data.message = PASSWORD_REQUIRED;
... ...
... ... @@ -12,7 +12,7 @@
a.async = 1;
a.src = j;
m.parentNode.insertBefore(a, m);
}(window, document, 'script', (document.location.protocol === 'https:' ? 'https:' : 'http:') + '//cdn.yoho.cn/yas-jssdk/2.2.2/yas.js', '_yas'));
}(window, document, 'script', (document.location.protocol === 'https:' ? 'https:' : 'http:') + '//cdn.yoho.cn/yas-jssdk/2.2.4/yas.js', '_yas'));
var _hmt = _hmt || [];
... ... @@ -59,23 +59,20 @@
window._yas(1 * new Date(), '2.2.2', 'yohobuy_m', uid, '', '');
}
// 非登录状态,加载百度统计
if (!uid) {
setTimeout(function() {
(function() {
var hm = document.createElement("script");
hm.src = "https://hm.baidu.com/hm.js?65dd99e0435a55177ffda862198ce841";
var s = document.getElementsByTagName("script")[0];
s.parentNode.insertBefore(hm, s);
})();
(function() {
var hm = document.createElement("script");
hm.src = "https://hm.baidu.com/hm.js?e5b83a487a4458aa5abca43f5779b764";
var s = document.getElementsByTagName("script")[0];
s.parentNode.insertBefore(hm, s);
})();
}, 1000);
}
setTimeout(function() {
(function() {
var hm = document.createElement("script");
hm.src = "https://hm.baidu.com/hm.js?65dd99e0435a55177ffda862198ce841";
var s = document.getElementsByTagName("script")[0];
s.parentNode.insertBefore(hm, s);
})();
(function() {
var hm = document.createElement("script");
hm.src = "https://hm.baidu.com/hm.js?e5b83a487a4458aa5abca43f5779b764";
var s = document.getElementsByTagName("script")[0];
s.parentNode.insertBefore(hm, s);
})();
}, 1000);
}());
</script>
... ...
{
"name": "m-yohobuy-node",
"version": "5.4.6",
"version": "5.4.7",
"private": true,
"description": "A New Yohobuy Project With Express",
"repository": {
... ...
... ... @@ -146,13 +146,14 @@ page = {
checkPoint('YB_MOBILE_LOGIN_C'); // 埋点
if (res.newer) {
//res.redirect = res.redirect + '&registerCode=' + res.registerCode;
res.redirect = res.redirect + '&registerCode=' + res.registerCode;
// 暂时跳注册 TODO
tip.show('请先注册!');
setTimeout(function(){
location.href = '//m.yohobuy.com/reg.html';
}, 2000);
return;
// tip.show('请先注册!');
// setTimeout(function(){
// location.href = '//m.yohobuy.com/reg.html';
// }, 2000);
// return;
}
location.href = res.redirect;
... ...
... ... @@ -20,7 +20,7 @@ setTimeout(function() {
}, 3000);
page = {
smsCode: window.queryString.smsCode,
registerCode: window.queryString.registerCode,
init: function() {
this.domInit();
this.bindEvent();
... ... @@ -40,7 +40,7 @@ page = {
});
$nextBtn.on('click', function() {
if (!self.smsCode) {
if (!self.registerCode) {
return tip.show('非法请求');
}
self.setPasswordAndLogin();
... ... @@ -82,7 +82,7 @@ page = {
$nextBtn.prop('disabled', true);
$.post('/passport/sms_login/password.json', {
password: password,
smsCode: self.smsCode
registerCode: self.registerCode
})
.done(function(res) {
if (res.code === 200) {
... ...