From a22f92c215822c410ec76ea315d794cab5dab0fb Mon Sep 17 00:00:00 2001 From: lll Date: Mon, 13 Nov 2023 22:37:10 +0800 Subject: [PATCH] 1 --- src/components/AddPolicy.vue | 2 ++ src/components/IpConfiguration.vue | 14 ++++++++++++-- src/components/NetworkManagement.vue | 2 ++ src/components/ObjectManagement.vue | 18 ++++++++++-------- src/components/PolicyManagement.vue | 4 +++- 5 files changed, 29 insertions(+), 11 deletions(-) diff --git a/src/components/AddPolicy.vue b/src/components/AddPolicy.vue index 5de54c1..e201da8 100644 --- a/src/components/AddPolicy.vue +++ b/src/components/AddPolicy.vue @@ -694,6 +694,8 @@ export default { }; }, created() { + alert(this.$route.query.id, this.$store.state.type); + console.log(this.user_id, this.$store.state.type); this.GetUserAnswer(); }, mounted() {}, diff --git a/src/components/IpConfiguration.vue b/src/components/IpConfiguration.vue index 3978ebb..f5b4964 100644 --- a/src/components/IpConfiguration.vue +++ b/src/components/IpConfiguration.vue @@ -488,7 +488,7 @@ export default { ) { callback(new Error("请输入主DNS服务器地址")); } else if ( - !isValidPrimaryDNS( + !this.isValidDNSAddress( this.ippz_dns_zy1 + "." + this.ippz_dns_zy2 + @@ -503,6 +503,16 @@ export default { callback(); } }, + isValidDNSAddress(value) { + // IPv4地址的正则表达式 + const ipv4Regex = /^(\d{1,3}\.){3}\d{1,3}$/; + + // IPv6地址的正则表达式 + const ipv6Regex = /^(?:[0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}$/; + + // 检查是否是有效的IPv4或IPv6地址 + return ipv4Regex.test(value) || ipv6Regex.test(value); + }, //备用dns服务验证 validatePrimaryDNS1(rule, value, callback) { if ( @@ -517,7 +527,7 @@ export default { ) { callback(new Error("请输入备用DNS服务器地址")); } else if ( - !isValidPrimaryDNS( + !this.isValidDNSAddress( this.ippz_dns_by1 + "." + this.ippz_dns_by2 + diff --git a/src/components/NetworkManagement.vue b/src/components/NetworkManagement.vue index 6aa6ac8..92422fa 100644 --- a/src/components/NetworkManagement.vue +++ b/src/components/NetworkManagement.vue @@ -236,6 +236,8 @@ export default { } else { this.$store.commit("setType", "GYWZ_wx"); } + alert(this.user_id, this.$store.state.type); + console.log(this.user_id, this.$store.state.type); this.GetUserAnswer(); }, methods: { diff --git a/src/components/ObjectManagement.vue b/src/components/ObjectManagement.vue index 55912bc..9c65ea2 100644 --- a/src/components/ObjectManagement.vue +++ b/src/components/ObjectManagement.vue @@ -163,14 +163,16 @@ export default { }, created() { this.dialogVisible = true; - // let str = window.location.href.split("?")[1]; - // this.user_id = str.split("|")[0]; - // let type = str.split("|")[1]; - // if (type == 1) { - // this.$store.commit("setType", "GYWZ_yx"); - // } else { - // this.$store.commit("setType", "GYWZ_wx"); - // } + let str = window.location.href.split("?")[1]; + this.user_id = str.split("|")[0]; + let type = str.split("|")[1]; + if (type == 1) { + this.$store.commit("setType", "GYWZ_yx"); + } else { + this.$store.commit("setType", "GYWZ_wx"); + } + alert(this.user_id, this.$store.state.type); + console.log(this.user_id, this.$store.state.type); this.GetUserAnswer(); }, methods: { diff --git a/src/components/PolicyManagement.vue b/src/components/PolicyManagement.vue index 81d9b36..ad5c777 100644 --- a/src/components/PolicyManagement.vue +++ b/src/components/PolicyManagement.vue @@ -278,13 +278,15 @@ export default { } else { this.$store.commit("setType", "GYWZ_wx"); } + alert(this.user_id, this.$store.state.type); + console.log(this.user_id, this.$store.state.type); this.GetUserAnswer(); }, methods: { addPolicy() { this.$router.push({ name: "addstrategy", - query: { id: "USER202307301109254198" }, + query: { id: this.user_id }, }); }, async del(index, a) {