password.js
1.97 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
/**
* 注册-密码
* @author: xuqi<qi.xu@yoho.cn>
* @date: 2015/10/8
*/
var $ = require('yoho-jquery');
var $pwd = $('#pwd'),
$btnSure = $('#btn-sure');
var api = require('../api');
var tip = require('../../plugin/tip');
var trim = $.trim;
var showErrTip = tip.show;
require('../../common');
api.bindEyesEvt({
status: 'open' // 默认眼睛打开
});
$pwd.bind('input', function() {
if (trim($pwd.val()) === '') {
$btnSure.addClass('disable');
} else {
$btnSure.removeClass('disable');
}
});
$btnSure.on('touchstart', function() {
var pwd = trim($pwd.val());
if ($btnSure.hasClass('disable')) {
return;
}
if (api.pwdValidate(pwd) === false) {
showErrTip('密码6-20位,请重新输入');
} else {
$.ajax({
type: 'POST',
url: '/passport/reg/setpassword',
data: {
password: pwd,
phoneNum: $('#phone-num').val(),
areaCode: $('#area-code').val(),
token: $('#token').val()
},
success: function(data) {
var res = data.data;
if (data.code === 200) {
// 统计代码:用于统计从哪个渠道注册成功的
if (window._yas && window._yas.sendCustomInfo) {
window._yas.sendCustomInfo({
op: 'YB_REGISTER_SUCCESS_L',
param: JSON.stringify({
C_ID: window._ChannelVary[window.cookie('_Channel')] || 1,
UNION_TYPE: window.queryString.union_type || window.cookie('unionTypeYas') || false
})
}, true);
}
showErrTip('注册成功');
location.href = res.href;
} else {
showErrTip(data.message);
}
}
});
}
});