From 140417fcbab219cdc5b978f8c62a9156aff6279b Mon Sep 17 00:00:00 2001 From: gongjiale <942894820@qq.com> Date: Tue, 17 Dec 2024 21:13:05 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AF=86=E7=A0=81=E7=AD=96=E7=95=A5=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/OutSideServiceImpl.java | 4 +- ruoyi-ui/src/views/register.vue | 2 +- ruoyi-ui/src/views/system/user/index.vue | 47 ++++++++++++++----- 3 files changed, 38 insertions(+), 15 deletions(-) diff --git a/RuoYi-Vue-Oracle/src/main/java/com/ruoyi/project/outside/service/impl/OutSideServiceImpl.java b/RuoYi-Vue-Oracle/src/main/java/com/ruoyi/project/outside/service/impl/OutSideServiceImpl.java index dd38444..75ba235 100644 --- a/RuoYi-Vue-Oracle/src/main/java/com/ruoyi/project/outside/service/impl/OutSideServiceImpl.java +++ b/RuoYi-Vue-Oracle/src/main/java/com/ruoyi/project/outside/service/impl/OutSideServiceImpl.java @@ -108,12 +108,12 @@ public class OutSideServiceImpl implements OutSideService { SensorData sensorData = new SensorData(); sensorData.setSn(node.get("equipmentUId").asText()); sensorData.setDs(node.get("vocRtd").asText()); - sensorData.setDw(getUnitDescription(5)); + sensorData.setDw("mg/m3"); // "vocTime":"2024-10-30T07:19:20.000+0000" 转为 yyyy-MM-dd HH:mm:ss String reportTime = node.get("vocTime").asText().replace("T", " ").substring(0, 19); sensorData.setReportTime(reportTime); - sensorData.setZt(node.get("vocRtd").asInt() > 5 ? "一级报警" : "正常"); + sensorData.setZt(node.get("vocRtd").asInt() > 4 ? "一级报警" : "正常"); return sensorData; } diff --git a/ruoyi-ui/src/views/register.vue b/ruoyi-ui/src/views/register.vue index 7bf6f43..0b716cf 100644 --- a/ruoyi-ui/src/views/register.vue +++ b/ruoyi-ui/src/views/register.vue @@ -95,7 +95,7 @@ export default { ], password: [ { required: true, trigger: "blur", message: "请输入您的密码" }, - { min: 5, max: 20, message: "用户密码长度必须介于 5 和 20 之间", trigger: "blur" }, + { min: 5, max: 20, message: "用户密码长度必须介于 10 和 20 之间", trigger: "blur" }, { pattern: /^[^<>"'|\\]+$/, message: "不能包含非法字符:< > \" ' \\\ |", trigger: "blur" } ], confirmPassword: [ diff --git a/ruoyi-ui/src/views/system/user/index.vue b/ruoyi-ui/src/views/system/user/index.vue index 5723246..c5b21a5 100644 --- a/ruoyi-ui/src/views/system/user/index.vue +++ b/ruoyi-ui/src/views/system/user/index.vue @@ -374,7 +374,22 @@ export default { dicts: ['sys_normal_disable', 'sys_user_sex'], components: { Treeselect }, data() { + const equalToPassword1 = (rule, value, callback) => { + let password = this.form.password + let hasUpperCase = /[A-Z]/.test(password); + let hasLowerCase = /[a-z]/.test(password); + let hasNumber = /[0-9]/.test(password); + let hasSpecialCharacter = /[!@#$%^&*()_+\-=\[\]{};':"\\|,.<>\/?]/.test(password); + + if (!hasUpperCase || !hasLowerCase || !hasNumber || !hasSpecialCharacter) { + callback(new Error("密码10位以上,请包含大小写、特殊字符以及数字!")); + } + else { + callback(); + } + }; return { + // 遮罩层 loading: true, // 选中数组 @@ -455,8 +470,9 @@ export default { { required: true, message: "用户昵称不能为空", trigger: "blur" } ], password: [ - { required: true, message: "用户密码不能为空", trigger: "blur" }, - { min: 5, max: 20, message: '用户密码长度必须介于 5 和 20 之间', trigger: 'blur' }, + { required: true, validator: equalToPassword1, trigger: "blur" }, + // { required: true, message: "用户密码不能为空", trigger: "blur" }, + { min: 10, max: 20, message: '用户密码长度必须介于 10 和 20 之间', trigger: 'blur' }, { pattern: /^[^<>"'|\\]+$/, message: "不能包含非法字符:< > \" ' \\\ |", trigger: "blur" } ], email: [ @@ -614,18 +630,25 @@ export default { confirmButtonText: "确定", cancelButtonText: "取消", closeOnClickModal: false, - inputPattern: /^.{5,20}$/, - inputErrorMessage: "用户密码长度必须介于 5 和 20 之间", - inputValidator: (value) => { - if (/<|>|"|'|\||\\/.test(value)) { - return "不能包含非法字符:< > \" ' \\\ |" - } - }, + inputPattern: /^.{10,20}$/, + inputErrorMessage: "密码长度10-20位,包含大小写、数字以及特殊字符" }).then(({ value }) => { - resetUserPwd(row.userId, value).then(response => { - this.$modal.msgSuccess("修改成功,新密码是:" + value); + let password = value + let hasUpperCase = /[A-Z]/.test(password); + let hasLowerCase = /[a-z]/.test(password); + let hasNumber = /[0-9]/.test(password); + let hasSpecialCharacter = /[!@#$%^&*()_+\-=\[\]{};':"\\|,.<>\/?]/.test(password); + + if (!hasUpperCase || !hasLowerCase || !hasNumber || !hasSpecialCharacter) { + this.$message.error("密码不符合要求:密码长度10-20位,包含大小写、数字以及特殊字符"); + } else { + let values =encrypt(value ) + resetUserPwd(row.userId, values).then(response => { + debugger + this.$modal.msgSuccess("密码修改成功!"); }); - }).catch(() => {}); + } + }).catch(() => { }); }, /** 分配角色操作 */ handleAuthRole: function(row) {