From 7f3fc2ea2e34c142d32b2224d00a13ca0ece45b2 Mon Sep 17 00:00:00 2001 From: xusc Date: Wed, 28 Aug 2024 09:33:32 +0800 Subject: [PATCH] =?UTF-8?q?http=E8=AF=B7=E6=B1=82=E7=B1=BB=E4=BF=AE?= =?UTF-8?q?=E6=94=B9,=E4=BA=BA=E5=91=98=E6=A1=A3=E6=A1=88=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/aspnet-core/ICS.Common/Helpers/HttpHelper.cs | 15 +++++++++++++-- .../create-or-edit-sys-user-info.vue | 2 +- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/src/aspnet-core/ICS.Common/Helpers/HttpHelper.cs b/src/aspnet-core/ICS.Common/Helpers/HttpHelper.cs index d3ab6ded..20438966 100644 --- a/src/aspnet-core/ICS.Common/Helpers/HttpHelper.cs +++ b/src/aspnet-core/ICS.Common/Helpers/HttpHelper.cs @@ -400,7 +400,7 @@ namespace ICS.Common.Helpers if (!string.IsNullOrEmpty(token)) httpClient.DefaultRequestHeaders.Add("Authorization", "Bearer " + token); httpClient.Timeout = new TimeSpan(0, 0, 60); - var response = httpClient.PostAsync(url, httpContent).Result; + HttpResponseMessage response = httpClient.PostAsync(url, httpContent).Result; result = response.Content.ReadAsStringAsync().Result; return JsonConvert.DeserializeObject(result); @@ -409,11 +409,22 @@ namespace ICS.Common.Helpers } - public static async Task HttpClientGet(string url) where T : new() + /// + /// Get请求 + /// + /// + /// + /// + /// + public static async Task HttpClientGet(string url, string token = "") where T : new() { using (HttpClient httpClient = new HttpClient()) { + if (!string.IsNullOrEmpty(token)) + httpClient.DefaultRequestHeaders.Add("Authorization", "Bearer " + token); + httpClient.Timeout = new TimeSpan(0, 0, 60); HttpResponseMessage res = httpClient.GetAsync(url).Result; + var t = res.Content.ReadAsStringAsync().Result; return JsonConvert.DeserializeObject(t); diff --git a/src/vue/src/app/sys-user-info/create-or-edit-sys-user-info/create-or-edit-sys-user-info.vue b/src/vue/src/app/sys-user-info/create-or-edit-sys-user-info/create-or-edit-sys-user-info.vue index 507721da..1aa8ab8c 100644 --- a/src/vue/src/app/sys-user-info/create-or-edit-sys-user-info/create-or-edit-sys-user-info.vue +++ b/src/vue/src/app/sys-user-info/create-or-edit-sys-user-info/create-or-edit-sys-user-info.vue @@ -190,7 +190,7 @@ export default defineComponent({ if (this.entity.id == null) { this.entity.isDeptManager = 'Y'; - + this.entity.isInspector = 'Y'; } else {