forgot_f.html
5.9 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport"
content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
<meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
<title></title>
<script src="../../assets/js/fontsize.js"></script>
<link rel="stylesheet" href="../../assets/css/api.css"/>
<link rel="stylesheet" href="../../assets/css/login_index.css">
<link rel="stylesheet" href="../../assets/icon/iconfont.css">
<style>
.forgot_box {
margin: 0.75rem 0.3rem;
}
.forgot_input span {
font-size: 13px;
color: #424242;
padding: 0;
}
.code_input input {
text-align: right;
}
.code_input span {
font-size: 13px;
color: #424242;
padding: 0;
}
.code_input .iconfont {
color: #ccc;
font-size: 20px;
}
.code_text {
display: flex;
align-items: center;
}
.code_inputs input {
width: 1.8rem;
}
.code_inputs .span {
font-size: 13px;
color: #424242;
padding: 0;
}
.code_inputs input {
padding-left: 0.2rem;
}
</style>
</head>
<body>
<div id="app">
<div class="forgot_box">
<div class="login_input code_input"><span>手机号</span><input type="number" placeholder="请输入手机号" v-model="phone">
</div>
<div class="login_input code_inputs"><span class="span">验证码</span><input type="text" placeholder="请输入验证码"
v-model="code">
<span v-if="show" @click="getCode" class="count">获取验证码</span>
<span v-else class="count">{{count}}秒重新发送</span>
</div>
<div class="login_input code_input">
<span>新密码</span>
<div class="code_text"><input type="password" placeholder="请输入新密码" v-model="password"><span
class="iconfont icon-jianpan"></span></div>
</div>
<div class="login_input code_input">
<span>确认密码</span>
<div class="code_text"><input type="password" placeholder="请再输入新密码" v-model="rePassword"><span
class="iconfont icon-jianpan"></span></div>
</div>
<div class="login_btn" @click="keepPass">确认</div>
</div>
</div>
</body>
</html>
<script type="text/javascript" src="../../assets/js/api.js"></script>
<script type="text/javascript" src="../../assets/js/public.js"></script>
<script type="text/javascript" src="../../assets/js/fastclick.js"></script>
<script>
new FastClick(document.body);
</script>
<script type="text/javascript" src="../../assets/js/vue.min.js"></script>
<script type="text/javascript" src="../../assets/js/axios.min.js"></script>
<script type="text/javascript" src="../../assets/icon/iconfont.js"></script>
<script>
var app = new Vue({
el: '#app',
data: {
show: true,
count: '',
timer: null,
phone: '',
code: '',
password: '',
rePassword: ''
},
created: function () {
apiready = function () {
}
},
methods: {
getCode: function () {
if (!mobileReg.test(app.phone)) {
toastMsg('手机号不正确')
}
else {
const TIME_COUNT = 60;
var post = {
tel: app.phone,
};
var header = {
'XX-Device-Type': getDevice()
};
getRequest('post', '/home/index/sendCode', post, header).then(function (res) {
toastMsg(res.data.msg);
if (!app.timer) {
app.count = TIME_COUNT;
app.show = false;
app.timer = setInterval(function () {
if (app.count > 0 && app.count <= TIME_COUNT) {
app.count--;
} else {
app.show = true;
clearInterval(app.timer);
app.timer = null;
}
}, 1000)
}
})
}
},
keepPass: function () {
if (!mobileReg.test(app.phone)) {
toastMsg('手机号码不正确')
} else if (app.code == '') {
toastMsg('请输入验证码')
} else if (app.password == '') {
toastMsg('密码不能为空')
} else if (app.password != app.rePassword) {
toastMsg('密码不一致')
} else {
var post = {
tel: app.phone,
password: app.password,
code: app.code
};
var header = {
'XX-Device-Type': getDevice()
};
getRequest('post', 'home/index/changePassword', post, header).then(function (res) {
if (res.data.code == 1) {
toastMsg(res.data.msg);
api.closeWin();
} else {
api.closeWin()
}
})
}
}
}
})
</script>