Authored by xuqi

login status. Review by:@王成龙

... ... @@ -73,6 +73,8 @@ $loginBtn.on('touchstart', function() {
return;
}
$loginBtn.text('正在登录...').addClass('disable');
if (api.phoneRegx[areaCode].test(pn) && api.pwdValidate(pwd)) {
$.ajax({
type: 'POST',
... ... @@ -83,7 +85,8 @@ $loginBtn.on('touchstart', function() {
password: pwd
},
success: function(data) {
var res;
var res,
time;
if (data.code === 200) {
res = data.data;
... ... @@ -91,19 +94,32 @@ $loginBtn.on('touchstart', function() {
$.ajax({
url: res.session,
dataType: 'jsonp'
dataType: 'jsonp',
success: function() {
clearTimeout(time);
//Cookie写入成功后,1s后跳转页面
setTimeout(function() {
location.href = res.href;
}, 1000);
}
});
//2000ms后跳转页面
setTimeout(function() {
//3秒后强制跳转
time = setTimeout(function() {
location.href = res.href;
}, 2000);
}, 3000);
showErrTip('登录成功');
} else {
showErrTip(data.message);
}
},
error: function() {
showErrTip('网络断开连接啦~');
},
complete: function() {
$loginBtn.text('登录').removeClass('disable');
}
});
} else {
... ...
... ... @@ -76,6 +76,8 @@ $loginBtn.on('touchstart', function() {
return;
}
$loginBtn.text('正在登录...').addClass('disable');
//验证账号(数字或者邮箱)和密码合理性
if ((/^[0-9]+$/.test(acc) || api.emailRegx.test(acc)) && api.pwdValidate(pwd)) {
$.ajax({
... ... @@ -86,28 +88,40 @@ $loginBtn.on('touchstart', function() {
password: pwd
},
success: function(data) {
var res;
var res,
time;
if (data.code === 200) {
res = data.data;
showErrTip('登录成功');
$.ajax({
url: res.session,
dataType: 'jsonp'
dataType: 'jsonp',
success: function() {
clearTimeout(time);
//Cookie写入成功后,1s后跳转页面
setTimeout(function() {
location.href = res.href;
}, 1000);
}
});
//2s后跳转页面
setTimeout(function() {
//3秒后强制跳转
time = setTimeout(function() {
location.href = res.href;
}, 2000);
}, 3000);
showErrTip('登录成功');
} else {
showErrTip(data.message);
}
},
error: function() {
showErrTip('网络断开连接啦~');
},
complete: function() {
$loginBtn.text('登录').removeClass('disable');
}
});
} else {
... ...