...
|
...
|
@@ -15,7 +15,6 @@ var $regionCodeText = $('#country-code'), |
|
|
$imgCaptchaInput = $('#verifyCode'),
|
|
|
$regionSelectCtrl = $('#area'),
|
|
|
$nextBtn = $('#find-btn'),
|
|
|
$phone = $('#phone'),
|
|
|
$form = $('#back-form');
|
|
|
|
|
|
var emailRegx = regx.emailRegx,
|
...
|
...
|
@@ -23,23 +22,16 @@ var emailRegx = regx.emailRegx, |
|
|
|
|
|
var ep = new EventProxy();
|
|
|
|
|
|
var $errTip = $('.tips'),
|
|
|
$errMsg = $errTip.find('.rectangle');
|
|
|
|
|
|
function errTip(ele, msg) {
|
|
|
var topLeft = ele.offset();
|
|
|
var $errTip = ele.next('.tips');
|
|
|
var $errMsg = $errTip.find('.rectangle');
|
|
|
|
|
|
$errMsg.text(msg);
|
|
|
return $errTip.css({
|
|
|
top: topLeft.top + ele.height() - 2,
|
|
|
left: topLeft.left,
|
|
|
width: ele.width() + 2,
|
|
|
height: ele.height
|
|
|
}).removeClass('hide');
|
|
|
return $errTip.removeClass('hide');
|
|
|
}
|
|
|
|
|
|
function hideTip() {
|
|
|
return $errTip.addClass('hide');
|
|
|
function hideTip(ele) {
|
|
|
return ele.next('.tips').addClass('hide');
|
|
|
}
|
|
|
|
|
|
require('yoho-jquery-placeholder');
|
...
|
...
|
@@ -64,7 +56,7 @@ function validatePhoneNumAsync() { |
|
|
if (data.code === 200) {
|
|
|
return true;
|
|
|
} else if (data.code === 402) {
|
|
|
errTip($phone, '该账号不存在');
|
|
|
errTip($phoneNumInput, '该账号不存在');
|
|
|
return false;
|
|
|
} else if (data.code === 400) {
|
|
|
refreshImgCaptcha();
|
...
|
...
|
@@ -89,7 +81,7 @@ function validatePhoneNumLocal() { |
|
|
if (val.length === 11 && phoneRegx['+86'].test(val)) {
|
|
|
return true;
|
|
|
} else {
|
|
|
errTip($phone, '手机号码不正确,请重新输入');
|
|
|
errTip($phoneNumInput, '手机号码不正确,请重新输入');
|
|
|
return false;
|
|
|
}
|
|
|
}
|
...
|
...
|
@@ -99,12 +91,12 @@ function validatePhoneNumLocal() { |
|
|
if (emailRegx.test(val)) {
|
|
|
return true;
|
|
|
} else {
|
|
|
errTip($phone, '邮箱格式不正确,请重新输入');
|
|
|
errTip($phoneNumInput, '邮箱格式不正确,请重新输入');
|
|
|
return false;
|
|
|
}
|
|
|
}
|
|
|
} else {
|
|
|
errTip($phone, '请输入帐号');
|
|
|
errTip($phoneNumInput, '请输入帐号');
|
|
|
return false;
|
|
|
}
|
|
|
}
|
...
|
...
|
@@ -118,7 +110,7 @@ function validatePhoneNum() { |
|
|
if (result) {
|
|
|
defer.resolve(true);
|
|
|
} else {
|
|
|
errTip($phone, '帐号不存在');
|
|
|
errTip($phoneNumInput, '帐号不存在');
|
|
|
defer.reject(false);
|
|
|
}
|
|
|
});
|
...
|
...
|
@@ -130,6 +122,7 @@ function validatePhoneNum() { |
|
|
}
|
|
|
|
|
|
return validate().then(function() {
|
|
|
hideTip($phoneNumInput);
|
|
|
ep.emit('phone-num', true);
|
|
|
}).fail(function() {
|
|
|
ep.emit('phone-num', false);
|
...
|
...
|
@@ -229,6 +222,12 @@ exports.init = function() { |
|
|
|
|
|
$imgCaptchaInput.on('blur', function() {
|
|
|
validateImgCaptcha();
|
|
|
}).on('focus', function() {
|
|
|
hideTip($imgCaptchaInput);
|
|
|
});
|
|
|
|
|
|
$phoneNumInput.on('focus', function() {
|
|
|
hideTip($phoneNumInput);
|
|
|
});
|
|
|
|
|
|
$nextBtn.on('click', function() {
|
...
|
...
|
|