mobile_validate.html
6.89 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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>手机验证-{$tpshop_config['shop_info_store_title']}</title>
<meta http-equiv="keywords" content="{$tpshop_config['shop_info_store_keyword']}" />
<meta name="description" content="{$tpshop_config['shop_info_store_desc']}" />
<link rel="stylesheet" href="__STATIC__/css/index.css" type="text/css">
<script src="__STATIC__/js/jquery-1.10.2.min.js"></script>
<script src="__STATIC__/js/slider.js"></script>
<script src="__PUBLIC__/js/global.js"></script>
<script src="__PUBLIC__/js/pc_common.js"></script>
<script src="__PUBLIC__/js/layer/layer.js"></script><!--弹窗js 参考文档 http://layer.layui.com/-->
</head>
<body style="background:RGB(242,242,242)">
<div class="uc">
<div class="uc_head">
<div class="uc_head_middle">
<div class="uc_head_middle_left">绑定手机</div>
<div class="uc_head_middle_right"><a class="logout_c" href="/">首页</a> | <a class="logout_c" href="javascript:history.back(-1)">返回</a></div>
</div>
</div>
<div class="uc_body pa-to-30">
<div class="uc_body_form">
<!--<div class="diraction_icon dir_icon1">-->
<!--<ul class="diraction_dl">-->
<!--<li>1 验证原邮箱</li>-->
<!--<li>2 安全验证</li>-->
<!--<li>3 新邮箱绑定</li>-->
<!--<li>4 验证新邮箱</li>-->
<!--</ul>-->
<!--</div>-->
<form action="" method="post" onSubmit="return check_form();">
<table class="changeAccount_theme">
<tbody>
<!--步骤二 验证新手机号码-->
<notempty name="user_info.mobile">
<tr class="tr_height">
<td class="cl_left fo-si-12" align="right"><label class="fo-si-12">原手机:</label></td>
<td class="cl_middle">
<input type="text" class="imput_text text_width foce" id="old_mobile" value="{$user_info['mobile']}" name="old_mobile" readonly="readonly"
style="cursor: not-allowed;color:#999" onpaste="this.value=this.value.replace(/[^\d]/g,'')" onKeyUp="this.value=this.value.replace(/[^\d]/g,'')" />
</td>
<td>
<span id="msg_txtMailAccount"></span>
</td>
</tr>
</notempty>
<tr class="tr_height">
<td class="cl_left fo-si-12" align="right"><label class="fo-si-12">新手机:</label></td>
<td class="cl_middle">
<input type="text" class="imput_text text_width foce" id="new_mobile" name="mobile" onpaste="this.value=this.value.replace(/[^\d]/g,'')" onKeyUp="this.value=this.value.replace(/[^\d]/g,'')" />
</td>
</tr>
<tr class="tr_height">
<td align="right" class="cl_left">
验证码:
</td>
<td class="cl_middle">
<input type="text" id="new_code" maxlength="4" style="width:100px;" class="imput_text" name="code">
<input type="button" class="box-ok" intervaltime="{$time}" value="获取验证码 " id="btnemailAuthCode2" onClick="sendCode(this,'new_mobile')">
</td>
</tr>
<!--步骤二 验证新手机号码结束-->
<tr class="tr_height">
<td valign="middle" align="center" colspan="3" style="height:120px;">
<input type="submit" value="下一步" class="btn_midefy" id="btn_next">
</td>
</tr>
<tr>
<td colspan="3"></td>
</tr>
</tbody>
</table>
</form>
</div>
</div>
</div>
<script>
// 表单提交验证
function check_form()
{
var old_mobile = $('#old_mobile').val();
var new_mobile = $('#new_mobile').val();
//原邮箱不为空的情况下 验证格式
if(old_mobile != '' && typeof(old_mobile) != 'undefined'){
if(!checkMobile(old_mobile)){
layer.alert('原手机格式错误', {icon: 2});// alert('原手机格式错误');
return false;
}
}
if(!checkMobile(new_mobile)){
layer.alert('新手机格式错误', {icon: 2});//alert('新手机格式错误');
return false;
}
if($.trim($('#new_code').val()) == '')
{
layer.alert('验证码不能为空', {icon: 2});//alert('验证码不能为空');
return false;
}
return true;
}
function sendCode(obj,input_id){
var id = $(obj).attr('id');
var input = $('#'+input_id).val();
var old_mobile = $('#old_mobile').val();
//原邮箱不为空的情况下 验证格式
if(old_mobile != '' && typeof(old_mobile) != 'undefined'){
if(!checkMobile(old_mobile)){
layer.alert('原手机格式错误', {icon: 2});//alert('原手机格式错误');
return false;
}
}
if(!checkMobile(input)){
layer.alert('手机号码格式错误', {icon: 2});//alert('手机号码格式错误');
return false;
}
var url = "/index.php?m=Home&c=Api&a=send_validate_code&scene=6&type=mobile&send="+input;
//发送验证码
$.ajax({
type : "GET",
url : url,
dataType : 'json',
error: function(request) {
layer.alert('服务器繁忙, 请联系管理员!', {icon: 2});//alert("服务器繁忙, 请联系管理员!");
return;
},
success: function(res) {
if(res.status == 1){
layer.alert(res.msg,{icon: 1});
jsInnerTimeout(id);
}else{
layer.alert(res.msg,{icon: 2});//alert('发送失败');
}
}
});
}
//倒计时函数
function jsInnerTimeout(id)
{
var codeObj=$("#"+id);
var intAs=parseInt(codeObj.attr("IntervalTime"));
intAs--;
codeObj.attr("disabled","disabled");
if(intAs<=-1)
{
codeObj.removeAttr("disabled");
codeObj.attr("IntervalTime",{$time});
codeObj.val("获取验证码");
return true;
}
codeObj.val(intAs+'s后再次获取');
codeObj.attr("IntervalTime",intAs);
setTimeout("jsInnerTimeout('"+id+"')",1000);
};
$("#btnemailAuthCode2").removeAttr("disabled");
</script>
</body>
</html>