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 Binary files /dev/null and b/maintain-ui/src/assets/qr/qr.png differ diff --git a/maintain-ui/src/views/login.vue b/maintain-ui/src/views/login.vue index cbc9c212012682ceb38de345e4cc798f64a2c228..88a03a5036eb204ad518cad3e6f5e3784bd66f7c 100644 --- a/maintain-ui/src/views/login.vue +++ b/maintain-ui/src/views/login.vue @@ -54,9 +54,21 @@ + + +
+
+
扫码下载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 79e9f906d26d82838fc3a9e5799523d48ce70300..725860da5b780f4d6326ddee85f41752a7512841 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 { } }; + +