|
@@ -49,7 +49,8 @@ var $accountInput = $('#account'), |
|
@@ -49,7 +49,8 @@ var $accountInput = $('#account'), |
49
|
|
49
|
|
50
|
// 图像验证码
|
50
|
// 图像验证码
|
51
|
$captchaImgInput = $('#captcha'),
|
51
|
$captchaImgInput = $('#captcha'),
|
52
|
- $captchaWrap = $('.captcha-wrap'),
|
52
|
+ $captchaImgWrapper = $('.captcha-wrap'),
|
|
|
53
|
+ $captchaImgPic = $captchaImgWrapper.find('#captcha-img'),
|
53
|
getCaptchaImgVal = function() {
|
54
|
getCaptchaImgVal = function() {
|
54
|
return $.trim($captchaImgInput.val());
|
55
|
return $.trim($captchaImgInput.val());
|
55
|
},
|
56
|
},
|
|
@@ -74,7 +75,10 @@ var $accountInput = $('#account'), |
|
@@ -74,7 +75,10 @@ var $accountInput = $('#account'), |
74
|
$countryList = $('#country-list'),
|
75
|
$countryList = $('#country-list'),
|
75
|
|
76
|
|
76
|
// 记住我
|
77
|
// 记住我
|
77
|
- $rememberMe = $('.remember-me');
|
78
|
+ $rememberMe = $('.remember-me'),
|
|
|
79
|
+ getRememberMeVal = function() {
|
|
|
80
|
+ return $rememberMe.hasClass('checked') ? true : false;
|
|
|
81
|
+ };
|
78
|
|
82
|
|
79
|
// 提示
|
83
|
// 提示
|
80
|
var $accountTip = $accountInput.siblings('.err-tip'),
|
84
|
var $accountTip = $accountInput.siblings('.err-tip'),
|
|
@@ -268,22 +272,13 @@ function hideCaptchaSmsTip() { |
|
@@ -268,22 +272,13 @@ function hideCaptchaSmsTip() { |
268
|
// 本地验证用户输入格式
|
272
|
// 本地验证用户输入格式
|
269
|
function validateAccountPasswordLocal() {
|
273
|
function validateAccountPasswordLocal() {
|
270
|
var account = getAccountVal(),
|
274
|
var account = getAccountVal(),
|
271
|
- countryCode = getAreaCodeVal(),
|
|
|
272
|
err;
|
275
|
err;
|
273
|
|
276
|
|
274
|
var defer = $.Deferred(); // eslint-disable-line
|
277
|
var defer = $.Deferred(); // eslint-disable-line
|
275
|
|
278
|
|
276
|
if (account !== '') {
|
279
|
if (account !== '') {
|
277
|
if (/^[0-9]+$/.test(account)) {
|
280
|
if (/^[0-9]+$/.test(account)) {
|
278
|
-
|
|
|
279
|
- // 如果是纯数字,则作为手机号码处理
|
|
|
280
|
- if (countryCode !== '+86' ||
|
|
|
281
|
- mailPhoneRegx.phoneRegx[countryCode].test(account)) {
|
|
|
282
|
- defer.resolve();
|
|
|
283
|
- } else {
|
|
|
284
|
- defer.reject();
|
|
|
285
|
- err = '手机号码不正确,请重新输入';
|
|
|
286
|
- }
|
281
|
+ defer.resolve();
|
287
|
} else {
|
282
|
} else {
|
288
|
if (mailPhoneRegx.emailRegx.test(account)) {
|
283
|
if (mailPhoneRegx.emailRegx.test(account)) {
|
289
|
defer.resolve();
|
284
|
defer.resolve();
|
|
@@ -427,7 +422,7 @@ function validateCaptchaImgAsync() { |
|
@@ -427,7 +422,7 @@ function validateCaptchaImgAsync() { |
427
|
// 本地和网络验证图形验证码
|
422
|
// 本地和网络验证图形验证码
|
428
|
function validateCaptchaImg() {
|
423
|
function validateCaptchaImg() {
|
429
|
// 验证码不可见的时候验证通过
|
424
|
// 验证码不可见的时候验证通过
|
430
|
- if ($captchaWrap.is(':hidden')) {
|
425
|
+ if ($captchaImgWrapper.is(':hidden')) {
|
431
|
return $.Deferred().resolve().promise(); //eslint-disable-line
|
426
|
return $.Deferred().resolve().promise(); //eslint-disable-line
|
432
|
}
|
427
|
}
|
433
|
|
428
|
|
|
@@ -591,9 +586,9 @@ function preSmsLoginWithValidate() { |
|
@@ -591,9 +586,9 @@ function preSmsLoginWithValidate() { |
591
|
|
586
|
|
592
|
// 密码错误次数,超过三次显示验证码
|
587
|
// 密码错误次数,超过三次显示验证码
|
593
|
function vaAccountErrTimes() {
|
588
|
function vaAccountErrTimes() {
|
594
|
- $captchaImgInput.attr('src', CAPTCHA_IMG_URL + $.now());
|
589
|
+ $captchaImgPic.attr('src', CAPTCHA_IMG_URL + $.now());
|
595
|
$captchaImgInput.val('');
|
590
|
$captchaImgInput.val('');
|
596
|
- $captchaWrap.removeClass('hide');
|
591
|
+ $captchaImgWrapper.removeClass('hide');
|
597
|
}
|
592
|
}
|
598
|
|
593
|
|
599
|
// 短信验证码重新发送
|
594
|
// 短信验证码重新发送
|
|
@@ -650,7 +645,7 @@ function login() { |
|
@@ -650,7 +645,7 @@ function login() { |
650
|
account: getAccountVal(),
|
645
|
account: getAccountVal(),
|
651
|
password: currentLogin.creditableToken(),
|
646
|
password: currentLogin.creditableToken(),
|
652
|
captcha: getCaptchaImgVal(),
|
647
|
captcha: getCaptchaImgVal(),
|
653
|
- isRemember: $rememberMe.hasClass('checked') ? true : false,
|
648
|
+ isRemember: getRememberMeVal(),
|
654
|
loginType: currentLogin.type()
|
649
|
loginType: currentLogin.type()
|
655
|
}
|
650
|
}
|
656
|
});
|
651
|
});
|
|
@@ -792,8 +787,8 @@ $('.va').on('focus', function() { |
|
@@ -792,8 +787,8 @@ $('.va').on('focus', function() { |
792
|
});
|
787
|
});
|
793
|
|
788
|
|
794
|
// 验证码刷新
|
789
|
// 验证码刷新
|
795
|
-$captchaWrap.on('click', '.change-captcha, .captcha-img', function() {
|
|
|
796
|
- $captchaImgInput.attr('src', CAPTCHA_IMG_URL + $.now());
|
790
|
+$captchaImgWrapper.on('click', '.change-captcha, .captcha-img', function() {
|
|
|
791
|
+ $captchaImgPic.attr('src', CAPTCHA_IMG_URL + $.now());
|
797
|
});
|
792
|
});
|
798
|
|
793
|
|
799
|
// 切换登录模式:密码登录和短信登录
|
794
|
// 切换登录模式:密码登录和短信登录
|