password_manager.html
6.7 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
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
<link rel="stylesheet" href="https://at.alicdn.com/t/font_834805_0ml90wdq5hzm.css">
<link rel="stylesheet" href="__INDEX__/css/base.css">
<link rel="stylesheet" href="__INDEX__/css/swiper.min.css">
<script type="text/javascript" src="__INDEX__/js/base.js"></script>
<title>密码管理</title>
<style>
body,html{
width:100%;
height:100%;
background: RGBA(245, 246, 250, 1);
}
.phone{
width:6.96rem;
margin: 0 auto;
height:1rem;
background: #fff;
border-radius: 0.5rem;
font-size: 0.28rem;
color: RGBA(151, 160, 168, 1);
/*padding: 0.37rem 0.52rem;*/
margin-top: 0.32rem;
}
.enterphone{
width:6.96rem;
margin: 0 auto;
height:1rem;
background: #fff;
border-radius: 0.5rem;
font-size: 0.28rem;
color: RGBA(151, 160, 168, 1);
padding: 0.37rem 0.52rem;
border:none;
outline:none;
}
.code{
font-size: 0;
display:flex;
justify-content: space-between;
align-content: center;
width:6.96rem;
margin: 0 auto;
height:1rem;
background: #fff;
border-radius: 0.5rem;
color: RGBA(151, 160, 168, 1);
margin-top: 0.32rem;
}
.code_num{
height:1rem;
line-height: 1rem;
font-size: 0.28rem;
margin-left: 0.52rem;
}
.entercode{
height:1rem;
line-height: 1rem;
font-size: 0.28rem;
outline:none;
border:none;
border-radius: 0.5rem;
color: RGBA(151, 160, 168, 1);
}
.sendcode{
width:2.44rem;
font-size: 0.28rem;
height:0.72rem;
background: RGBA(254, 10, 1, 1);
color:#fff;
border-radius: 0.36rem;
line-height: 0.72rem;
text-align: center;
margin-top: 0.15rem;
margin-right: 0.37rem;
border:none;
outline:none;
}
.nextstep{
display:block;
width:6.86rem;
height:0.88rem;
text-align: center;
line-height: 0.88rem;
background:RGBA(254, 10, 1, 1);
font-size: 0.32rem;
color:#fff;
border-radius: 0.44rem;
position:fixed;
bottom:0.55rem;
left:0;
right:0;
margin: 0 auto;
box-shadow:0px 15px 30px 0px rgba(254,10,1,0.24);
border:none;
outline:none;
}
</style>
</head>
<body>
<div class="container">
<div class="phone">
<input type="text" class="enterphone" placeholder="手机号">
</div>
</div>
<div class="code">
<p class="code_num">
<input type="text" class="entercode" placeholder="验证码">
</p>
<button class="sendcode"></button>
</div>
<button class="nextstep">
下一步
</button>
</body>
<script src="__INDEX__/js/jquery.min.js"></script>
<script>
$(".sendcode").click(function () {
var mobile = $(".enterphone").val();
var pattern = /^1[34578]\d{9}$/;
if(pattern.test(mobile)) {
$.ajax({
url: "{:url('sms/Sms/sendSms')}",
data: {
mobile: mobile
},
type: "POST",
dataType: "JSON",
})
} else {
alert('请输入正确的手机号');
}
})
$(".nextstep").click(function(){
var mobile = $(".enterphone").val();
var code = $(".entercode").val();
if(mobile == '') {
alert('请输入手机号');
}else {
if(code == '') {
alert('请输入验证码');
}else {
$.ajax({
url:"{:url('sms/Sms/checkCodeS')}",
data:{
mobile:mobile,
code:code
},
type:"POST",
dataType:"JSON",
success: function (data) {
if(data.data === true) {
localStorage.clear();
window.location.href="{:url('friendship/Friend/enterPassword')}"
}else {
alert(data.msg);
}
}
})
}
}
})
var InterValObj; //timer变量,控制时间
var count = 60; //间隔函数,1秒执行
var curCount;//当前剩余秒数
var t=localStorage.getItem("time");
InterValObj = window.setInterval(SetRemainTime,1000);
if(t!=null){
curCount=t;
//$(".nextstep").attr("disabled",true);
$(".sendcode").attr("disabled",true)
var phone=localStorage.getItem("mobile");
$(".enterphone").val(phone)
}else{
curCount=60;
window.clearInterval(InterValObj);
$(".sendcode").html("获取验证码");
}
$(".sendcode").click(function(){
curCount = count;
var tel = $(".enterphone").val();
if(tel==""){
return false;
}
var reg= /^1[34578]\d{9}$/;
if(!reg.test(tel)){
return false;
}
localStorage.setItem("mobile",tel)
//设置button效果,开始计时
$(".sendcode").attr("disabled",true);
//$(".nextstep").attr("disabled",true);
// $(".sendcode").unbind()
$(".sendcode").html( curCount + "秒");
$(".sendcode").css("color","#fff");
InterValObj = window.setInterval(SetRemainTime, 1000); //启动计时器,1秒执行一次
});
//timer处理函数
function SetRemainTime() {
if (curCount == 0) {
window.clearInterval(InterValObj);//停止计时器
$(".sendcode").removeAttr("disabled");//启用按钮
//$(".nextstep").removeAttr("disabled");
$(".sendcode").html("重新发送验证码");
$(".sendcode").css("color","#fff");
localStorage.clear();
}
else {
curCount--;
localStorage.setItem("time",curCount);
$(".sendcode").html(curCount + "秒");
$(".sendcode").css("color","#fff");
}
}
</script>
</html>