From ca73a173f008c8d7a9d700bad897ca24fe2d2203 Mon Sep 17 00:00:00 2001
From: k94314517 <8417338+k94314517@user.noreply.gitee.com>
Date: 星期一, 16 十月 2023 09:29:57 +0800
Subject: [PATCH] 111

---
 minipro_standard/pages/changePassword/changePassword.vue |   45 ++++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 44 insertions(+), 1 deletions(-)

diff --git a/minipro_standard/pages/changePassword/changePassword.vue b/minipro_standard/pages/changePassword/changePassword.vue
index a975dd8..51fb0b2 100644
--- a/minipro_standard/pages/changePassword/changePassword.vue
+++ b/minipro_standard/pages/changePassword/changePassword.vue
@@ -10,6 +10,7 @@
 				<view class="password_list_item_box">
 					<input type="password" v-model="form.originalPassword" maxlength="20" placeholder="璇疯緭鍏ュ師瀵嗙爜">
 				</view>
+				<text class="password_list_item_btn" @click="forgotPassword">蹇樿瀵嗙爜</text>
 			</view>
 			<view class="password_list_item">
 				<text>鏂板瘑鐮�</text>
@@ -25,7 +26,7 @@
 			</view>
 		</view>
 		<view class="password_footer">
-			<button v-preventReClick class="password_footer_submit">
+			<button class="password_footer_submit" @click="submit">
 				<text>瀹屾垚</text>
 			</button>
 		</view>
@@ -33,6 +34,7 @@
 </template>
 
 <script>
+	import { updatePwd } from '@/util/api/PersonalAPI'
 	export default {
 		data() {
 			return {
@@ -42,6 +44,40 @@
 					confirmPassword: ''
 				}
 			};
+		},
+		methods: {
+			// 蹇樿瀵嗙爜
+			forgotPassword() {
+				uni.navigateTo({
+					url: '/pages_adjust/pages/forgotPassword/forgotPassword'
+				});
+			},
+			// 鎻愪氦淇敼
+			submit() {
+				if (!this.form.originalPassword) {
+					uni.showToast({ title: '鍘熷瘑鐮佷笉鑳戒负绌�', icon: 'none', duration: 2000 });
+				} else if (!this.form.newPassword) {
+					uni.showToast({ title: '鏂板瘑鐮佷笉鑳戒负绌�', icon: 'none', duration: 2000 });
+				} else if (!/^([a-z0-9\.\@\!\#\(/)/$\%\^\&\*\(\)]){6,20}$/i.test(this.form.newPassword)) {
+					uni.showToast({ title: '瀵嗙爜鏍煎紡涓嶆纭�', icon: 'none', duration: 2000 });
+				} else if (!this.form.confirmPassword) {
+					uni.showToast({ title: '纭瀵嗙爜涓嶈兘涓虹┖', icon: 'none', duration: 2000 });
+				} else if (this.form.newPassword !== this.form.confirmPassword) {
+					uni.showToast({ title: '涓ゆ杈撳叆鐨勫瘑鐮佷笉涓�鑷�', icon: 'none', duration: 2000 });
+				} else {
+					updatePwd({
+						newPwd: this.form.newPassword,
+						oldPwd: this.form.originalPassword
+					}).then(res => {
+						if (res.code === 200) {
+							uni.showToast({ title: '淇敼鎴愬姛', icon: 'success', duration: 2000, mask: true });
+							setTimeout(() => {
+								uni.navigateBack({ delta: 1 });
+							}, 2000)
+						}
+					})
+				}
+			}
 		}
 	}
 </script>
@@ -83,6 +119,13 @@
 	                font-weight: 400;
 	                color: #222222;
 	            }
+				.password_list_item_btn {
+					text-align: right;
+					font-size: 26rpx;
+					font-family: PingFangSC-Regular, PingFang SC;
+					font-weight: 400;
+					color: #4275FC;
+				}
 	            .password_list_item_box {
 	                display: flex;
 	                justify-content: space-between;

--
Gitblit v1.9.3