-
Notifications
You must be signed in to change notification settings - Fork 0
/
ews.js
81 lines (80 loc) · 3.1 KB
/
ews.js
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
74
75
76
77
78
79
80
81
jQuery(function($){
$(".ews-button").click(function(){
var that = $(this),
code = that.prev().val();
if(code){
if(!that.hasClass("disabled")){
that.text("验证中...");
that.addClass("disabled");
$.post(ews_ajax_url, {
"action": "ews_login",
"code": code
}, function(data) {
if(data.status == "1"){
location.reload();
}else{
that.removeClass("disabled");
that.text("验证登录");
if(typeof(logtips) != "undefined"){
logtips("登录失败!请检查是否验证码已过期~");
}else if(typeof(layer) != "undefined"){
layer.msg("登录失败!请检查是否验证码已过期~");
}else{
alert("登录失败!请检查是否验证码已过期~");
}
}
});
}
}else{
if(typeof(logtips) != "undefined"){
logtips("请输入验证码~");
}else if(typeof(layer) != "undefined"){
layer.msg("请输入验证码~");
}else{
alert("请输入验证码~");
}
}
return false;
});
$(".ews-bind-button").click(function(){
var that = $(this),
code = that.prev().val();
if(code){
if(!that.hasClass("disabled")){
that.text("验证中...");
that.addClass("disabled");
$.post(ews_ajax_url, {
"action": "ews_bind",
"code": code
}, function(data) {
if(data.status == "1"){
location.reload();
}else if(data.status == "2"){
that.removeClass("disabled");
that.text("验证绑定");
if(typeof(layer) != "undefined"){
layer.msg("绑定失败!此微信已绑定过其他账号了~");
}else{
alert("绑定失败!此微信已绑定过其他账号了~");
}
}else{
that.removeClass("disabled");
that.text("验证绑定");
if(typeof(layer) != "undefined"){
layer.msg("绑定失败!请检查是否验证码已过期~");
}else{
alert("绑定失败!请检查是否验证码已过期~");
}
}
});
}
}else{
if(typeof(layer) != "undefined"){
layer.msg("请输入验证码~");
}else{
alert("请输入验证码~");
}
}
return false;
});
});