| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172 | 
							- <template>
 
- 	<view class="container">
 
- 			<view class="input-content">
 
- 				<view class="cu-form-group">
 
- 					<text class="label">旧密码</text>
 
- 					<input type="password" :value="oldPwd" placeholder="请输入旧密码" placeholder-class="input-empty" maxlength="20"
 
- 					 minlength="6" data-key="oldpassword" @input="inputChange" @confirm="toLogin" />
 
- 				</view>
 
- 				<view class="cu-form-group">
 
- 					<text class="label">新密码</text>
 
- 					<input type="password" :value="pwd" placeholder="请设置新密码" placeholder-class="input-empty" maxlength="20"
 
- 					 minlength="6" data-key="password" @input="inputChange" @confirm="toLogin" />
 
- 				</view>
 
- 			</view>
 
- 			<button class="confirm-btn" @click="toLogin">修改密码</button>
 
- 	</view>
 
- </template>
 
- <script>
 
- 	export default {
 
- 		data() {
 
- 			return {
 
- 				code: '',
 
- 				phone: '',
 
- 				password: '',
 
- 				oldpassword: '',
 
- 				sending: false,
 
- 				sendTime: '获取验证码',
 
- 				count: 60,
 
- 				logining: false,
 
- 				oldPwd: '',
 
- 				pwd: ''
 
- 			}
 
- 		},
 
- 		methods: {
 
- 			sendMsg() {
 
- 				const {
 
- 					phone
 
- 				} = this;
 
- 				if (!phone) {
 
- 					this.$queue.showToast("请输入手机号");
 
- 				} else if (phone.length !== 11) {
 
- 					this.$queue.showToast("请输入正确的手机号");
 
- 				} else {
 
- 					this.$queue.showLoading("正在发送验证码...");
 
- 					this.$Request.getT('/appLogin/sendMsg/' + mobile + '/forget').then(res => {
 
- 						if (res.code === 0) {
 
- 							this.sending = true;
 
- 							this.$queue.showToast('验证码发送成功请注意查收');
 
- 							this.countDown();
 
- 							uni.hideLoading();
 
- 						} else {
 
- 							uni.hideLoading();
 
- 							uni.showModal({
 
- 								showCancel: false,
 
- 								title: '短信发送失败',
 
- 								content: res.msg ? res.msg : '请一分钟后再获取验证码'
 
- 							});
 
- 						}
 
- 					});
 
- 				}
 
- 			},
 
- 			countDown() {
 
- 				const {
 
- 					count
 
- 				} = this;
 
- 				if (count === 1) {
 
- 					this.count = 60;
 
- 					this.sending = false;
 
- 					this.sendTime = '获取验证码'
 
- 				} else {
 
- 					this.count = count - 1;
 
- 					this.sending = true;
 
- 					this.sendTime = count - 1 + '秒后重新获取';
 
- 					setTimeout(this.countDown.bind(this), 1000);
 
- 				}
 
- 			},
 
- 			inputChange(e) {
 
- 				const key = e.currentTarget.dataset.key;
 
- 				this[key] = e.detail.value;
 
- 			},
 
- 			navBack() {
 
- 				uni.navigateBack();
 
- 			},
 
- 			toLogin() {
 
- 				const {
 
- 					password,
 
- 					oldpassword
 
- 				} = this;
 
- 				if (!oldpassword) {
 
- 					this.$queue.showToast("请输入旧密码");
 
- 				} else if (oldpassword.length < 6) {
 
- 					this.$queue.showToast("旧密码位数必须大于六位");
 
- 				} else if (!password) {
 
- 					this.$queue.showToast("请设置新密码");
 
- 				} else if (password.length < 6) {
 
- 					this.$queue.showToast("新密码位数必须大于六位");
 
- 				} else {
 
- 					this.logining = true;
 
- 					this.$queue.showLoading("正在修改密码中...");
 
- 					this.$Request.post("/app/user/updatePwd", {
 
- 						pwd : password,
 
- 						oldPwd : oldpassword,
 
- 					}).then(res => {
 
- 						uni.hideLoading();
 
- 						if (res.code === 0) {
 
- 							this.$queue.showToast('密码修改成功!下次请使用新密码登录!')
 
- 							setTimeout(function(){
 
- 								uni.navigateBack()
 
- 							},1000)
 
- 						} else {
 
- 							uni.showModal({
 
- 								showCancel: false,
 
- 								title: '密码修改失败',
 
- 								content: res.msg,
 
- 							});
 
- 						}
 
- 					});
 
- 				}
 
- 			},
 
- 		},
 
- 	}
 
- </script>
 
- <style lang='scss' scoped>
 
- 	page {
 
- 		height: 100%;
 
- 		background: #F6F6F6;
 
- 	}
 
- 	.container {
 
- 		height: 100%;
 
- 		padding-top: 20rpx;
 
- 		
 
- 	}
 
- 	.label{
 
- 		width: 100rpx;
 
- 		font-weight: bold;
 
- 		font-size: 28rpx;
 
- 		color: #222222;
 
- 	}
 
- 	.cu-form-group{
 
- 		background: none!important;
 
- 	}
 
- 	.input-content {
 
- 		width: 686rpx;
 
- 		height: 164rpx;
 
- 		background: #FFFFFF;
 
- 		border-radius: 32rpx 32rpx 32rpx 32rpx;
 
- 		margin: 0 auto;
 
- 	}
 
- 	.confirm-btn {
 
- 		width: 686rpx;
 
- 		height: 100rpx;
 
- 		line-height: 100rpx;
 
- 		background: linear-gradient( 143deg, #FFE6EE 0%, #FF9AB2 100%);
 
- 		border-radius: 86rpx 86rpx 86rpx 86rpx;
 
- 		font-weight: bold;
 
- 		font-size: 32rpx;
 
- 		color: #222222;
 
- 		margin-top: 32rpx;
 
- 	}
 
- </style>
 
 
  |