setPass.html
7.8 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
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,minimum-scale=1,user-scalable=no">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" type="text/css" href="css/base.css" />
<link rel="stylesheet" type="text/css" href="css/style.css" />
<link rel="stylesheet" href="css/weui.css">
<script src="js/base.js"></script>
<script src="js/common.js"></script>
<style>
body {
box-shadow: 0px 0px 0px #888888;
}
</style>
<script>
function tab(pid) {
var tabs = ["tab1", "tab2"];
for (var i = 0; i < 2; i++) {
if (tabs[i] == pid) {
document.getElementById(tabs[i]).style.display = "block";
var div = document.getElementById('ctab3');
div.setAttribute("class", "off");
var div = document.getElementById('ctab4');
div.setAttribute("class", "on");
} else {
document.getElementById(tabs[i]).style.display = "none";
var div = document.getElementById('ctab4');
div.setAttribute("class", "off");
var div = document.getElementById('ctab3');
div.setAttribute("class", "on");
var div = document.getElementById('ctab3');
div.setAttribute("class", "on");
}
}
}
</script>
<title>修改密码</title>
</head>
<body style="background-color:#fff;">
<div class="perheader center">
<div class="left perback">
<a href="#" onClick="javascript:history.back(-1);">
<img src="images/care_03.jpg" />
</a>
</div>
<div class="bloodtext">修改密码</div>
</div>
<div class="lopart1 center" id="tab">
<form action="#" class="login" id="tab1">
<div class="modname">
<span class="left">请输入手机号</span>
<span class="right">
<input type="text" placeholder="请输入手机号" class="modput" id="phone" />
</span>
</div>
<div class="modname">
<span class="left">请输入验证码</span>
<span class="right">
<input type="text" class="modput1" id="code" />
<span class="right modyz">
<img src="images/loshu_03.jpg" />
<a class="T-getCode">获取验证码</a>
</span>
</span>
</div>
<div class="modname">
<span class="left">新密码</span>
<span class="right">
<input type="password" placeholder="请输入新密码" class="modput" id="pass" />
</span>
</div>
<div class="modname">
<span class="left">确认密码</span>
<span class="right">
<input type="password" placeholder="请再输入新密码" class="modput" id="passTwo" />
</span>
</div>
<button type="button" id="modbut">确认</button>
</form>
</div>
<div style="height:3rem; background-color:#fff;"></div>
<script src="js/jquery-3.3.1.min.js"></script>
<script src="js/weui.js"></script>
<script>
$(function () {
// 点击确认
$("#modbut").on("click", (function () {
var phone = $("#phone").val();
var code = $("#code").val();
var pass = $("#pass").val();
var passTwo = $("#passTwo").val();
if (phone != "") {
if (code != "") {
if (pass != "") {
if (passTwo != "") {
if (pass == passTwo) {
alert("可以提交")
} else {
let loading = weui.loading("新密码不统一")
setTimeout(function () {
loading.hide();
}, 1500);
}
} else {
let loading = weui.loading("请确认密码")
setTimeout(function () {
loading.hide();
}, 1500);
}
} else {
let loading = weui.loading("请填写新密码")
setTimeout(function () {
loading.hide();
}, 1500);
}
} else {
let loading = weui.loading("请填写验证码")
setTimeout(function () {
loading.hide();
}, 1500);
}
} else {
let loading = weui.loading("请填写手机号码")
setTimeout(function () {
loading.hide();
}, 1500);
}
}))
// 短信验证码倒计时
//获取短信验证码
var validCode = true;
$(".T-getCode").click(function () {
var time = 60;
var $code = $(this);
if (validCode) {
var phone = $("#phone").val();
if (phone != "") {
if (phones() == true) {
sendAjax('post', 'home/index/sendCode', {
tel: phone,
}, function (res) {
console.log(res)
if(res.code == 1){
weui.toast(res.msg, 1000);
validCode = false;
var t = setInterval(function () {
time--;
$code.html(time + "秒");
if (time == 0) {
clearInterval(t);
$code.html("重新获取");
validCode = true;
}
}, 1000)
}
});
} else {
let loading = weui.loading("手机格式错误")
setTimeout(function () {
loading.hide();
}, 1500);
}
} else {
let loading = weui.loading("请填写手机号码")
setTimeout(function () {
loading.hide();
}, 1500);
}
}
})
// 验证手机
function phones() {
var value = document.getElementById("phone").value;
var reg = /^1(3|4|5|7|8)\d{9}$/;
if (reg.test(value) == true) {
return true;
} else {
return false;
}
}
})
</script>
</body>