From f26f29d84e0a68831a6af14dab3eec5500496d2e Mon Sep 17 00:00:00 2001
From: spring <2396852758@qq.com>
Date: 星期三, 28 五月 2025 16:48:52 +0800
Subject: [PATCH] 初始化项目

---
 pages/sys/user/pwd.vue |  121 ++++++++++++++++++++++++++++++++++++++++
 1 files changed, 121 insertions(+), 0 deletions(-)

diff --git a/pages/sys/user/pwd.vue b/pages/sys/user/pwd.vue
new file mode 100644
index 0000000..9309e5e
--- /dev/null
+++ b/pages/sys/user/pwd.vue
@@ -0,0 +1,121 @@
+<template>
+	<view class="wrap">
+		<u-form class="form" :model="model" :rules="rules" ref="uForm">
+			<u-form-item label="鏃у瘑鐮�" prop="oldPassword" label-width="180">
+				<u-input type="password" v-model="model.password" placeholder="璇疯緭鍏ユ棫瀵嗙爜"></u-input>
+			</u-form-item>
+			<u-form-item label="鏂板瘑鐮�" prop="newPassword" label-width="180">
+				<u-input type="password" v-model="model.newpassword1" placeholder="璇疯緭鍏ユ柊瀵嗙爜"></u-input>
+			</u-form-item>
+			<u-form-item label="纭瀵嗙爜" prop="confirmNewPassword" label-width="180">
+				<u-input type="password" v-model="model.newpassword2" placeholder="璇风‘璁ゆ柊瀵嗙爜"></u-input>
+			</u-form-item>
+		</u-form>
+		<view class="form-footer">
+			<u-button class="btn" type="primary" @click="submit">鎻愪氦</u-button>
+      <u-button class="btn" type="default" @click="cancel">鍏抽棴</u-button>
+		</view>
+	</view>
+</template>
+<script>
+/**
+ * Copyright (c) 2013-Now http://jeesite.com All rights reserved.
+ */
+export default {
+	data() {
+		return {
+			model: {
+        password: '',
+        newpassword1: '',
+        newpassword2: ''
+			},
+			rules: {
+        password: [
+					{
+						required: true,
+						message: '璇疯緭鍏ユ棫瀵嗙爜',
+						trigger: ['change','blur'],
+					}
+				],
+        newpassword1: [
+					{
+						required: true,
+						message: '璇疯緭鍏ユ柊瀵嗙爜',
+						trigger: ['change','blur'],
+					},
+					{
+						pattern: /^(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Za-z]+\S{5,12}$/,
+						message: '闇�鍚屾椂鍚湁瀛楁瘝鍜屾暟瀛楋紝闀垮害鍦�6-12涔嬮棿',
+						trigger: ['change','blur'],
+					}
+				],
+        newpassword2: [
+					{
+						required: true,
+						message: '璇烽噸鏂拌緭鍏ュ瘑鐮�',
+						trigger: ['change','blur'],
+					},
+					{
+						validator: (rule, value, callback) => {
+							return value === this.model.newpassword1;
+						},
+						message: '涓ゆ杈撳叆鐨勫瘑鐮佷笉鐩哥瓑',
+						trigger: ['change','blur'],
+					}
+				],
+			}
+		};
+	},
+	onReady() {
+		this.$refs.uForm.setRules(this.rules);
+	},
+	methods: {
+		submit() {
+			this.$refs.uForm.validate(valid => {
+				if (valid) {
+				  //淇敼瀵嗙爜鏃舵惡甯︿笂userid涓巙sername
+					this.$u.api.user.updateUserInfo({
+            userId:this.vuex_userId,
+            username:this.vuex_username,
+            password: this.model.password,
+            newpassword1: this.model.newpassword1
+					}).then(res => {
+					  let temp = this
+						uni.showModal({
+							title: '鎻愮ず',
+							content: '淇敼瀵嗙爜鎴愬姛,璇烽噸鏂扮櫥褰�.',
+							showCancel: false,
+							success: function () {
+                temp.$u.api.logout().then(res => {
+                  //娓呯┖瀛樺偍淇℃伅
+                  temp.$u.vuex('vuex_token', '')
+                  temp.$u.vuex('vuex_refresh_token','')
+                  temp.$u.vuex('vuex_username', '')
+                  temp.$u.vuex('vuex_userId', '')
+                  temp.$u.vuex('vuex_client_id', '')
+                  temp.$u.vuex('vuex_user',{})
+
+                  setTimeout(() => {
+                    uni.reLaunch({
+                      url: '/pages/sys/login/index'
+                    });
+                  }, 500);
+
+                });
+							}
+						});
+					});
+				} else {
+					this.$u.toast('鎮ㄥ~鍐欑殑淇℃伅鏈夎锛岃鏍规嵁鎻愮ず淇銆�');
+				}
+			});
+		},
+		cancel() {
+			uni.navigateBack();
+		}
+	}
+};
+</script>
+<style lang="scss">
+
+</style>

--
Gitblit v1.9.3