...
|
...
|
@@ -3990,14 +3990,30 @@ validateResult = [ |
|
|
];
|
|
|
|
|
|
//手机号ajax校验
|
|
|
function phoneAjaxFn(callback) {
|
|
|
$.ajax({
|
|
|
url: '/passport/register/checkmobile',
|
|
|
type: 'POST',
|
|
|
data: {
|
|
|
function phoneAjaxFn(page, callback) {
|
|
|
var url,
|
|
|
data;
|
|
|
|
|
|
if (page === 'reg') {
|
|
|
url = '/passport/register/checkmobile';
|
|
|
data = {
|
|
|
mobile: $pn.val(),
|
|
|
area: $region.text().split('+')[1]
|
|
|
};
|
|
|
} else if (page === 'third') {
|
|
|
url = '/passport/autouserinfo/bindCheck';
|
|
|
data = {
|
|
|
mobile: $pn.val(),
|
|
|
area: $region.text().split('+')[1],
|
|
|
openId: 1,
|
|
|
sourceType: 'QQ'
|
|
|
};
|
|
|
}
|
|
|
|
|
|
$.ajax({
|
|
|
url: url,
|
|
|
type: 'POST',
|
|
|
data: data
|
|
|
}).then(function(data) {
|
|
|
switch (data.code) {
|
|
|
case 200:
|
...
|
...
|
@@ -4015,10 +4031,17 @@ function phoneAjaxFn(callback) { |
|
|
}
|
|
|
|
|
|
//图形验证码ajax校验
|
|
|
function picCaptchaAjaxFn(callback) {
|
|
|
function picCaptchaAjaxFn(page, callback) {
|
|
|
var url;
|
|
|
|
|
|
if (page === 'reg') {
|
|
|
url = '/passport/register/piccaptcha';
|
|
|
} else if (page === 'third') {
|
|
|
url = '/passport/autouserinfo/checkPicCode';
|
|
|
}
|
|
|
$.ajax({
|
|
|
type: 'POST',
|
|
|
url: '/passport/register/piccaptcha',
|
|
|
url: url,
|
|
|
data: {
|
|
|
code: $ca.val(),
|
|
|
mobile: $pn.val(),
|
...
|
...
|
@@ -4030,7 +4053,7 @@ function picCaptchaAjaxFn(callback) { |
|
|
validateResult[1].message = '';
|
|
|
validateResult[1].status = true;
|
|
|
break;
|
|
|
case 404:
|
|
|
case 400:
|
|
|
validateResult[1].message = '图形验证码错误';
|
|
|
validateResult[1].status = false;
|
|
|
break;
|
...
|
...
|
@@ -4040,10 +4063,17 @@ function picCaptchaAjaxFn(callback) { |
|
|
}
|
|
|
|
|
|
//短信验证码ajax校验
|
|
|
function msgCaptchaAjaxFn(callback) {
|
|
|
function msgCaptchaAjaxFn(page, callback) {
|
|
|
var url;
|
|
|
|
|
|
if (page === 'reg') {
|
|
|
url = '/passport/register/msgcaptcha';
|
|
|
} else if (page === 'third') {
|
|
|
url = '/passport/autouserinfo/checkBindMsg';
|
|
|
}
|
|
|
$.ajax({
|
|
|
type: 'POST',
|
|
|
url: '/passport/register/msgcaptcha',
|
|
|
url: url,
|
|
|
data: {
|
|
|
code: $ca.val(),
|
|
|
mobile: $pn.val(),
|
...
|
...
|
@@ -4055,7 +4085,7 @@ function msgCaptchaAjaxFn(callback) { |
|
|
validateResult[2].message = '';
|
|
|
validateResult[2].status = true;
|
|
|
break;
|
|
|
case 404:
|
|
|
case 400:
|
|
|
validateResult[2].message = '短信验证码错误';
|
|
|
validateResult[2].status = false;
|
|
|
break;
|
...
|
...
|
@@ -4066,7 +4096,7 @@ function msgCaptchaAjaxFn(callback) { |
|
|
}
|
|
|
|
|
|
// 验证
|
|
|
function validateRule($element, callback) {
|
|
|
function validateRule(page, $element, callback) {
|
|
|
|
|
|
var val = $.trim($element.val()),
|
|
|
regionCode;
|
...
|
...
|
@@ -4088,7 +4118,7 @@ function validateRule($element, callback) { |
|
|
callback();
|
|
|
|
|
|
} else {
|
|
|
phoneAjaxFn(callback);
|
|
|
phoneAjaxFn(page, callback);
|
|
|
}
|
|
|
|
|
|
//图形验证码校验
|
...
|
...
|
@@ -4107,7 +4137,7 @@ function validateRule($element, callback) { |
|
|
|
|
|
// 并且手机号正确
|
|
|
if (validateResult[0].status) {
|
|
|
picCaptchaAjaxFn(callback);
|
|
|
picCaptchaAjaxFn(page, callback);
|
|
|
} else {
|
|
|
validateResult[1].message = '图形验证码错误';
|
|
|
validateResult[1].status = false;
|
...
|
...
|
@@ -4133,7 +4163,7 @@ function validateRule($element, callback) { |
|
|
|
|
|
// 并且图形验证码正确
|
|
|
if (validateResult[1].status) {
|
|
|
msgCaptchaAjaxFn(callback);
|
|
|
msgCaptchaAjaxFn(page, callback);
|
|
|
} else {
|
|
|
validateResult[2].message = '短信验证码错误';
|
|
|
validateResult[2].status = false;
|
...
|
...
|
@@ -4286,14 +4316,16 @@ function pwdFn($obj) { |
|
|
|
|
|
// 失去焦点时开始校验
|
|
|
// Tips: 不可以在获得焦点的时候验证,获得焦点和失去焦点的间隔太小,如果中间存在ajax校验的话会出现问题
|
|
|
$registerPage.find('.va').keyup(function() {
|
|
|
// ( ▼-▼ )注册页和信息完善页面接口不同
|
|
|
exports.init = function(page) {
|
|
|
$registerPage.find('.va').keyup(function() {
|
|
|
|
|
|
var j,
|
|
|
statusLen = 0,
|
|
|
vLen = validateResult.length,
|
|
|
$that = $(this);
|
|
|
|
|
|
validateRule($(this), function() {
|
|
|
validateRule(page, $(this), function() {
|
|
|
showErrTip(); // 显示错误提示
|
|
|
showBorder(); // 显示红色边框
|
|
|
|
...
|
...
|
@@ -4329,32 +4361,48 @@ $registerPage.find('.va').keyup(function() { |
|
|
pwdFn($that);
|
|
|
}
|
|
|
|
|
|
}).blur(function() {
|
|
|
}).blur(function() {
|
|
|
|
|
|
/*validateRule($(this), function() {
|
|
|
showErrTip();
|
|
|
showBorder(); // 显示红色边框
|
|
|
});*/
|
|
|
});
|
|
|
});
|
|
|
|
|
|
$regionSelect.change(function() {
|
|
|
$regionSelect.change(function() {
|
|
|
|
|
|
$region.text('+' + $('#region').val());
|
|
|
|
|
|
validateRule($pn, showErrTip); //验证
|
|
|
});
|
|
|
validateRule(page, $pn, showErrTip); //验证
|
|
|
});
|
|
|
|
|
|
// 点击发送验证码
|
|
|
$sendCaptcha.click(function() {
|
|
|
var timeResidue = 10,
|
|
|
t;
|
|
|
// 点击发送验证码
|
|
|
$sendCaptcha.click(function() {
|
|
|
var timeResidue = 20,
|
|
|
t,
|
|
|
url;
|
|
|
|
|
|
if ($(this).hasClass('disable')) {
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
//todo ajax
|
|
|
if (page === 'reg') {
|
|
|
url = '/passport/register/sendBindMsg';
|
|
|
} else if (page === 'third') {
|
|
|
url = '/passport/autouserinfo/sendBindMsg';
|
|
|
}
|
|
|
|
|
|
//todo ajax 发送验证码
|
|
|
$.ajax({
|
|
|
type: 'POST',
|
|
|
url: url,
|
|
|
data: {
|
|
|
area: $region.text().split('+')[1],
|
|
|
mobile: $pn.val(),
|
|
|
code: $ca.val()
|
|
|
}
|
|
|
}).then(function(data) {
|
|
|
if (data.code === 200) {
|
|
|
t = setInterval(function() {
|
|
|
if (timeResidue <= 0) {
|
|
|
$sendCaptcha.removeClass('disable').val('获取短信验证码');
|
...
|
...
|
@@ -4363,10 +4411,20 @@ $sendCaptcha.click(function() { |
|
|
}
|
|
|
$sendCaptcha.addClass('disable').val(timeResidue-- + '秒可重新发送');
|
|
|
}, 1000);
|
|
|
});
|
|
|
}
|
|
|
});
|
|
|
});
|
|
|
|
|
|
//ajax表单提交
|
|
|
$registerBtn.click(function() {
|
|
|
|
|
|
//form表单提交
|
|
|
$registerBtn.click(function() {
|
|
|
var url;
|
|
|
|
|
|
if (page === 'reg') {
|
|
|
url = '/passport/register/mobileregister';
|
|
|
} else if (page === 'third') {
|
|
|
url = '/passport/autouserinfo/bindMobile';
|
|
|
}
|
|
|
|
|
|
if ($(this).hasClass('disable')) {
|
|
|
return;
|
...
|
...
|
@@ -4375,7 +4433,7 @@ $registerBtn.click(function() { |
|
|
//ajax提交
|
|
|
$.ajax({
|
|
|
type: 'POST',
|
|
|
url: '/passport/register/mobileregister',
|
|
|
url: url,
|
|
|
data: {
|
|
|
area: $region.text().split('+')[1],
|
|
|
mobile: $pn.val(),
|
...
|
...
|
@@ -4414,15 +4472,16 @@ $registerBtn.click(function() { |
|
|
|
|
|
});
|
|
|
}
|
|
|
});
|
|
|
});
|
|
|
|
|
|
$('.change-captcha').click(function() {
|
|
|
$('.change-captcha').click(function() {
|
|
|
var time = new Date(),
|
|
|
$captchaImg = $('.captcha-img'),
|
|
|
captchaImgSrc = $captchaImg.attr('src').split('?')[0];
|
|
|
|
|
|
$captchaImg.attr('src', captchaImgSrc + '?t=' + time.getTime());
|
|
|
});
|
|
|
});
|
|
|
};
|
|
|
});
|
|
|
define("js/passport/mail-phone-regx", [], function(require, exports, module){
|
|
|
/**
|
...
|
...
|
@@ -4828,6 +4887,8 @@ var checkbox = { |
|
|
unchecked: ''
|
|
|
};
|
|
|
|
|
|
var authing = false;
|
|
|
|
|
|
var emailAcTime;
|
|
|
|
|
|
require("jquery.placeholder");
|
...
|
...
|
@@ -4843,7 +4904,7 @@ function validateAccount() { |
|
|
if (/^[0-9]+$/.test(account)) {
|
|
|
|
|
|
//如果是纯数字,则作为手机号码处理
|
|
|
if (mailPhoneRegx.phoneRegx['+' + $countryCodeHide.val()].test(account)) {
|
|
|
if (mailPhoneRegx.phoneRegx[$countryCodeHide.val()].test(account)) {
|
|
|
pass = true;
|
|
|
} else {
|
|
|
pass = false;
|
...
|
...
|
@@ -4894,6 +4955,7 @@ function validatePassword() { |
|
|
$passwordTip.removeClass('hide').children('em').text(err);
|
|
|
$password.addClass('error');
|
|
|
}
|
|
|
return pass;
|
|
|
}
|
|
|
|
|
|
//验证
|
...
|
...
|
@@ -5051,8 +5113,30 @@ $('.va').on('focus', function() { |
|
|
$('#login-btn').on('click', function() {
|
|
|
var pass = validate();
|
|
|
|
|
|
if (pass) {
|
|
|
$('#login-form').submit();
|
|
|
if (pass && authing === false) {
|
|
|
authing = true;
|
|
|
|
|
|
$.ajax({
|
|
|
url: '/passport/login/auth',
|
|
|
type: 'POST',
|
|
|
data: {
|
|
|
areaCode: $countryCodeHide.val().replace('+', ''),
|
|
|
account: $.trim($account.val()),
|
|
|
password: $.trim($password.val())
|
|
|
},
|
|
|
success: function(data) {
|
|
|
if (data.code === 400) {
|
|
|
$passwordTip.removeClass('hide').children('em').text(data.message);
|
|
|
$password.addClass('error');
|
|
|
return;
|
|
|
} else {
|
|
|
location.href = data.data.href;
|
|
|
}
|
|
|
},
|
|
|
complete: function() {
|
|
|
authing = false;
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
});
|
|
|
});
|
...
|
...
|
|