接入密码找回功能
							parent
							
								
									592827bc3d
								
							
						
					
					
						commit
						475a681300
					
				|  | @ -5,6 +5,8 @@ export function sendSmsCode(mobile, scene) { | ||||||
|   return request.post('app-api/member/auth/send-sms-code', { |   return request.post('app-api/member/auth/send-sms-code', { | ||||||
|     mobile, |     mobile, | ||||||
|     scene |     scene | ||||||
|  |   }, { | ||||||
|  |     noAuth: true // TODO 芋艿:后续要做调整
 | ||||||
|   }); |   }); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -14,3 +14,15 @@ export function updateUser(data) { | ||||||
| export function updateUserMobile(data) { | export function updateUserMobile(data) { | ||||||
|   return request.put('app-api/member/user/update-mobile', data); |   return request.put('app-api/member/user/update-mobile', data); | ||||||
| } | } | ||||||
|  | 
 | ||||||
|  | // 修改用户密码
 | ||||||
|  | export function updateUserPassword(data) { | ||||||
|  |   return request.put('app-api/member/user/update-password', data); | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | // 重置密码
 | ||||||
|  | export function resetUserPassword(data) { | ||||||
|  |   return request.put('app-api/member/user/reset-password', data, { | ||||||
|  |     noAuth: true // TODO 芋艿:后续要做调整
 | ||||||
|  |   }); | ||||||
|  | } | ||||||
|  |  | ||||||
|  | @ -130,12 +130,6 @@ | ||||||
| 					"style": { | 					"style": { | ||||||
| 					} | 					} | ||||||
| 				}, | 				}, | ||||||
| 				{ |  | ||||||
| 					"path": "retrievePassword/index", |  | ||||||
| 					"style": { |  | ||||||
| 						"navigationBarTitleText": "忘记密码" |  | ||||||
| 					} |  | ||||||
| 				}, |  | ||||||
| 				{ | 				{ | ||||||
| 					"path": "user_info/index", | 					"path": "user_info/index", | ||||||
| 					"style": { | 					"style": { | ||||||
|  |  | ||||||
|  | @ -2,7 +2,7 @@ | ||||||
| 	<view class="register absolute"> | 	<view class="register absolute"> | ||||||
| 	    <view class="shading"> | 	    <view class="shading"> | ||||||
|         <view class="pictrue acea-row row-center-wrapper"> |         <view class="pictrue acea-row row-center-wrapper"> | ||||||
| 			 <image src="../../static/images/logo2.png"></image> |           <image src="../../static/images/logo2.png" /> | ||||||
| 	      </view> | 	      </view> | ||||||
| 	    </view> | 	    </view> | ||||||
| 	    <view class="whiteBg"> | 	    <view class="whiteBg"> | ||||||
|  | @ -10,13 +10,13 @@ | ||||||
| 	      <view class="list"> | 	      <view class="list"> | ||||||
| 	        <view class="item"> | 	        <view class="item"> | ||||||
| 	          <view class="acea-row row-middle"> | 	          <view class="acea-row row-middle"> | ||||||
| 				<image src="/static/images/phone_1.png"></image> |               <image src="/static/images/phone_1.png" /> | ||||||
| 	            <input type="text" placeholder="输入手机号码" placeholder-class="placeholder" v-model="account" class="input"/> | 	            <input type="text" placeholder="输入手机号码" placeholder-class="placeholder" v-model="mobile" class="input"/> | ||||||
| 	          </view> | 	          </view> | ||||||
| 	        </view> | 	        </view> | ||||||
| 	        <view class="item"> | 	        <view class="item"> | ||||||
|             <view class="align-left acea-row row-middle"> |             <view class="align-left acea-row row-middle"> | ||||||
| 				<image src="/static/images/code_2.png"></image> |               <image src="/static/images/code_2.png" /> | ||||||
| 	            <input type="text" placeholder="填写验证码" class="codeIput" v-model="captcha" placeholder-class="placeholder"/> | 	            <input type="text" placeholder="填写验证码" class="codeIput" v-model="captcha" placeholder-class="placeholder"/> | ||||||
| 	            <button class="code" :disabled="disabled" :class="disabled === true ? 'on' : ''" @click="code"> | 	            <button class="code" :disabled="disabled" :class="disabled === true ? 'on' : ''" @click="code"> | ||||||
| 	              {{ text }} | 	              {{ text }} | ||||||
|  | @ -25,7 +25,7 @@ | ||||||
| 	        </view> | 	        </view> | ||||||
| 	        <view class="item"> | 	        <view class="item"> | ||||||
| 	          <view class="acea-row row-middle"> | 	          <view class="acea-row row-middle"> | ||||||
| 	            <image src="/static/images/code_1.png"></image> | 	            <image src="/static/images/code_1.png" /> | ||||||
| 	            <input type="password" placeholder="填写您的登录密码" v-model="password" placeholder-class="placeholder" class="input"/> | 	            <input type="password" placeholder="填写您的登录密码" v-model="password" placeholder-class="placeholder" class="input"/> | ||||||
| 	          </view> | 	          </view> | ||||||
| 	        </view> | 	        </view> | ||||||
|  | @ -35,17 +35,18 @@ | ||||||
|           <text class="font-color">立即登录</text> |           <text class="font-color">立即登录</text> | ||||||
| 	      </navigator> | 	      </navigator> | ||||||
| 	    </view> | 	    </view> | ||||||
| 	    <view class="bottom"></view> | 	    <view class="bottom" /> | ||||||
| 	  </view> | 	  </view> | ||||||
| </template> | </template> | ||||||
| 
 | 
 | ||||||
| <script> | <script> | ||||||
| 	import sendVerifyCode from "@/mixins/SendVerifyCode"; | 	import sendVerifyCode from "@/mixins/SendVerifyCode"; | ||||||
| 	import { registerVerify, registerReset } from "@/api/user"; |   import * as AuthUtil from '@/api/member/auth.js'; | ||||||
|  |   import * as UserApi from '@/api/member/user.js'; | ||||||
|   export default { |   export default { | ||||||
| 	  data() { | 	  data() { | ||||||
| 	    return { | 	    return { | ||||||
| 	      account: "", | 	      mobile: "", | ||||||
| 	      password: "", | 	      password: "", | ||||||
| 	      captcha: "" | 	      captcha: "" | ||||||
| 	    }; | 	    }; | ||||||
|  | @ -53,63 +54,73 @@ | ||||||
| 	  mixins: [sendVerifyCode], | 	  mixins: [sendVerifyCode], | ||||||
| 	  methods: { | 	  methods: { | ||||||
| 	    registerReset() { | 	    registerReset() { | ||||||
| 	      let that = this; |         if (!this.mobile) { | ||||||
| 		  if (!that.account) return that.$util.Tips({ |           return this.$util.Tips({ | ||||||
|             title: '请填写手机号码' |             title: '请填写手机号码' | ||||||
|           }); |           }); | ||||||
| 		  if (!/^1(3|4|5|7|8|9|6)\d{9}$/i.test(that.account)) return that.$util.Tips({ |         } | ||||||
|  |         if (!/^1(3|4|5|7|8|9|6)\d{9}$/i.test(this.mobile)) { | ||||||
|  |           return this.$util.Tips({ | ||||||
|             title: '请输入正确的手机号码' |             title: '请输入正确的手机号码' | ||||||
|           }); |           }); | ||||||
| 		  if (!that.captcha) return that.$util.Tips({ |         } | ||||||
|  |         if (!this.captcha) { | ||||||
|  |           return this.$util.Tips({ | ||||||
|             title: '请填写验证码' |             title: '请填写验证码' | ||||||
|           }); |           }); | ||||||
| 		  if (!/^[\w\d]+$/i.test(that.captcha)) return that.$util.Tips({ |         } | ||||||
|  |         if (!/^[\w\d]+$/i.test(this.captcha)) { | ||||||
|  |           return this.$util.Tips({ | ||||||
|             title: '请输入正确的验证码' |             title: '请输入正确的验证码' | ||||||
|           }); |           }); | ||||||
| 		  if (!that.password) return that.$util.Tips({ |         } | ||||||
|  |         if (!this.password) { | ||||||
|  |           return this.$util.Tips({ | ||||||
|             title: '请填写密码' |             title: '请填写密码' | ||||||
|           }); |           }); | ||||||
| 		  if (!/^(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Za-z]{6,16}$/i.test(that.password)) return that.$util.Tips({ |         } | ||||||
|  |         if (!/^(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Za-z]{6,16}$/i.test(this.password)) { | ||||||
|  |           return this.$util.Tips({ | ||||||
|             title: '您输入的密码过于简单' |             title: '您输入的密码过于简单' | ||||||
|           }); |           }); | ||||||
| 		  registerReset({ |  | ||||||
| 		          account: that.account, |  | ||||||
| 		          captcha: that.captcha, |  | ||||||
| 		          password: that.password |  | ||||||
| 		        }) |  | ||||||
| 		          .then(res => { |  | ||||||
| 					  that.$util.Tips({ |  | ||||||
| 					    title: res, |  | ||||||
| 					    success: () => { |  | ||||||
| 							uni.navigateTo({ |  | ||||||
| 							    url: '/pages/login/index' |  | ||||||
| 							}); |  | ||||||
|         } |         } | ||||||
|  |         UserApi.resetUserPassword({ | ||||||
|  |           mobile: this.mobile, | ||||||
|  |           code: this.captcha, | ||||||
|  |           password: this.password | ||||||
|  |         }).then(res => { | ||||||
|  |           return this.$util.Tips({ | ||||||
|  |             title: '密码找回成功', | ||||||
|  |             icon: 'success' | ||||||
|  |           }, { | ||||||
|  |             tab: 5, | ||||||
|  |             url: '/pages/users/login/index' | ||||||
|           }); |           }); | ||||||
| 		          }) |         }).catch(res => { | ||||||
| 		          .catch(res => { |           this.$util.Tips({ | ||||||
| 					  that.$util.Tips({ |  | ||||||
|             title: res |             title: res | ||||||
|           }); |           }); | ||||||
|         }); |         }); | ||||||
| 	    }, | 	    }, | ||||||
|  | 
 | ||||||
|       async code() { |       async code() { | ||||||
| 	         let that = this; |         if (!this.mobile) { | ||||||
| 			 if (!that.account) return that.$util.Tips({ |           return this.$util.Tips({ | ||||||
|             title: '请填写手机号码' |             title: '请填写手机号码' | ||||||
|           }); |           }); | ||||||
| 			 if (!/^1(3|4|5|7|8|9|6)\d{9}$/i.test(that.account)) return that.$util.Tips({ |         } | ||||||
|  |         if (!/^1(3|4|5|7|8|9|6)\d{9}$/i.test(this.mobile)) { | ||||||
|  |           return this.$util.Tips({ | ||||||
|             title: '请输入正确的手机号码' |             title: '请输入正确的手机号码' | ||||||
|           }); |           }); | ||||||
| 	         registerVerify({ phone: that.account }) |         } | ||||||
| 	           .then(res => { |         AuthUtil.sendSmsCode(this.mobile, 4).then(res => { | ||||||
| 	             that.$util.Tips({ |          this.$util.Tips({ | ||||||
|            title: res |            title: res | ||||||
|          }); |          }); | ||||||
| 	             that.sendCode(); |          this.sendCode(); | ||||||
| 	           }) |        }).catch(res => { | ||||||
| 	           .catch(res => { |          this.$util.Tips({ | ||||||
| 	             that.$util.Tips({ |  | ||||||
|            title: res |            title: res | ||||||
|          }); |          }); | ||||||
|        }); |        }); | ||||||
|  |  | ||||||
|  | @ -1,161 +0,0 @@ | ||||||
| <template> |  | ||||||
| 	<div class="register absolute"> |  | ||||||
| 		<div class="shading"> |  | ||||||
| 			<div class="pictrue acea-row row-center-wrapper"> |  | ||||||
| 				<image src="../../../static/images/logo2.png" /> |  | ||||||
| 			</div> |  | ||||||
| 		</div> |  | ||||||
| 		<div class="whiteBg"> |  | ||||||
| 			<div class="title">找回密码</div> |  | ||||||
| 			<div class="list"> |  | ||||||
| 				<div class="item"> |  | ||||||
| 					<div class="acea-row row-middle"> |  | ||||||
| 						<image src="/static/images/phone_1.png"></image> |  | ||||||
| 						<input type="text" placeholder="输入手机号码" v-model="account" /> |  | ||||||
| 					</div> |  | ||||||
| 				</div> |  | ||||||
| 				<div class="item"> |  | ||||||
| 
 |  | ||||||
| 					<div class="acea-row row-middle"> |  | ||||||
| 						<image src="/static/images/code_2.png"></image> |  | ||||||
| 						<input type="text" placeholder="填写验证码" class="codeIput" v-model="captcha" /> |  | ||||||
| 						<button class="code" :disabled="disabled" :class="disabled === true ? 'on' : ''" @click="code"> |  | ||||||
| 							{{ text }} |  | ||||||
| 						</button> |  | ||||||
| 					</div> |  | ||||||
| 				</div> |  | ||||||
| 				<div class="item"> |  | ||||||
| 					<div class="acea-row row-middle"> |  | ||||||
| 						<image src="/static/images/code_2.png"></image> |  | ||||||
| 						<input type="password" placeholder="填写您的新密码" v-model="password" /> |  | ||||||
| 					</div> |  | ||||||
| 				</div> |  | ||||||
| 				<div class="item" v-if="isShowCode"> |  | ||||||
| 					<div class="align-left"> |  | ||||||
| 						<input type="text" placeholder="填写验证码" class="codeIput" v-model="codeVal" /> |  | ||||||
| 						<div class="code" @click="again"><img :src="codeUrl" /></div> |  | ||||||
| 					</div> |  | ||||||
| 				</div> |  | ||||||
| 			</div> |  | ||||||
| 			<div class="logon" @click="registerReset">确认</div> |  | ||||||
| 			<div class="tip"> |  | ||||||
| 				<span class="font-color-red" @click="back">立即登录</span> |  | ||||||
| 			</div> |  | ||||||
| 		</div> |  | ||||||
| 		<div class="bottom"></div> |  | ||||||
| 	</div> |  | ||||||
| </template> |  | ||||||
| 
 |  | ||||||
| <script> |  | ||||||
| 	import sendVerifyCode from "@/mixins/SendVerifyCode"; |  | ||||||
| 	import { |  | ||||||
| 		registerVerify, |  | ||||||
| 		registerReset, |  | ||||||
| 		getCodeApi |  | ||||||
| 	} from "@/api/user"; |  | ||||||
| 	// import { validatorDefaultCatch } from "@/utils/dialog"; |  | ||||||
| 	// import attrs, { required, alpha_num, chs_phone } from "@utils/validate"; |  | ||||||
| 	// import { VUE_APP_API_URL } from "@utils"; |  | ||||||
| 
 |  | ||||||
| 	export default { |  | ||||||
| 		name: "RetrievePassword", |  | ||||||
| 		data: function() { |  | ||||||
| 			return { |  | ||||||
| 				account: "", |  | ||||||
| 				password: "", |  | ||||||
| 				captcha: "", |  | ||||||
| 				keyCode: "", |  | ||||||
| 				codeUrl: "", |  | ||||||
| 				codeVal: "", |  | ||||||
| 				isShowCode: false |  | ||||||
| 			}; |  | ||||||
| 		}, |  | ||||||
| 		mixins: [sendVerifyCode], |  | ||||||
| 		mounted: function() { |  | ||||||
| 			this.getCode(); |  | ||||||
| 		}, |  | ||||||
| 		methods: { |  | ||||||
| 			back() { |  | ||||||
| 				uni.navigateBack(); |  | ||||||
| 			}, |  | ||||||
| 			again() { |  | ||||||
| 				this.codeUrl = |  | ||||||
| 					VUE_APP_API_URL + "/captcha?" + this.keyCode + Date.parse(new Date()); |  | ||||||
| 			}, |  | ||||||
| 			getCode() { |  | ||||||
| 				getCodeApi() |  | ||||||
| 					.then(res => { |  | ||||||
| 						this.keyCode = res.data.key; |  | ||||||
| 					}) |  | ||||||
| 					.catch(res => { |  | ||||||
| 						this.$dialog.error(res.msg); |  | ||||||
| 					}); |  | ||||||
| 			}, |  | ||||||
| 			async registerReset() { |  | ||||||
| 				var that = this; |  | ||||||
| 				if (!that.account) return that.$util.Tips({ |  | ||||||
| 					title: '请填写手机号码' |  | ||||||
| 				}); |  | ||||||
| 				if (!/^1(3|4|5|7|8|9|6)\d{9}$/i.test(that.account)) return that.$util.Tips({ |  | ||||||
| 					title: '请输入正确的手机号码' |  | ||||||
| 				}); |  | ||||||
| 				if (!that.captcha) return that.$util.Tips({ |  | ||||||
| 					title: '请填写验证码' |  | ||||||
| 				}); |  | ||||||
| 				registerReset({ |  | ||||||
| 						account: that.account, |  | ||||||
| 						captcha: that.captcha, |  | ||||||
| 						password: that.password, |  | ||||||
| 						code: that.codeVal |  | ||||||
| 					}) |  | ||||||
| 					.then(res => { |  | ||||||
| 						that.$util.Tips({ |  | ||||||
| 							title: res.message |  | ||||||
| 						}, { |  | ||||||
| 							tab: 3 |  | ||||||
| 						}) |  | ||||||
| 					}) |  | ||||||
| 					.catch(res => { |  | ||||||
| 						that.$util.Tips({ |  | ||||||
| 							title: res |  | ||||||
| 						}) |  | ||||||
| 					}); |  | ||||||
| 			}, |  | ||||||
| 			async code() { |  | ||||||
| 				let that = this; |  | ||||||
| 				if (!that.account) return that.$util.Tips({ |  | ||||||
| 					title: '请填写手机号码' |  | ||||||
| 				}); |  | ||||||
| 				if (!/^1(3|4|5|7|8|9|6)\d{9}$/i.test(that.account)) return that.$util.Tips({ |  | ||||||
| 					title: '请输入正确的手机号码' |  | ||||||
| 				}); |  | ||||||
| 				if (that.formItem == 2) that.type = "register"; |  | ||||||
| 				await registerVerify({ |  | ||||||
| 						phone: that.account, |  | ||||||
| 						type: that.type, |  | ||||||
| 						key: that.keyCode, |  | ||||||
| 						code: that.codeVal |  | ||||||
| 					}) |  | ||||||
| 					.then(res => { |  | ||||||
| 						that.$dialog.success(res.message); |  | ||||||
| 						that.sendCode(); |  | ||||||
| 					}) |  | ||||||
| 					.catch(res => { |  | ||||||
| 						// if (res.data.status === 402) { |  | ||||||
| 						// 	that.codeUrl = `${VUE_APP_API_URL}/sms_captcha?key=${that.keyCode}`; |  | ||||||
| 						// 	that.isShowCode = true; |  | ||||||
| 						// } |  | ||||||
| 						that.$util.Tips({ |  | ||||||
| 							title: res |  | ||||||
| 						}); |  | ||||||
| 					}); |  | ||||||
| 			}, |  | ||||||
| 		} |  | ||||||
| 	}; |  | ||||||
| </script> |  | ||||||
| <style scoped> |  | ||||||
| 	.code img { |  | ||||||
| 		width: 100%; |  | ||||||
| 		height: 100%; |  | ||||||
| 	} |  | ||||||
| </style> |  | ||||||
|  | @ -122,7 +122,7 @@ | ||||||
|               oldCode: this.captcha |               oldCode: this.captcha | ||||||
|             }).then(res => { |             }).then(res => { | ||||||
|               return this.$util.Tips({ |               return this.$util.Tips({ | ||||||
|                 title: res.message, |                 title: '手机修改成功', | ||||||
|                 icon: 'success' |                 icon: 'success' | ||||||
|               }, { |               }, { | ||||||
|                 tab: 5, |                 tab: 5, | ||||||
|  |  | ||||||
|  | @ -2,16 +2,18 @@ | ||||||
| 	<view> | 	<view> | ||||||
| 		<view class="ChangePassword"> | 		<view class="ChangePassword"> | ||||||
| 			<form @submit="editPwd" report-submit='true'> | 			<form @submit="editPwd" report-submit='true'> | ||||||
| 				<view class="phone">当前手机号:{{phone}}</view> | 				<view class="phone">当前手机号:{{ userInfo.mobile }}</view> | ||||||
| 				<view class="list"> | 				<view class="list"> | ||||||
| 					<view class="item"> | 					<view class="item"> | ||||||
| 						<input type='password' placeholder='以字母开头,长度在6~18之间,只能包含字符、数字和下划线' placeholder-class='placeholder' name="password" :value="password"></input> | 						<input type='password' placeholder='以字母开头,长度在6~18之间,只能包含字符、数字和下划线' | ||||||
|  |                    placeholder-class='placeholder' name="password" :value="password" /> | ||||||
| 					</view> | 					</view> | ||||||
| 					<view class="item"> | 					<view class="item"> | ||||||
| 						<input type='password' placeholder='确认新密码' placeholder-class='placeholder' name="qr_password" :value="qr_password"></input> | 						<input type='password' placeholder='确认新密码' placeholder-class='placeholder' | ||||||
|  |                    name="qr_password" :value="qr_password" /> | ||||||
| 					</view> | 					</view> | ||||||
| 					<view class="item acea-row row-between-wrapper"> | 					<view class="item acea-row row-between-wrapper"> | ||||||
| 						<input type='number' placeholder='填写验证码' placeholder-class='placeholder' class="codeIput" name="captcha" :value="captcha"></input> | 						<input type='number' placeholder='填写验证码' placeholder-class='placeholder' class="codeIput" name="captcha" :value="captcha" /> | ||||||
| 						<button class="code font-color" :class="disabled === true ? 'on' : ''" :disabled='disabled' @click="code"> | 						<button class="code font-color" :class="disabled === true ? 'on' : ''" :disabled='disabled' @click="code"> | ||||||
| 							{{ text }} | 							{{ text }} | ||||||
| 						</button> | 						</button> | ||||||
|  | @ -20,105 +22,41 @@ | ||||||
| 				<button form-type="submit" class="confirmBnt bg-color">确认修改</button> | 				<button form-type="submit" class="confirmBnt bg-color">确认修改</button> | ||||||
| 			</form> | 			</form> | ||||||
| 		</view> | 		</view> | ||||||
| 		<!-- #ifdef MP --> |  | ||||||
| 		<!-- <authorize @onLoadFun="onLoadFun" :isAuto="isAuto" :isShowAuth="isShowAuth" @authColse="authColse"></authorize> --> |  | ||||||
| 		<!-- #endif --> |  | ||||||
| 	</view> | 	</view> | ||||||
| </template> | </template> | ||||||
| 
 | 
 | ||||||
| <script> | <script> | ||||||
|  | 	import { mapGetters } from "vuex"; | ||||||
|   import sendVerifyCode from "@/mixins/SendVerifyCode"; |   import sendVerifyCode from "@/mixins/SendVerifyCode"; | ||||||
| 	import { |   import * as AuthUtil from '@/api/member/auth.js'; | ||||||
| 		phoneRegisterReset, |   import * as UserApi from '@/api/member/user.js'; | ||||||
| 		registerVerify |  | ||||||
| 	} from '@/api/api.js'; |  | ||||||
| 	import { |  | ||||||
| 		getUserInfo |  | ||||||
| 	} from '@/api/user.js'; |  | ||||||
| 	import { |  | ||||||
| 		toLogin |  | ||||||
| 	} from '@/libs/login.js'; |  | ||||||
| 	import { |  | ||||||
| 		mapGetters |  | ||||||
| 	} from "vuex"; |  | ||||||
| 	// #ifdef MP |  | ||||||
| 	import authorize from '@/components/Authorize'; |  | ||||||
| 	// #endif |  | ||||||
|   export default { |   export default { | ||||||
| 		mixins: [sendVerifyCode], |  | ||||||
| 		components: { |  | ||||||
| 			// #ifdef MP |  | ||||||
| 			authorize |  | ||||||
| 			// #endif |  | ||||||
| 		}, |  | ||||||
| 		data() { | 		data() { | ||||||
| 			return { | 			return { | ||||||
| 				userInfo: {}, |  | ||||||
| 				phone: '', |  | ||||||
| 				password: '', | 				password: '', | ||||||
| 				captcha: '', |  | ||||||
|         qr_password: '', |         qr_password: '', | ||||||
| 				isAuto: false, //没有授权的不会自动授权 |         captcha: '', | ||||||
| 				isShowAuth: false //是否隐藏授权 |  | ||||||
| 			}; | 			}; | ||||||
| 		}, | 		}, | ||||||
| 		computed: mapGetters(['isLogin']), |     mixins: [sendVerifyCode], | ||||||
| 		watch:{ |     computed: mapGetters(['isLogin', 'userInfo']), | ||||||
| 			isLogin:{ |  | ||||||
| 				handler:function(newV,oldV){ |  | ||||||
| 					if(newV){ |  | ||||||
| 						this.getUserInfo(); |  | ||||||
| 					} |  | ||||||
| 				}, |  | ||||||
| 				deep:true |  | ||||||
| 			} |  | ||||||
| 		}, |  | ||||||
| 		onLoad() { |  | ||||||
| 			if (this.isLogin) { |  | ||||||
| 				this.getUserInfo(); |  | ||||||
| 			} else { |  | ||||||
| 				toLogin(); |  | ||||||
| 			} |  | ||||||
| 		}, |  | ||||||
| 		methods: { | 		methods: { | ||||||
| 			/** |  | ||||||
| 			 * 授权回调 |  | ||||||
| 			 */ |  | ||||||
| 			onLoadFun: function(e) { |  | ||||||
| 				this.getUserInfo(); |  | ||||||
| 			}, |  | ||||||
| 			// 授权关闭 |  | ||||||
| 			authColse: function(e) { |  | ||||||
| 				this.isShowAuth = e |  | ||||||
| 			}, |  | ||||||
| 			/** |  | ||||||
| 			 * 获取个人用户信息 |  | ||||||
| 			 */ |  | ||||||
| 			getUserInfo: function() { |  | ||||||
| 				let that = this; |  | ||||||
| 				getUserInfo().then(res => { |  | ||||||
| 					let tel = res.data.phone; |  | ||||||
| 					let phone = tel.substr(0, 3) + "****" + tel.substr(7); |  | ||||||
| 					that.$set(that, 'userInfo', res.data); |  | ||||||
| 					that.phone = phone; |  | ||||||
| 				}); |  | ||||||
| 			}, |  | ||||||
| 			/** | 			/** | ||||||
| 			 * 发送验证码 | 			 * 发送验证码 | ||||||
| 			 *  |  | ||||||
| 			 */ | 			 */ | ||||||
| 			async code() { | 			async code() { | ||||||
| 				let that = this; | 				if (!this.userInfo.mobile) { | ||||||
| 				if (!that.userInfo.phone) return that.$util.Tips({ |           return this.$util.Tips({ | ||||||
| 					title: '手机号码不存在,无法发送验证码!' |             title: '手机号码不存在,无法发送验证码!' | ||||||
|           }); |           }); | ||||||
| 				await registerVerify(that.userInfo.phone).then(res => { |         } | ||||||
| 					that.$util.Tips({ | 				await AuthUtil.sendSmsCode(this.userInfo.mobile, 3).then(res => { | ||||||
| 						title: res.message | 					this.$util.Tips({ | ||||||
|  |             title: '验证码已发送' | ||||||
| 					}); | 					}); | ||||||
| 					that.sendCode(); | 					this.sendCode(); | ||||||
| 				}).catch(err => { | 				}).catch(err => { | ||||||
| 					return that.$util.Tips({ | 					return this.$util.Tips({ | ||||||
| 						title: err | 						title: err | ||||||
| 					}); | 					}); | ||||||
| 				}); | 				}); | ||||||
|  | @ -126,38 +64,43 @@ | ||||||
| 
 | 
 | ||||||
| 			/** | 			/** | ||||||
| 			 * H5登录 修改密码 | 			 * H5登录 修改密码 | ||||||
| 			 *  |  | ||||||
| 			 */ | 			 */ | ||||||
| 			editPwd: function(e) { | 			editPwd: function(e) { | ||||||
| 				let that = this, | 				const password = e.detail.value.password; | ||||||
| 					password = e.detail.value.password, |         const qr_password = e.detail.value.qr_password; | ||||||
| 					qr_password = e.detail.value.qr_password, | 				const	captcha = e.detail.value.captcha; | ||||||
| 					captcha = e.detail.value.captcha; | 				if (!password) { | ||||||
| 				if (!password) return that.$util.Tips({ |           return this.$util.Tips({ | ||||||
|             title: '请输入新密码' |             title: '请输入新密码' | ||||||
|           }); |           }); | ||||||
| 				if (!/^[a-zA-Z]\w{5,17}$/i.test(password)) return that.$util.Tips({ |         } | ||||||
|  | 				if (!/^[a-zA-Z]\w{5,17}$/i.test(password)) { | ||||||
|  |           return this.$util.Tips({ | ||||||
|             title: '以字母开头,长度在6~18之间,只能包含字符、数字和下划线' |             title: '以字母开头,长度在6~18之间,只能包含字符、数字和下划线' | ||||||
|           }); |           }); | ||||||
| 				if (qr_password != password) return that.$util.Tips({ |         } | ||||||
|  | 				if (qr_password !== password) { | ||||||
|  |           return this.$util.Tips({ | ||||||
|             title: '两次输入的密码不一致!' |             title: '两次输入的密码不一致!' | ||||||
|           }); |           }); | ||||||
| 				if (!captcha) return that.$util.Tips({ |         } | ||||||
|  | 				if (!captcha) { | ||||||
|  |           return this.$util.Tips({ | ||||||
|             title: '请输入验证码' |             title: '请输入验证码' | ||||||
|           }); |           }); | ||||||
| 				phoneRegisterReset({ |         } | ||||||
| 					account: that.userInfo.phone, |         UserApi.updateUserPassword({ | ||||||
| 					captcha: captcha, | 					code: captcha, | ||||||
| 					password: password | 					password: password | ||||||
| 				}).then(res => { | 				}).then(res => { | ||||||
| 					return that.$util.Tips({ | 					return this.$util.Tips({ | ||||||
| 						title: res.message | 						title: '修改成功' | ||||||
| 					}, { | 					}, { | ||||||
| 						tab: 3, | 						tab: 3, | ||||||
| 						url: 1 | 						url: 1 | ||||||
| 					}); | 					}); | ||||||
| 				}).catch(err => { | 				}).catch(err => { | ||||||
| 					return that.$util.Tips({ | 					return this.$util.Tips({ | ||||||
| 						title: err | 						title: err | ||||||
| 					}); | 					}); | ||||||
| 				}); | 				}); | ||||||
|  | @ -165,7 +108,6 @@ | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
| </script> | </script> | ||||||
| 
 |  | ||||||
| <style lang="scss"> | <style lang="scss"> | ||||||
| 	page { | 	page { | ||||||
| 		background-color: #fff !important; | 		background-color: #fff !important; | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue
	
	 YunaiV
						YunaiV