From dcd9aa2d092c304655605ed713a4819cf39db371 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E5=B8=85?= Date: Fri, 22 Aug 2025 09:32:40 +0800 Subject: [PATCH] =?UTF-8?q?1.=E4=BF=AE=E6=94=B9=E5=AF=86=E7=A0=81=E4=BC=98?= =?UTF-8?q?=E5=8C=96=EF=BC=8C=E5=A2=9E=E5=8A=A0=E5=BC=B1=E5=AF=86=E7=A0=81?= =?UTF-8?q?=E6=A0=A1=E9=AA=8C=202.=E7=99=BB=E5=BD=95=E9=A1=B5=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E6=89=AB=E7=A0=81=E4=B8=8B=E8=BD=BDAPP=E4=BA=8C?= =?UTF-8?q?=E7=BB=B4=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- maintain-ui/src/assets/qr/qr.png | Bin 0 -> 2852 bytes maintain-ui/src/views/login.vue | 61 ++++++++- .../views/system/user/profile/resetPwd.vue | 127 +++++++++++++++++- 3 files changed, 185 insertions(+), 3 deletions(-) create mode 100644 maintain-ui/src/assets/qr/qr.png diff --git a/maintain-ui/src/assets/qr/qr.png b/maintain-ui/src/assets/qr/qr.png new file mode 100644 index 0000000000000000000000000000000000000000..26631662dced59eaabfaa7c8f4e3dc5d5b355348 GIT binary patch literal 2852 zcmai0YgAKL7LL$(fk0wqCIJ($(z+Plv_Oa;P(cL5f=UZ228kkqyplo)5QrwYYFUD) z!>g4-5ygdI!qWiZmC^>KDhPo9;gOnA!y{>s5W+*4OV`YFRwsA*RS?ip;_xFAK z+dJoIke`vkE&~`0W)$Fm@Hh;%?Z(#9(*aLVlNGnYk3QM|WHJnf{Bdh-E3`pkVK9S{ zfP)70J3r;C?`&=sU&yDM8U$LL{37@|L2R*i47LBG2FAw9n{qE0d~+;I z7q;oZ*ZJf<#N!>dANbT=HvF@VhQ5qpFc?!U`L3rQuC`?$vTOKNp7-*&Da%9Hlx3o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beJa z%7Q=`?BE7=-|TW;V*iS)Geka$#}&}&CbRBE!JiRdBGBdUKuz%~jY f?EC)?pBe`d?dHd!t`D5Su@@HL8+4HE9m)D9ob0 + + +
+
+
扫码下载APP
+
+ + APP下载二维码 +
+
+
+ @@ -163,6 +175,7 @@ export default { height: 100%; background-image: url("../assets/images/login-background.jpg"); background-size: cover; + position: relative; } .title { margin: 0px auto 30px auto; @@ -216,4 +229,50 @@ export default { .login-code-img { height: 38px; } + +/* 右下角二维码样式 */ +.qr-code-container { + position: fixed; + right: 20px; + bottom: 60px; + z-index: 100; +} + +.qr-code-box { + width: 140px; + padding: 12px; + background: rgba(255, 255, 255, 0.9); + border-radius: 8px; + box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1); + text-align: center; +} + +.qr-code-title { + font-size: 14px; + font-weight: bold; + margin-bottom: 8px; + color: #333; +} + +.qr-code-image { + width: 100px; + height: 100px; + margin: 0 auto; + background-color: #f5f5f5; + display: flex; + align-items: center; + justify-content: center; + border: 1px solid #eaeaea; + + img { + max-width: 100%; + max-height: 100%; + } +} + +.qr-code-text { + font-size: 12px; + color: #666; + margin-top: 8px; +} diff --git a/maintain-ui/src/views/system/user/profile/resetPwd.vue b/maintain-ui/src/views/system/user/profile/resetPwd.vue index 79e9f90..725860d 100644 --- a/maintain-ui/src/views/system/user/profile/resetPwd.vue +++ b/maintain-ui/src/views/system/user/profile/resetPwd.vue @@ -4,7 +4,16 @@ - + +
+
+
+
+ 密码强度: {{ strengthText }} +
+ 密码必须包含大写字母、小写字母、数字和特殊字符 +
+
@@ -21,6 +30,27 @@ import { updateUserPwd } from "@/api/system/user"; export default { data() { + // 验证密码复杂度 + const validatePasswordComplexity = (rule, value, callback) => { + if (!value) { + callback(new Error("新密码不能为空")); + return; + } + + // 检查密码复杂度 + const hasLowerCase = /[a-z]/.test(value); + const hasUpperCase = /[A-Z]/.test(value); + const hasNumber = /[0-9]/.test(value); + const hasSpecialChar = /[!@#$%^&*()_+\-=\[\]{};':"\\|,.<>\/?]/.test(value); + + if (!hasLowerCase || !hasUpperCase || !hasNumber || !hasSpecialChar) { + callback(new Error("密码必须包含大小写字母、数字和特殊字符")); + return; + } + + callback(); + }; + const equalToPassword = (rule, value, callback) => { if (this.user.newPassword !== value) { callback(new Error("两次输入的密码不一致")); @@ -28,12 +58,16 @@ export default { callback(); } }; + return { user: { oldPassword: undefined, newPassword: undefined, confirmPassword: undefined }, + strengthClass: 'weak', + strengthText: '弱', + isPasswordStrong: false, // 表单校验 rules: { oldPassword: [ @@ -41,7 +75,8 @@ export default { ], newPassword: [ { required: true, message: "新密码不能为空", trigger: "blur" }, - { min: 6, max: 20, message: "长度在 6 到 20 个字符", trigger: "blur" } + { min: 8, message: "密码长度至少为8个字符", trigger: "blur" }, + { validator: validatePasswordComplexity, trigger: "blur" } ], confirmPassword: [ { required: true, message: "确认密码不能为空", trigger: "blur" }, @@ -51,9 +86,56 @@ export default { }; }, methods: { + // 检查密码强度 + checkPasswordStrength() { + if (!this.user.newPassword) { + this.strengthClass = 'weak'; + this.strengthText = '弱'; + this.isPasswordStrong = false; + return; + } + + let strength = 0; + + // 长度检查 + if (this.user.newPassword.length >= 8) strength++; + + // 包含小写字母 + if (/[a-z]/.test(this.user.newPassword)) strength++; + + // 包含大写字母 + if (/[A-Z]/.test(this.user.newPassword)) strength++; + + // 包含数字 + if (/[0-9]/.test(this.user.newPassword)) strength++; + + // 包含特殊字符 + if (/[!@#$%^&*()_+\-=\[\]{};':"\\|,.<>\/?]/.test(this.user.newPassword)) strength++; + + // 设置强度等级 + if (strength <= 2) { + this.strengthClass = 'weak'; + this.strengthText = '弱'; + this.isPasswordStrong = false; + } else if (strength <= 4) { + this.strengthClass = 'medium'; + this.strengthText = '中'; + this.isPasswordStrong = false; + } else { + this.strengthClass = 'strong'; + this.strengthText = '强'; + this.isPasswordStrong = true; + } + }, submit() { this.$refs["form"].validate(valid => { if (valid) { + // 再次确认密码强度 + if (!this.isPasswordStrong) { + this.$message.error("密码强度不足,请确保包含大小写字母、数字和特殊字符"); + return; + } + updateUserPwd(this.user.oldPassword, this.user.newPassword).then(response => { this.$modal.msgSuccess("修改成功"); }); @@ -66,3 +148,44 @@ export default { } }; + + -- 2.22.0