From 43b48fc9ae1f84d01e75a167b87037274d829124 Mon Sep 17 00:00:00 2001 From: Argo-2016 Date: Sun, 9 Feb 2020 13:28:21 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20Blazor=20=E7=A8=8B=E5=BA=8F=E5=BC=82?= =?UTF-8?q?=E5=B8=B8=E9=A1=B5=E9=9D=A2=E5=A2=9E=E5=8A=A0=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E6=97=A5=E5=BF=97=E6=98=8E=E7=BB=86=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Pages/Views/Admin/Exceptions.razor | 21 ++++++++++++ .../Pages/Views/Components/ExceptionsBase.cs | 34 +++++++++++++++++++ 2 files changed, 55 insertions(+) diff --git a/src/admin/Bootstrap.Admin/Pages/Views/Admin/Exceptions.razor b/src/admin/Bootstrap.Admin/Pages/Views/Admin/Exceptions.razor index 7351be13..07c79d70 100644 --- a/src/admin/Bootstrap.Admin/Pages/Views/Admin/Exceptions.razor +++ b/src/admin/Bootstrap.Admin/Pages/Views/Admin/Exceptions.razor @@ -30,3 +30,24 @@ + + + +
+
+ @foreach(var item in Items) + { +
+ @item +
+ } +
+
+
+ + + +
diff --git a/src/admin/Bootstrap.Admin/Pages/Views/Components/ExceptionsBase.cs b/src/admin/Bootstrap.Admin/Pages/Views/Components/ExceptionsBase.cs index a9d71824..32c7e24d 100644 --- a/src/admin/Bootstrap.Admin/Pages/Views/Components/ExceptionsBase.cs +++ b/src/admin/Bootstrap.Admin/Pages/Views/Components/ExceptionsBase.cs @@ -3,6 +3,7 @@ using Bootstrap.Admin.Pages.Extensions; using Bootstrap.DataAccess; using Microsoft.AspNetCore.Components; using System; +using System.Collections.Generic; namespace Bootstrap.Admin.Pages.Views.Admin.Components { @@ -50,10 +51,43 @@ namespace Bootstrap.Admin.Pages.Views.Admin.Components } + /// + /// 获得 错误日志文件集合 + /// + protected IEnumerable Items { get; set; } = new string[0]; + + private bool show; /// /// 显示异常明细方法 /// protected void ShowDetail() + { + Items = ExceptionsHelper.RetrieveLogFiles(); + show = true; + StateHasChanged(); + } + + /// + /// OnAfterRender 方法 + /// + protected override void OnAfterRender(bool firstRender) + { + if (show) + { + show = false; + Modal?.Toggle(); + } + } + + /// + /// 获得/设置 Modal 实例 + /// + protected ModalBase? Modal { get; set; } + + /// + /// 显示指定文件内容明细 + /// + protected void ShowLog(string fileName) { }