Showing
6 changed files
with
373 additions
and
383 deletions
1 | -<template> | ||
2 | - <view class="code-page"> | ||
3 | - <!-- 公共组件-每个页面必须引入 --> | ||
4 | - <public-module></public-module> | ||
5 | - <view class="f__login"> | ||
6 | - <view class="loginPhone"> | ||
7 | - <view class="phone-main" style="margin-top: 173rpx;"> | ||
8 | - <text class="text">手机验证码登录</text> | ||
9 | - <view class="circleStyle"></view> | ||
10 | - </view> | ||
11 | - <view class="form-row"> | ||
12 | - <input class="input" type="number" v-model="phone" placeholder="请输入手机号码" | ||
13 | - placeholder-style="font-weight:normal;color:#bbbbbb;"></input> | ||
14 | - </view> | ||
15 | - <view class="form-row"> | ||
16 | - <input class="input" type="number" v-model="vCode" placeholder="请输入验证码" | ||
17 | - placeholder-style="font-weight:normal;color:#bbbbbb;"></input> | ||
18 | - <view class="getvcode" :class="{forhidden:readonly}" @click="getVcode">{{ codeText }}</view> | ||
19 | - </view> | ||
20 | - <button class="submit" size="default" @click="onSubmit"> | ||
21 | - <text class="text">登录</text> | ||
22 | - </button> | ||
23 | - <view class="u-flex account-style"> | ||
24 | - <view class="content" @click="openAccountFunc">账号密码登录</view> | ||
25 | - </view> | ||
26 | - <view class="circleStyleBottom"></view> | ||
27 | - </view> | ||
28 | - </view> | ||
29 | - </view> | ||
30 | -</template> | ||
31 | - | ||
32 | -<script> | ||
33 | - var clear; | ||
34 | - import { mapState, mapMutations } from 'vuex'; | ||
35 | - export default { | ||
36 | - data() { | ||
37 | - return { | ||
38 | - readonly: false, | ||
39 | - codeText: '发送验证码', | ||
40 | - phone: '', //号码 | ||
41 | - vCode: '', //验证码 | ||
42 | - } | ||
43 | - }, | ||
44 | - methods: { | ||
45 | - ...mapMutations(['setUserInfo']), | ||
46 | - //验证码按钮文字状态 | ||
47 | - getCodeState() { | ||
48 | - const _this = this; | ||
49 | - this.readonly = true; | ||
50 | - this.codeText = '60S后重新获取'; | ||
51 | - var s = 60; | ||
52 | - clear = setInterval(() => { | ||
53 | - s--; | ||
54 | - _this.codeText = s + 'S后重新获取'; | ||
55 | - if (s <= 0) { | ||
56 | - clearInterval(clear); | ||
57 | - _this.codeText = '发送验证码'; | ||
58 | - _this.readonly = false; | ||
59 | - } | ||
60 | - }, 1000); | ||
61 | - }, | ||
62 | - //获取验证码 | ||
63 | - getVcode() { | ||
64 | - if (this.readonly) { | ||
65 | - uni.showToast({ | ||
66 | - title: '验证码已发送~', | ||
67 | - icon: 'none' | ||
68 | - }); | ||
69 | - return; | ||
70 | - } | ||
71 | - if (this.phone == '') { | ||
72 | - uni.showToast({ | ||
73 | - title: '请输入手机号~', | ||
74 | - icon: 'none' | ||
75 | - }); | ||
76 | - return; | ||
77 | - } | ||
78 | - const phoneRegular = /^1\d{10}$/; | ||
79 | - if (!phoneRegular.test(this.phone)) { | ||
80 | - uni.showToast({ | ||
81 | - title: '手机号格式不正确~', | ||
82 | - icon: 'none' | ||
83 | - }); | ||
84 | - return; | ||
85 | - } | ||
86 | - // 获取验证码接口 | ||
87 | - uni.$u.http.post(`/yt/noauth/sendLoginSmsCode/${this.phone}` ).then(res => { | ||
88 | - if(res){ | ||
89 | - this.getCodeState(); //开始倒计时 | ||
90 | - } | ||
91 | - }) | ||
92 | - }, | ||
93 | - onSubmit() { | ||
94 | - const phoneRegular = /^1\d{10}$/; | ||
95 | - if(this.phone==''){ | ||
96 | - uni.showToast({ | ||
97 | - title: '请输入手机号码~', | ||
98 | - icon: 'none' | ||
99 | - }); | ||
100 | - return; | ||
101 | - }else if (!phoneRegular.test(this.phone)) { | ||
102 | - uni.showToast({ | ||
103 | - title: '手机号格式不正确~', | ||
104 | - icon: 'none' | ||
105 | - }); | ||
106 | - return; | ||
107 | - } | ||
108 | - if (this.vCode == '') { | ||
109 | - uni.showToast({ | ||
110 | - title: '请输入验证码~', | ||
111 | - icon: 'none' | ||
112 | - }); | ||
113 | - return; | ||
114 | - } else if(!(/^\d{6}$/.test(this.vCode))){ | ||
115 | - uni.showToast({ | ||
116 | - title: '验证码格式不正确~', | ||
117 | - icon: 'none' | ||
118 | - }); | ||
119 | - return | ||
120 | - } | ||
121 | - let httpData = { | ||
122 | - code: this.vCode, | ||
123 | - phoneNumber: this.phone | ||
124 | - } | ||
125 | - uni.$u.http.post('/yt/auth/code/login', httpData).then(res => { | ||
126 | - if (res) { | ||
127 | - // 储存登录信息 | ||
128 | - let resObj = { | ||
129 | - refreshToken: res.refreshToken, | ||
130 | - isToken: res.token | ||
131 | - }; | ||
132 | - let userInfo = { | ||
133 | - ...resObj, | ||
134 | - token: true ,//token用于判断是否登录 | ||
135 | - isThirdLogin: false | ||
136 | - }; | ||
137 | - if (userInfo.token) { | ||
138 | - this.setUserInfo(userInfo); | ||
139 | - } | ||
140 | - uni.showToast({ | ||
141 | - title: '登录成功~', | ||
142 | - icon: 'none' | ||
143 | - }).then(res => { | ||
144 | - uni.reLaunch({ | ||
145 | - url: '/pages/personal/personal' | ||
146 | - }); | ||
147 | - }); | ||
148 | - this.saveUserInfo(); | ||
149 | - | ||
150 | - } | ||
151 | - }); | ||
152 | - }, | ||
153 | - saveUserInfo() { | ||
154 | - //储存个人信息 | ||
155 | - uni.$u.http.get('/yt/user/me/info').then(res => { | ||
156 | - if (res) { | ||
157 | - this.setUserInfo(res); | ||
158 | - } | ||
159 | - }); | ||
160 | - }, | ||
161 | - openAccountFunc(){ | ||
162 | - uni.navigateTo({ | ||
163 | - url:"../public/login" | ||
164 | - }) | ||
165 | - } | ||
166 | - } | ||
167 | - } | ||
168 | -</script> | ||
169 | - | ||
170 | -<style lang="scss" scoped> | ||
171 | - @import './static/code.scss'; | 1 | +<template> |
2 | + <view class="code-page"> | ||
3 | + <!-- 公共组件-每个页面必须引入 --> | ||
4 | + <public-module></public-module> | ||
5 | + <view class="f__login"> | ||
6 | + <view class="loginPhone"> | ||
7 | + <view class="phone-main" style="margin-top: 173rpx;"> | ||
8 | + <text class="text">手机验证码登录</text> | ||
9 | + <view class="circleStyle"></view> | ||
10 | + </view> | ||
11 | + <view class="form-row"> | ||
12 | + <u-input v-model="phone" type="number" placeholder="请输入手机号码" border="bottom"></u-input> | ||
13 | + </view> | ||
14 | + <view class="form-row"> | ||
15 | + <u-input type="number" v-model="vCode" placeholder="请输入验证码" border="bottom"> | ||
16 | + <template slot="suffix" @click="getVcode"> | ||
17 | + <view class="getvcode" >{{ codeText }}</view> | ||
18 | + </template> | ||
19 | + </u-input> | ||
20 | + </view> | ||
21 | + <button class="submit" size="default" @click="onSubmit"><text class="text">登录</text></button> | ||
22 | + <view class="u-flex account-style"><view class="content" @click="openAccountFunc">账号密码登录</view></view> | ||
23 | + <view class="circleStyleBottom"></view> | ||
24 | + </view> | ||
25 | + </view> | ||
26 | + </view> | ||
27 | +</template> | ||
28 | + | ||
29 | +<script> | ||
30 | +var clear; | ||
31 | +import { mapState, mapMutations } from 'vuex'; | ||
32 | +export default { | ||
33 | + data() { | ||
34 | + return { | ||
35 | + readonly: false, | ||
36 | + codeText: '发送验证码', | ||
37 | + phone: '', //号码 | ||
38 | + vCode: '' //验证码 | ||
39 | + }; | ||
40 | + }, | ||
41 | + methods: { | ||
42 | + ...mapMutations(['setUserInfo']), | ||
43 | + //验证码按钮文字状态 | ||
44 | + getCodeState() { | ||
45 | + const _this = this; | ||
46 | + this.readonly = true; | ||
47 | + this.codeText = '60s后重新获取'; | ||
48 | + var s = 60; | ||
49 | + clear = setInterval(() => { | ||
50 | + s--; | ||
51 | + _this.codeText = s + 's后重新获取'; | ||
52 | + if (s <= 0) { | ||
53 | + clearInterval(clear); | ||
54 | + _this.codeText = '发送验证码'; | ||
55 | + _this.readonly = false; | ||
56 | + } | ||
57 | + }, 1000); | ||
58 | + }, | ||
59 | + //获取验证码 | ||
60 | + getVcode() { | ||
61 | + if (this.readonly) { | ||
62 | + uni.showToast({ | ||
63 | + title: '验证码已发送~', | ||
64 | + icon: 'none' | ||
65 | + }); | ||
66 | + return; | ||
67 | + } | ||
68 | + if (this.phone == '') { | ||
69 | + uni.showToast({ | ||
70 | + title: '请输入手机号~', | ||
71 | + icon: 'none' | ||
72 | + }); | ||
73 | + return; | ||
74 | + } | ||
75 | + const phoneRegular = /^1\d{10}$/; | ||
76 | + if (!phoneRegular.test(this.phone)) { | ||
77 | + uni.showToast({ | ||
78 | + title: '手机号格式不正确~', | ||
79 | + icon: 'none' | ||
80 | + }); | ||
81 | + return; | ||
82 | + } | ||
83 | + // 获取验证码接口 | ||
84 | + uni.$u.http.post(`/yt/noauth/sendLoginSmsCode/${this.phone}`).then(res => { | ||
85 | + if (res) { | ||
86 | + this.getCodeState(); //开始倒计时 | ||
87 | + } | ||
88 | + }); | ||
89 | + }, | ||
90 | + onSubmit() { | ||
91 | + const phoneRegular = /^1\d{10}$/; | ||
92 | + if (this.phone == '') { | ||
93 | + uni.showToast({ | ||
94 | + title: '请输入手机号码~', | ||
95 | + icon: 'none' | ||
96 | + }); | ||
97 | + return; | ||
98 | + } else if (!phoneRegular.test(this.phone)) { | ||
99 | + uni.showToast({ | ||
100 | + title: '手机号格式不正确~', | ||
101 | + icon: 'none' | ||
102 | + }); | ||
103 | + return; | ||
104 | + } | ||
105 | + if (this.vCode == '') { | ||
106 | + uni.showToast({ | ||
107 | + title: '请输入验证码~', | ||
108 | + icon: 'none' | ||
109 | + }); | ||
110 | + return; | ||
111 | + } else if (!/^\d{6}$/.test(this.vCode)) { | ||
112 | + uni.showToast({ | ||
113 | + title: '验证码格式不正确~', | ||
114 | + icon: 'none' | ||
115 | + }); | ||
116 | + return; | ||
117 | + } | ||
118 | + let httpData = { | ||
119 | + code: this.vCode, | ||
120 | + phoneNumber: this.phone | ||
121 | + }; | ||
122 | + uni.$u.http.post('/yt/auth/code/login', httpData).then(res => { | ||
123 | + if (res) { | ||
124 | + // 储存登录信息 | ||
125 | + let resObj = { | ||
126 | + refreshToken: res.refreshToken, | ||
127 | + isToken: res.token | ||
128 | + }; | ||
129 | + let userInfo = { | ||
130 | + ...resObj, | ||
131 | + token: true, //token用于判断是否登录 | ||
132 | + isThirdLogin: false | ||
133 | + }; | ||
134 | + if (userInfo.token) { | ||
135 | + this.setUserInfo(userInfo); | ||
136 | + } | ||
137 | + uni | ||
138 | + .showToast({ | ||
139 | + title: '登录成功~', | ||
140 | + icon: 'none' | ||
141 | + }) | ||
142 | + .then(res => { | ||
143 | + uni.reLaunch({ | ||
144 | + url: '/pages/personal/personal' | ||
145 | + }); | ||
146 | + }); | ||
147 | + this.saveUserInfo(); | ||
148 | + } | ||
149 | + }); | ||
150 | + }, | ||
151 | + saveUserInfo() { | ||
152 | + //储存个人信息 | ||
153 | + uni.$u.http.get('/yt/user/me/info').then(res => { | ||
154 | + if (res) { | ||
155 | + this.setUserInfo(res); | ||
156 | + } | ||
157 | + }); | ||
158 | + }, | ||
159 | + openAccountFunc() { | ||
160 | + uni.navigateTo({ | ||
161 | + url: '../public/login' | ||
162 | + }); | ||
163 | + } | ||
164 | + } | ||
165 | +}; | ||
166 | +</script> | ||
167 | + | ||
168 | +<style lang="scss" scoped> | ||
169 | +@import './static/code.scss'; | ||
172 | </style> | 170 | </style> |
1 | -<template> | ||
2 | - <view class="find-password-page"> | ||
3 | - <public-module></public-module> | ||
4 | - <view class="top u-flex" > | ||
5 | - <view @click="showPhone" :style="{color:!nextStatus?'#0079fe':''}" class="item">1.验证手机号码</view> | ||
6 | - <view :style="{color:!nextStatus?'':'#0079fe'}" class="item">2.设置新密码</view> | ||
7 | - </view> | ||
8 | - <view v-if="!nextStatus" style="margin-top: 40rpx;" class="f__login"> | ||
9 | - <view class="loginPhone"> | ||
10 | - <view class="form-row"> | ||
11 | - <input class="input" type="number" v-model="phone" placeholder="请输入手机号码" | ||
12 | - placeholder-style="font-weight:normal"></input> | ||
13 | - </view> | ||
14 | - <view style="height: 25rpx;"></view> | ||
15 | - <view class="form-row"> | ||
16 | - <input class="input" type="number" v-model="vCode" placeholder="请输入短信验证码" | ||
17 | - placeholder-style="font-weight:normal"></input> | ||
18 | - <view class="getvcode" :class="{forhidden:readonly}" @click="getVcode">{{ codeText }}</view> | ||
19 | - </view> | ||
20 | - <button class="submit" size="default" @click="onNextSubmit"> | ||
21 | - <text style="color:#fff">下一步</text> | ||
22 | - </button> | ||
23 | - </view> | ||
24 | - </view> | ||
25 | - <view v-else style="margin-top: 40rpx;" class="f__login"> | ||
26 | - <view class="loginPhone"> | ||
27 | - <view style="margin-top:50rpx" class="form-row u-flex"> | ||
28 | - <view class="v-input"><input type="text" v-model="password" maxlength="32" placeholder="请设置6-20位新的登录密码" :password="!showPasswordF" /></view> | ||
29 | - <view class="v-password"><u-icon size="25" @click="showPasswordModeF" :name="showPasswordF ? 'eye-fill' : 'eye-off'"></u-icon></view> | ||
30 | - <u-icon></u-icon> | ||
31 | - </view> | ||
32 | - <view style="margin-top:70rpx" class="form-row u-flex"> | ||
33 | - <view class="v-input"><input type="text" v-model="rePassword" maxlength="32" placeholder="请再次输入新的登录密码" :password="!showPasswordS" /></view> | ||
34 | - <view class="v-password"><u-icon size="25" @click="showPasswordModeS" :name="showPasswordS ? 'eye-fill' : 'eye-off'"></u-icon></view> | ||
35 | - <u-icon></u-icon> | ||
36 | - </view> | ||
37 | - <button class="submit" size="default" @click="onSubmit"> | ||
38 | - <text style="color:#fff">确定</text> | ||
39 | - </button> | ||
40 | - </view> | ||
41 | - </view> | ||
42 | - </view> | ||
43 | -</template> | ||
44 | - | ||
45 | -<script> | ||
46 | - var clear; | ||
47 | - export default { | ||
48 | - data() { | ||
49 | - return { | ||
50 | - readonly: false, | ||
51 | - codeText: '发送验证码', | ||
52 | - phone: '', //号码 | ||
53 | - vCode: '', //验证码 | ||
54 | - nextStatus: false, | ||
55 | - password:'', | ||
56 | - rePassword:'', | ||
57 | - showPasswordF: false, | ||
58 | - showPasswordS: false, | ||
59 | - } | ||
60 | - }, | ||
61 | - methods: { | ||
62 | - //验证码按钮文字状态 | ||
63 | - getCodeState() { | ||
64 | - const _this = this; | ||
65 | - this.readonly = true; | ||
66 | - this.codeText = '60S后重新获取'; | ||
67 | - var s = 60; | ||
68 | - clear = setInterval(() => { | ||
69 | - s--; | ||
70 | - _this.codeText = s + 'S后重新获取'; | ||
71 | - if (s <= 0) { | ||
72 | - clearInterval(clear); | ||
73 | - _this.codeText = '发送验证码'; | ||
74 | - _this.readonly = false; | ||
75 | - } | ||
76 | - }, 1000); | ||
77 | - }, | ||
78 | - //获取验证码 | ||
79 | - getVcode() { | ||
80 | - if (this.readonly) { | ||
81 | - uni.showToast({ | ||
82 | - title: '验证码已发送~', | ||
83 | - icon: 'none' | ||
84 | - }); | ||
85 | - return; | ||
86 | - } | ||
87 | - if (this.phone == '') { | ||
88 | - uni.showToast({ | ||
89 | - title: '请输入手机号~', | ||
90 | - icon: 'none' | ||
91 | - }); | ||
92 | - return; | ||
93 | - } | ||
94 | - const phoneRegular = /^1\d{10}$/; | ||
95 | - if (!phoneRegular.test(this.phone)) { | ||
96 | - uni.showToast({ | ||
97 | - title: '手机号格式不正确~', | ||
98 | - icon: 'none' | ||
99 | - }); | ||
100 | - return; | ||
101 | - } | ||
102 | - let httpData = {} | ||
103 | - // 获取验证码接口 | ||
104 | - uni.$u.http.post(`/yt/noauth/resetCode/${this.phone}` ).then(res => { | ||
105 | - this.getCodeState(); //开始倒计时 | ||
106 | - }) | ||
107 | - }, | ||
108 | - onNextSubmit() { | ||
109 | - const phoneRegular = /^1\d{10}$/; | ||
110 | - if(this.phone==''){ | ||
111 | - uni.showToast({ | ||
112 | - title: '请输入手机号码~', | ||
113 | - icon: 'none' | ||
114 | - }); | ||
115 | - return; | ||
116 | - }else if (!phoneRegular.test(this.phone)) { | ||
117 | - uni.showToast({ | ||
118 | - title: '手机号格式不正确~', | ||
119 | - icon: 'none' | ||
120 | - }); | ||
121 | - return; | ||
122 | - } | ||
123 | - if (this.vCode == '') { | ||
124 | - uni.showToast({ | ||
125 | - title: '请输入验证码~', | ||
126 | - icon: 'none' | ||
127 | - }); | ||
128 | - return; | ||
129 | - } else if(!(/^\d{6}$/.test(this.vCode))){ | ||
130 | - uni.showToast({ | ||
131 | - title: '验证码格式不正确~', | ||
132 | - icon: 'none' | ||
133 | - }); | ||
134 | - return | ||
135 | - } | ||
136 | - this.nextStatus = true | ||
137 | - }, | ||
138 | - showPhone(){ | ||
139 | - this.nextStatus = false | ||
140 | - }, | ||
141 | - onSubmit() { | ||
142 | - const passReg=/^(?=.*?[A-Z])(?=(.*[a-z]){1,})(?=(.*[\d]){1,})(?=(.*[\W]){1,})(?!.*\s).{8,}$/ | ||
143 | - if(this.password=='' &&this.rePassword==''){ | ||
144 | - uni.showToast({ | ||
145 | - title: '请输入密码~', | ||
146 | - icon: 'none' | ||
147 | - }); | ||
148 | - return; | ||
149 | - }else if (!passReg.test(this.password)&&!passReg.test(this.rePassword)) { | ||
150 | - uni.showToast({ | ||
151 | - title: '密码格式不正确(至少一个大写英文字母、至少一个小写英文字母、至少一位数字、至少一个特殊字符、最少八个字符)~', | ||
152 | - icon: 'none', | ||
153 | - duration: 3000 | ||
154 | - }); | ||
155 | - return; | ||
156 | - } | ||
157 | - if(this.password!==this.rePassword) return uni.$u.toast('两次输入密码不一致'); | ||
158 | - let httpData={ | ||
159 | - password: this.password, | ||
160 | - phoneNumber: this.phone, | ||
161 | - userId: this.vCode | ||
162 | - } | ||
163 | - uni.$u.http.post(`/yt/noauth/reset/${this.phone}`, httpData).then(res => { | ||
164 | - uni.showToast({ | ||
165 | - title: '重置密码成功~', | ||
166 | - icon: 'none' | ||
167 | - }).then(res=>{ | ||
168 | - uni.reLaunch({ | ||
169 | - url: '/pages/personal/personal' | ||
170 | - }); | ||
171 | - /** | ||
172 | - * 有些时候不起作用 | ||
173 | - */ | ||
174 | - // uni.navigateBack({ | ||
175 | - // delta:2 | ||
176 | - // }) | ||
177 | - }) | ||
178 | - }); | ||
179 | - }, | ||
180 | - showPasswordModeF() { | ||
181 | - this.showPasswordF = !this.showPasswordF; | ||
182 | - }, | ||
183 | - showPasswordModeS() { | ||
184 | - this.showPasswordS = !this.showPasswordS; | ||
185 | - }, | ||
186 | - } | ||
187 | - } | ||
188 | -</script> | ||
189 | - | ||
190 | -<style lang="scss" scoped> | ||
191 | - @import './static/findPassword.scss'; | 1 | +<template> |
2 | + <view class="find-password-page"> | ||
3 | + <public-module></public-module> | ||
4 | + <view class="top u-flex"> | ||
5 | + <view @click="showPhone" :style="{ color: !nextStatus ? '#0079fe' : '' }" class="item">1.验证手机号码</view> | ||
6 | + <view :style="{ color: !nextStatus ? '' : '#0079fe' }" class="item">2.设置新密码</view> | ||
7 | + </view> | ||
8 | + <view v-if="!nextStatus" style="margin-top: 40rpx;" class="f__login"> | ||
9 | + <view class="loginPhone"> | ||
10 | + <view class="form-row"><u-input v-model="phone" type="number" placeholder="请输入手机号码" border="bottom"></u-input></view> | ||
11 | + <view style="height: 25rpx;"></view> | ||
12 | + <view class="form-row"> | ||
13 | + <u-input type="number" v-model="vCode" placeholder="请输入短信验证码" border="bottom"> | ||
14 | + <template slot="suffix" @click="getVcode"> | ||
15 | + <view class="getvcode">{{ codeText }}</view> | ||
16 | + </template> | ||
17 | + </u-input> | ||
18 | + </view> | ||
19 | + <button class="submit" size="default" @click="onNextSubmit"><text style="color:#fff">下一步</text></button> | ||
20 | + </view> | ||
21 | + </view> | ||
22 | + <view v-else style="margin-top: 40rpx;" class="f__login"> | ||
23 | + <view class="loginPhone"> | ||
24 | + <view class="form-row u-flex"> | ||
25 | + <u-input v-model="password" :password="showPasswordF" placeholder="请设置6-20位新的登录密码" border="bottom"> | ||
26 | + <template slot="suffix" @click="showPasswordModeF"> | ||
27 | + <view style="padding:20rpx"><u-icon :name="showPasswordF ? '/static/eye-hide.png' : '/static/eye.png'"></u-icon></view> | ||
28 | + </template> | ||
29 | + </u-input> | ||
30 | + </view> | ||
31 | + <view class="form-row u-flex"> | ||
32 | + <u-input v-model="rePassword" :password="showPasswordS" placeholder="请再次输入新的登录密码" border="bottom"> | ||
33 | + <template slot="suffix" @click="showPasswordModeS"> | ||
34 | + <view style="padding:20rpx"><u-icon :name="showPasswordS ? '/static/eye-hide.png' : '/static/eye.png'"></u-icon></view> | ||
35 | + </template> | ||
36 | + </u-input> | ||
37 | + </view> | ||
38 | + <button class="submit" size="default" @click="onSubmit"><text style="color:#fff">确定</text></button> | ||
39 | + </view> | ||
40 | + </view> | ||
41 | + </view> | ||
42 | +</template> | ||
43 | + | ||
44 | +<script> | ||
45 | +var clear; | ||
46 | +export default { | ||
47 | + data() { | ||
48 | + return { | ||
49 | + readonly: false, | ||
50 | + codeText: '发送验证码', | ||
51 | + phone: '', //号码 | ||
52 | + vCode: '', //验证码 | ||
53 | + nextStatus: false, | ||
54 | + password: '', | ||
55 | + rePassword: '', | ||
56 | + showPasswordF: true, | ||
57 | + showPasswordS: true | ||
58 | + }; | ||
59 | + }, | ||
60 | + methods: { | ||
61 | + //验证码按钮文字状态 | ||
62 | + getCodeState() { | ||
63 | + const _this = this; | ||
64 | + this.readonly = true; | ||
65 | + this.codeText = '60s后重新获取'; | ||
66 | + var s = 60; | ||
67 | + clear = setInterval(() => { | ||
68 | + s--; | ||
69 | + _this.codeText = s + 's后重新获取'; | ||
70 | + if (s <= 0) { | ||
71 | + clearInterval(clear); | ||
72 | + _this.codeText = '发送验证码'; | ||
73 | + _this.readonly = false; | ||
74 | + } | ||
75 | + }, 1000); | ||
76 | + }, | ||
77 | + //获取验证码 | ||
78 | + getVcode() { | ||
79 | + if (this.readonly) { | ||
80 | + uni.showToast({ | ||
81 | + title: '验证码已发送~', | ||
82 | + icon: 'none' | ||
83 | + }); | ||
84 | + return; | ||
85 | + } | ||
86 | + if (this.phone == '') { | ||
87 | + uni.showToast({ | ||
88 | + title: '请输入手机号~', | ||
89 | + icon: 'none' | ||
90 | + }); | ||
91 | + return; | ||
92 | + } | ||
93 | + const phoneRegular = /^1\d{10}$/; | ||
94 | + if (!phoneRegular.test(this.phone)) { | ||
95 | + uni.showToast({ | ||
96 | + title: '手机号格式不正确~', | ||
97 | + icon: 'none' | ||
98 | + }); | ||
99 | + return; | ||
100 | + } | ||
101 | + let httpData = {}; | ||
102 | + // 获取验证码接口 | ||
103 | + uni.$u.http.post(`/yt/noauth/resetCode/${this.phone}`).then(res => { | ||
104 | + this.getCodeState(); //开始倒计时 | ||
105 | + }); | ||
106 | + }, | ||
107 | + onNextSubmit() { | ||
108 | + const phoneRegular = /^1\d{10}$/; | ||
109 | + if (this.phone == '') { | ||
110 | + uni.showToast({ | ||
111 | + title: '请输入手机号码~', | ||
112 | + icon: 'none' | ||
113 | + }); | ||
114 | + return; | ||
115 | + } else if (!phoneRegular.test(this.phone)) { | ||
116 | + uni.showToast({ | ||
117 | + title: '手机号格式不正确~', | ||
118 | + icon: 'none' | ||
119 | + }); | ||
120 | + return; | ||
121 | + } | ||
122 | + if (this.vCode == '') { | ||
123 | + uni.showToast({ | ||
124 | + title: '请输入验证码~', | ||
125 | + icon: 'none' | ||
126 | + }); | ||
127 | + return; | ||
128 | + } else if (!/^\d{6}$/.test(this.vCode)) { | ||
129 | + uni.showToast({ | ||
130 | + title: '验证码格式不正确~', | ||
131 | + icon: 'none' | ||
132 | + }); | ||
133 | + return; | ||
134 | + } | ||
135 | + this.nextStatus = true; | ||
136 | + }, | ||
137 | + showPhone() { | ||
138 | + this.nextStatus = false; | ||
139 | + }, | ||
140 | + onSubmit() { | ||
141 | + const passReg = /^(?=.*?[A-Z])(?=(.*[a-z]){1,})(?=(.*[\d]){1,})(?=(.*[\W]){1,})(?!.*\s).{8,}$/; | ||
142 | + if (this.password == '' && this.rePassword == '') { | ||
143 | + uni.showToast({ | ||
144 | + title: '请输入密码~', | ||
145 | + icon: 'none' | ||
146 | + }); | ||
147 | + return; | ||
148 | + } else if (!passReg.test(this.password) && !passReg.test(this.rePassword)) { | ||
149 | + uni.showToast({ | ||
150 | + title: '密码格式不正确(至少一个大写英文字母、至少一个小写英文字母、至少一位数字、至少一个特殊字符、最少八个字符)~', | ||
151 | + icon: 'none', | ||
152 | + duration: 3000 | ||
153 | + }); | ||
154 | + return; | ||
155 | + } | ||
156 | + if (this.password !== this.rePassword) return uni.$u.toast('两次输入密码不一致'); | ||
157 | + let httpData = { | ||
158 | + password: this.password, | ||
159 | + phoneNumber: this.phone, | ||
160 | + userId: this.vCode | ||
161 | + }; | ||
162 | + uni.$u.http.post(`/yt/noauth/reset/${this.phone}`, httpData).then(res => { | ||
163 | + uni | ||
164 | + .showToast({ | ||
165 | + title: '重置密码成功~', | ||
166 | + icon: 'none' | ||
167 | + }) | ||
168 | + .then(res => { | ||
169 | + uni.reLaunch({ | ||
170 | + url: '/pages/personal/personal' | ||
171 | + }); | ||
172 | + /** | ||
173 | + * 有些时候不起作用 | ||
174 | + */ | ||
175 | + // uni.navigateBack({ | ||
176 | + // delta:2 | ||
177 | + // }) | ||
178 | + }); | ||
179 | + }); | ||
180 | + }, | ||
181 | + showPasswordModeF() { | ||
182 | + this.showPasswordF = !this.showPasswordF; | ||
183 | + }, | ||
184 | + showPasswordModeS() { | ||
185 | + this.showPasswordS = !this.showPasswordS; | ||
186 | + } | ||
187 | + } | ||
188 | +}; | ||
189 | +</script> | ||
190 | + | ||
191 | +<style lang="scss" scoped> | ||
192 | +@import './static/findPassword.scss'; | ||
192 | </style> | 193 | </style> |
@@ -33,7 +33,7 @@ | @@ -33,7 +33,7 @@ | ||
33 | 33 | ||
34 | .form-row { | 34 | .form-row { |
35 | position: relative; | 35 | position: relative; |
36 | - border-bottom: 1rpx solid #e8e8e8; | 36 | + // border-bottom: 1rpx solid #e8e8e8; |
37 | margin-top: 30rpx; | 37 | margin-top: 30rpx; |
38 | .input { | 38 | .input { |
39 | font-size: 34rpx; | 39 | font-size: 34rpx; |
@@ -62,11 +62,6 @@ | @@ -62,11 +62,6 @@ | ||
62 | transform: translateY(-50%); | 62 | transform: translateY(-50%); |
63 | right: 0; | 63 | right: 0; |
64 | z-index: 11; | 64 | z-index: 11; |
65 | - | ||
66 | - &.forhidden { | ||
67 | - // background: #eee; | ||
68 | - // color: #cccccc; | ||
69 | - } | ||
70 | } | 65 | } |
71 | } | 66 | } |
72 | 67 |
@@ -25,7 +25,6 @@ | @@ -25,7 +25,6 @@ | ||
25 | .loginPhone { | 25 | .loginPhone { |
26 | .form-row { | 26 | .form-row { |
27 | position: relative; | 27 | position: relative; |
28 | - border-bottom: 1px solid #e5e5e5; | ||
29 | justify-content: space-between; | 28 | justify-content: space-between; |
30 | .v-input { | 29 | .v-input { |
31 | width: 620rpx; | 30 | width: 620rpx; |
@@ -14,18 +14,14 @@ | @@ -14,18 +14,14 @@ | ||
14 | 14 | ||
15 | <view class="f__login"> | 15 | <view class="f__login"> |
16 | <view class="loginPhone"> | 16 | <view class="loginPhone"> |
17 | - <view class="form-row u-flex"> | ||
18 | - <view class="v-input"><input type="text" v-model="loginForm.username" maxlength="32" placeholder="请输入登录账号" /></view> | ||
19 | - <u-icon></u-icon> | ||
20 | - </view> | 17 | + <view class="form-row u-flex"><u-input v-model="loginForm.username" type="text" placeholder="请输入登录账号" border="bottom" /></view> |
21 | 18 | ||
22 | <view class="form-row u-flex"> | 19 | <view class="form-row u-flex"> |
23 | - <view class="v-input"><input type="text" v-model="loginForm.password" maxlength="32" placeholder="请输入登录密码" :password="!showPassword" /></view> | ||
24 | - <view class="v-password" style="padding: 30rpx;" @click="showPasswordMode"> | ||
25 | - <u-icon color="#9a9a9a" :name="showPassword ? '/static/eye.png' : '/static/eye-hide.png'"></u-icon> | ||
26 | - </view> | ||
27 | - | ||
28 | - <u-icon></u-icon> | 20 | + <u-input v-model="loginForm.password" :password="showPassword" placeholder="请输入登录密码" border="bottom"> |
21 | + <template slot="suffix" @click="showPasswordMode"> | ||
22 | + <view style="padding:20rpx"><u-icon :name="showPassword ? '/static/eye-hide.png' : '/static/eye.png'"></u-icon></view> | ||
23 | + </template> | ||
24 | + </u-input> | ||
29 | </view> | 25 | </view> |
30 | 26 | ||
31 | <button class="submit" size="default" @click="onSubmitFunc"><text class="text">登录</text></button> | 27 | <button class="submit" size="default" @click="onSubmitFunc"><text class="text">登录</text></button> |
@@ -68,7 +64,7 @@ export default { | @@ -68,7 +64,7 @@ export default { | ||
68 | password: '' | 64 | password: '' |
69 | }, | 65 | }, |
70 | 66 | ||
71 | - showPassword: false, | 67 | + showPassword: true, |
72 | 68 | ||
73 | code: '', | 69 | code: '', |
74 | 70 | ||
@@ -261,7 +257,8 @@ export default { | @@ -261,7 +257,8 @@ export default { | ||
261 | 257 | ||
262 | token: true, //token用于判断是否登录 | 258 | token: true, //token用于判断是否登录 |
263 | 259 | ||
264 | - isThirdLogin: false | 260 | + isThirdLogin: false, |
261 | + isThirdLoginAndNoDind:false | ||
265 | }; | 262 | }; |
266 | 263 | ||
267 | if (userInfo.token) { | 264 | if (userInfo.token) { |
@@ -314,4 +311,4 @@ export default { | @@ -314,4 +311,4 @@ export default { | ||
314 | /deep/ button { | 311 | /deep/ button { |
315 | background: rgba(0, 0, 0, 0); | 312 | background: rgba(0, 0, 0, 0); |
316 | } | 313 | } |
317 | -</style> | 314 | +</style> |
@@ -38,7 +38,7 @@ | @@ -38,7 +38,7 @@ | ||
38 | .form-row { | 38 | .form-row { |
39 | position: relative; | 39 | position: relative; |
40 | justify-content: space-between; | 40 | justify-content: space-between; |
41 | - margin-top: 60rpx; | 41 | + // margin-top: 60rpx; |
42 | .v-input { | 42 | .v-input { |
43 | width: 690rpx; | 43 | width: 690rpx; |
44 | border-bottom: 1px solid #e5e5e5; | 44 | border-bottom: 1px solid #e5e5e5; |