...
|
...
|
@@ -24,17 +24,29 @@ api.selectCssHack($('#country-select')); |
|
|
|
|
|
api.bindClearEvt();
|
|
|
|
|
|
|
|
|
// 图片验证码
|
|
|
let ImgCheck = require('plugin/img-check');
|
|
|
|
|
|
let imgCheck = new ImgCheck('#js-img-check', {
|
|
|
useREM: {
|
|
|
rootFontSize: 40,
|
|
|
picWidth: 150
|
|
|
}
|
|
|
});
|
|
|
|
|
|
imgCheck.init();
|
|
|
|
|
|
/**
|
|
|
* 必填校验
|
|
|
*/
|
|
|
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) {
|
|
|
$.each([phone, area], function(i, val) {
|
|
|
if (!val) {
|
|
|
ret = false;
|
|
|
return ret;
|
...
|
...
|
@@ -44,24 +56,13 @@ function checkEnableNext() { |
|
|
return ret;
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 刷新 校验码
|
|
|
*/
|
|
|
function refreshCaptcha() {
|
|
|
$captcha.val('').focus();
|
|
|
$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() {
|
|
|
.on('input', '.phone-num', function() {
|
|
|
$btnNext.toggleClass('disable', !checkEnableNext());
|
|
|
})
|
|
|
.on('click', '.passport-captcha-png', refreshCaptcha);
|
|
|
});
|
|
|
|
|
|
$countrySelect.change(function() {
|
|
|
$areaCode.text($countrySelect.val());
|
...
|
...
|
@@ -70,10 +71,10 @@ $countrySelect.change(function() { |
|
|
$btnNext.on('touchstart', function() {
|
|
|
var pn = trim($phoneNum.val()),
|
|
|
areaCode = $countrySelect.val(),
|
|
|
captcha = $captcha.val().trim();
|
|
|
captcha = imgCheck.getResults();
|
|
|
|
|
|
if (!captcha) {
|
|
|
tip.show('请输入验证码');
|
|
|
if (captcha === '0000') {
|
|
|
tip.show('请将图片旋转到正确位置');
|
|
|
return false;
|
|
|
}
|
|
|
|
...
|
...
|
@@ -102,7 +103,7 @@ $btnNext.on('touchstart', function() { |
|
|
if (data.code === 200) {
|
|
|
location.href = data.data;
|
|
|
} else {
|
|
|
refreshCaptcha();
|
|
|
imgCheck.refresh();
|
|
|
|
|
|
showErrTip(data.message);
|
|
|
requested = false;
|
...
|
...
|
@@ -110,7 +111,7 @@ $btnNext.on('touchstart', function() { |
|
|
},
|
|
|
error: function() {
|
|
|
showErrTip('出错了,请重试');
|
|
|
refreshCaptcha();
|
|
|
imgCheck.refresh();
|
|
|
requested = false;
|
|
|
}
|
|
|
});
|
...
|
...
|
|