From 233e4fc4f35bd00a36ee34a7fbf5e47b41db26db Mon Sep 17 00:00:00 2001
From: chenyao <1219716595@qq.com>
Date: Mon, 17 Nov 2025 09:54:44 +0800
Subject: [PATCH] feat:更新初始化地形
---
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