Authored by 王水玲

Merge branch 'release/4.9.2' of git.yoho.cn:fe/yohobuywap-node into release/4.9.2

... ... @@ -23,7 +23,7 @@ const indexEmailPage = (req, res) => {
page: 'back-email',
title: '找回密码-通过邮箱'
}, {
backUrl: SIGN_IN,
// backUrl: SIGN_IN,
headerText: '找回密码',
isPassportPage: true,
backEmail: true
... ... @@ -100,7 +100,7 @@ const backSuccessByEmailPage = (req, res) => {
page: 'back-email-success',
title: '找回密码-通过邮箱'
}, {
backUrl: helpers.urlFormat('/passport/back/email'),
// backUrl: helpers.urlFormat('/passport/back/email'),
headerText: '找回密码',
isPassportPage: true,
backEmailSuccess: true,
... ... @@ -145,7 +145,7 @@ const indexMobilePage = (req, res, next) => {
page: 'back-mobile',
title: '找回密码-通过手机号'
}, {
backUrl: SIGN_IN,
// backUrl: SIGN_IN,
headerText: '找回密码',
isPassportPage: true,
backMobile: true,
... ... @@ -203,7 +203,7 @@ const verifyCodeByMobilePage = (req, res) => {
page: 'back-code',
title: '找回密码-通过手机号'
}, {
backUrl: helpers.urlFormat('/passport/back/mobile'),
// backUrl: helpers.urlFormat('/passport/back/mobile'),
headerText: '找回密码',
isPassportPage: true,
backCode: true,
... ... @@ -261,7 +261,7 @@ const setNewPasswordByMobilePage = (req, res) => {
page: 'back-new-password',
title: '找回密码-输入新密码'
}, {
backUrl: SIGN_IN,
// backUrl: SIGN_IN,
headerText: '找回密码',
isPassportPage: true,
backNewPwd: true,
... ...
... ... @@ -29,7 +29,7 @@ const _step1 = (req, res, next) => {
let viewData = {
module: 'passport',
page: 'sms-login',
backUrl: '/passport/login',
title: '手机短信登录',
isPassportPage: true,
headerText: '手机号码快捷登录',
areaCode: '+86', // 默认的区号
... ... @@ -49,7 +49,7 @@ const _step2 = (req, res, next) => {
const viewData = {
module: 'passport',
page: 'sms-check',
backUrl: '/passport/sms_login?step=1',
title: '手机短信登录',
isPassportPage: true,
headerText: '手机号码快捷登录',
canResend: interval < Date.now(),
... ... @@ -66,7 +66,7 @@ const _step3 = (req, res, next) => {
const viewData = {
module: 'passport',
page: 'sms-password',
backUrl: '/passport/sms_login?step=2',
title: '设置密码',
isPassportPage: true,
headerText: '设置密码'
};
... ...
... ... @@ -5,7 +5,8 @@
<div class="input-container phone-container row has-clear">
<span id="area-code" class="area-code">{{areaCode}}</span>
<input id="phone-num" class="input phone-num" type="text" placeholder="手机号">
<button class="clear-input" type="button"></button>
</div>
<span id="btn-next" class="btn btn-next disable row">获取短信验证码</span>
<button id="btn-next" class="btn btn-next disable row" disabled>获取短信验证码</button>
</div>
</div>
\ No newline at end of file
... ...
... ... @@ -18,4 +18,8 @@
{{/data}}
</ul>
{{/if}}
<div class="swiper-pagination">
<div class="pagination-inner">
</div>
</div>
</div>
\ No newline at end of file
... ...
... ... @@ -116,6 +116,7 @@ if ($('.banner-center-swiper').find('li').size() > 1) {
autoplayDisableOnInteraction: false,
paginationClickable: true,
slideElement: 'li',
pagination: '.banner-center .pagination-inner'
});
}
... ...
... ... @@ -41,21 +41,29 @@ var page = {
$smsCode.on('input', function() {
var hasVal = Boolean($.trim(this.value));
$nextBtn.toggleClass('disable', !hasVal);
$nextBtn.prop('disabled', !hasVal);
$nextBtn.trigger('toggleDisable', !hasVal);
$resetBtn.toggle(hasVal);
});
$nextBtn.on('click', function() {
!self.disableAjax && self.submit();
self.submit();
});
$resetBtn.on('click', function() {
$smsCode.val('');
$resetBtn.hide();
$nextBtn.trigger('toggleDisable');
});
},
$nextBtn.on('toggleDisable', function(event, bool) {
if (bool === void 0) {
bool = true;
}
$nextBtn.toggleClass('disable', bool);
$nextBtn.prop('disabled', bool);
});
},
countDown: function() {
var self = this;
... ... @@ -65,7 +73,8 @@ var page = {
return;
}
$resendBtn.prop('disable', true);
$resendBtn.prop('disabled', true);
$resendBtn.text('重新发送(' + second + ')');
this.timerId = setInterval(function() {
var txt = self.resendText;
... ... @@ -74,7 +83,7 @@ var page = {
if (second < 0) {
clearInterval(self.timerId);
self.timerId = null;
$resendBtn.prop('disable', false);
$resendBtn.prop('disabled', false);
} else {
txt = '重新发送(' + second + '秒)';
}
... ... @@ -88,7 +97,7 @@ var page = {
resendSMS: function() {
var self = this;
if ($resendBtn.prop('disable')) {
if ($resendBtn.prop('disabled')) {
return;
}
... ... @@ -110,17 +119,20 @@ var page = {
},
submit: function() {
var self = this;
var code = $.trim($smsCode.val());
$nextBtn.prop('disabled', this.disableAjax = true);
if ($nextBtn.prop('disabled')) {
return;
}
$nextBtn.prop('disabled', true);
$.get('/passport/sms_login/check.json', {
code: code
})
.done(function(res) {
if (res.code === 200) {
location.href = res.redirect;
self.disableAjax = true; // 成功后 disabled, 执行跳转
$nextBtn.off();
return;
}
... ... @@ -128,10 +140,9 @@ var page = {
})
.fail(function() {
tip.show('出错了, 请重试');
self.disableAjax = false; // 失败后 允许再次 请求
})
.always(function() {
$nextBtn.prop('disabled', self.disableAjax);
$nextBtn.prop('disabled', false);
});
}
};
... ...
... ... @@ -6,21 +6,20 @@ var api = require('./api');
var $countrySelect,
$areaCode,
$nextBtn,
$resetBtn,
$phoneNum;
var page = {
disableAjax: false,
init: function() {
this.domInit();
this.bindEvent();
this.toggleNextBtn();
},
domInit: function() {
$countrySelect = $('#country-select');
$areaCode = $('#area-code');
$nextBtn = $('#btn-next');
$phoneNum = $('#phone-num');
$resetBtn = $('.clear-input');
},
bindEvent: function() {
var self = this;
... ... @@ -33,7 +32,15 @@ var page = {
});
$nextBtn.on('click', function() {
!self.disableAjax && self.goNext();
self.goNext();
});
$resetBtn.on('click', function() {
$phoneNum.val('');
$nextBtn
.prop('disabled', true)
.toggleClass('disable', true);
$resetBtn.hide();
});
},
... ... @@ -43,16 +50,17 @@ var page = {
$nextBtn
.toggleClass('disable', !bool)
.prop('disable', !bool);
.prop('disabled', !bool);
$resetBtn.toggle(bool);
},
// 提交按钮
goNext: function() {
var areaCode = $countrySelect.val();
var phone = $.trim($phoneNum.val());
var self = this;
if ($nextBtn.hasClass('disable')) {
if ($nextBtn.prop('disabled')) {
return;
}
... ... @@ -61,13 +69,14 @@ var page = {
return;
}
this.disableAjax = true;
$nextBtn.prop('disabled', true);
$.get('/passport/sms_login/token.json', {
area: areaCode.replace('+', ''),
mobile: phone
})
.done(function(data) {
if (data.code === 200) {
$nextBtn.off();
location.href = data.redirect;
} else {
tip.show(data.message);
... ... @@ -77,7 +86,7 @@ var page = {
tip.show('出错了, 请重试');
})
.always(function() {
self.disableAjax = false;
$nextBtn.prop('disabled', false);
});
... ...
... ... @@ -5,8 +5,6 @@ var $eyeBtn,
$nextBtn;
var page = {
disableAjax: false,
init: function() {
this.domInit();
this.bindEvent();
... ... @@ -24,7 +22,7 @@ var page = {
});
$nextBtn.on('click', function() {
!self.disableAjax && self.setPasswordAndLogin();
self.setPasswordAndLogin();
});
$pwd.on('input', function() {
... ... @@ -32,7 +30,7 @@ var page = {
$nextBtn
.toggleClass('disable', !bool)
.prop('disable', !bool);
.prop('disabled', !bool);
});
},
... ... @@ -46,15 +44,19 @@ var page = {
},
setPasswordAndLogin: function() {
var self = this;
var password = $.trim($pwd.val());
this.disableAjax = true;
if ($nextBtn.prop('disabled')) {
return;
}
$nextBtn.prop('disabled', true);
$.post('/passport/sms_login/password.json', {
password: password
})
.done(function(res) {
if (res.code === 200) {
$nextBtn.off();
location.href = res.redirect;
return;
}
... ... @@ -65,7 +67,7 @@ var page = {
tip.show('出错了, 请重试');
})
.always(function() {
self.disableAjax = false;
$nextBtn.prop('disabled', false);
});
}
};
... ...
.banner-center {
position: relative;
margin: 30px 0 0;
height: 200px;
overflow: hidden;
... ... @@ -8,6 +9,34 @@
width: 100%;
height: 100%;
}
.swiper-pagination {
position: absolute;
left: 0;
right: 0;
bottom: 20px;
text-align: center;
z-index: 1;
.pagination-inner {
display: inline-block;
span {
display: inline-block;
width: 14px;
height: 14px;
background: #fff;
opacity: 0.5;
margin: 0 9px;
border-radius: 50%;
&.swiper-pagination-bullet-active {
background: #fff;
opacity: 1;
}
}
}
}
}
.banner-center-swiper {
... ...
... ... @@ -138,7 +138,10 @@ body.passport-body {
background-color: #36a74c;
border-radius: 5PX;
color: #fff;
&.disable, &[disabled] {
border: none;
outline: none;
&.disable, &:disabled {
background-color: #a2a2a2;
}
}
... ... @@ -154,6 +157,9 @@ body.passport-body {
height: 16PX;
background: resolve('passport/clear-input.png') no-repeat;
background-size: 100% 100%;
outline: none;
border: none;
padding: 0; /* button has padding in default */
}
.eye {
position: absolute;
... ...
... ... @@ -12,6 +12,11 @@
border-radius: 20PX;
font-size: 16PX;
color: #36a74c;
&:disabled {
color: #a2a2a2;
border-color: #a2a2a2;
}
}
button {
... ...