Showing
1 changed file
with
157 additions
and
147 deletions
... | ... | @@ -7,7 +7,9 @@ |
7 | 7 | </view> |
8 | 8 | <view v-if="!nextStatus" style="margin-top: 40rpx;" class="f__login"> |
9 | 9 | <view class="loginPhone"> |
10 | - <view class="form-row"><u-input v-model="phone" type="number" placeholder="请输入手机号码" border="bottom" /></view> | |
10 | + <view class="form-row"> | |
11 | + <u-input v-model="phone" type="number" placeholder="请输入手机号码" border="bottom" /> | |
12 | + </view> | |
11 | 13 | <view class="form-row"> |
12 | 14 | <u-input type="number" v-model="vCode" placeholder="请输入验证码" border="bottom"> |
13 | 15 | <template slot="suffix"> |
... | ... | @@ -22,15 +24,23 @@ |
22 | 24 | <view class="loginPhone"> |
23 | 25 | <view class="form-row u-flex"> |
24 | 26 | <u-input v-model="password" :password="showPasswordF" placeholder="请设置6-20位新的登录密码" border="bottom"> |
25 | - <template slot="suffix" @click="showPasswordModeF"> | |
26 | - <view style="padding:20rpx"><u-icon :name="showPasswordF ? '/static/eye-hide.png' : '/static/eye.png'"></u-icon></view> | |
27 | + <template slot="suffix"> | |
28 | + <view @click="showPasswordMode" style="padding: 10rpx"> | |
29 | + <u-icon width="18" height="14" :name=" | |
30 | + showPasswordF ? '/static/eye-hide.png' : '/static/eye.png' | |
31 | + "></u-icon> | |
32 | + </view> | |
27 | 33 | </template> |
28 | 34 | </u-input> |
29 | 35 | </view> |
30 | 36 | <view class="form-row u-flex"> |
31 | 37 | <u-input v-model="rePassword" :password="showPasswordS" placeholder="请再次输入新的登录密码" border="bottom"> |
32 | - <template slot="suffix" @click="showPasswordModeS"> | |
33 | - <view style="padding:20rpx"><u-icon :name="showPasswordS ? '/static/eye-hide.png' : '/static/eye.png'"></u-icon></view> | |
38 | + <template slot="suffix"> | |
39 | + <view @click="showPasswordModeS" style="padding: 10rpx"> | |
40 | + <u-icon width="18" height="14" :name=" | |
41 | + showPasswordS ? '/static/eye-hide.png' : '/static/eye.png' | |
42 | + "></u-icon> | |
43 | + </view> | |
34 | 44 | </template> |
35 | 45 | </u-input> |
36 | 46 | </view> |
... | ... | @@ -41,161 +51,161 @@ |
41 | 51 | </template> |
42 | 52 | |
43 | 53 | <script> |
44 | -var clear; | |
45 | -export default { | |
46 | - data() { | |
47 | - return { | |
48 | - readonly: false, | |
49 | - codeText: '发送验证码', | |
50 | - phone: '', //号码 | |
51 | - vCode: '', //验证码 | |
52 | - nextStatus: false, | |
53 | - password: '', | |
54 | - rePassword: '', | |
55 | - showPasswordF: true, | |
56 | - showPasswordS: true | |
57 | - }; | |
58 | - }, | |
59 | - methods: { | |
60 | - //验证码按钮文字状态 | |
61 | - getCodeState() { | |
62 | - const _this = this; | |
63 | - this.readonly = true; | |
64 | - this.codeText = '60s后重新获取'; | |
65 | - var s = 60; | |
66 | - clear = setInterval(() => { | |
67 | - s--; | |
68 | - _this.codeText = s + 's后重新获取'; | |
69 | - if (s <= 0) { | |
70 | - clearInterval(clear); | |
71 | - _this.codeText = '发送验证码'; | |
72 | - _this.readonly = false; | |
73 | - } | |
74 | - }, 1000); | |
54 | + var clear; | |
55 | + export default { | |
56 | + data() { | |
57 | + return { | |
58 | + readonly: false, | |
59 | + codeText: '发送验证码', | |
60 | + phone: '', //号码 | |
61 | + vCode: '', //验证码 | |
62 | + nextStatus: false, | |
63 | + password: '', | |
64 | + rePassword: '', | |
65 | + showPasswordF: true, | |
66 | + showPasswordS: true | |
67 | + }; | |
75 | 68 | }, |
76 | - //获取验证码 | |
77 | - getVcode() { | |
78 | - if (this.readonly) { | |
79 | - uni.showToast({ | |
80 | - title: '验证码已发送~', | |
81 | - icon: 'none' | |
82 | - }); | |
83 | - return; | |
84 | - } | |
85 | - if (this.phone == '') { | |
86 | - uni.showToast({ | |
87 | - title: '请输入手机号~', | |
88 | - icon: 'none' | |
89 | - }); | |
90 | - return; | |
91 | - } | |
92 | - const phoneRegular = /^1\d{10}$/; | |
93 | - if (!phoneRegular.test(this.phone)) { | |
94 | - uni.showToast({ | |
95 | - title: '手机号格式不正确~', | |
96 | - icon: 'none' | |
97 | - }); | |
98 | - return; | |
99 | - } | |
100 | - let httpData = {}; | |
101 | - // 获取验证码接口 | |
102 | - uni.$u.http | |
103 | - .post(`/yt/noauth/reset_code/${this.phone}`) | |
104 | - .then(res => { | |
105 | - this.getCodeState(); //开始倒计时 | |
106 | - }) | |
107 | - .catch(err => { | |
69 | + methods: { | |
70 | + //验证码按钮文字状态 | |
71 | + getCodeState() { | |
72 | + const _this = this; | |
73 | + this.readonly = true; | |
74 | + this.codeText = '60s后重新获取'; | |
75 | + var s = 60; | |
76 | + clear = setInterval(() => { | |
77 | + s--; | |
78 | + _this.codeText = s + 's后重新获取'; | |
79 | + if (s <= 0) { | |
80 | + clearInterval(clear); | |
81 | + _this.codeText = '发送验证码'; | |
82 | + _this.readonly = false; | |
83 | + } | |
84 | + }, 1000); | |
85 | + }, | |
86 | + //获取验证码 | |
87 | + getVcode() { | |
88 | + if (this.readonly) { | |
108 | 89 | uni.showToast({ |
109 | - title: err.data.msg, | |
90 | + title: '验证码已发送~', | |
110 | 91 | icon: 'none' |
111 | 92 | }); |
112 | - }); | |
113 | - }, | |
114 | - onNextSubmit() { | |
115 | - const phoneRegular = /^1\d{10}$/; | |
116 | - if (this.phone == '') { | |
117 | - uni.showToast({ | |
118 | - title: '请输入手机号码~', | |
119 | - icon: 'none' | |
120 | - }); | |
121 | - return; | |
122 | - } else if (!phoneRegular.test(this.phone)) { | |
123 | - uni.showToast({ | |
124 | - title: '手机号格式不正确~', | |
125 | - icon: 'none' | |
126 | - }); | |
127 | - return; | |
128 | - } | |
129 | - if (this.vCode == '') { | |
130 | - uni.showToast({ | |
131 | - title: '请输入验证码~', | |
132 | - icon: 'none' | |
133 | - }); | |
134 | - return; | |
135 | - } else if (!/^\d{6}$/.test(this.vCode)) { | |
136 | - uni.showToast({ | |
137 | - title: '验证码格式不正确~', | |
138 | - icon: 'none' | |
139 | - }); | |
140 | - return; | |
141 | - } | |
142 | - this.nextStatus = true; | |
143 | - }, | |
144 | - showPhone() { | |
145 | - this.nextStatus = false; | |
146 | - }, | |
147 | - onSubmit() { | |
148 | - const passReg = /^(?=.*?[A-Z])(?=(.*[a-z]){1,})(?=(.*[\d]){1,})(?=(.*[\W]){1,})(?!.*\s).{8,}$/; | |
149 | - if (this.password == '' && this.rePassword == '') { | |
150 | - uni.showToast({ | |
151 | - title: '请输入密码~', | |
152 | - icon: 'none' | |
153 | - }); | |
154 | - return; | |
155 | - } else if (!passReg.test(this.password) && !passReg.test(this.rePassword)) { | |
156 | - //uni.showToast,字数过长,会造成手机上显示不完全,官方bug,采用uni.showModal | |
157 | - uni.showModal({ | |
158 | - title: '提示', | |
159 | - content: '密码格式不正确(至少一个大写英文字母、至少一个小写英文字母、至少一位数字、至少一个特殊字符、最少八个字符)~', | |
160 | - showCancel: false | |
161 | - }); | |
162 | - return; | |
163 | - } | |
164 | - if (this.password !== this.rePassword) return uni.$u.toast('两次输入密码不一致'); | |
165 | - let httpData = { | |
166 | - password: this.password, | |
167 | - phoneNumber: this.phone, | |
168 | - userId: this.vCode | |
169 | - }; | |
170 | - uni.$u.http | |
171 | - .post(`/yt/noauth/reset/${this.phone}`, httpData) | |
172 | - .then(res => { | |
93 | + return; | |
94 | + } | |
95 | + if (this.phone == '') { | |
173 | 96 | uni.showToast({ |
174 | - title: '重置密码成功~', | |
97 | + title: '请输入手机号~', | |
175 | 98 | icon: 'none' |
176 | - }).then(res => { | |
177 | - uni.reLaunch({ | |
178 | - url: '/publicLoginSubPage/public/login' | |
99 | + }); | |
100 | + return; | |
101 | + } | |
102 | + const phoneRegular = /^1\d{10}$/; | |
103 | + if (!phoneRegular.test(this.phone)) { | |
104 | + uni.showToast({ | |
105 | + title: '手机号格式不正确~', | |
106 | + icon: 'none' | |
107 | + }); | |
108 | + return; | |
109 | + } | |
110 | + let httpData = {}; | |
111 | + // 获取验证码接口 | |
112 | + uni.$u.http | |
113 | + .post(`/yt/noauth/reset_code/${this.phone}`) | |
114 | + .then(res => { | |
115 | + this.getCodeState(); //开始倒计时 | |
116 | + }) | |
117 | + .catch(err => { | |
118 | + uni.showToast({ | |
119 | + title: err.data.msg, | |
120 | + icon: 'none' | |
179 | 121 | }); |
180 | 122 | }); |
181 | - }) | |
182 | - .catch(err => { | |
123 | + }, | |
124 | + onNextSubmit() { | |
125 | + const phoneRegular = /^1\d{10}$/; | |
126 | + if (this.phone == '') { | |
183 | 127 | uni.showToast({ |
184 | - title: err.data.msg, | |
128 | + title: '请输入手机号码~', | |
185 | 129 | icon: 'none' |
186 | 130 | }); |
187 | - }); | |
188 | - }, | |
189 | - showPasswordModeF() { | |
190 | - this.showPasswordF = !this.showPasswordF; | |
191 | - }, | |
192 | - showPasswordModeS() { | |
193 | - this.showPasswordS = !this.showPasswordS; | |
131 | + return; | |
132 | + } else if (!phoneRegular.test(this.phone)) { | |
133 | + uni.showToast({ | |
134 | + title: '手机号格式不正确~', | |
135 | + icon: 'none' | |
136 | + }); | |
137 | + return; | |
138 | + } | |
139 | + if (this.vCode == '') { | |
140 | + uni.showToast({ | |
141 | + title: '请输入验证码~', | |
142 | + icon: 'none' | |
143 | + }); | |
144 | + return; | |
145 | + } else if (!/^\d{6}$/.test(this.vCode)) { | |
146 | + uni.showToast({ | |
147 | + title: '验证码格式不正确~', | |
148 | + icon: 'none' | |
149 | + }); | |
150 | + return; | |
151 | + } | |
152 | + this.nextStatus = true; | |
153 | + }, | |
154 | + showPhone() { | |
155 | + this.nextStatus = false; | |
156 | + }, | |
157 | + onSubmit() { | |
158 | + const passReg = /^(?=.*?[A-Z])(?=(.*[a-z]){1,})(?=(.*[\d]){1,})(?=(.*[\W]){1,})(?!.*\s).{8,}$/; | |
159 | + if (this.password == '' && this.rePassword == '') { | |
160 | + uni.showToast({ | |
161 | + title: '请输入密码~', | |
162 | + icon: 'none' | |
163 | + }); | |
164 | + return; | |
165 | + } else if (!passReg.test(this.password) && !passReg.test(this.rePassword)) { | |
166 | + //uni.showToast,字数过长,会造成手机上显示不完全,官方bug,采用uni.showModal | |
167 | + uni.showModal({ | |
168 | + title: '提示', | |
169 | + content: '密码格式不正确(至少一个大写英文字母、至少一个小写英文字母、至少一位数字、至少一个特殊字符、最少八个字符)~', | |
170 | + showCancel: false | |
171 | + }); | |
172 | + return; | |
173 | + } | |
174 | + if (this.password !== this.rePassword) return uni.$u.toast('两次输入密码不一致'); | |
175 | + let httpData = { | |
176 | + password: this.password, | |
177 | + phoneNumber: this.phone, | |
178 | + userId: this.vCode | |
179 | + }; | |
180 | + uni.$u.http | |
181 | + .post(`/yt/noauth/reset/${this.phone}`, httpData) | |
182 | + .then(res => { | |
183 | + uni.showToast({ | |
184 | + title: '重置密码成功~', | |
185 | + icon: 'none' | |
186 | + }).then(res => { | |
187 | + uni.reLaunch({ | |
188 | + url: '/publicLoginSubPage/public/login' | |
189 | + }); | |
190 | + }); | |
191 | + }) | |
192 | + .catch(err => { | |
193 | + uni.showToast({ | |
194 | + title: err.data.msg, | |
195 | + icon: 'none' | |
196 | + }); | |
197 | + }); | |
198 | + }, | |
199 | + showPasswordMode() { | |
200 | + this.showPasswordF = !this.showPasswordF; | |
201 | + }, | |
202 | + showPasswordModeS() { | |
203 | + this.showPasswordS = !this.showPasswordS; | |
204 | + } | |
194 | 205 | } |
195 | - } | |
196 | -}; | |
206 | + }; | |
197 | 207 | </script> |
198 | 208 | |
199 | 209 | <style lang="scss" scoped> |
200 | -@import './static/findPassword.scss'; | |
210 | + @import './static/findPassword.scss'; | |
201 | 211 | </style> | ... | ... |