...
|
...
|
@@ -8,6 +8,8 @@ var $ = require('yoho-jquery'); |
|
|
var $phoneNum = $('#phone-num'),
|
|
|
$countrySelect = $('#country-select'),
|
|
|
$areaCode = $('#area-code'),
|
|
|
$captcha = $('#js-captcha'),
|
|
|
$captchaPNG = $('.passport-captcha-png'),
|
|
|
$btnNext = $('#btn-next');
|
|
|
|
|
|
var api = require('../api');
|
...
|
...
|
@@ -22,13 +24,43 @@ api.selectCssHack($('#country-select')); |
|
|
|
|
|
api.bindClearEvt();
|
|
|
|
|
|
$phoneNum.bind('input', function() {
|
|
|
if (trim($phoneNum.val()) === '') {
|
|
|
$btnNext.addClass('disable');
|
|
|
} else {
|
|
|
$btnNext.removeClass('disable');
|
|
|
}
|
|
|
});
|
|
|
/**
|
|
|
* 必填校验
|
|
|
*/
|
|
|
function checkEnableNext() {
|
|
|
var phone = trim($phoneNum.val());
|
|
|
var area = trim($countrySelect.val());
|
|
|
var captcha = trim($captcha.val());
|
|
|
|
|
|
var ret = true;
|
|
|
|
|
|
$.each([phone, area, captcha], function(i, val) {
|
|
|
if (!val) {
|
|
|
ret = false;
|
|
|
return ret;
|
|
|
}
|
|
|
});
|
|
|
|
|
|
return ret;
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 刷新 校验码
|
|
|
*/
|
|
|
function refreshCaptcha() {
|
|
|
$captchaPNG.attr('src', ['//m.yohobuy.com/passport/reg/captcha.png', '?t=', Date.now()].join(''));
|
|
|
}
|
|
|
|
|
|
|
|
|
/*
|
|
|
Event bind
|
|
|
*/
|
|
|
$('.reg-page')
|
|
|
.on('input', '.phone-num, #js-captcha', function() {
|
|
|
$btnNext.toggleClass('disable', !checkEnableNext());
|
|
|
})
|
|
|
.on('click', '.passport-captcha-png', refreshCaptcha);
|
|
|
|
|
|
$countrySelect.change(function() {
|
|
|
$areaCode.text($countrySelect.val());
|
...
|
...
|
@@ -36,7 +68,13 @@ $countrySelect.change(function() { |
|
|
|
|
|
$btnNext.on('touchstart', function() {
|
|
|
var pn = trim($phoneNum.val()),
|
|
|
areaCode = $countrySelect.val();
|
|
|
areaCode = $countrySelect.val(),
|
|
|
captcha = $captcha.val().trim();
|
|
|
|
|
|
if (!captcha) {
|
|
|
tip.show('请输入验证码');
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
if ($btnNext.hasClass('disable')) {
|
|
|
return;
|
...
|
...
|
@@ -56,7 +94,8 @@ $btnNext.on('touchstart', function() { |
|
|
type: 'POST',
|
|
|
data: {
|
|
|
areaCode: areaCode.replace('+', ''),
|
|
|
phoneNum: pn
|
|
|
phoneNum: pn,
|
|
|
captcha: captcha
|
|
|
},
|
|
|
success: function(data) {
|
|
|
if (data.code === 200) {
|
...
|
...
|
|