...
|
...
|
@@ -9,8 +9,7 @@ var $ = require('yoho-jquery'), |
|
|
computeComplex = require('../common/pwd-strength'),
|
|
|
EventProxy = require('yoho-eventproxy');
|
|
|
|
|
|
var $registerPage = $('.register-page'),
|
|
|
$phone = $('#phone');
|
|
|
var $registerPage = $('.register-page');
|
|
|
|
|
|
var $phoneNumInput = $('#phone-num'),
|
|
|
$smsCaptchaInput = $('#msg-captcha'),
|
...
|
...
|
@@ -22,6 +21,7 @@ var $phoneNumInput = $('#phone-num'), |
|
|
$regionCodeText = $('#country-code'),
|
|
|
$registerBtn = $('#register-btn');
|
|
|
|
|
|
var $phone = $phoneNumInput;
|
|
|
var second = 60;
|
|
|
var ep = new EventProxy();
|
|
|
|
...
|
...
|
@@ -35,25 +35,18 @@ var checkboxIcon = { |
|
|
unchecked: ''
|
|
|
};
|
|
|
|
|
|
var $errTip = $('.tips'),
|
|
|
$errMsg = $errTip.find('.rectangle');
|
|
|
|
|
|
require('yoho-jquery-placeholder');
|
|
|
|
|
|
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');
|
|
|
}
|
|
|
|
|
|
setTimeout(function() {
|
...
|
...
|
@@ -162,7 +155,7 @@ function validateImgCaptcha() { |
|
|
}
|
|
|
|
|
|
return validate().then(function() {
|
|
|
hideTip();
|
|
|
hideTip($imgCaptchaInput);
|
|
|
ep.emit('captcha-img', true);
|
|
|
}).fail(function() {
|
|
|
ep.emit('captcha-img', false);
|
...
|
...
|
@@ -230,7 +223,7 @@ function validateSMSCaptcha() { |
|
|
}
|
|
|
|
|
|
return validate().then(function() {
|
|
|
hideTip();
|
|
|
hideTip($smsCaptchaInput);
|
|
|
ep.emit('captcha-sms', true);
|
|
|
}).fail(function() {
|
|
|
ep.emit('captcha-sms', false);
|
...
|
...
|
@@ -284,7 +277,7 @@ function validatePhoneNum() { |
|
|
}
|
|
|
|
|
|
return validate().then(function() {
|
|
|
hideTip();
|
|
|
hideTip($phone);
|
|
|
ep.emit('phone-num', true);
|
|
|
}).fail(function() {
|
|
|
ep.emit('phone-num', false);
|
...
|
...
|
@@ -322,7 +315,7 @@ function validatePassword() { |
|
|
}
|
|
|
|
|
|
return validate().then(function() {
|
|
|
hideTip();
|
|
|
hideTip($passwordInput);
|
|
|
ep.emit('password', true);
|
|
|
}).fail(function() {
|
|
|
ep.emit('password', false);
|
...
|
...
|
@@ -450,11 +443,15 @@ exports.init = function() { |
|
|
// 验证手机输入
|
|
|
$phoneNumInput.on('keyup blur', function() {
|
|
|
validatePhoneNum();
|
|
|
}).on('focus', function() {
|
|
|
hideTip($phoneNumInput);
|
|
|
});
|
|
|
|
|
|
// 验证图形输入
|
|
|
$imgCaptchaInput.on('keyup blur', function() {
|
|
|
validateImgCaptcha();
|
|
|
}).on('focus', function() {
|
|
|
hideTip($imgCaptchaInput);
|
|
|
});
|
|
|
|
|
|
// 图形验证通过时,发送短信按钮可点击
|
...
|
...
|
@@ -469,6 +466,8 @@ exports.init = function() { |
|
|
// 验证短信输入
|
|
|
$smsCaptchaInput.on('keyup blur', function() {
|
|
|
validateSMSCaptcha();
|
|
|
}).on('focus', function() {
|
|
|
hideTip($smsCaptchaInput);
|
|
|
});
|
|
|
|
|
|
// 验证密码输入
|
...
|
...
|
@@ -478,6 +477,8 @@ exports.init = function() { |
|
|
validatePassword().always(function() {
|
|
|
validatePasswordComplexLocal($this);
|
|
|
});
|
|
|
}).on('focus', function() {
|
|
|
hideTip($passwordInput);
|
|
|
});
|
|
|
|
|
|
// 服务条款
|
...
|
...
|
|