From 610855449827738d8ebbffee55365e8f192669ce Mon Sep 17 00:00:00 2001 From: zuohuaijun Date: Tue, 30 Sep 2025 10:02:56 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=98=8E1=E3=80=81=E4=BC=98=E5=8C=96?= =?UTF-8?q?=E4=B8=8B=E6=8B=89=E6=A1=86=E7=BB=84=E4=BB=B6=20=20=202?= =?UTF-8?q?=E3=80=81=E5=A2=9E=E5=8A=A0HMAC=E5=8A=A0=E5=AF=86=E7=AE=97?= =?UTF-8?q?=E6=B3=95=20=203=E3=80=81=E5=8D=87=E7=BA=A7=E4=BE=9D=E8=B5=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Admin.NET.Core/Admin.NET.Core.csproj | 16 +++--- Admin.NET/Admin.NET.Core/Utils/GM/GM.cs | 50 +++++++++++++++++++ .../Admin.NET.Test/Admin.NET.Test.csproj | 4 +- Web/package.json | 10 ++-- .../components/selector/pulldownSelecter.vue | 14 +++--- 5 files changed, 73 insertions(+), 21 deletions(-) diff --git a/Admin.NET/Admin.NET.Core/Admin.NET.Core.csproj b/Admin.NET/Admin.NET.Core/Admin.NET.Core.csproj index 85636837..71990981 100644 --- a/Admin.NET/Admin.NET.Core/Admin.NET.Core.csproj +++ b/Admin.NET/Admin.NET.Core/Admin.NET.Core.csproj @@ -27,10 +27,10 @@ - - - - + + + + @@ -39,7 +39,7 @@ - + @@ -50,14 +50,14 @@ - + - + - + diff --git a/Admin.NET/Admin.NET.Core/Utils/GM/GM.cs b/Admin.NET/Admin.NET.Core/Utils/GM/GM.cs index 9196062a..a8c85214 100644 --- a/Admin.NET/Admin.NET.Core/Utils/GM/GM.cs +++ b/Admin.NET/Admin.NET.Core/Utils/GM/GM.cs @@ -11,6 +11,7 @@ using Org.BouncyCastle.Crypto; using Org.BouncyCastle.Crypto.Digests; using Org.BouncyCastle.Crypto.Engines; using Org.BouncyCastle.Crypto.Generators; +using Org.BouncyCastle.Crypto.Macs; using Org.BouncyCastle.Crypto.Parameters; using Org.BouncyCastle.Math; using Org.BouncyCastle.Security; @@ -469,4 +470,53 @@ public class GM Arrays.Fill(iv, (byte)0); return iv; } + + /// + /// HMAC 加密 + /// + /// + /// + /// + public static byte[] Hmac(byte[] key, byte[] srcData) + { + KeyParameter keyParameter = new KeyParameter(key); + SM3Digest digest = new SM3Digest(); + HMac mac = new HMac(digest); + mac.Init(keyParameter); + mac.BlockUpdate(srcData, 0, srcData.Length); + byte[] result = new byte[mac.GetMacSize()]; + mac.DoFinal(result, 0); + return result; + } + + /// + /// 字节数组转十六进制字符串 + /// + /// + /// + public static string ByteArrayToHexString(byte[] bytes) + { + StringBuilder hex = new StringBuilder(bytes.Length * 2); + foreach (byte b in bytes) + { + hex.AppendFormat("{0:x2}", b); + } + return hex.ToString(); + } + + /// + /// 十六进制字符串转字节数组 + /// + /// + /// + public static byte[] HexStringToByteArray(string hex) + { + int length = hex.Length; + byte[] bytes = new byte[length / 2]; + for (int i = 0; i < length; i += 2) + { + bytes[i / 2] = Convert.ToByte(hex.Substring(i, 2), 16); + } + return bytes; + } } \ No newline at end of file diff --git a/Admin.NET/Admin.NET.Test/Admin.NET.Test.csproj b/Admin.NET/Admin.NET.Test/Admin.NET.Test.csproj index 3752e30b..41935c8a 100644 --- a/Admin.NET/Admin.NET.Test/Admin.NET.Test.csproj +++ b/Admin.NET/Admin.NET.Test/Admin.NET.Test.csproj @@ -14,8 +14,8 @@ - - + + compile diff --git a/Web/package.json b/Web/package.json index 5e482295..fa02264b 100644 --- a/Web/package.json +++ b/Web/package.json @@ -81,7 +81,7 @@ "vue-router": "^4.5.1", "vue-signature-pad": "^3.0.2", "vue3-tree-org": "^4.2.2", - "vxe-pc-ui": "^4.9.38", + "vxe-pc-ui": "^4.9.41", "vxe-table": "^4.16.20", "xe-utils": "^3.7.9", "xlsx-js-style": "^1.2.0" @@ -90,18 +90,18 @@ "@iconify/vue": "^5.0.0", "@plugin-web-update-notification/vite": "^2.0.2", "@types/lodash-es": "^4.17.12", - "@types/node": "^22.18.6", + "@types/node": "^22.18.7", "@types/nprogress": "^0.2.3", "@types/sortablejs": "^1.15.8", - "@typescript-eslint/eslint-plugin": "^8.44.1", - "@typescript-eslint/parser": "^8.44.1", + "@typescript-eslint/eslint-plugin": "^8.45.0", + "@typescript-eslint/parser": "^8.45.0", "@vitejs/plugin-vue": "^6.0.1", "@vitejs/plugin-vue-jsx": "^5.1.1", "@vue/compiler-sfc": "^3.5.22", "cli-progress": "^3.12.0", "code-inspector-plugin": "^1.2.10", "colors": "^1.4.0", - "dotenv": "^17.2.1", + "dotenv": "^17.2.3", "eslint": "^9.36.0", "eslint-plugin-vue": "^10.5.0", "globals": "^16.4.0", diff --git a/Web/src/components/selector/pulldownSelecter.vue b/Web/src/components/selector/pulldownSelecter.vue index 4c88c1f8..db98465c 100644 --- a/Web/src/components/selector/pulldownSelecter.vue +++ b/Web/src/components/selector/pulldownSelecter.vue @@ -291,12 +291,14 @@ const handleChange = (row: any) => { // 选择器下拉框显示隐藏事件 const selectVisibleChange = (visible: boolean) => { - if (visible) { - state.tableData.items = []; - state.tableData.total = 0; - state.tableQuery[props.keywordProp] = undefined; - handleQuery(); - } + if (!visible) return; + + state.loading = true; + state.tableData.items = []; + state.tableData.total = 0; + state.tableQuery[props.keywordProp] = undefined; + handleQuery(); + state.loading = false; }; // 设置默认选项