enter_password.html
4.6 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
<!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:#F5F6FA;
}
.passwordnum{
color:#1A1A1A;
font-size: 0.36rem;
font-weight: bold;
margin: 2.16rem 3.02rem;
}
.nextstep{
width:2.4rem;
height:0.88rem;
background:#FE0A01;
color:#fff;
font-size: 0.32rem;
text-align: center;
line-height: 0.88rem;
border-radius: 0.44rem;
box-shadow:0px 15px 30px 0px rgba(254,10,1,0.24);
margin: 0.66rem 2.55rem 0 2.55rem;
}
.enterpassword{
width:4.8rem;
margin: 0 auto;
display:flex;
justify-content: space-between;
align-items: center;
font-size: 0;
margin-top: 0.48rem;
}
.enterpassword li{
width:0.8rem;
height:0.8rem;
list-style: none;
border:1px solid rgba(153,153,153,1);
text-align: center;
border-right:0;
background: #fff;
}
.enterpassword li:last-child{
border-right:1px solid rgba(153,153,153,1) ;
}
.enterpassword li input{
width:0.67rem;
height:0.76rem;
list-style: none;
text-align: center;
border:none;
}
</style>
</head>
<body>
<div class="container">
<p class="passwordnum">输入密码</p>
<ul class="enterpassword" id="wrap">
<li>
<input type="number" class="entercode">
</li>
<li>
<input type="number" class="entercode">
</li>
<li>
<input type="number" class="entercode">
</li>
<li>
<input type="number" class="entercode">
</li>
<li>
<input type="number" class="entercode">
</li>
<li>
<input type="number" class="entercode">
</li>
</ul>
<p class="nextstep">下一步</p>
</div>
</body>
<script src="__INDEX__/js/jquery.min.js"></script>
<script>
var str=""
var arr=[];
var txts = wrap.getElementsByClassName("entercode");
for(var i=0;i<txts.length;i++){
$(txts[i]).val("")
}
var t = '';
//输入的密码自动输入到下一个
onload = function(){
console.log(txts);
for(var i = 0; i<txts.length;i++){
t = txts[i];
t.index = i;
if(t.index>0){
t.setAttribute("readonly", true);
}
t.onkeyup=function(){
var regular = /\s+/g;
if(regular.test(this.value)){
$(this).focus();
}else if($(this).val()==""){
$(this).focus();
}else{
console.log($(this).val());
arr.push($(this).val());
var next = this.index + 1;
if(next > txts.length - 1) return;
txts[next].removeAttribute("readonly");
txts[next].focus();
}
}
if(t.index==5){
t.onkeyup=function(){
arr.push($(this).val())
console.log(arr);
str=arr[0]+arr[1]+arr[2]+arr[3]+arr[4]+arr[5];
console.log(str)
}
}
}
txts[0].removeAttribute("readonly");
}
$(".nextstep").click(function(){
if(arr.length == 6) {
$.ajax({
url: "{:url('friendship/Friend/pwd')}",
data: {
integral_pwd: str,
step: 'enter'
},
type: "POST",
dataType: "JSON",
success: function (data) {
alert(data.msg);
if (data.data === true) {
window.location.href = data.url
}
}
})
}
})
</script>
</html>