Authored by 陈轩

滑动解锁登陆 自测修改

... ... @@ -25,11 +25,16 @@ var showErrTip = tip.show;
// 登录按钮状态切换
function switchLoginBtnStatus() {
if (pnPass && pwdPass && (slideUnlock && slideUnlock.isOk)) {
$loginBtn.removeClass('disable');
} else {
$loginBtn.addClass('disable');
}
var bool = slideUnlock ?
!(slideUnlock.isOk && pnPass && pwdPass) :
!(pnPass && pwdPass);
$loginBtn.toggleClass('disable', bool);
}
function resetForm() {
$pwd.val('').focus();
$loginBtn.text('登录').addClass('disable');
}
// Android-UC下显示select的direction:rtl无效的临时解决办法
... ... @@ -113,6 +118,7 @@ $loginBtn.on('touchstart', function() {
location.href = res.href;
}, 3000);
$loginBtn.text('登录成功').off();
showErrTip('登录成功');
} else {
if (!slideUnlock && data.slideUnlock) {
... ... @@ -124,19 +130,18 @@ $loginBtn.on('touchstart', function() {
showErrTip(data.message);
resetForm();
}
},
error: function() {
showErrTip('网络断开连接啦~');
slideUnlock && slideUnlock.reset();
},
complete: function() {
$loginBtn.text('登录').removeClass('disable');
$loginBtn.text('登录');
}
});
} else {
showErrTip('账号或密码有错误,请重新输入');
$loginBtn.text('登录').removeClass('disable');
$loginBtn.text('登录').addClass('disable');
}
});
... ...
... ... @@ -26,11 +26,18 @@ var showErrTip = tip.show;
// 登录按钮状态切换
function switchLoginBtnStatus() {
if (accPass && pwdPass && (slideUnlock && slideUnlock.isOk)) {
$loginBtn.removeClass('disable');
} else {
$loginBtn.addClass('disable');
}
var bool = true;
bool = slideUnlock ?
!(slideUnlock.isOk && accPass && pwdPass) :
!(accPass && pwdPass);
$loginBtn.toggleClass('disable', bool);
}
function resetForm() {
$pwd.val('').focus();
$loginBtn.text('登录').addClass('disable');
}
// 显示找回密码面板
... ... @@ -98,6 +105,7 @@ $loginBtn.on('touchstart', function() {
showErrTip('登录成功');
location.href = res.href;
$loginBtn.text('登录成功').off();
} else {
if (!slideUnlock && data.slideUnlock) {
slideUnlock = new SlideUnlock('#js-slideunlock', {}, switchLoginBtnStatus);
... ... @@ -107,14 +115,13 @@ $loginBtn.on('touchstart', function() {
}
showErrTip(data.message);
resetForm();
}
},
error: function() {
showErrTip('网络断开连接啦~');
slideUnlock && slideUnlock.reset();
},
complete: function() {
$loginBtn.text('登录').removeClass('disable');
$loginBtn.text('登录');
}
});
} else {
... ...
... ... @@ -16,6 +16,7 @@ function SliderUnlock(elm, options, success) {
me.elm = $(html).replaceAll($c);
me.$progress = me.elm.find('.progress');
me.$labelTip = me.elm.find('.label-tip');
var opts = {
successLabelTip: '验证成功',
... ... @@ -191,7 +192,7 @@ SliderUnlock.prototype.move = function() {
}
if (me.index + me.labelWidth + 2 === me.max && me.max > 0 && me.isOk) {
// 解锁默认操作
$('.label').next('.labelTip').
$('.label').next('.label-tip').
text(me.opts.successLabelTip).css({
color: '#fff'
});
... ... @@ -227,10 +228,14 @@ SliderUnlock.prototype.reset = function() {
}, me.opts.duration);
me.elm.find('.label').animate({
left: me.index
}, me.opts.duration)
.next('#lableTip').animate({
}, me.opts.duration);
me.$labelTip
.text('向右滑动验证')
.animate({
opacity: 1
}, me.opts.duration);
me.updateView();
};
... ...