|
@@ -24,17 +24,29 @@ api.selectCssHack($('#country-select')); |
|
@@ -24,17 +24,29 @@ api.selectCssHack($('#country-select')); |
24
|
|
24
|
|
25
|
api.bindClearEvt();
|
25
|
api.bindClearEvt();
|
26
|
|
26
|
|
|
|
27
|
+
|
|
|
28
|
+// 图片验证码
|
|
|
29
|
+let ImgCheck = require('plugin/img-check');
|
|
|
30
|
+
|
|
|
31
|
+let imgCheck = new ImgCheck('#js-img-check', {
|
|
|
32
|
+ useREM: {
|
|
|
33
|
+ rootFontSize: 40,
|
|
|
34
|
+ picWidth: 150
|
|
|
35
|
+ }
|
|
|
36
|
+});
|
|
|
37
|
+
|
|
|
38
|
+imgCheck.init();
|
|
|
39
|
+
|
27
|
/**
|
40
|
/**
|
28
|
* 必填校验
|
41
|
* 必填校验
|
29
|
*/
|
42
|
*/
|
30
|
function checkEnableNext() {
|
43
|
function checkEnableNext() {
|
31
|
var phone = trim($phoneNum.val());
|
44
|
var phone = trim($phoneNum.val());
|
32
|
var area = trim($countrySelect.val());
|
45
|
var area = trim($countrySelect.val());
|
33
|
- var captcha = trim($captcha.val());
|
|
|
34
|
|
46
|
|
35
|
var ret = true;
|
47
|
var ret = true;
|
36
|
|
48
|
|
37
|
- $.each([phone, area, captcha], function(i, val) {
|
49
|
+ $.each([phone, area], function(i, val) {
|
38
|
if (!val) {
|
50
|
if (!val) {
|
39
|
ret = false;
|
51
|
ret = false;
|
40
|
return ret;
|
52
|
return ret;
|
|
@@ -44,24 +56,13 @@ function checkEnableNext() { |
|
@@ -44,24 +56,13 @@ function checkEnableNext() { |
44
|
return ret;
|
56
|
return ret;
|
45
|
}
|
57
|
}
|
46
|
|
58
|
|
47
|
-
|
|
|
48
|
-/**
|
|
|
49
|
- * 刷新 校验码
|
|
|
50
|
- */
|
|
|
51
|
-function refreshCaptcha() {
|
|
|
52
|
- $captcha.val('').focus();
|
|
|
53
|
- $captchaPNG.attr('src', ['//m.yohobuy.com/passport/reg/captcha.png', '?t=', Date.now()].join(''));
|
|
|
54
|
-}
|
|
|
55
|
-
|
|
|
56
|
-
|
|
|
57
|
/*
|
59
|
/*
|
58
|
Event bind
|
60
|
Event bind
|
59
|
*/
|
61
|
*/
|
60
|
$('.reg-page')
|
62
|
$('.reg-page')
|
61
|
- .on('input', '.phone-num, #js-captcha', function() {
|
63
|
+ .on('input', '.phone-num', function() {
|
62
|
$btnNext.toggleClass('disable', !checkEnableNext());
|
64
|
$btnNext.toggleClass('disable', !checkEnableNext());
|
63
|
- })
|
|
|
64
|
- .on('click', '.passport-captcha-png', refreshCaptcha);
|
65
|
+ });
|
65
|
|
66
|
|
66
|
$countrySelect.change(function() {
|
67
|
$countrySelect.change(function() {
|
67
|
$areaCode.text($countrySelect.val());
|
68
|
$areaCode.text($countrySelect.val());
|
|
@@ -70,10 +71,10 @@ $countrySelect.change(function() { |
|
@@ -70,10 +71,10 @@ $countrySelect.change(function() { |
70
|
$btnNext.on('touchstart', function() {
|
71
|
$btnNext.on('touchstart', function() {
|
71
|
var pn = trim($phoneNum.val()),
|
72
|
var pn = trim($phoneNum.val()),
|
72
|
areaCode = $countrySelect.val(),
|
73
|
areaCode = $countrySelect.val(),
|
73
|
- captcha = $captcha.val().trim();
|
74
|
+ captcha = imgCheck.getResults();
|
74
|
|
75
|
|
75
|
- if (!captcha) {
|
|
|
76
|
- tip.show('请输入验证码');
|
76
|
+ if (captcha === '0000') {
|
|
|
77
|
+ tip.show('请将图片旋转到正确位置');
|
77
|
return false;
|
78
|
return false;
|
78
|
}
|
79
|
}
|
79
|
|
80
|
|
|
@@ -102,7 +103,7 @@ $btnNext.on('touchstart', function() { |
|
@@ -102,7 +103,7 @@ $btnNext.on('touchstart', function() { |
102
|
if (data.code === 200) {
|
103
|
if (data.code === 200) {
|
103
|
location.href = data.data;
|
104
|
location.href = data.data;
|
104
|
} else {
|
105
|
} else {
|
105
|
- refreshCaptcha();
|
106
|
+ imgCheck.refresh();
|
106
|
|
107
|
|
107
|
showErrTip(data.message);
|
108
|
showErrTip(data.message);
|
108
|
requested = false;
|
109
|
requested = false;
|
|
@@ -110,7 +111,7 @@ $btnNext.on('touchstart', function() { |
|
@@ -110,7 +111,7 @@ $btnNext.on('touchstart', function() { |
110
|
},
|
111
|
},
|
111
|
error: function() {
|
112
|
error: function() {
|
112
|
showErrTip('出错了,请重试');
|
113
|
showErrTip('出错了,请重试');
|
113
|
- refreshCaptcha();
|
114
|
+ imgCheck.refresh();
|
114
|
requested = false;
|
115
|
requested = false;
|
115
|
}
|
116
|
}
|
116
|
});
|
117
|
});
|