From 682182cf67a5aa9fed34335fea22d4673f30f10c Mon Sep 17 00:00:00 2001
From: Mr.Shi <1878285526@qq.com>
Date: 星期一, 04 九月 2023 11:59:44 +0800
Subject: [PATCH] 小程序

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

diff --git a/minipro_standard/pages/changePassword/changePassword.vue b/minipro_standard/pages/changePassword/changePassword.vue
index a975dd8..311f0d2 100644
--- a/minipro_standard/pages/changePassword/changePassword.vue
+++ b/minipro_standard/pages/changePassword/changePassword.vue
@@ -25,7 +25,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 +33,7 @@
 </template>
 
 <script>
+	import { updatePwd } from '@/util/api/PersonalAPI'
 	export default {
 		data() {
 			return {
@@ -42,6 +43,38 @@
 					confirmPassword: ''
 				}
 			};
+		},
+		methods: {
+			// 蹇樿瀵嗙爜
+			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-Za-z])(?=.*\d)(?=.*[$@$!%*#?&])[A-Za-z\d$@$!%*#?&]{6,}$/.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>

--
Gitblit v1.9.3