From 5808f76456ca0d40de5074f132b73a5a488e3e13 Mon Sep 17 00:00:00 2001
From: 张含笑 <zhx18749296735@163.com>
Date: Tue, 09 Dec 2025 09:12:03 +0800
Subject: [PATCH] Merge branch 'refs/heads/feature/v9.0/9.0.1' into test

---
 src/views/system/userinfo.vue |   45 ++++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 44 insertions(+), 1 deletions(-)

diff --git a/src/views/system/userinfo.vue b/src/views/system/userinfo.vue
index 2f0882c..89bc9cf 100644
--- a/src/views/system/userinfo.vue
+++ b/src/views/system/userinfo.vue
@@ -52,7 +52,7 @@
             <!--						<el-form-item label="昵称:">
 													<el-input class="ztzf-input" v-model="userInfo.name" />
 												</el-form-item>-->
-            <el-form-item label="所属单位:">
+            <el-form-item label="所属部门:">
               <el-input class="ztzf-input" v-model="userInfo.deptName" disabled />
             </el-form-item>
             <el-form-item label="手机号:">
@@ -165,6 +165,29 @@
 	}
 	return true
 }
+// 校验密码不能包含中文
+const validatePasswordNoChinese = (password) => {
+  const chineseRegex = /[\u4e00-\u9fa5]/;
+  if (chineseRegex.test(password)) {
+    ElMessage.error('密码不能包含中文字符');
+    return false;
+  }
+  return true;
+};
+// 校验密码复杂度(长度≥6位,包含字母和数字)
+const validatePasswordStrength = (password) => {
+  if (password.length < 6) {
+    ElMessage.error('密码长度不能少于6位');
+    return false;
+  }
+  // const hasLetter = /[a-zA-Z]/.test(password);
+  // const hasNumber = /\d/.test(password);
+  // if (!hasLetter || !hasNumber) {
+  //   ElMessage.error('密码需同时包含字母和数字');
+  //   return false;
+  // }
+  return true;
+};
 const passwordForm = ref({
   oldPassword: '',
   newPassword: '',
@@ -245,6 +268,26 @@
       }
     });
   } else if (checked.value === 1) {
+   // 原始密码校验
+    if (!passwordForm.value.oldPassword) {
+      ElMessage.error('请输入原始密码');
+      return;
+    }
+     // 中文校验
+    if (!validatePasswordNoChinese(passwordForm.value.newPassword)) return;
+    // 新密码校验
+    if (!passwordForm.value.newPassword) {
+      ElMessage.error('请输入新密码');
+      return;
+    }
+    // 确认密码校验
+    if (passwordForm.value.newPassword !== passwordForm.value.newPassword1) {
+      ElMessage.error('两次输入的新密码不一致');
+      return;
+    }
+   
+    // 复杂度校验
+    if (!validatePasswordStrength(passwordForm.value.newPassword)) return;
     updatePassword(
       md5(passwordForm.value.oldPassword),
       md5(passwordForm.value.newPassword),

--
Gitblit v1.9.3