From 3f73c16c051e452e86444b2d97a7415a8da8ca70 Mon Sep 17 00:00:00 2001 From: yaojn Date: Fri, 31 Oct 2025 15:36:35 +0800 Subject: [PATCH] =?UTF-8?q?-=20[=E4=BF=AE=E5=A4=8D]IP=E6=A0=A1=E9=AA=8C?= =?UTF-8?q?=E6=96=B0=E5=A2=9EIPv6=E7=9A=84=E6=AD=A3=E5=88=99=E6=A0=A1?= =?UTF-8?q?=E9=AA=8C=20=20=20-=20[=E5=85=B3=E8=81=94]#[1544202553360384]IP?= =?UTF-8?q?=E6=A0=A1=E9=AA=8C=E6=96=B0=E5=A2=9EIPv6=E7=9A=84=E6=AD=A3?= =?UTF-8?q?=E5=88=99=E6=A0=A1=E9=AA=8C=20http://192.168.0.96:8090/demo/rdm?= =?UTF-8?q?.html#/bug-detail/939050947543040/939050947543057/1544202553360?= =?UTF-8?q?384?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/resources/plugins/TsForm/TsValidtor.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/resources/plugins/TsForm/TsValidtor.js b/src/resources/plugins/TsForm/TsValidtor.js index 614291c4..1f1af1d0 100755 --- a/src/resources/plugins/TsForm/TsValidtor.js +++ b/src/resources/plugins/TsForm/TsValidtor.js @@ -94,7 +94,9 @@ let validtor = { ip: { validator: function(rule, value) { if (value != '') { - return /^(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[0-9])\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9]|0)\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9]|0)\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[0-9])$/.test(value); + const IPv6 = /^((?:[0-9A-Fa-f]{1,4}:){7}[0-9A-Fa-f]{1,4}|(?:[0-9A-Fa-f]{1,4}:){1,7}:|(?:[0-9A-Fa-f]{1,4}:){1,6}:[0-9A-Fa-f]{1,4}|(?:[0-9A-Fa-f]{1,4}:){1,5}(?::[0-9A-Fa-f]{1,4}){1,2}|(?:[0-9A-Fa-f]{1,4}:){1,4}(?::[0-9A-Fa-f]{1,4}){1,3}|(?:[0-9A-Fa-f]{1,4}:){1,3}(?::[0-9A-Fa-f]{1,4}){1,4}|(?:[0-9A-Fa-f]{1,4}:){1,2}(?::[0-9A-Fa-f]{1,4}){1,5}|[0-9A-Fa-f]{1,4}:(?:(?::[0-9A-Fa-f]{1,4}){1,6})|:(?:(?::[0-9A-Fa-f]{1,4}){1,7}|:)|fe80:(?::[0-9A-Fa-f]{0,4}){0,4})(?:%[0-9A-Za-z]{1,})?$|^::(ffff(?::0{1,4}){0,1}:){0,1}(?:25[0-5]|2[0-4]\d|[01]?\d?\d)(?:\.(?:25[0-5]|2[0-4]\d|[01]?\d?\d)){3}$/; + const IPv4 = /^(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[0-9])\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9]|0)\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9]|0)\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[0-9])$/; + return (IPv4.test(value) || IPv6.test(value)); } else { return true; } -- Gitee