From f03da0951912efb9eeb2e7063c8070414d7e45c4 Mon Sep 17 00:00:00 2001 From: iamshen Date: Thu, 25 Apr 2024 17:50:05 +0800 Subject: [PATCH 1/2] Add web admin --- DaprTool.Solution.sln | 18 +- DaprTool.Solution.sln.DotSettings | 11 +- Directory.Packages.props | 27 +- .../AppDataConnectionExtensions.cs | 6 +- .../Ordering.Infrastructure.Repository.xml | 4 +- .../Ordering.Api/ProgramExtensions.cs | 2 +- .../WebAdmin.Client/Pages/Counter.razor | 21 + src/Web/WebAdmin/WebAdmin.Client/Program.cs | 24 + .../WebAdmin.Client/WebAdmin.Client.csproj | 28 ++ .../WebAdmin.Client/WebAdmin.Client.xml | 8 + .../WebAdmin/WebAdmin.Client/_Imports.razor | 10 + .../wwwroot/appsettings.Development.json | 13 + .../WebAdmin.Client/wwwroot/appsettings.json | 8 + .../WebAdmin/WebAdmin/Components/App.razor | 26 ++ .../Components/Layout/MainLayout.razor | 42 ++ .../Components/Layout/MainLayout.razor.css | 31 ++ .../Components/Layout/MainSearch.razor | 24 + .../Components/Layout/MainSearch.razor.cs | 54 +++ .../WebAdmin/Components/Layout/NavMenu.razor | 23 + .../Components/Layout/NavMenu.razor.css | 105 +++++ .../Components/Layout/NavMenuItem.razor | 36 ++ .../Components/Pages/CustomerLevels.razor | 3 + .../Components/Pages/CustomerList.razor | 52 +++ .../WebAdmin/Components/Pages/Error.razor | 36 ++ .../WebAdmin/Components/Pages/Home.razor | 45 ++ .../Components/Pages/PurchaseOrder.razor | 81 ++++ .../WebAdmin/WebAdmin/Components/Routes.razor | 6 + .../Components/Shared/CultureSelector.razor | 32 ++ .../Shared/CultureSelector.razor.cs | 52 +++ .../Shared/CultureSelector.razor.css | 3 + .../WebAdmin/Components/Shared/CustomIcons.cs | 13 + .../WebAdmin/Components/Shared/NavItem.cs | 47 ++ .../WebAdmin/Components/Shared/NavProvider.cs | 172 +++++++ .../Components/Shared/SiteLinks.razor | 23 + .../Components/Shared/SiteLinks.razor.css | 4 + .../Components/Shared/SiteSettings.razor | 8 + .../Components/Shared/SiteSettings.razor.cs | 24 + .../Components/Shared/SiteSettingsPanel.razor | 76 ++++ .../Shared/SiteSettingsPanel.razor.cs | 80 ++++ .../Components/Shared/UserProfile.razor | 11 + .../Components/Shared/UserProfile.razor.css | 5 + .../WebAdmin/Components/_Imports.razor | 19 + .../WebAdmin/Configurations/AdminUiOptions.cs | 102 +++++ .../Configurations/ConfigurationConsts.cs | 6 + .../WebAdmin/Controllers/CultureController.cs | 18 + .../Infrastructure/AppVersionService.cs | 27 ++ .../Infrastructure/CacheStorageAccessor.cs | 96 ++++ .../Infrastructure/IAppVersionService.cs | 9 + src/Web/WebAdmin/WebAdmin/Program.cs | 84 ++++ .../WebAdmin/Properties/launchSettings.json | 25 ++ .../Resources/Components/Layout/NavMenu.cs | 5 + .../Components/Layout/NavMenu.en.resx | 161 +++++++ .../Components/Layout/NavMenu.zh-Hans.resx | 161 +++++++ .../Components/Pages/CustomerList.en.resx | 123 +++++ .../Pages/CustomerList.zh-Hans.resx | 123 +++++ .../Resources/Components/Pages/Home.en.resx | 123 +++++ .../Components/Pages/Home.zh-Hans.resx | 123 +++++ src/Web/WebAdmin/WebAdmin/WebAdmin.csproj | 45 ++ src/Web/WebAdmin/WebAdmin/WebAdmin.xml | 110 +++++ .../WebAdmin/appsettings.Development.json | 49 ++ src/Web/WebAdmin/WebAdmin/appsettings.json | 9 + src/Web/WebAdmin/WebAdmin/wwwroot/app.css | 425 ++++++++++++++++++ src/Web/WebAdmin/WebAdmin/wwwroot/favicon.png | Bin 0 -> 1148 bytes .../wwwroot/js/CacheStorageAccessor.js | 91 ++++ .../Base/DbDependencySetupFixture.cs | 4 +- 65 files changed, 3217 insertions(+), 15 deletions(-) create mode 100644 src/Web/WebAdmin/WebAdmin.Client/Pages/Counter.razor create mode 100644 src/Web/WebAdmin/WebAdmin.Client/Program.cs create mode 100644 src/Web/WebAdmin/WebAdmin.Client/WebAdmin.Client.csproj create mode 100644 src/Web/WebAdmin/WebAdmin.Client/WebAdmin.Client.xml create mode 100644 src/Web/WebAdmin/WebAdmin.Client/_Imports.razor create mode 100644 src/Web/WebAdmin/WebAdmin.Client/wwwroot/appsettings.Development.json create mode 100644 src/Web/WebAdmin/WebAdmin.Client/wwwroot/appsettings.json create mode 100644 src/Web/WebAdmin/WebAdmin/Components/App.razor create mode 100644 src/Web/WebAdmin/WebAdmin/Components/Layout/MainLayout.razor create mode 100644 src/Web/WebAdmin/WebAdmin/Components/Layout/MainLayout.razor.css create mode 100644 src/Web/WebAdmin/WebAdmin/Components/Layout/MainSearch.razor create mode 100644 src/Web/WebAdmin/WebAdmin/Components/Layout/MainSearch.razor.cs create mode 100644 src/Web/WebAdmin/WebAdmin/Components/Layout/NavMenu.razor create mode 100644 src/Web/WebAdmin/WebAdmin/Components/Layout/NavMenu.razor.css create mode 100644 src/Web/WebAdmin/WebAdmin/Components/Layout/NavMenuItem.razor create mode 100644 src/Web/WebAdmin/WebAdmin/Components/Pages/CustomerLevels.razor create mode 100644 src/Web/WebAdmin/WebAdmin/Components/Pages/CustomerList.razor create mode 100644 src/Web/WebAdmin/WebAdmin/Components/Pages/Error.razor create mode 100644 src/Web/WebAdmin/WebAdmin/Components/Pages/Home.razor create mode 100644 src/Web/WebAdmin/WebAdmin/Components/Pages/PurchaseOrder.razor create mode 100644 src/Web/WebAdmin/WebAdmin/Components/Routes.razor create mode 100644 src/Web/WebAdmin/WebAdmin/Components/Shared/CultureSelector.razor create mode 100644 src/Web/WebAdmin/WebAdmin/Components/Shared/CultureSelector.razor.cs create mode 100644 src/Web/WebAdmin/WebAdmin/Components/Shared/CultureSelector.razor.css create mode 100644 src/Web/WebAdmin/WebAdmin/Components/Shared/CustomIcons.cs create mode 100644 src/Web/WebAdmin/WebAdmin/Components/Shared/NavItem.cs create mode 100644 src/Web/WebAdmin/WebAdmin/Components/Shared/NavProvider.cs create mode 100644 src/Web/WebAdmin/WebAdmin/Components/Shared/SiteLinks.razor create mode 100644 src/Web/WebAdmin/WebAdmin/Components/Shared/SiteLinks.razor.css create mode 100644 src/Web/WebAdmin/WebAdmin/Components/Shared/SiteSettings.razor create mode 100644 src/Web/WebAdmin/WebAdmin/Components/Shared/SiteSettings.razor.cs create mode 100644 src/Web/WebAdmin/WebAdmin/Components/Shared/SiteSettingsPanel.razor create mode 100644 src/Web/WebAdmin/WebAdmin/Components/Shared/SiteSettingsPanel.razor.cs create mode 100644 src/Web/WebAdmin/WebAdmin/Components/Shared/UserProfile.razor create mode 100644 src/Web/WebAdmin/WebAdmin/Components/Shared/UserProfile.razor.css create mode 100644 src/Web/WebAdmin/WebAdmin/Components/_Imports.razor create mode 100644 src/Web/WebAdmin/WebAdmin/Configurations/AdminUiOptions.cs create mode 100644 src/Web/WebAdmin/WebAdmin/Configurations/ConfigurationConsts.cs create mode 100644 src/Web/WebAdmin/WebAdmin/Controllers/CultureController.cs create mode 100644 src/Web/WebAdmin/WebAdmin/Infrastructure/AppVersionService.cs create mode 100644 src/Web/WebAdmin/WebAdmin/Infrastructure/CacheStorageAccessor.cs create mode 100644 src/Web/WebAdmin/WebAdmin/Infrastructure/IAppVersionService.cs create mode 100644 src/Web/WebAdmin/WebAdmin/Program.cs create mode 100644 src/Web/WebAdmin/WebAdmin/Properties/launchSettings.json create mode 100644 src/Web/WebAdmin/WebAdmin/Resources/Components/Layout/NavMenu.cs create mode 100644 src/Web/WebAdmin/WebAdmin/Resources/Components/Layout/NavMenu.en.resx create mode 100644 src/Web/WebAdmin/WebAdmin/Resources/Components/Layout/NavMenu.zh-Hans.resx create mode 100644 src/Web/WebAdmin/WebAdmin/Resources/Components/Pages/CustomerList.en.resx create mode 100644 src/Web/WebAdmin/WebAdmin/Resources/Components/Pages/CustomerList.zh-Hans.resx create mode 100644 src/Web/WebAdmin/WebAdmin/Resources/Components/Pages/Home.en.resx create mode 100644 src/Web/WebAdmin/WebAdmin/Resources/Components/Pages/Home.zh-Hans.resx create mode 100644 src/Web/WebAdmin/WebAdmin/WebAdmin.csproj create mode 100644 src/Web/WebAdmin/WebAdmin/WebAdmin.xml create mode 100644 src/Web/WebAdmin/WebAdmin/appsettings.Development.json create mode 100644 src/Web/WebAdmin/WebAdmin/appsettings.json create mode 100644 src/Web/WebAdmin/WebAdmin/wwwroot/app.css create mode 100644 src/Web/WebAdmin/WebAdmin/wwwroot/favicon.png create mode 100644 src/Web/WebAdmin/WebAdmin/wwwroot/js/CacheStorageAccessor.js diff --git a/DaprTool.Solution.sln b/DaprTool.Solution.sln index 116fa3f..c71afb4 100644 --- a/DaprTool.Solution.sln +++ b/DaprTool.Solution.sln @@ -115,9 +115,13 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SampleInterfaces", "samples EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Ordering.Domain.Interfaces", "src\Services\Ordering\Domain\Ordering.Domain.Interfaces\Ordering.Domain.Interfaces.csproj", "{88C29601-0AA3-4751-9AF2-65F93743AA5D}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Dependency", "src\BuildingBlocks\Dependency\Dependency.csproj", "{631B0704-ED1C-444A-95AB-E52952756F43}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Dependency", "src\BuildingBlocks\Dependency\Dependency.csproj", "{631B0704-ED1C-444A-95AB-E52952756F43}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Validation", "src\BuildingBlocks\Validation\Validation.csproj", "{7449D8D4-0F2A-4D35-BC2F-0DEF40833C91}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Validation", "src\BuildingBlocks\Validation\Validation.csproj", "{7449D8D4-0F2A-4D35-BC2F-0DEF40833C91}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WebAdmin", "src\Web\WebAdmin\WebAdmin\WebAdmin.csproj", "{20F4D5A5-8047-4ACA-B8A0-6F1EB2D2F5B9}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WebAdmin.Client", "src\Web\WebAdmin\WebAdmin.Client\WebAdmin.Client.csproj", "{8E19ECB4-9DC8-45A9-95F6-AB0E1D5D1A4B}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -209,6 +213,14 @@ Global {7449D8D4-0F2A-4D35-BC2F-0DEF40833C91}.Debug|Any CPU.Build.0 = Debug|Any CPU {7449D8D4-0F2A-4D35-BC2F-0DEF40833C91}.Release|Any CPU.ActiveCfg = Release|Any CPU {7449D8D4-0F2A-4D35-BC2F-0DEF40833C91}.Release|Any CPU.Build.0 = Release|Any CPU + {20F4D5A5-8047-4ACA-B8A0-6F1EB2D2F5B9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {20F4D5A5-8047-4ACA-B8A0-6F1EB2D2F5B9}.Debug|Any CPU.Build.0 = Debug|Any CPU + {20F4D5A5-8047-4ACA-B8A0-6F1EB2D2F5B9}.Release|Any CPU.ActiveCfg = Release|Any CPU + {20F4D5A5-8047-4ACA-B8A0-6F1EB2D2F5B9}.Release|Any CPU.Build.0 = Release|Any CPU + {8E19ECB4-9DC8-45A9-95F6-AB0E1D5D1A4B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {8E19ECB4-9DC8-45A9-95F6-AB0E1D5D1A4B}.Debug|Any CPU.Build.0 = Debug|Any CPU + {8E19ECB4-9DC8-45A9-95F6-AB0E1D5D1A4B}.Release|Any CPU.ActiveCfg = Release|Any CPU + {8E19ECB4-9DC8-45A9-95F6-AB0E1D5D1A4B}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -257,6 +269,8 @@ Global {88C29601-0AA3-4751-9AF2-65F93743AA5D} = {7910C4F6-E2F6-4309-BC0F-45285E1124D7} {631B0704-ED1C-444A-95AB-E52952756F43} = {121D78F3-3F0F-4F00-B2C9-3C797653C951} {7449D8D4-0F2A-4D35-BC2F-0DEF40833C91} = {121D78F3-3F0F-4F00-B2C9-3C797653C951} + {20F4D5A5-8047-4ACA-B8A0-6F1EB2D2F5B9} = {6720D68A-1AF5-48BA-8CB5-349E70E151B0} + {8E19ECB4-9DC8-45A9-95F6-AB0E1D5D1A4B} = {6720D68A-1AF5-48BA-8CB5-349E70E151B0} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {CE377903-BDA1-4347-BEC2-62ED2F807EE3} diff --git a/DaprTool.Solution.sln.DotSettings b/DaprTool.Solution.sln.DotSettings index 5447d4e..8541c3c 100644 --- a/DaprTool.Solution.sln.DotSettings +++ b/DaprTool.Solution.sln.DotSettings @@ -1,15 +1,24 @@  True True + True True + True True True + True + True + True + True True + True True True True True True + True True True - True \ No newline at end of file + True + True \ No newline at end of file diff --git a/Directory.Packages.props b/Directory.Packages.props index fec2624..9a69802 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -15,10 +15,18 @@ - - - + + + + + + + + + + + @@ -26,19 +34,30 @@ + + + + + + + + + - + + + diff --git a/src/Services/Ordering/Infrastructure/Ordering.Infrastructure.Repository/AppDataConnectionExtensions.cs b/src/Services/Ordering/Infrastructure/Ordering.Infrastructure.Repository/AppDataConnectionExtensions.cs index 4fa5878..f98ecb7 100644 --- a/src/Services/Ordering/Infrastructure/Ordering.Infrastructure.Repository/AppDataConnectionExtensions.cs +++ b/src/Services/Ordering/Infrastructure/Ordering.Infrastructure.Repository/AppDataConnectionExtensions.cs @@ -34,7 +34,7 @@ public static class AppDataConnectionExtensions /// /// /// - public static void AddAppDataConnection(this IServiceCollection services, string connectionString) + public static void AddOrderAppDataConnection(this IServiceCollection services, string connectionString) { if (string.IsNullOrEmpty(connectionString)) throw new ArgumentException("connectionString can not be null", nameof(connectionString)); @@ -53,8 +53,8 @@ public static class AppDataConnectionExtensions /// /// /// - public static void AddAppDataConnection(this IServiceCollection services, IConfiguration configuration) + public static void AddOrderAppDataConnection(this IServiceCollection services, IConfiguration configuration) { - services.AddAppDataConnection(configuration.GetConnectionString(DaprConstants.Ordering.AppId)!); + services.AddOrderAppDataConnection(configuration.GetConnectionString(DaprConstants.Ordering.AppId)!); } } \ No newline at end of file diff --git a/src/Services/Ordering/Infrastructure/Ordering.Infrastructure.Repository/Ordering.Infrastructure.Repository.xml b/src/Services/Ordering/Infrastructure/Ordering.Infrastructure.Repository/Ordering.Infrastructure.Repository.xml index 0d4934b..05928c5 100644 --- a/src/Services/Ordering/Infrastructure/Ordering.Infrastructure.Repository/Ordering.Infrastructure.Repository.xml +++ b/src/Services/Ordering/Infrastructure/Ordering.Infrastructure.Repository/Ordering.Infrastructure.Repository.xml @@ -104,7 +104,7 @@ - + 注册 DataConnection @@ -113,7 +113,7 @@ - + 注册 DataConnection diff --git a/src/Services/Ordering/Presentation/Ordering.Api/ProgramExtensions.cs b/src/Services/Ordering/Presentation/Ordering.Api/ProgramExtensions.cs index a232a72..d2ae6f6 100644 --- a/src/Services/Ordering/Presentation/Ordering.Api/ProgramExtensions.cs +++ b/src/Services/Ordering/Presentation/Ordering.Api/ProgramExtensions.cs @@ -17,6 +17,6 @@ public static class ProgramExtensions // 注册 应用配置 builder.Services.Configure(builder.Configuration); // 注册 业务数据库 - builder.Services.AddAppDataConnection(builder.Configuration); + builder.Services.AddOrderAppDataConnection(builder.Configuration); } } \ No newline at end of file diff --git a/src/Web/WebAdmin/WebAdmin.Client/Pages/Counter.razor b/src/Web/WebAdmin/WebAdmin.Client/Pages/Counter.razor new file mode 100644 index 0000000..36b7980 --- /dev/null +++ b/src/Web/WebAdmin/WebAdmin.Client/Pages/Counter.razor @@ -0,0 +1,21 @@ +@page "/counter" +@rendermode InteractiveAuto + +Counter + +

Counter

+ +
+ Current count: @currentCount +
+ +Click me + +@code { + private int currentCount = 0; + + private void IncrementCount() + { + currentCount++; + } +} diff --git a/src/Web/WebAdmin/WebAdmin.Client/Program.cs b/src/Web/WebAdmin/WebAdmin.Client/Program.cs new file mode 100644 index 0000000..9cd5f49 --- /dev/null +++ b/src/Web/WebAdmin/WebAdmin.Client/Program.cs @@ -0,0 +1,24 @@ +using System.Globalization; +using Microsoft.AspNetCore.Components.WebAssembly.Hosting; +using Microsoft.FluentUI.AspNetCore.Components; +using Microsoft.JSInterop; + +var builder = WebAssemblyHostBuilder.CreateDefault(args); + +builder.Services.AddFluentUIComponents(); +builder.Services.AddLocalization(opt => opt.ResourcesPath = "Resources"); + +var host = builder.Build(); + +const string defaultCulture = "en"; +var js = host.Services.GetRequiredService(); +var result = await js.InvokeAsync("blazorCulture.get"); +var culture = CultureInfo.GetCultureInfo(result ?? defaultCulture); + +if (result == null) await js.InvokeVoidAsync("blazorCulture.set", defaultCulture); + +CultureInfo.DefaultThreadCurrentCulture = culture; +CultureInfo.DefaultThreadCurrentUICulture = culture; + + +await host.RunAsync(); \ No newline at end of file diff --git a/src/Web/WebAdmin/WebAdmin.Client/WebAdmin.Client.csproj b/src/Web/WebAdmin/WebAdmin.Client/WebAdmin.Client.csproj new file mode 100644 index 0000000..5e7aadc --- /dev/null +++ b/src/Web/WebAdmin/WebAdmin.Client/WebAdmin.Client.csproj @@ -0,0 +1,28 @@ + + + + net8.0 + enable + enable + true + Default + true + + + + + + + + + + + + PreserveNewest + + + PreserveNewest + + + + diff --git a/src/Web/WebAdmin/WebAdmin.Client/WebAdmin.Client.xml b/src/Web/WebAdmin/WebAdmin.Client/WebAdmin.Client.xml new file mode 100644 index 0000000..46229ea --- /dev/null +++ b/src/Web/WebAdmin/WebAdmin.Client/WebAdmin.Client.xml @@ -0,0 +1,8 @@ + + + + WebAdmin.Client + + + + diff --git a/src/Web/WebAdmin/WebAdmin.Client/_Imports.razor b/src/Web/WebAdmin/WebAdmin.Client/_Imports.razor new file mode 100644 index 0000000..a97f169 --- /dev/null +++ b/src/Web/WebAdmin/WebAdmin.Client/_Imports.razor @@ -0,0 +1,10 @@ +@using System.Net.Http +@using System.Net.Http.Json +@using Microsoft.AspNetCore.Components.Forms +@using Microsoft.AspNetCore.Components.Routing +@using Microsoft.AspNetCore.Components.Web +@using static Microsoft.AspNetCore.Components.Web.RenderMode +@using Microsoft.AspNetCore.Components.Web.Virtualization +@using Microsoft.JSInterop +@using Microsoft.FluentUI.AspNetCore.Components +@using WebAdmin.Client diff --git a/src/Web/WebAdmin/WebAdmin.Client/wwwroot/appsettings.Development.json b/src/Web/WebAdmin/WebAdmin.Client/wwwroot/appsettings.Development.json new file mode 100644 index 0000000..2f85d82 --- /dev/null +++ b/src/Web/WebAdmin/WebAdmin.Client/wwwroot/appsettings.Development.json @@ -0,0 +1,13 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.AspNetCore": "Warning" + } + }, + "ConnectionStrings": { + "Catalog": "Server=192.168.8.112;Port=5432;Database=dapr_catalog;User Id=dapr;Password=Local@Db;Pooling=true;MaxPoolSize=100;", + "Identity": "Server=192.168.8.112;Port=5432;Database=dapr_identity;User Id=dapr;Password=Local@Db;Pooling=true;MaxPoolSize=100;", + "Ordering": "Server=192.168.8.112;Port=5432;Database=dapr_ordering;User Id=dapr;Password=Local@Db;Pooling=true;MaxPoolSize=100;" + } +} diff --git a/src/Web/WebAdmin/WebAdmin.Client/wwwroot/appsettings.json b/src/Web/WebAdmin/WebAdmin.Client/wwwroot/appsettings.json new file mode 100644 index 0000000..0c208ae --- /dev/null +++ b/src/Web/WebAdmin/WebAdmin.Client/wwwroot/appsettings.json @@ -0,0 +1,8 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.AspNetCore": "Warning" + } + } +} diff --git a/src/Web/WebAdmin/WebAdmin/Components/App.razor b/src/Web/WebAdmin/WebAdmin/Components/App.razor new file mode 100644 index 0000000..c89570b --- /dev/null +++ b/src/Web/WebAdmin/WebAdmin/Components/App.razor @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/src/Web/WebAdmin/WebAdmin/Components/Layout/MainLayout.razor b/src/Web/WebAdmin/WebAdmin/Components/Layout/MainLayout.razor new file mode 100644 index 0000000..8f91d3d --- /dev/null +++ b/src/Web/WebAdmin/WebAdmin/Components/Layout/MainLayout.razor @@ -0,0 +1,42 @@ +@inherits LayoutComponentBase + + + + + DaprTool-Solution + + + + + + + + + + + + + +
+ @Body +
+
+ + + + + + +
+ + github + + Copyright Ⓒ 2024 DaprTool-Solution + +
+ +
+ An unhandled error has occurred. + Reload + 🗙 +
\ No newline at end of file diff --git a/src/Web/WebAdmin/WebAdmin/Components/Layout/MainLayout.razor.css b/src/Web/WebAdmin/WebAdmin/Components/Layout/MainLayout.razor.css new file mode 100644 index 0000000..669ad4d --- /dev/null +++ b/src/Web/WebAdmin/WebAdmin/Components/Layout/MainLayout.razor.css @@ -0,0 +1,31 @@ +.siteheader { + background-color: var(--neutral-layer-4) !important; + border-bottom: calc(var(--stroke-width) * 2px) solid var(--accent-fill-rest); + margin-bottom: 0 !important; +} + +.siteheader .logo { + width: 108px; + height: 23px; + grid-column: 1; +} + +.siteheader .search { + display: flex; + align-items: center; + padding-right: 20px; +} + + +.siteheader .notifications { + display: flex; + align-items: center; +} + +.siteheader .settings { + padding-right: 6px; + display: flex; + align-items: center; + margin-left: 0; + margin-right: 10px; +} diff --git a/src/Web/WebAdmin/WebAdmin/Components/Layout/MainSearch.razor b/src/Web/WebAdmin/WebAdmin/Components/Layout/MainSearch.razor new file mode 100644 index 0000000..8c95ff3 --- /dev/null +++ b/src/Web/WebAdmin/WebAdmin/Components/Layout/MainSearch.razor @@ -0,0 +1,24 @@ +@using Microsoft.Extensions.Localization +@rendermode InteractiveServer +@inject IStringLocalizer L + + \ No newline at end of file diff --git a/src/Web/WebAdmin/WebAdmin/Components/Layout/MainSearch.razor.cs b/src/Web/WebAdmin/WebAdmin/Components/Layout/MainSearch.razor.cs new file mode 100644 index 0000000..278951c --- /dev/null +++ b/src/Web/WebAdmin/WebAdmin/Components/Layout/MainSearch.razor.cs @@ -0,0 +1,54 @@ +using Microsoft.AspNetCore.Components; +using Microsoft.FluentUI.AspNetCore.Components; +using System.Diagnostics; +using WebAdmin.Components.Shared; + +namespace WebAdmin.Components.Layout; + +public partial class MainSearch +{ + [Inject] + protected NavProvider NavProvider { get; set; } = default!; + + [Inject] + protected NavigationManager NavigationManager { get; set; } = default!; + + private string? _searchTerm = ""; + private IEnumerable? _selectedOptions = []; + private IReadOnlyList FlattenedMenuItems => NavProvider.FlattenedMenuItems + .Select(x => new NavLink(href: x.Href, icon: x.Icon, match: x.Match, name: L[x.Name])) + .ToList() + .AsReadOnly(); + + private void HandleSearchInput(OptionsSearchEventArgs e) + { + var searchTerm = e.Text; + + if (string.IsNullOrWhiteSpace(searchTerm)) + { + e.Items = FlattenedMenuItems; + } + else + { + e.Items = FlattenedMenuItems + .Where(x => x.Href != null) + .Where(x => x.Name.Contains(searchTerm, StringComparison.OrdinalIgnoreCase)); + } + } + + private void HandleSearchClicked() + { + _searchTerm = null; + var targetHref = _selectedOptions?.SingleOrDefault()?.Href; + _selectedOptions = []; + InvokeAsync(StateHasChanged); + + // Ignore clearing the search bar + if (targetHref is null) + { + return; + } + + NavigationManager.NavigateTo(targetHref ?? throw new UnreachableException("无效项")); + } +} \ No newline at end of file diff --git a/src/Web/WebAdmin/WebAdmin/Components/Layout/NavMenu.razor b/src/Web/WebAdmin/WebAdmin/Components/Layout/NavMenu.razor new file mode 100644 index 0000000..2e5da45 --- /dev/null +++ b/src/Web/WebAdmin/WebAdmin/Components/Layout/NavMenu.razor @@ -0,0 +1,23 @@ +@using Microsoft.Extensions.Localization +@rendermode InteractiveServer +@inject IStringLocalizer L +@inject NavProvider NavProvider + +@code { + private bool _expanded = true; +} + + \ No newline at end of file diff --git a/src/Web/WebAdmin/WebAdmin/Components/Layout/NavMenu.razor.css b/src/Web/WebAdmin/WebAdmin/Components/Layout/NavMenu.razor.css new file mode 100644 index 0000000..4e15395 --- /dev/null +++ b/src/Web/WebAdmin/WebAdmin/Components/Layout/NavMenu.razor.css @@ -0,0 +1,105 @@ +.navbar-toggler { + appearance: none; + cursor: pointer; + width: 3.5rem; + height: 2.5rem; + color: white; + position: absolute; + top: 0.5rem; + right: 1rem; + border: 1px solid rgba(255, 255, 255, 0.1); + background: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba%28255, 255, 255, 0.55%29' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e") no-repeat center/1.75rem rgba(255, 255, 255, 0.1); +} + +.navbar-toggler:checked { + background-color: rgba(255, 255, 255, 0.5); +} + +.top-row { + height: 3.5rem; + background-color: rgba(0,0,0,0.4); +} + +.navbar-brand { + font-size: 1.1rem; +} + +.bi { + display: inline-block; + position: relative; + width: 1.25rem; + height: 1.25rem; + margin-right: 0.75rem; + top: -1px; + background-size: cover; +} + +.bi-house-door-fill-nav-menu { + background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='white' class='bi bi-house-door-fill' viewBox='0 0 16 16'%3E%3Cpath d='M6.5 14.5v-3.505c0-.245.25-.495.5-.495h2c.25 0 .5.25.5.5v3.5a.5.5 0 0 0 .5.5h4a.5.5 0 0 0 .5-.5v-7a.5.5 0 0 0-.146-.354L13 5.793V2.5a.5.5 0 0 0-.5-.5h-1a.5.5 0 0 0-.5.5v1.293L8.354 1.146a.5.5 0 0 0-.708 0l-6 6A.5.5 0 0 0 1.5 7.5v7a.5.5 0 0 0 .5.5h4a.5.5 0 0 0 .5-.5Z'/%3E%3C/svg%3E"); +} + +.bi-plus-square-fill-nav-menu { + background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='white' class='bi bi-plus-square-fill' viewBox='0 0 16 16'%3E%3Cpath d='M2 0a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V2a2 2 0 0 0-2-2H2zm6.5 4.5v3h3a.5.5 0 0 1 0 1h-3v3a.5.5 0 0 1-1 0v-3h-3a.5.5 0 0 1 0-1h3v-3a.5.5 0 0 1 1 0z'/%3E%3C/svg%3E"); +} + +.bi-list-nested-nav-menu { + background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='white' class='bi bi-list-nested' viewBox='0 0 16 16'%3E%3Cpath fill-rule='evenodd' d='M4.5 11.5A.5.5 0 0 1 5 11h10a.5.5 0 0 1 0 1H5a.5.5 0 0 1-.5-.5zm-2-4A.5.5 0 0 1 3 7h10a.5.5 0 0 1 0 1H3a.5.5 0 0 1-.5-.5zm-2-4A.5.5 0 0 1 1 3h10a.5.5 0 0 1 0 1H1a.5.5 0 0 1-.5-.5z'/%3E%3C/svg%3E"); +} + +.nav-item { + font-size: 0.9rem; + padding-bottom: 0.5rem; +} + + .nav-item:first-of-type { + padding-top: 1rem; + } + + .nav-item:last-of-type { + padding-bottom: 1rem; + } + + .nav-item ::deep .nav-link { + color: #d7d7d7; + background: none; + border: none; + border-radius: 4px; + height: 3rem; + display: flex; + align-items: center; + line-height: 3rem; + width: 100%; + } + +.nav-item ::deep a.active { + background-color: rgba(255,255,255,0.37); + color: white; +} + +.nav-item ::deep .nav-link:hover { + background-color: rgba(255,255,255,0.1); + color: white; +} + +.nav-scrollable { + display: none; +} + +.navbar-toggler:checked ~ .nav-scrollable { + display: block; +} + +@media (min-width: 641px) { + .navbar-toggler { + display: none; + } + + .nav-scrollable { + /* Never collapse the sidebar for wide screens */ + display: block; + + /* Allow sidebar to scroll for tall menus */ + height: calc(100vh - 3.5rem); + overflow-y: auto; + } +} diff --git a/src/Web/WebAdmin/WebAdmin/Components/Layout/NavMenuItem.razor b/src/Web/WebAdmin/WebAdmin/Components/Layout/NavMenuItem.razor new file mode 100644 index 0000000..e74bac9 --- /dev/null +++ b/src/Web/WebAdmin/WebAdmin/Components/Layout/NavMenuItem.razor @@ -0,0 +1,36 @@ +@using Microsoft.Extensions.Localization +@using NavLink = WebAdmin.Components.Shared.NavLink +@inject IStringLocalizer L + +@switch (Value) +{ + case NavGroup group: + + +

@L[group.Name]

+
+ + @foreach (var item in group.Children) + { + + } + +
+ break; + case NavLink: + + @if (Value.Match is NavLinkMatch.All) + { +

@L[Value.Name]

+ } + else + { + @L[Value.Name] + } +
+ break; +} + +@code { + [Parameter] [EditorRequired] public required NavItem Value { get; set; } +} \ No newline at end of file diff --git a/src/Web/WebAdmin/WebAdmin/Components/Pages/CustomerLevels.razor b/src/Web/WebAdmin/WebAdmin/Components/Pages/CustomerLevels.razor new file mode 100644 index 0000000..72f7d44 --- /dev/null +++ b/src/Web/WebAdmin/WebAdmin/Components/Pages/CustomerLevels.razor @@ -0,0 +1,3 @@ +@page "/customer-level" + +

CustomerLevelMgr

diff --git a/src/Web/WebAdmin/WebAdmin/Components/Pages/CustomerList.razor b/src/Web/WebAdmin/WebAdmin/Components/Pages/CustomerList.razor new file mode 100644 index 0000000..77e02d5 --- /dev/null +++ b/src/Web/WebAdmin/WebAdmin/Components/Pages/CustomerList.razor @@ -0,0 +1,52 @@ +@page "/customer/list" +@using Microsoft.Extensions.Localization +@attribute [StreamRendering] +@inject AdminConfiguration AdminConfiguration +@inject IStringLocalizer L + +@L["PageTitle"] - @AdminConfiguration.PageTitle + +

会员

+ +

This component demonstrates showing data.

+ + +@if (_customers == null) +{ +

Loading...

+} +else +{ + + + + + + +} + +@code { + private IQueryable? _customers; + + protected override async Task OnInitializedAsync() + { + // Simulate asynchronous loading to demonstrate streaming rendering + await Task.Delay(500); + + var startDate = DateOnly.FromDateTime(DateTime.Now); + var summaries = new[] { "Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching" }; + _customers = Enumerable.Range(1, 5).Select(index => new CustomerTable + { + BirthDate = startDate.AddDays(index), + Age = Random.Shared.Next(-20, 55), + Name = summaries[Random.Shared.Next(summaries.Length)] + }).AsQueryable(); + } + + private class CustomerTable + { + public int Age { get; init; } + public string? Name { get; init; } + public DateOnly BirthDate { get; init; } + } +} diff --git a/src/Web/WebAdmin/WebAdmin/Components/Pages/Error.razor b/src/Web/WebAdmin/WebAdmin/Components/Pages/Error.razor new file mode 100644 index 0000000..576cc2d --- /dev/null +++ b/src/Web/WebAdmin/WebAdmin/Components/Pages/Error.razor @@ -0,0 +1,36 @@ +@page "/Error" +@using System.Diagnostics + +Error + +

Error.

+

An error occurred while processing your request.

+ +@if (ShowRequestId) +{ +

+ Request ID: @RequestId +

+} + +

Development Mode

+

+ Swapping to Development environment will display more detailed information about the error that occurred. +

+

+ The Development environment shouldn't be enabled for deployed applications. + It can result in displaying sensitive information from exceptions to end users. + For local debugging, enable the Development environment by setting the ASPNETCORE_ENVIRONMENT environment variable to Development + and restarting the app. +

+ +@code{ + [CascadingParameter] + private HttpContext? HttpContext { get; set; } + + private string? RequestId { get; set; } + private bool ShowRequestId => !string.IsNullOrEmpty(RequestId); + + protected override void OnInitialized() => + RequestId = Activity.Current?.Id ?? HttpContext?.TraceIdentifier; +} diff --git a/src/Web/WebAdmin/WebAdmin/Components/Pages/Home.razor b/src/Web/WebAdmin/WebAdmin/Components/Pages/Home.razor new file mode 100644 index 0000000..cacb649 --- /dev/null +++ b/src/Web/WebAdmin/WebAdmin/Components/Pages/Home.razor @@ -0,0 +1,45 @@ +@page "/" +@using System.Globalization +@using Microsoft.Extensions.Localization +@inject AdminConfiguration AdminConfiguration +@inject IStringLocalizer L + +@L["PageTitle"] - @AdminConfiguration?.PageTitle + + + +

Hello, world!

+ +

@L["PageTitle"]

+ +

+ 当前语言:@CultureInfo.CurrentCulture.DisplayName | @CultureInfo.CurrentCulture.Name +

+ +

+ The following <input> elements use + CultureInfo.InvariantCulture. +

+ +
+

Welcome to your new app.

+

+ TestKey: @L["TestKey"] +

+
+ + + + + + @(new Emojis.Objects.Color.Default.Accordion().ToMarkup("280px")) + @(new Emojis.TravelPlaces.Color.Default.Ambulance().ToMarkup("500px")) + + + Icon: + Emoji: + Button: Click Me +
+ + + \ No newline at end of file diff --git a/src/Web/WebAdmin/WebAdmin/Components/Pages/PurchaseOrder.razor b/src/Web/WebAdmin/WebAdmin/Components/Pages/PurchaseOrder.razor new file mode 100644 index 0000000..47fd86e --- /dev/null +++ b/src/Web/WebAdmin/WebAdmin/Components/Pages/PurchaseOrder.razor @@ -0,0 +1,81 @@ +@page "/order" +@attribute [StreamRendering] +@rendermode InteractiveServer +@inject AppDataConnection DataConnection + +暂无数据

"))" + Items="@FilteredItems" + ResizableColumns="true" + Pagination="@_pagination" + GridTemplateColumns="0.4fr 0.2fr 0.2fr 0.2fr 0.2fr 0.2fr 0.2fr 0.2fr" + RowClass="@_rowClass" + RowStyle="@_rowStyle" + Style="height: 405px; overflow: auto;"> + + + + + + + + + + + + + +
+ + + + + + + + +@code { + bool _clearItems; + IQueryable? _items; + readonly PaginationState _pagination = new() { ItemsPerPage = 10 }; + string _orderNoFilter = string.Empty; + readonly Func _rowClass = x => x.OrderNo.EndsWith("00000000") ? "highlighted-row" : null; + readonly Func _rowStyle = x => x.OrderNo.StartsWith("Au") ? "background-color: var(--highlight-bg);" : null; + + IQueryable? FilteredItems => _items?.Where(x => x.OrderNo.Contains(_orderNoFilter, StringComparison.CurrentCultureIgnoreCase)); + + protected override async Task OnInitializedAsync() + { + _items = DataConnection.PurchaseOrder.Where(x => x.DeletedTime == 0); + + await Task.CompletedTask; + } + + private void HandleOrderFilter(ChangeEventArgs args) + { + if (args.Value is string value) + { + _orderNoFilter = value; + } + } + + private void HandleClear() + { + if (string.IsNullOrWhiteSpace(_orderNoFilter)) + { + _orderNoFilter = string.Empty; + } + } + + private async Task ToggleItemsAsync() + { + _items = _clearItems ? null : DataConnection.PurchaseOrder.Where(x => x.DeletedTime == 0); + + await Task.CompletedTask; + } + +} \ No newline at end of file diff --git a/src/Web/WebAdmin/WebAdmin/Components/Routes.razor b/src/Web/WebAdmin/WebAdmin/Components/Routes.razor new file mode 100644 index 0000000..d39c7e8 --- /dev/null +++ b/src/Web/WebAdmin/WebAdmin/Components/Routes.razor @@ -0,0 +1,6 @@ + + + + + + diff --git a/src/Web/WebAdmin/WebAdmin/Components/Shared/CultureSelector.razor b/src/Web/WebAdmin/WebAdmin/Components/Shared/CultureSelector.razor new file mode 100644 index 0000000..42e3acb --- /dev/null +++ b/src/Web/WebAdmin/WebAdmin/Components/Shared/CultureSelector.razor @@ -0,0 +1,32 @@ + +
+ + + + @foreach (var item in CultureOptions) + { + + @item.Text + + } + +
+ + +@code { + private bool _showMenu = false; + private string _status = ""; + + private void OnMenuChange(MenuChangeEventArgs args) + { + if (args is not null && args.Value is not null) + _status = $"Item \"{args.Value}\" clicked"; + Console.WriteLine(_status); + } + +} \ No newline at end of file diff --git a/src/Web/WebAdmin/WebAdmin/Components/Shared/CultureSelector.razor.cs b/src/Web/WebAdmin/WebAdmin/Components/Shared/CultureSelector.razor.cs new file mode 100644 index 0000000..9b5ab2b --- /dev/null +++ b/src/Web/WebAdmin/WebAdmin/Components/Shared/CultureSelector.razor.cs @@ -0,0 +1,52 @@ +using System.Globalization; +using Microsoft.AspNetCore.Components; +using Microsoft.FluentUI.AspNetCore.Components; +using Microsoft.JSInterop; +using WebAdmin.Configurations; + +namespace WebAdmin.Components.Shared; + +public partial class CultureSelector +{ + [Inject] protected IJSRuntime JsRuntime { get; set; } = null!; + + [Inject] protected NavigationManager NavigationManager { get; set; } = null!; + + [Inject] protected CultureConfiguration CultureConfiguration { get; set; } = null!; + + private string _culture = string.Empty; + + public string Culture + { + get => _culture; + set + { + _culture = value; + ChangeCulture(value); + } + } + + private static readonly List> CultureOptions = + [ + new Option { Value = "zh-Hans", Text = "中文(简体)" }, + new Option { Value = "en", Text = "English" } + ]; + + + protected override Task OnInitializedAsync() + { + _culture = CultureInfo.CurrentCulture.Name; + + return base.OnInitializedAsync(); + } + + public void ChangeCulture(string? _) + { + var redirect = new Uri(NavigationManager.Uri).GetComponents(UriComponents.PathAndQuery | UriComponents.Fragment, + UriFormat.UriEscaped); + + var query = $"?culture={Uri.EscapeDataString(_culture)}&redirectUri={redirect}"; + + NavigationManager.NavigateTo("Culture/SetCulture" + query, true); + } +} \ No newline at end of file diff --git a/src/Web/WebAdmin/WebAdmin/Components/Shared/CultureSelector.razor.css b/src/Web/WebAdmin/WebAdmin/Components/Shared/CultureSelector.razor.css new file mode 100644 index 0000000..4ff7011 --- /dev/null +++ b/src/Web/WebAdmin/WebAdmin/Components/Shared/CultureSelector.razor.css @@ -0,0 +1,3 @@ +.language { + +} \ No newline at end of file diff --git a/src/Web/WebAdmin/WebAdmin/Components/Shared/CustomIcons.cs b/src/Web/WebAdmin/WebAdmin/Components/Shared/CustomIcons.cs new file mode 100644 index 0000000..71352e2 --- /dev/null +++ b/src/Web/WebAdmin/WebAdmin/Components/Shared/CustomIcons.cs @@ -0,0 +1,13 @@ +using Microsoft.FluentUI.AspNetCore.Components; + +namespace WebAdmin.Components.Shared; + +public static class CustomIcons +{ + public static class Size20 + { + // The official SVGs from GitHub have a viewbox of 96x96, so we need to scale them down to 20x20 and center them within the 24x24 box to make them match the + // other icons we're using. We also need to remove the fill attribute from the SVGs so that we can color them with CSS. + public sealed class GitHub : Icon { public GitHub() : base("GitHub", IconVariant.Regular, IconSize.Size20, @"") { } } + } +} \ No newline at end of file diff --git a/src/Web/WebAdmin/WebAdmin/Components/Shared/NavItem.cs b/src/Web/WebAdmin/WebAdmin/Components/Shared/NavItem.cs new file mode 100644 index 0000000..9f25c53 --- /dev/null +++ b/src/Web/WebAdmin/WebAdmin/Components/Shared/NavItem.cs @@ -0,0 +1,47 @@ +using Microsoft.AspNetCore.Components.Routing; +using Microsoft.FluentUI.AspNetCore.Components; + +namespace WebAdmin.Components.Shared; + +public abstract record NavItem +{ + public string Name { get; init; } = string.Empty; + public string? Href { get; init; } + public NavLinkMatch Match { get; init; } = NavLinkMatch.Prefix; + public Icon Icon { get; init; } = new Icons.Regular.Size20.Document(); + public Color IconColor { get; set; } = Color.Accent; +} + +public record NavLink : NavItem +{ + public NavLink( + string? href, + Icon icon, + string name, + NavLinkMatch match = NavLinkMatch.Prefix, + Color iconColor = Color.Accent) + { + Href = href; + Icon = icon; + Name = name; + Match = match; + IconColor = iconColor; + } +} + +public record NavGroup : NavItem +{ + public bool Expanded { get; init; } + public string Gap { get; init; } + public IReadOnlyList Children { get; } + + public NavGroup(Icon icon, string name, bool expanded, string gap, List children) + { + Href = null; + Icon = icon; + Name = name; + Expanded = expanded; + Gap = gap; + Children = children.AsReadOnly(); + } +} \ No newline at end of file diff --git a/src/Web/WebAdmin/WebAdmin/Components/Shared/NavProvider.cs b/src/Web/WebAdmin/WebAdmin/Components/Shared/NavProvider.cs new file mode 100644 index 0000000..fb2edb3 --- /dev/null +++ b/src/Web/WebAdmin/WebAdmin/Components/Shared/NavProvider.cs @@ -0,0 +1,172 @@ +using Microsoft.AspNetCore.Components.Routing; +using Microsoft.FluentUI.AspNetCore.Components; + +namespace WebAdmin.Components.Shared; + +public class NavProvider +{ + public NavProvider() + { + NavMenuItems = + [ + new NavLink( + href: "/", + match: NavLinkMatch.All, + icon: new Icons.Regular.Size20.Home(), + name: "Home" + ), + + new NavLink( + href: "/counter", + match: NavLinkMatch.All, + icon: new Icons.Regular.Size20.NumberSymbolSquare(), + name: "Counter" + ), + + // 会员管理 + new NavGroup( + icon: new Icons.Regular.Size20.Group(), + name: "CustomerMgr", + expanded: true, + gap: "10px", + children: + [ + new NavLink( + href: "/customer/list", + icon: new Icons.Regular.Size20.Accessibility(), + name: "CustomerList" + ), + new NavLink( + href: "/customer/level", + icon: new Icons.Regular.Size20.Trophy(), + name: "CustomerLevel" + ) + ]), + + // 订单管理 + new NavGroup( + icon: new Icons.Regular.Size20.ReceiptCube(), + name: "OrderMgr", + expanded: false, + gap: "10px", + children: + [ + new NavLink( + href: "/order/purchase", + icon: new Icons.Regular.Size20.ShoppingBag(), + name: "PurchaseOrder" + ), + new NavLink( + href: "/order/process", + icon: new Icons.Regular.Size20.BuildingFactory(), + name: "ProcessOrder" + ) + ]), + + // 支付管理 + new NavGroup( + icon: new Icons.Regular.Size20.CurrencyDollarEuro(), + name: "PaymentMgr", + expanded: false, + gap: "10px", + children: + [ + new NavLink( + href: "/payment/receiving-orders", + icon: new Icons.Regular.Size20.CreditCardClock(), + name: "ReceiveOrder" + ), + new NavLink( + href: "/payment/paid-orders", + icon: new Icons.Regular.Size20.WalletCreditCard(), + name: "PaidOrder" + ) + ]), + + // 物流管理 + new NavGroup( + icon: new Icons.Regular.Size20.VehicleTruckBag(), + name: "LogisticsMgr", + expanded: false, + gap: "10px", + children: + [ + new NavLink( + href: "/logistics/orders", + icon: new Icons.Regular.Size20.BoxMultipleSearch(), + name: "LogisticsOrder" + ), + new NavLink( + href: "/logistics/services", + icon: new Icons.Regular.Size20.Globe(), + name: "LogisticsService" + ), + new NavLink( + href: "/logistics/channels", + icon: new Icons.Regular.Size20.CompassNorthwest(), + name: "LogisticsChannel" + ) + ]), + + // 终端管理 + new NavGroup( + icon: new Icons.Regular.Size20.TabletLaptop(), + name: "DeviceMgr", + expanded: false, + gap: "10px", + children: + [ + new NavLink( + href: "/device/list", + icon: new Icons.Regular.Size20.DeviceMeetingRoom(), + name: "DeviceList" + ), + new NavLink( + href: "/device/types", + icon: new Icons.Regular.Size20.AppsList(), + name: "DeviceType" + ), + new NavLink( + href: "/device/models", + icon: new Icons.Regular.Size20.Cube(), + name: "DeviceModule" + ), + new NavLink( + href: "/device/maintenance-orders", + icon: new Icons.Regular.Size20.VirtualNetworkToolbox(), + name: "DeviceMaintain" + ), + new NavLink( + href: "/device/remote-controls", + icon: new Icons.Regular.Size20.DesktopCursor(), + name: "RemoveControl" + ), + new NavLink( + href: "/device/versions", + icon: new Icons.Regular.Size20.BranchFork(), + name: "VersionMgr" + ) + ]), + ]; + + FlattenedMenuItems = GetFlattenedMenuItems(NavMenuItems) + .ToList() + .AsReadOnly(); + } + + public IReadOnlyList NavMenuItems { get; init; } + + public IReadOnlyList FlattenedMenuItems { get; init; } + + private static IEnumerable GetFlattenedMenuItems(IEnumerable items) + { + foreach (var item in items) + { + yield return item; + + if (item is not NavGroup group || !group.Children.Any()) continue; + + foreach (var flattenedMenuItem in GetFlattenedMenuItems(group.Children)) yield return flattenedMenuItem; + } + } +} \ No newline at end of file diff --git a/src/Web/WebAdmin/WebAdmin/Components/Shared/SiteLinks.razor b/src/Web/WebAdmin/WebAdmin/Components/Shared/SiteLinks.razor new file mode 100644 index 0000000..518de77 --- /dev/null +++ b/src/Web/WebAdmin/WebAdmin/Components/Shared/SiteLinks.razor @@ -0,0 +1,23 @@ +@rendermode InteractiveServer + + + + +@code { + + [Inject] protected IJSRuntime JsRuntime { get; set; } = null!; + + private async Task NavigateToGitHub() + { + await JsRuntime.InvokeVoidAsync("open", "http://github.com/iamshen", "_blank"); + } + +} \ No newline at end of file diff --git a/src/Web/WebAdmin/WebAdmin/Components/Shared/SiteLinks.razor.css b/src/Web/WebAdmin/WebAdmin/Components/Shared/SiteLinks.razor.css new file mode 100644 index 0000000..6f563d6 --- /dev/null +++ b/src/Web/WebAdmin/WebAdmin/Components/Shared/SiteLinks.razor.css @@ -0,0 +1,4 @@ +.links { + display: flex; + align-items: center; +} \ No newline at end of file diff --git a/src/Web/WebAdmin/WebAdmin/Components/Shared/SiteSettings.razor b/src/Web/WebAdmin/WebAdmin/Components/Shared/SiteSettings.razor new file mode 100644 index 0000000..4413ec0 --- /dev/null +++ b/src/Web/WebAdmin/WebAdmin/Components/Shared/SiteSettings.razor @@ -0,0 +1,8 @@ +@rendermode InteractiveServer +@inject IDialogService DialogService + +
+ + + +
\ No newline at end of file diff --git a/src/Web/WebAdmin/WebAdmin/Components/Shared/SiteSettings.razor.cs b/src/Web/WebAdmin/WebAdmin/Components/Shared/SiteSettings.razor.cs new file mode 100644 index 0000000..20b4f78 --- /dev/null +++ b/src/Web/WebAdmin/WebAdmin/Components/Shared/SiteSettings.razor.cs @@ -0,0 +1,24 @@ +using Microsoft.FluentUI.AspNetCore.Components; + +namespace WebAdmin.Components.Shared; + +public partial class SiteSettings +{ + private IDialogReference? _dialog; + + private async Task OpenSiteSettingsAsync() + { + Console.WriteLine($"Open site settings"); + _dialog = await DialogService.ShowPanelAsync(new DialogParameters() + { + ShowTitle = true, + Title = "Site settings", + Alignment = HorizontalAlignment.Right, + PrimaryAction = "OK", + SecondaryAction = null, + ShowDismiss = true + }); + + DialogResult result = await _dialog.Result; + } +} \ No newline at end of file diff --git a/src/Web/WebAdmin/WebAdmin/Components/Shared/SiteSettingsPanel.razor b/src/Web/WebAdmin/WebAdmin/Components/Shared/SiteSettingsPanel.razor new file mode 100644 index 0000000..ae123cd --- /dev/null +++ b/src/Web/WebAdmin/WebAdmin/Components/Shared/SiteSettingsPanel.razor @@ -0,0 +1,76 @@ +@implements IDialogContentComponent + +
+ + + + + + + + + + @context + + + + + + + These values (except for Direction) are persisted in the LocalStorage. + and will be recovered during your next visits.

+ Use the 'Reset settings button' below to go back to the system theme and a random color. +
+ + +
Reset site settings
+ +

+ This site stores settings for the theme and color and downloaded samples, emoji and icons in the browser' cache and local storage. +

+

+ You can check the contents of the cache and storage in the browser's developer tools. If you are using Edge or Chrome, you can do this by + going to the Application tab and then clicking on the Cache Storage or Local Storagesection.
+ In Firefox, you can do this by going to the Storage tab and then clicking on the Cache Storage or Local Storage section. +

+ +

+ If you feel like you're not seeing the latest and greatest of samples. emoji or icons, or you want to clear out the stored theme and color, + click the button below to clear the cache and delete local storage. +

+

+ Don't worry, this will only reset stored data for this site. It will not clear any of your browser's cache for other sites! +

+ +
+ + + Reset settings + + + +

+ @_status +

+
+
diff --git a/src/Web/WebAdmin/WebAdmin/Components/Shared/SiteSettingsPanel.razor.cs b/src/Web/WebAdmin/WebAdmin/Components/Shared/SiteSettingsPanel.razor.cs new file mode 100644 index 0000000..ed25e6c --- /dev/null +++ b/src/Web/WebAdmin/WebAdmin/Components/Shared/SiteSettingsPanel.razor.cs @@ -0,0 +1,80 @@ +using Microsoft.AspNetCore.Components; +using Microsoft.FluentUI.AspNetCore.Components.Extensions; +using Microsoft.FluentUI.AspNetCore.Components; +using WebAdmin.Infrastructure; + +namespace WebAdmin.Components.Shared; + +public partial class SiteSettingsPanel +{ + private string? _status; + private bool _popVisible; + private bool _ltr = true; + private FluentDesignTheme? _theme; + + [Inject] + public required ILogger Logger { get; set; } + + [Inject] + public required CacheStorageAccessor CacheStorageAccessor { get; set; } + + [Inject] + public required GlobalState GlobalState { get; set; } + + public DesignThemeModes Mode { get; set; } + + public OfficeColor? OfficeColor { get; set; } + + public LocalizationDirection? Direction { get; set; } + + private static IEnumerable AllModes => Enum.GetValues(); + + private static IEnumerable AllOfficeColors + { + get + { + return Enum.GetValues().Select(i => (OfficeColor?)i); + } + } + + protected override void OnAfterRender(bool firstRender) + { + if (firstRender) + { + Direction = GlobalState.Dir; + _ltr = !Direction.HasValue || Direction.Value == LocalizationDirection.LeftToRight; + } + } + + protected void HandleDirectionChanged(bool isLeftToRight) + { + + _ltr = isLeftToRight; + Direction = isLeftToRight ? LocalizationDirection.LeftToRight : LocalizationDirection.RightToLeft; + } + + private async Task ResetSiteAsync() + { + var msg = "Site settings reset and cache cleared!"; + + await CacheStorageAccessor.RemoveAllAsync(); + _theme?.ClearLocalStorageAsync(); + + Logger.LogInformation(msg); + _status = msg; + + OfficeColor = OfficeColorUtilities.GetRandom(); + Mode = DesignThemeModes.System; + } + + private static string? GetCustomColor(OfficeColor? color) + { + return color switch + { + null => OfficeColorUtilities.GetRandom(true).ToAttributeValue(), + Microsoft.FluentUI.AspNetCore.Components.OfficeColor.Default => "#036ac4", + _ => color.ToAttributeValue(), + }; + + } +} \ No newline at end of file diff --git a/src/Web/WebAdmin/WebAdmin/Components/Shared/UserProfile.razor b/src/Web/WebAdmin/WebAdmin/Components/Shared/UserProfile.razor new file mode 100644 index 0000000..d2fa480 --- /dev/null +++ b/src/Web/WebAdmin/WebAdmin/Components/Shared/UserProfile.razor @@ -0,0 +1,11 @@ +
+ +
\ No newline at end of file diff --git a/src/Web/WebAdmin/WebAdmin/Components/Shared/UserProfile.razor.css b/src/Web/WebAdmin/WebAdmin/Components/Shared/UserProfile.razor.css new file mode 100644 index 0000000..35b0e55 --- /dev/null +++ b/src/Web/WebAdmin/WebAdmin/Components/Shared/UserProfile.razor.css @@ -0,0 +1,5 @@ +.profile { + padding-right: 16px; + margin-left: 0; + /*margin-right: 10px;*/ +} diff --git a/src/Web/WebAdmin/WebAdmin/Components/_Imports.razor b/src/Web/WebAdmin/WebAdmin/Components/_Imports.razor new file mode 100644 index 0000000..84ad10d --- /dev/null +++ b/src/Web/WebAdmin/WebAdmin/Components/_Imports.razor @@ -0,0 +1,19 @@ +@using System.Net.Http +@using System.Net.Http.Json +@using Microsoft.AspNetCore.Components.Forms +@using Microsoft.AspNetCore.Components.Routing +@using Microsoft.AspNetCore.Components.Web +@using static Microsoft.AspNetCore.Components.Web.RenderMode +@using Microsoft.AspNetCore.Components.Web.Virtualization +@using Microsoft.JSInterop +@using Microsoft.FluentUI.AspNetCore.Components +@using WebAdmin +@using WebAdmin.Client +@using WebAdmin.Components +@using WebAdmin.Configurations +@using Ordering.Infrastructure.Repository +@using Ordering.Infrastructure.Repository.Entities +@using System.Globalization +@using Microsoft.AspNetCore.Localization +@using WebAdmin.Components.Shared +@using System.Threading diff --git a/src/Web/WebAdmin/WebAdmin/Configurations/AdminUiOptions.cs b/src/Web/WebAdmin/WebAdmin/Configurations/AdminUiOptions.cs new file mode 100644 index 0000000..07548bb --- /dev/null +++ b/src/Web/WebAdmin/WebAdmin/Configurations/AdminUiOptions.cs @@ -0,0 +1,102 @@ +namespace WebAdmin.Configurations; + +/// +/// 管理后台配置 +/// +public class AdminUiOptions +{ + /// 管理后台的基础配置 + public AdminConfiguration Admin { get; } = new(); + + /// 全球化配置 + public CultureConfiguration Culture { get; set; } = new(); + + /// HTTP 托管环境配置 + public HttpConfiguration Http { get; set; } = new(); + + /// + /// 将从 appsettings 文件解析的配置应用到这些选项中。 + /// + /// 绑定到此实例的配置 + public void BindConfiguration(IConfiguration configuration) + { + configuration.GetSection(nameof(AdminConfiguration)).Bind(Admin); + configuration.GetSection(nameof(CultureConfiguration)).Bind(Culture); + configuration.GetSection(nameof(HttpConfiguration)).Bind(Http); + } +} + +/// +/// 管理后台的基础配置 +/// +public class AdminConfiguration +{ + /// Page Name + public string? PageTitle { get; set; } + + /// Favicon Uri + public string? FaviconUri { get; set; } + + /// Web Admin Redirect Uri + public string? AdminRedirectUri { get; set; } + + /// Scopes + public string[] Scopes { get; set; } = []; + + /// Administration Role Name + public string? AdministrationRole { get; set; } + + /// Require HttpsMetadata + public bool RequireHttpsMetadata { get; set; } + + /// Web Admin CookieName + public string? AdminCookieName { get; set; } + + /// Web Admin Cookie Expires UtcHours + public double AdminCookieExpiresUtcHours { get; set; } + + /// Token Validation ClaimName + public string? TokenValidationClaimName { get; set; } + + /// Token Validation ClaimRole + public string? TokenValidationClaimRole { get; set; } + + /// IdentityServer BaseUrl + public string? IdentityServerBaseUrl { get; set; } + + /// ClientId + public string? ClientId { get; set; } + + /// ClientSecret + public string? ClientSecret { get; set; } + + /// Oidc ResponseType + public string? OidcResponseType { get; set; } +} + +/// +/// 全球化配置 +/// +public class CultureConfiguration +{ + /// 可用的多语言文化 + public static readonly string[] AvailableCultures = ["zh-Hans", "en"]; + + /// 默认的文化 + public static readonly string DefaultRequestCulture = "zh-Hans"; + + /// 可用的多语言文化列表 + public List Cultures { get; set; } = []; + + /// 默认的文化 + public string DefaultCulture { get; set; } = DefaultRequestCulture; +} + +/// +/// Http 配置 +/// +public class HttpConfiguration +{ + /// BasePath + public string BasePath { get; set; } = ""; +} \ No newline at end of file diff --git a/src/Web/WebAdmin/WebAdmin/Configurations/ConfigurationConsts.cs b/src/Web/WebAdmin/WebAdmin/Configurations/ConfigurationConsts.cs new file mode 100644 index 0000000..096d802 --- /dev/null +++ b/src/Web/WebAdmin/WebAdmin/Configurations/ConfigurationConsts.cs @@ -0,0 +1,6 @@ +namespace WebAdmin.Configurations; + +public class ConfigurationConsts +{ + public const string ResourcesPath = "Resources"; +} \ No newline at end of file diff --git a/src/Web/WebAdmin/WebAdmin/Controllers/CultureController.cs b/src/Web/WebAdmin/WebAdmin/Controllers/CultureController.cs new file mode 100644 index 0000000..a59a176 --- /dev/null +++ b/src/Web/WebAdmin/WebAdmin/Controllers/CultureController.cs @@ -0,0 +1,18 @@ +using Microsoft.AspNetCore.Localization; +using Microsoft.AspNetCore.Mvc; + +namespace WebAdmin.Controllers; + +[Route("Culture/[action]")] +public class CultureController : Controller +{ + public IActionResult SetCulture(string culture, string redirectUri) + { + if (culture != null) + Response.Cookies.Append( + CookieRequestCultureProvider.DefaultCookieName, + CookieRequestCultureProvider.MakeCookieValue(new RequestCulture(culture))); + + return LocalRedirect(redirectUri); + } +} \ No newline at end of file diff --git a/src/Web/WebAdmin/WebAdmin/Infrastructure/AppVersionService.cs b/src/Web/WebAdmin/WebAdmin/Infrastructure/AppVersionService.cs new file mode 100644 index 0000000..7538310 --- /dev/null +++ b/src/Web/WebAdmin/WebAdmin/Infrastructure/AppVersionService.cs @@ -0,0 +1,27 @@ +using System.Reflection; + +namespace WebAdmin.Infrastructure; + +/// +/// AppVersion Service +/// +public class AppVersionService : IAppVersionService +{ + public string Version => GetVersionFromAssembly(); + + public static string GetVersionFromAssembly() + { + string strVersion = default!; + var versionAttribute = + Assembly.GetExecutingAssembly().GetCustomAttribute(); + if (versionAttribute == null) return strVersion; + var version = versionAttribute.InformationalVersion; + var plusIndex = version.IndexOf('+'); + if (plusIndex >= 0 && plusIndex + 9 < version.Length) + strVersion = version[..(plusIndex + 9)]; + else + strVersion = version; + + return strVersion; + } +} \ No newline at end of file diff --git a/src/Web/WebAdmin/WebAdmin/Infrastructure/CacheStorageAccessor.cs b/src/Web/WebAdmin/WebAdmin/Infrastructure/CacheStorageAccessor.cs new file mode 100644 index 0000000..2361039 --- /dev/null +++ b/src/Web/WebAdmin/WebAdmin/Infrastructure/CacheStorageAccessor.cs @@ -0,0 +1,96 @@ +using Microsoft.FluentUI.AspNetCore.Components.Utilities; +using Microsoft.JSInterop; + +namespace WebAdmin.Infrastructure; + +public class CacheStorageAccessor(IJSRuntime js, IAppVersionService vs) : JSModule(js, "./js/CacheStorageAccessor.js") +{ + private readonly IAppVersionService _vs = vs; + private string? _currentCacheVersion = default; + + public async ValueTask PutAsync(HttpRequestMessage requestMessage, HttpResponseMessage responseMessage) + { + var requestMethod = requestMessage.Method.Method; + var requestBody = await GetRequestBodyAsync(requestMessage); + var responseBody = await responseMessage.Content.ReadAsStringAsync(); + + await InvokeVoidAsync("put", requestMessage.RequestUri!, requestMethod, requestBody, responseBody); + } + + public async ValueTask PutAndGetAsync(HttpRequestMessage requestMessage, HttpResponseMessage responseMessage) + { + var requestMethod = requestMessage.Method.Method; + var requestBody = await GetRequestBodyAsync(requestMessage); + var responseBody = await responseMessage.Content.ReadAsStringAsync(); + + await InvokeVoidAsync("put", requestMessage.RequestUri!, requestMethod, requestBody, responseBody); + + return responseBody; + } + + public async ValueTask GetAsync(HttpRequestMessage requestMessage) + { + if (_currentCacheVersion is null) + { + await InitializeCacheAsync(); + } + + var result = await InternalGetAsync(requestMessage); + + return result; + } + private async ValueTask InternalGetAsync(HttpRequestMessage requestMessage) + { + var requestMethod = requestMessage.Method.Method; + var requestBody = await GetRequestBodyAsync(requestMessage); + var result = await InvokeAsync("get", requestMessage.RequestUri!, requestMethod, requestBody); + + return result; + } + + public async ValueTask RemoveAsync(HttpRequestMessage requestMessage) + { + var requestMethod = requestMessage.Method.Method; + var requestBody = await GetRequestBodyAsync(requestMessage); + + await InvokeVoidAsync("remove", requestMessage.RequestUri!, requestMethod, requestBody); + } + + public async ValueTask RemoveAllAsync() + { + await InvokeVoidAsync("removeAll"); + } + private static async ValueTask GetRequestBodyAsync(HttpRequestMessage requestMessage) + { + var requestBody = string.Empty; + if (requestMessage.Content is not null) + { + requestBody = await requestMessage.Content.ReadAsStringAsync(); + } + + return requestBody; + } + + private async Task InitializeCacheAsync() + { + // last version cached is stored in appVersion + var requestMessage = new HttpRequestMessage(HttpMethod.Get, "appVersion"); + + // get the last version cached + var result = await InternalGetAsync(requestMessage); + if (!result.Equals(_vs.Version)) + { + // running newer version now, clear cache, and update version in cache + await RemoveAllAsync(); + var requestBody = await GetRequestBodyAsync(requestMessage); + await InvokeVoidAsync( + "put", + requestMessage.RequestUri!, + requestMessage.Method.Method, + requestBody, + _vs.Version); + } + // + _currentCacheVersion = _vs.Version; + } +} \ No newline at end of file diff --git a/src/Web/WebAdmin/WebAdmin/Infrastructure/IAppVersionService.cs b/src/Web/WebAdmin/WebAdmin/Infrastructure/IAppVersionService.cs new file mode 100644 index 0000000..c7c09e3 --- /dev/null +++ b/src/Web/WebAdmin/WebAdmin/Infrastructure/IAppVersionService.cs @@ -0,0 +1,9 @@ +namespace WebAdmin.Infrastructure; + +/// +/// AppVersion Service +/// +public interface IAppVersionService +{ + string Version { get; } +} \ No newline at end of file diff --git a/src/Web/WebAdmin/WebAdmin/Program.cs b/src/Web/WebAdmin/WebAdmin/Program.cs new file mode 100644 index 0000000..c009174 --- /dev/null +++ b/src/Web/WebAdmin/WebAdmin/Program.cs @@ -0,0 +1,84 @@ +using Microsoft.AspNetCore.Hosting.StaticWebAssets; +using Microsoft.FluentUI.AspNetCore.Components; +using WebAdmin.Components; +using WebAdmin.Components.Shared; +using WebAdmin.Configurations; +using WebAdmin.Infrastructure; +using _Imports = WebAdmin.Client._Imports; + +var builder = WebApplication.CreateBuilder(args); + +StaticWebAssetsLoader.UseStaticWebAssets(builder.Environment, builder.Configuration); + +// Add services to the container. + +var adminUiOptions = new AdminUiOptions(); +adminUiOptions.BindConfiguration(builder.Configuration); + +builder.Services.AddSingleton(adminUiOptions); +builder.Services.AddSingleton(adminUiOptions.Admin); +builder.Services.AddSingleton(adminUiOptions.Culture); +builder.Services.AddSingleton(adminUiOptions.Http); + + +builder.Services.AddScoped(); +builder.Services.AddSingleton(); +builder.Services.AddSingleton(); + +builder.Services.AddRazorComponents() + .AddInteractiveServerComponents() + .AddInteractiveWebAssemblyComponents(); +builder.Services.AddControllers(); +builder.Services.AddFluentUIComponents(); +builder.Services.AddOrderAppDataConnection(builder.Configuration); + +builder.Services.AddLocalization(opt => opt.ResourcesPath = ConfigurationConsts.ResourcesPath); +var app = builder.Build(); + + +// Configure the HTTP request pipeline. +if (app.Environment.IsDevelopment()) +{ + app.UseWebAssemblyDebugging(); +} +else +{ + app.UseExceptionHandler("/Error", true); + // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts. + app.UseHsts(); +} + +app.UseHttpsRedirection(); +app.MapControllers(); +app.UseRequestLocalization(options => +{ + var cultureConfiguration = adminUiOptions.Culture; + + var supportedCultureCodes = + (cultureConfiguration?.Cultures?.Count > 0 + ? cultureConfiguration.Cultures.Intersect(CultureConfiguration.AvailableCultures) + : CultureConfiguration.AvailableCultures).ToArray(); + + if (supportedCultureCodes.Length == 0) supportedCultureCodes = CultureConfiguration.AvailableCultures; + + var defaultCultureCode = string.IsNullOrEmpty(cultureConfiguration!.DefaultCulture) + ? CultureConfiguration.DefaultRequestCulture + : cultureConfiguration.DefaultCulture; + + if (!supportedCultureCodes.Contains(defaultCultureCode)) + defaultCultureCode = supportedCultureCodes.FirstOrDefault(); + + options + .SetDefaultCulture(defaultCultureCode!) + .AddSupportedCultures(supportedCultureCodes) + .AddSupportedUICultures(supportedCultureCodes); +}); +app.UseStaticFiles(); +app.UseAntiforgery(); + +app.MapRazorComponents() + .AddInteractiveServerRenderMode() + .AddInteractiveWebAssemblyRenderMode() + .AddAdditionalAssemblies(typeof(_Imports).Assembly); + +app.Run(); \ No newline at end of file diff --git a/src/Web/WebAdmin/WebAdmin/Properties/launchSettings.json b/src/Web/WebAdmin/WebAdmin/Properties/launchSettings.json new file mode 100644 index 0000000..ae96d44 --- /dev/null +++ b/src/Web/WebAdmin/WebAdmin/Properties/launchSettings.json @@ -0,0 +1,25 @@ +{ + "$schema": "http://json.schemastore.org/launchsettings.json", + "profiles": { + "http": { + "commandName": "Project", + "dotnetRunMessages": true, + "launchBrowser": true, + "inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}", + "applicationUrl": "http://localhost:5103", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + }, + "https": { + "commandName": "Project", + "dotnetRunMessages": true, + "launchBrowser": true, + "inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}", + "applicationUrl": "https://localhost:7039;http://localhost:5103", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + } + } + } diff --git a/src/Web/WebAdmin/WebAdmin/Resources/Components/Layout/NavMenu.cs b/src/Web/WebAdmin/WebAdmin/Resources/Components/Layout/NavMenu.cs new file mode 100644 index 0000000..eeaea36 --- /dev/null +++ b/src/Web/WebAdmin/WebAdmin/Resources/Components/Layout/NavMenu.cs @@ -0,0 +1,5 @@ +namespace WebAdmin.Resources.Components.Layout; + +public class NavMenu +{ +} \ No newline at end of file diff --git a/src/Web/WebAdmin/WebAdmin/Resources/Components/Layout/NavMenu.en.resx b/src/Web/WebAdmin/WebAdmin/Resources/Components/Layout/NavMenu.en.resx new file mode 100644 index 0000000..2034ad2 --- /dev/null +++ b/src/Web/WebAdmin/WebAdmin/Resources/Components/Layout/NavMenu.en.resx @@ -0,0 +1,161 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 1.3 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.3500.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.3500.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Customer + + + Customer Level + + + Customer List + + + Order + + + Purchase Orders + + + Process Orders + + + Payment + + + Receiving Orders + + + Paid Orders + + + Logistics + + + Logistics Orders + + + Logistics Services + + + Logistics Channels + + + Device + + + Device List + + + Device Types + + + Device Modules + + + Maintenance Orders + + + Remote Control + + + Version + + \ No newline at end of file diff --git a/src/Web/WebAdmin/WebAdmin/Resources/Components/Layout/NavMenu.zh-Hans.resx b/src/Web/WebAdmin/WebAdmin/Resources/Components/Layout/NavMenu.zh-Hans.resx new file mode 100644 index 0000000..708114e --- /dev/null +++ b/src/Web/WebAdmin/WebAdmin/Resources/Components/Layout/NavMenu.zh-Hans.resx @@ -0,0 +1,161 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 1.3 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.3500.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.3500.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + 会员管理 + + + 会员列表 + + + 会员等级 + + + 订单管理 + + + 采购订单 + + + 加工订单 + + + 支付管理 + + + 收款订单 + + + 付款订单 + + + 物流管理 + + + 物流订单 + + + 物流服务 + + + 物流渠道 + + + 终端管理 + + + 终端列表 + + + 型号列表 + + + 基础模块 + + + 维护订单 + + + 远程控制 + + + 版本管理 + + \ No newline at end of file diff --git a/src/Web/WebAdmin/WebAdmin/Resources/Components/Pages/CustomerList.en.resx b/src/Web/WebAdmin/WebAdmin/Resources/Components/Pages/CustomerList.en.resx new file mode 100644 index 0000000..585e2a1 --- /dev/null +++ b/src/Web/WebAdmin/WebAdmin/Resources/Components/Pages/CustomerList.en.resx @@ -0,0 +1,123 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Customer List + + \ No newline at end of file diff --git a/src/Web/WebAdmin/WebAdmin/Resources/Components/Pages/CustomerList.zh-Hans.resx b/src/Web/WebAdmin/WebAdmin/Resources/Components/Pages/CustomerList.zh-Hans.resx new file mode 100644 index 0000000..439fcda --- /dev/null +++ b/src/Web/WebAdmin/WebAdmin/Resources/Components/Pages/CustomerList.zh-Hans.resx @@ -0,0 +1,123 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + 会员列表 + + \ No newline at end of file diff --git a/src/Web/WebAdmin/WebAdmin/Resources/Components/Pages/Home.en.resx b/src/Web/WebAdmin/WebAdmin/Resources/Components/Pages/Home.en.resx new file mode 100644 index 0000000..d2a88d1 --- /dev/null +++ b/src/Web/WebAdmin/WebAdmin/Resources/Components/Pages/Home.en.resx @@ -0,0 +1,123 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Home + + \ No newline at end of file diff --git a/src/Web/WebAdmin/WebAdmin/Resources/Components/Pages/Home.zh-Hans.resx b/src/Web/WebAdmin/WebAdmin/Resources/Components/Pages/Home.zh-Hans.resx new file mode 100644 index 0000000..6aff071 --- /dev/null +++ b/src/Web/WebAdmin/WebAdmin/Resources/Components/Pages/Home.zh-Hans.resx @@ -0,0 +1,123 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + 首页 + + \ No newline at end of file diff --git a/src/Web/WebAdmin/WebAdmin/WebAdmin.csproj b/src/Web/WebAdmin/WebAdmin/WebAdmin.csproj new file mode 100644 index 0000000..c84d102 --- /dev/null +++ b/src/Web/WebAdmin/WebAdmin/WebAdmin.csproj @@ -0,0 +1,45 @@ + + + + net8.0 + enable + enable + latest + false + false + false + + + + + + + + False + 6 + true + false + 612;618;1701;1702;8669;1591;1816 + + + + True + 1701;1702;8669;1591 + false + true + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/Web/WebAdmin/WebAdmin/WebAdmin.xml b/src/Web/WebAdmin/WebAdmin/WebAdmin.xml new file mode 100644 index 0000000..8536ce5 --- /dev/null +++ b/src/Web/WebAdmin/WebAdmin/WebAdmin.xml @@ -0,0 +1,110 @@ + + + + WebAdmin + + + + + 管理后台配置 + + + + 管理后台的基础配置 + + + 全球化配置 + + + HTTP 托管环境配置 + + + + 将从 appsettings 文件解析的配置应用到这些选项中。 + + 绑定到此实例的配置 + + + + 管理后台的基础配置 + + + + Page Name + + + Favicon Uri + + + Web Admin Redirect Uri + + + Scopes + + + Administration Role Name + + + Require HttpsMetadata + + + Web Admin CookieName + + + Web Admin Cookie Expires UtcHours + + + Token Validation ClaimName + + + Token Validation ClaimRole + + + IdentityServer BaseUrl + + + ClientId + + + ClientSecret + + + Oidc ResponseType + + + + 全球化配置 + + + + 可用的多语言文化 + + + 默认的文化 + + + 可用的多语言文化列表 + + + 默认的文化 + + + + Http 配置 + + + + BasePath + + + + AppVersion Service + + + + + AppVersion Service + + + + diff --git a/src/Web/WebAdmin/WebAdmin/appsettings.Development.json b/src/Web/WebAdmin/WebAdmin/appsettings.Development.json new file mode 100644 index 0000000..01daaa3 --- /dev/null +++ b/src/Web/WebAdmin/WebAdmin/appsettings.Development.json @@ -0,0 +1,49 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.AspNetCore": "Warning" + } + }, + + "DetailedErrors": true, + + "AllowedHosts": "*", + + "ConnectionStrings": { + "Catalog": "Server=192.168.8.112;Port=5432;Database=dapr_catalog;User Id=dapr;Password=Local@Db;Pooling=true;MaxPoolSize=100;", + "Identity": "Server=192.168.8.112;Port=5432;Database=dapr_identity;User Id=dapr;Password=Local@Db;Pooling=true;MaxPoolSize=100;", + "Ordering": "Server=192.168.8.112;Port=5432;Database=dapr_ordering;User Id=dapr;Password=Local@Db;Pooling=true;MaxPoolSize=100;" + }, + + "AdminConfiguration": { + "PageTitle": "管理后台", + "FaviconUri": "~/favicon.ico", + "AdminRedirectUri": "https://localhost:44303/signin-oidc", + "IdentityServerBaseUrl": "https://localhost:44310", + "AdminCookieName": "IdentityServerAdmin", + "AdminCookieExpiresUtcHours": 12, + "RequireHttpsMetadata": false, + "TokenValidationClaimName": "name", + "TokenValidationClaimRole": "role", + "ClientId": "web_admin", + "ClientSecret": "3E220EE1-C134-4A0C-9ADF-73E303AA9FA8", + "OidcResponseType": "code", + "Scopes": [ + "openid", + "profile", + "email", + "roles" + ], + "AdministrationRole": "Administrator" + }, + + "CultureConfiguration": { + "Cultures": [ "en", "zh-Hans" ], + "DefaultCulture": "zh-Hans" + }, + + "HttpConfiguration": { + "BasePath": "" + } +} diff --git a/src/Web/WebAdmin/WebAdmin/appsettings.json b/src/Web/WebAdmin/WebAdmin/appsettings.json new file mode 100644 index 0000000..10f68b8 --- /dev/null +++ b/src/Web/WebAdmin/WebAdmin/appsettings.json @@ -0,0 +1,9 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.AspNetCore": "Warning" + } + }, + "AllowedHosts": "*" +} diff --git a/src/Web/WebAdmin/WebAdmin/wwwroot/app.css b/src/Web/WebAdmin/WebAdmin/wwwroot/app.css new file mode 100644 index 0000000..da5e427 --- /dev/null +++ b/src/Web/WebAdmin/WebAdmin/wwwroot/app.css @@ -0,0 +1,425 @@ +@import '/_content/Microsoft.FluentUI.AspNetCore.Components/css/reboot.css'; + +@import '/_content/Microsoft.FluentUI.AspNetCore.Components/css/reboot.css'; + +body { + height: 100%; + overflow: hidden; +} + +.siteheader { + border-bottom: calc(var(--stroke-width) * 2px) solid var(--accent-fill-rest); + margin-bottom: 0 !important; +} + +.siteheader .logo { + grid-column: 1; + height: 23px; + width: 108px; +} + +.siteheader .search { + align-items: center; + display: flex; + padding-right: 20px; +} + +.siteheader .links { + align-items: center; + display: flex; + padding-right: 10px; +} + +.siteheader .notifications { + align-items: center; + display: flex; +} + +.siteheader .settings { + align-items: center; + display: flex; + margin-left: 0; + margin-right: 10px; + padding-right: 6px; +} + +[dir="rtl"] .siteheader .settings { + margin-left: 10px; + margin-right: 0; + padding: 0 0 0 6px; +} + +[dir="rtl"] .siteheader .search { + padding-left: 20px; + padding-right: 0; +} + +[dir="rtl"] .siteheader .links { padding-left: 10px; } + +.search-result-icon { vertical-align: middle; } + +.body-stack { flex-direction: row; } + +.footer { + background: var(--neutral-layer-4); + color: var(--neutral-foreground-rest) !important; + display: flex !important; + flex-direction: row !important; + margin-top: 0px !important; + padding: 10px 10px; +} + +.footer .version a { + color: var(--neutral-foreground-rest); + text-decoration: none; +} + +.footer .version a:focus { + outline: 1px dashed; + outline-offset: 3px; +} + +.footer .version a:hover { text-decoration: underline; } + + +nav.sitenav { + background-color: var(--neutral-layer-1); + height: calc(100dvh - 90px); + overflow-y: auto; + padding: 1.5rem 1rem; + width: 18rem; +} + +nav h2 { + font-size: var(--type-ramp-plus-1-font-size); + line-height: var(--type-ramp-plus-1-line-height); + margin: 0; + padding: 15px 0; + pointer-events: none; +} + +nav h3 { + font-size: var(--type-ramp-base-font-size); + line-height: var(--type-ramp-minus-1-line-height); + margin: 0; + padding: 10px 0; + pointer-events: none; +} + + +nav fluent-anchor { + color: var(--fill-color); + width: 100%; +} + +nav fluent-anchor::part(control) { + background: var(--accent-fill-rest); + justify-content: start; +} + + +.fluent-nav-link.notactive .fluent-nav-text { font-weight: 600 !important; } + +/*.content { + background-color: var(--neutral-layer-1); + display: flex; +}*/ + +article { + border-right: 1px solid var(--neutral-stroke-divider-rest); + margin: 0 0; + overflow-x: hidden; + padding: 1.5rem 1rem; + transition: all 300ms ease-in-out; + width: calc(100% - 18rem); +} + +aside { + height: 100vh; + padding: 1.5rem 1rem; + position: sticky; + top: 0px; + width: 18rem; +} + +#navmenu-toggle { display: none; } + +.navmenu-icon { display: none; } + +#navmenu-toggle:checked > nav { width: 0px; } + +[dir="rtl"] #navmenu-toggle:checked ~ nav { right: 0px; } + +#color { + margin-left: 0; + margin-right: 10px; +} + +[dir="rtl"] #color { + margin-left: 10px; + margin-right: 0; +} + + +label { + color: var(--neutral-foreground-rest); + cursor: pointer; +} + +.shell, .sourceCode { + background: var(--neutral-stroke-layer-rest); + padding: 7px; +} + +code { background: var(--neutral-stroke-layer-rest); } + +.demopanel { + border: 1px dashed var(--accent-fill-rest); + padding: 5px; +} + +.highlighted-row { background-color: var(--neutral-fill-secondary-hover); } + +kbd { + background-color: var(--neutral-fill-secondary-rest); + border: 1px solid var(--accent-fill-rest); + border-radius: 0.25rem; + color: var(--neutral-foreground-rest); + font-size: 0.875em; + padding: 0.10rem 0.25rem; +} + +#blazor-error-ui { + background: lightyellow; + bottom: 0; + box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2); + color: var(--neutral-foreground-rest); + display: none; + left: 0; + margin: 20px 0; + padding: 0.6rem 1.25rem 0.7rem 1.25rem; + position: fixed; + width: 100%; + z-index: 1000; +} + +#blazor-error-ui .dismiss { + cursor: pointer; + position: absolute; + right: 0.75rem; + top: 0.5rem; +} + +.blazor-error-boundary { + background: url("data:image/svg+xml;base64,PHN2ZyB3aWR0aD0nNDgnIGhlaWdodD0nNDgnIHhtbG5zPSdodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZycgeG1sbnM6eGxpbms9J2h0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsnIG92ZXJmbG93PSdoaWRkZW4nIGZpbGw9JyNCQzJGMzInPjxwYXRoIGQ9J00yNCA0YTIwIDIwIDAgMSAwIDAgNDAgMjAgMjAgMCAwIDAgMC00MFptMCA5Yy42OSAwIDEuMjUuNTYgMS4yNSAxLjI1djEyLjVhMS4yNSAxLjI1IDAgMSAxLTIuNSAwdi0xMi41YzAtLjY5LjU2LTEuMjUgMS4yNS0xLjI1Wm0wIDIxYTIgMiAwIDEgMSAwLTQgMiAyIDAgMCAxIDAgNFonPjwvcGF0aD48L3N2Zz4=") no-repeat 1rem/1.8rem; + border: 1px dashed var(--error); + padding: 1rem 1rem 1rem 3.7rem; +} + +.blazor-error-boundary::before { content: "An error has occurred: " } + +.loading-progress { + display: block; + height: 8rem; + margin: 20vh auto 1rem auto; + position: relative; + width: 8rem; +} + +.loading-progress circle { + fill: none; + stroke: var(--neutral-fill-layer-rest); + stroke-width: 0.6rem; + transform: rotate(-90deg); + transform-origin: 50% 50%; +} + +.loading-progress circle:last-child { + stroke: #1b6ec2; + stroke-dasharray: calc(3.141 * var(--blazor-load-percentage, 0%) * 0.8), 500%; + transition: stroke-dasharray 0.05s ease-in-out; +} + +.loading-progress-text { + font-weight: bold; + inset: calc(20vh + 3.25rem) 0 auto 0.2rem; + position: absolute; + text-align: center; +} + +.loading-progress-text:after { content: var(--blazor-load-percentage-text, "Loading"); } + +@media (max-width: 767px) { + .siteheader { + align-items: center; + grid-area: header; + grid-template-columns: 150px 1fr; + justify-content: flex-start; + } + + .siteheader .search { display: none; } + + .siteheader .logo { + height: 23px; + width: 160px; + /*padding: 0 25px;*/ + } + + + .body-stack { flex-direction: column !important; } + + nav.sitenav { + height: calc(100dvh - 50px); + width: 100%; + } + + .navmenu { width: 100%; } + + #navmenu-toggle { appearance: none; } + + .navmenu-icon { + border: none; + cursor: pointer; + display: block; + height: 20px; + left: unset; + position: absolute; + right: 20px; + top: 15px; + width: 20px; + z-index: 10; + } + + [dir="rtl"] .navmenu-icon { + left: 20px; + right: unset + } + + #navmenu-toggle ~ nav { display: none; } + + #navmenu-toggle:checked ~ nav { display: block; } + + #navmenu-toggle ~ article { display: block; } + + #navmenu-toggle:checked ~ article { display: none; } + + .content { flex-direction: column; } + + article { + padding-top: 0px; + width: 100%; + } + + aside { + padding: 1em 0.75em; + width: 100%; + } + + .footer { + display: grid; + grid-template-columns: 10px auto 10px; + } + + .footer .version { + grid-column: 2; + justify-self: start; + } + + .footer .copy { + grid-column: 2; + grid-row: 2; + justify-self: end; + } + + + @media screen and (max-width: 767px) and (orientation: landscape) { + nav { padding: 25px 40px; } + + nav ul { margin: 0 0; } + } +} + +@media (min-width: 768px) and (max-width: 1024px) { + fluent-select::part(control) { width: 150px; } + + aside { + padding: 1.5em 0.75em 1em 0.75em; + width: 12rem; + } + + article { + padding-top: 0px; + width: 100%; + } +} + + +/* Surface Duo specific styling */ + +@media (horizontal-viewport-segments: 2) { + .siteheader { + align-items: center; + background-color: var(--neutral-layer-4); + display: grid; + grid-area: header; + grid-template-columns: 150px calc(env(viewport-segment-width 0 0) - 160px) 1fr; + grid-template-rows: 1fr; + justify-content: flex-start; + padding: 12px 0; + } + + .siteheader a { + color: var(--neutral-foreground-rest); + padding: 0px 15px; + } + + .siteheader .logo { + grid-column: 1; + height: 23px; + width: 108px; + /*padding: 0 30px;*/ + } + + main { + display: grid; + grid-template-columns: env(viewport-segment-width 0 0) 1fr; + grid-template-rows: repeat(0, 1fr); + } + + nav { + grid-column: 1; + width: env(viewport-segment-width 0 0) !important; + } + + .content { + display: grid; + grid-template-columns: auto; + } + + aside { + grid-area: 2/2/3/3; + margin-inline-end: calc(100% - env(viewport-segment-left 1 0)); + margin-inline-start: calc(env(viewport-segment-left 1 0) - env(viewport-segment-right 0 0)); /* hinge width */ + padding: 1.5em 0.75em 1em 0.75em; + width: auto; + } + + article { + grid-area: 1/2/2/3; + margin-inline-end: calc(100% - env(viewport-segment-left 1 0)); + margin-inline-start: calc(env(viewport-segment-left 1 0) - env(viewport-segment-right 0 0)); /* hinge width */ + padding-top: 0px; + width: auto; + } +} + + + +@media (min-width: 800px) { + .fluent-dialog-main { --dialog-width: 340px; } +} + + +@media (max-width: 480px) { + .fluent-dialog-main { --dialog-width: 100vw; } +} diff --git a/src/Web/WebAdmin/WebAdmin/wwwroot/favicon.png b/src/Web/WebAdmin/WebAdmin/wwwroot/favicon.png new file mode 100644 index 0000000000000000000000000000000000000000..8422b59695935d180d11d5dbe99653e711097819 GIT binary patch literal 1148 zcmV-?1cUpDP)9h26h2-Cs%i*@Moc3?#6qJID|D#|3|2Hn7gTIYEkr|%Xjp);YgvFmB&0#2E2b=| zkVr)lMv9=KqwN&%obTp-$<51T%rx*NCwceh-E+=&e(oLO`@Z~7gybJ#U|^tB2Pai} zRN@5%1qsZ1e@R(XC8n~)nU1S0QdzEYlWPdUpH{wJ2Pd4V8kI3BM=)sG^IkUXF2-j{ zrPTYA6sxpQ`Q1c6mtar~gG~#;lt=s^6_OccmRd>o{*=>)KS=lM zZ!)iG|8G0-9s3VLm`bsa6e ze*TlRxAjXtm^F8V`M1%s5d@tYS>&+_ga#xKGb|!oUBx3uc@mj1%=MaH4GR0tPBG_& z9OZE;->dO@`Q)nr<%dHAsEZRKl zedN6+3+uGHejJp;Q==pskSAcRcyh@6mjm2z-uG;s%dM-u0*u##7OxI7wwyCGpS?4U zBFAr(%GBv5j$jS@@t@iI8?ZqE36I^4t+P^J9D^ELbS5KMtZ z{Qn#JnSd$15nJ$ggkF%I4yUQC+BjDF^}AtB7w348EL>7#sAsLWs}ndp8^DsAcOIL9 zTOO!!0!k2`9BLk25)NeZp7ev>I1Mn={cWI3Yhx2Q#DnAo4IphoV~R^c0x&nw*MoIV zPthX?{6{u}sMS(MxD*dmd5rU(YazQE59b|TsB5Tm)I4a!VaN@HYOR)DwH1U5y(E)z zQqQU*B%MwtRQ$%x&;1p%ANmc|PkoFJZ%<-uq%PX&C!c-7ypis=eP+FCeuv+B@h#{4 zGx1m0PjS~FJt}3mdt4c!lel`1;4W|03kcZRG+DzkTy|7-F~eDsV2Tx!73dM0H0CTh zl)F-YUkE1zEzEW(;JXc|KR5{ox%YTh{$%F$a36JP6Nb<0%#NbSh$dMYF-{ z1_x(Vx)}fs?5_|!5xBTWiiIQHG<%)*e=45Fhjw_tlnmlixq;mUdC$R8v#j( zhQ$9YR-o%i5Uc`S?6EC51!bTRK=Xkyb<18FkCKnS2;o*qlij1YA@-nRpq#OMTX&RbL<^2q@0qja!uIvI;j$6>~k@IMwD42=8$$!+R^@5o6HX(*n~ now) { + const result = await response.text(); + + return result; + } + } + + return ""; +} + +export async function remove(url, method, body = "") { + const cache = await openCacheStorage(); + + if (cache != null) { + const request = createRequest(url, method, body); + await cache.delete(request); + } +} + +export async function removeAll() { + const cache = await openCacheStorage(); + + if (cache != null) { + cache.keys().then(function(names) { + for (let name of names) + cache.delete(name); + }); + //let requests = await cache.keys(); + + //for (let request in requests) { + // await cache.delete(request); + //} + } +} \ No newline at end of file diff --git a/test/DaprTool.AbstractionsTest/Base/DbDependencySetupFixture.cs b/test/DaprTool.AbstractionsTest/Base/DbDependencySetupFixture.cs index 6ad1e79..87b212a 100644 --- a/test/DaprTool.AbstractionsTest/Base/DbDependencySetupFixture.cs +++ b/test/DaprTool.AbstractionsTest/Base/DbDependencySetupFixture.cs @@ -11,7 +11,7 @@ public class DbDependencySetupFixture : DependencySetupFixture { // 注册 业务数据库 ServiceCollection.AddLogging(); - ServiceCollection.AddAppDataConnection(Configuration); + ServiceCollection.AddOrderAppDataConnection(Configuration); } } @@ -25,7 +25,7 @@ public class ObserverDependencySetupFixture : DependencySetupFixture // 注册 MediatR ServiceCollection.AddLogging(); ServiceCollection.AddAppMediators(); - ServiceCollection.AddAppDataConnection(Configuration); + ServiceCollection.AddOrderAppDataConnection(Configuration); } } -- Gitee From 2464dcb74ec1f03f0e6fdce65da5a28391ca24e6 Mon Sep 17 00:00:00 2001 From: iamshen Date: Tue, 30 Apr 2024 15:23:58 +0800 Subject: [PATCH 2/2] Update web admin ui blazor-flent-ui --- Common.props | 2 +- DaprTool.Solution.sln | 31 +- Directory.Packages.props | 27 +- src/Web/WebAdmin.Client/Layout/NavMenu.razor | 18 + .../WebAdmin.Client/Pages/Counter.razor | 0 src/Web/WebAdmin.Client/Program.cs | 5 + .../WebAdmin.Client/WebAdmin.Client.csproj | 15 +- .../WebAdmin.Client/WebAdmin.Client.xml | 0 .../WebAdmin.Client/_Imports.razor | 2 +- .../wwwroot/appsettings.Development.json} | 0 .../WebAdmin.Client/wwwroot/appsettings.json | 8 + .../Components}/CultureSelector.razor | 6 +- .../Components}/CultureSelector.razor.cs | 4 +- .../Components}/CultureSelector.razor.css | 0 .../Components}/SiteLinks.razor | 7 +- .../Components}/SiteLinks.razor.css | 0 .../Components/SiteSearch.razor} | 4 +- .../Components/SiteSearch.razor.cs} | 7 +- .../Components}/SiteSettings.razor | 7 +- .../Components}/SiteSettings.razor.cs | 4 +- .../Components}/SiteSettingsPanel.razor | 39 +- .../Components}/SiteSettingsPanel.razor.cs | 24 +- .../Components/TableOfContents.razor | 14 + .../Components/TableOfContents.razor.cs | 170 ++++++++ .../Components/TableOfContents.razor.css | 57 +++ .../Components/TableOfContents.razor.js | 74 ++++ .../Components}/UserProfile.razor | 8 +- .../Components}/UserProfile.razor.css | 0 .../Configurations/AdminUiOptions.cs | 4 +- .../Configurations/ConfigurationConsts.cs | 3 +- .../Infrastructure/AppVersionService.cs | 2 +- .../Infrastructure/CacheStorageAccessor.cs | 4 +- .../Infrastructure}/CustomIcons.cs | 2 +- .../HttpBasedStaticAssetService.cs | 57 +++ .../Infrastructure/IAppVersionService.cs | 2 +- .../Infrastructure/IStaticAssetService.cs | 6 + .../Infrastructure}/NavProvider.cs | 12 +- .../Infrastructure/OfficeColorNameMapper.cs | 38 ++ .../ServerStaticAssetService.cs | 21 + .../ServiceCollectionExtensions.cs | 34 ++ .../WebAdmin.Shared/Layout/MainLayout.razor | 111 ++++++ .../Layout/MainLayout.razor.js | 12 + .../Layout/NavMenu.razor | 4 +- .../Layout/NavMenu.razor.css | 0 .../Layout/NavMenuItem.razor | 3 +- .../Layout/NavMenuItem.razor.css | 1 + .../Records}/NavItem.cs | 8 +- .../Resources}/Layout/NavMenu.cs | 2 +- .../Resources}/Layout/NavMenu.en.resx | 0 .../Resources}/Layout/NavMenu.zh-Hans.resx | 0 .../WebAdmin.Shared.csproj} | 11 +- src/Web/WebAdmin.Shared/_App.razor | 13 + src/Web/WebAdmin.Shared/_App.razor.cs | 15 + src/Web/WebAdmin.Shared/_Imports.razor | 23 ++ .../wwwroot/css}/app.css | 362 ++++++++++-------- .../wwwroot/js/CacheStorageAccessor.js | 0 src/Web/WebAdmin/Components/App.razor | 19 + .../Components/Layout/MainLayout.razor | 26 +- .../Components/Pages/Error.razor | 0 src/Web/WebAdmin/Components/Pages/Home.razor | 123 ++++++ .../WebAdmin/Components/Pages/Weather.razor | 65 ++++ .../{WebAdmin => }/Components/Routes.razor | 6 +- .../{WebAdmin => }/Components/_Imports.razor | 12 +- .../Controllers/CultureController.cs | 11 +- src/Web/WebAdmin/{WebAdmin => }/Program.cs | 55 +-- .../Properties/launchSettings.json | 12 +- .../Components/Pages/CustomerList.en.resx | 0 .../Pages/CustomerList.zh-Hans.resx | 0 .../Resources/Components/Pages/Home.en.resx | 0 .../Components/Pages/Home.zh-Hans.resx | 0 .../Components/Pages/Weather.en.resx | 123 ++++++ .../Components/Pages/Weather.zh-Hans.resx | 123 ++++++ src/Web/WebAdmin/WebAdmin.Client/Program.cs | 24 -- .../wwwroot/appsettings.Development.json | 13 - src/Web/WebAdmin/WebAdmin.csproj | 17 + src/Web/WebAdmin/WebAdmin.xml | 8 + .../WebAdmin/WebAdmin/Components/App.razor | 26 -- .../Components/Layout/MainLayout.razor.css | 31 -- .../Components/Pages/CustomerLevels.razor | 3 - .../Components/Pages/CustomerList.razor | 52 --- .../WebAdmin/Components/Pages/Home.razor | 45 --- .../Components/Pages/PurchaseOrder.razor | 81 ---- src/Web/WebAdmin/WebAdmin/WebAdmin.xml | 110 ------ src/Web/WebAdmin/WebAdmin/wwwroot/favicon.png | Bin 1148 -> 0 bytes .../appsettings.Development.json | 0 .../WebAdmin/{WebAdmin => }/appsettings.json | 0 src/Web/WebAdmin/wwwroot/app.css | 177 +++++++++ src/Web/WebAdmin/wwwroot/favicon.ico | Bin 0 -> 15086 bytes 88 files changed, 1712 insertions(+), 733 deletions(-) create mode 100644 src/Web/WebAdmin.Client/Layout/NavMenu.razor rename src/Web/{WebAdmin => }/WebAdmin.Client/Pages/Counter.razor (100%) create mode 100644 src/Web/WebAdmin.Client/Program.cs rename src/Web/{WebAdmin => }/WebAdmin.Client/WebAdmin.Client.csproj (34%) rename src/Web/{WebAdmin => }/WebAdmin.Client/WebAdmin.Client.xml (100%) rename src/Web/{WebAdmin => }/WebAdmin.Client/_Imports.razor (100%) rename src/Web/{WebAdmin/WebAdmin.Client/wwwroot/appsettings.json => WebAdmin.Client/wwwroot/appsettings.Development.json} (100%) create mode 100644 src/Web/WebAdmin.Client/wwwroot/appsettings.json rename src/Web/{WebAdmin/WebAdmin/Components/Shared => WebAdmin.Shared/Components}/CultureSelector.razor (87%) rename src/Web/{WebAdmin/WebAdmin/Components/Shared => WebAdmin.Shared/Components}/CultureSelector.razor.cs (94%) rename src/Web/{WebAdmin/WebAdmin/Components/Shared => WebAdmin.Shared/Components}/CultureSelector.razor.css (100%) rename src/Web/{WebAdmin/WebAdmin/Components/Shared => WebAdmin.Shared/Components}/SiteLinks.razor (70%) rename src/Web/{WebAdmin/WebAdmin/Components/Shared => WebAdmin.Shared/Components}/SiteLinks.razor.css (100%) rename src/Web/{WebAdmin/WebAdmin/Components/Layout/MainSearch.razor => WebAdmin.Shared/Components/SiteSearch.razor} (89%) rename src/Web/{WebAdmin/WebAdmin/Components/Layout/MainSearch.razor.cs => WebAdmin.Shared/Components/SiteSearch.razor.cs} (91%) rename src/Web/{WebAdmin/WebAdmin/Components/Shared => WebAdmin.Shared/Components}/SiteSettings.razor (31%) rename src/Web/{WebAdmin/WebAdmin/Components/Shared => WebAdmin.Shared/Components}/SiteSettings.razor.cs (88%) rename src/Web/{WebAdmin/WebAdmin/Components/Shared => WebAdmin.Shared/Components}/SiteSettingsPanel.razor (52%) rename src/Web/{WebAdmin/WebAdmin/Components/Shared => WebAdmin.Shared/Components}/SiteSettingsPanel.razor.cs (76%) create mode 100644 src/Web/WebAdmin.Shared/Components/TableOfContents.razor create mode 100644 src/Web/WebAdmin.Shared/Components/TableOfContents.razor.cs create mode 100644 src/Web/WebAdmin.Shared/Components/TableOfContents.razor.css create mode 100644 src/Web/WebAdmin.Shared/Components/TableOfContents.razor.js rename src/Web/{WebAdmin/WebAdmin/Components/Shared => WebAdmin.Shared/Components}/UserProfile.razor (50%) rename src/Web/{WebAdmin/WebAdmin/Components/Shared => WebAdmin.Shared/Components}/UserProfile.razor.css (100%) rename src/Web/{WebAdmin/WebAdmin => WebAdmin.Shared}/Configurations/AdminUiOptions.cs (97%) rename src/Web/{WebAdmin/WebAdmin => WebAdmin.Shared}/Configurations/ConfigurationConsts.cs (48%) rename src/Web/{WebAdmin/WebAdmin => WebAdmin.Shared}/Infrastructure/AppVersionService.cs (94%) rename src/Web/{WebAdmin/WebAdmin => WebAdmin.Shared}/Infrastructure/CacheStorageAccessor.cs (96%) rename src/Web/{WebAdmin/WebAdmin/Components/Shared => WebAdmin.Shared/Infrastructure}/CustomIcons.cs (97%) create mode 100644 src/Web/WebAdmin.Shared/Infrastructure/HttpBasedStaticAssetService.cs rename src/Web/{WebAdmin/WebAdmin => WebAdmin.Shared}/Infrastructure/IAppVersionService.cs (73%) create mode 100644 src/Web/WebAdmin.Shared/Infrastructure/IStaticAssetService.cs rename src/Web/{WebAdmin/WebAdmin/Components/Shared => WebAdmin.Shared/Infrastructure}/NavProvider.cs (94%) create mode 100644 src/Web/WebAdmin.Shared/Infrastructure/OfficeColorNameMapper.cs create mode 100644 src/Web/WebAdmin.Shared/Infrastructure/ServerStaticAssetService.cs create mode 100644 src/Web/WebAdmin.Shared/Infrastructure/ServiceCollectionExtensions.cs create mode 100644 src/Web/WebAdmin.Shared/Layout/MainLayout.razor create mode 100644 src/Web/WebAdmin.Shared/Layout/MainLayout.razor.js rename src/Web/{WebAdmin/WebAdmin/Components => WebAdmin.Shared}/Layout/NavMenu.razor (87%) rename src/Web/{WebAdmin/WebAdmin/Components => WebAdmin.Shared}/Layout/NavMenu.razor.css (100%) rename src/Web/{WebAdmin/WebAdmin/Components => WebAdmin.Shared}/Layout/NavMenuItem.razor (90%) create mode 100644 src/Web/WebAdmin.Shared/Layout/NavMenuItem.razor.css rename src/Web/{WebAdmin/WebAdmin/Components/Shared => WebAdmin.Shared/Records}/NavItem.cs (91%) rename src/Web/{WebAdmin/WebAdmin/Resources/Components => WebAdmin.Shared/Resources}/Layout/NavMenu.cs (32%) rename src/Web/{WebAdmin/WebAdmin/Resources/Components => WebAdmin.Shared/Resources}/Layout/NavMenu.en.resx (100%) rename src/Web/{WebAdmin/WebAdmin/Resources/Components => WebAdmin.Shared/Resources}/Layout/NavMenu.zh-Hans.resx (100%) rename src/Web/{WebAdmin/WebAdmin/WebAdmin.csproj => WebAdmin.Shared/WebAdmin.Shared.csproj} (73%) create mode 100644 src/Web/WebAdmin.Shared/_App.razor create mode 100644 src/Web/WebAdmin.Shared/_App.razor.cs create mode 100644 src/Web/WebAdmin.Shared/_Imports.razor rename src/Web/{WebAdmin/WebAdmin/wwwroot => WebAdmin.Shared/wwwroot/css}/app.css (61%) rename src/Web/{WebAdmin/WebAdmin => WebAdmin.Shared}/wwwroot/js/CacheStorageAccessor.js (100%) create mode 100644 src/Web/WebAdmin/Components/App.razor rename src/Web/WebAdmin/{WebAdmin => }/Components/Layout/MainLayout.razor (43%) rename src/Web/WebAdmin/{WebAdmin => }/Components/Pages/Error.razor (100%) create mode 100644 src/Web/WebAdmin/Components/Pages/Home.razor create mode 100644 src/Web/WebAdmin/Components/Pages/Weather.razor rename src/Web/WebAdmin/{WebAdmin => }/Components/Routes.razor (31%) rename src/Web/WebAdmin/{WebAdmin => }/Components/_Imports.razor (64%) rename src/Web/WebAdmin/{WebAdmin => }/Controllers/CultureController.cs (60%) rename src/Web/WebAdmin/{WebAdmin => }/Program.cs (62%) rename src/Web/WebAdmin/{WebAdmin => }/Properties/launchSettings.json (48%) rename src/Web/WebAdmin/{WebAdmin => }/Resources/Components/Pages/CustomerList.en.resx (100%) rename src/Web/WebAdmin/{WebAdmin => }/Resources/Components/Pages/CustomerList.zh-Hans.resx (100%) rename src/Web/WebAdmin/{WebAdmin => }/Resources/Components/Pages/Home.en.resx (100%) rename src/Web/WebAdmin/{WebAdmin => }/Resources/Components/Pages/Home.zh-Hans.resx (100%) create mode 100644 src/Web/WebAdmin/Resources/Components/Pages/Weather.en.resx create mode 100644 src/Web/WebAdmin/Resources/Components/Pages/Weather.zh-Hans.resx delete mode 100644 src/Web/WebAdmin/WebAdmin.Client/Program.cs delete mode 100644 src/Web/WebAdmin/WebAdmin.Client/wwwroot/appsettings.Development.json create mode 100644 src/Web/WebAdmin/WebAdmin.csproj create mode 100644 src/Web/WebAdmin/WebAdmin.xml delete mode 100644 src/Web/WebAdmin/WebAdmin/Components/App.razor delete mode 100644 src/Web/WebAdmin/WebAdmin/Components/Layout/MainLayout.razor.css delete mode 100644 src/Web/WebAdmin/WebAdmin/Components/Pages/CustomerLevels.razor delete mode 100644 src/Web/WebAdmin/WebAdmin/Components/Pages/CustomerList.razor delete mode 100644 src/Web/WebAdmin/WebAdmin/Components/Pages/Home.razor delete mode 100644 src/Web/WebAdmin/WebAdmin/Components/Pages/PurchaseOrder.razor delete mode 100644 src/Web/WebAdmin/WebAdmin/WebAdmin.xml delete mode 100644 src/Web/WebAdmin/WebAdmin/wwwroot/favicon.png rename src/Web/WebAdmin/{WebAdmin => }/appsettings.Development.json (100%) rename src/Web/WebAdmin/{WebAdmin => }/appsettings.json (100%) create mode 100644 src/Web/WebAdmin/wwwroot/app.css create mode 100644 src/Web/WebAdmin/wwwroot/favicon.ico diff --git a/Common.props b/Common.props index e01f9df..a518bd0 100644 --- a/Common.props +++ b/Common.props @@ -4,7 +4,7 @@ net8.0 enable enable - NU1803;NU1507;1701;1702;1591;8002 + NU1803;NU1507;1701;1702;1591;8002;CS1573; diff --git a/DaprTool.Solution.sln b/DaprTool.Solution.sln index c71afb4..a9c0118 100644 --- a/DaprTool.Solution.sln +++ b/DaprTool.Solution.sln @@ -119,9 +119,11 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Dependency", "src\BuildingB EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Validation", "src\BuildingBlocks\Validation\Validation.csproj", "{7449D8D4-0F2A-4D35-BC2F-0DEF40833C91}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WebAdmin", "src\Web\WebAdmin\WebAdmin\WebAdmin.csproj", "{20F4D5A5-8047-4ACA-B8A0-6F1EB2D2F5B9}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WebAdmin.Shared", "src\Web\WebAdmin.Shared\WebAdmin.Shared.csproj", "{9FCF0D70-CF60-4C0D-8667-42DB50BC6EE2}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WebAdmin.Client", "src\Web\WebAdmin\WebAdmin.Client\WebAdmin.Client.csproj", "{8E19ECB4-9DC8-45A9-95F6-AB0E1D5D1A4B}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WebAdmin.Client", "src\Web\WebAdmin.Client\WebAdmin.Client.csproj", "{306E933B-914F-4935-A924-DA756F766753}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WebAdmin", "src\Web\WebAdmin\WebAdmin.csproj", "{EA794699-4DD1-4622-A80F-DB138AB53D86}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -213,14 +215,18 @@ Global {7449D8D4-0F2A-4D35-BC2F-0DEF40833C91}.Debug|Any CPU.Build.0 = Debug|Any CPU {7449D8D4-0F2A-4D35-BC2F-0DEF40833C91}.Release|Any CPU.ActiveCfg = Release|Any CPU {7449D8D4-0F2A-4D35-BC2F-0DEF40833C91}.Release|Any CPU.Build.0 = Release|Any CPU - {20F4D5A5-8047-4ACA-B8A0-6F1EB2D2F5B9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {20F4D5A5-8047-4ACA-B8A0-6F1EB2D2F5B9}.Debug|Any CPU.Build.0 = Debug|Any CPU - {20F4D5A5-8047-4ACA-B8A0-6F1EB2D2F5B9}.Release|Any CPU.ActiveCfg = Release|Any CPU - {20F4D5A5-8047-4ACA-B8A0-6F1EB2D2F5B9}.Release|Any CPU.Build.0 = Release|Any CPU - {8E19ECB4-9DC8-45A9-95F6-AB0E1D5D1A4B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {8E19ECB4-9DC8-45A9-95F6-AB0E1D5D1A4B}.Debug|Any CPU.Build.0 = Debug|Any CPU - {8E19ECB4-9DC8-45A9-95F6-AB0E1D5D1A4B}.Release|Any CPU.ActiveCfg = Release|Any CPU - {8E19ECB4-9DC8-45A9-95F6-AB0E1D5D1A4B}.Release|Any CPU.Build.0 = Release|Any CPU + {9FCF0D70-CF60-4C0D-8667-42DB50BC6EE2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {9FCF0D70-CF60-4C0D-8667-42DB50BC6EE2}.Debug|Any CPU.Build.0 = Debug|Any CPU + {9FCF0D70-CF60-4C0D-8667-42DB50BC6EE2}.Release|Any CPU.ActiveCfg = Release|Any CPU + {9FCF0D70-CF60-4C0D-8667-42DB50BC6EE2}.Release|Any CPU.Build.0 = Release|Any CPU + {306E933B-914F-4935-A924-DA756F766753}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {306E933B-914F-4935-A924-DA756F766753}.Debug|Any CPU.Build.0 = Debug|Any CPU + {306E933B-914F-4935-A924-DA756F766753}.Release|Any CPU.ActiveCfg = Release|Any CPU + {306E933B-914F-4935-A924-DA756F766753}.Release|Any CPU.Build.0 = Release|Any CPU + {EA794699-4DD1-4622-A80F-DB138AB53D86}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {EA794699-4DD1-4622-A80F-DB138AB53D86}.Debug|Any CPU.Build.0 = Debug|Any CPU + {EA794699-4DD1-4622-A80F-DB138AB53D86}.Release|Any CPU.ActiveCfg = Release|Any CPU + {EA794699-4DD1-4622-A80F-DB138AB53D86}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -269,8 +275,9 @@ Global {88C29601-0AA3-4751-9AF2-65F93743AA5D} = {7910C4F6-E2F6-4309-BC0F-45285E1124D7} {631B0704-ED1C-444A-95AB-E52952756F43} = {121D78F3-3F0F-4F00-B2C9-3C797653C951} {7449D8D4-0F2A-4D35-BC2F-0DEF40833C91} = {121D78F3-3F0F-4F00-B2C9-3C797653C951} - {20F4D5A5-8047-4ACA-B8A0-6F1EB2D2F5B9} = {6720D68A-1AF5-48BA-8CB5-349E70E151B0} - {8E19ECB4-9DC8-45A9-95F6-AB0E1D5D1A4B} = {6720D68A-1AF5-48BA-8CB5-349E70E151B0} + {9FCF0D70-CF60-4C0D-8667-42DB50BC6EE2} = {6720D68A-1AF5-48BA-8CB5-349E70E151B0} + {306E933B-914F-4935-A924-DA756F766753} = {6720D68A-1AF5-48BA-8CB5-349E70E151B0} + {EA794699-4DD1-4622-A80F-DB138AB53D86} = {6720D68A-1AF5-48BA-8CB5-349E70E151B0} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {CE377903-BDA1-4347-BEC2-62ED2F807EE3} diff --git a/Directory.Packages.props b/Directory.Packages.props index 9a69802..b0e6f36 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -5,6 +5,7 @@ 8.0.0 8.0.0 + 8.0.4 1.13.0 @@ -15,10 +16,6 @@ - - - - @@ -29,16 +26,24 @@ + + +
+ + + + + - - - - - - - + + + + + + + diff --git a/src/Web/WebAdmin.Client/Layout/NavMenu.razor b/src/Web/WebAdmin.Client/Layout/NavMenu.razor new file mode 100644 index 0000000..8f3dffe --- /dev/null +++ b/src/Web/WebAdmin.Client/Layout/NavMenu.razor @@ -0,0 +1,18 @@ +@rendermode InteractiveAuto + + + +@code { + private bool expanded = true; + +} \ No newline at end of file diff --git a/src/Web/WebAdmin/WebAdmin.Client/Pages/Counter.razor b/src/Web/WebAdmin.Client/Pages/Counter.razor similarity index 100% rename from src/Web/WebAdmin/WebAdmin.Client/Pages/Counter.razor rename to src/Web/WebAdmin.Client/Pages/Counter.razor diff --git a/src/Web/WebAdmin.Client/Program.cs b/src/Web/WebAdmin.Client/Program.cs new file mode 100644 index 0000000..519269f --- /dev/null +++ b/src/Web/WebAdmin.Client/Program.cs @@ -0,0 +1,5 @@ +using Microsoft.AspNetCore.Components.WebAssembly.Hosting; + +var builder = WebAssemblyHostBuilder.CreateDefault(args); + +await builder.Build().RunAsync(); diff --git a/src/Web/WebAdmin/WebAdmin.Client/WebAdmin.Client.csproj b/src/Web/WebAdmin.Client/WebAdmin.Client.csproj similarity index 34% rename from src/Web/WebAdmin/WebAdmin.Client/WebAdmin.Client.csproj rename to src/Web/WebAdmin.Client/WebAdmin.Client.csproj index 5e7aadc..1ad68c0 100644 --- a/src/Web/WebAdmin/WebAdmin.Client/WebAdmin.Client.csproj +++ b/src/Web/WebAdmin.Client/WebAdmin.Client.csproj @@ -1,28 +1,17 @@  - net8.0 - enable - enable true Default - true - - - + - - PreserveNewest - - - PreserveNewest - + diff --git a/src/Web/WebAdmin/WebAdmin.Client/WebAdmin.Client.xml b/src/Web/WebAdmin.Client/WebAdmin.Client.xml similarity index 100% rename from src/Web/WebAdmin/WebAdmin.Client/WebAdmin.Client.xml rename to src/Web/WebAdmin.Client/WebAdmin.Client.xml diff --git a/src/Web/WebAdmin/WebAdmin.Client/_Imports.razor b/src/Web/WebAdmin.Client/_Imports.razor similarity index 100% rename from src/Web/WebAdmin/WebAdmin.Client/_Imports.razor rename to src/Web/WebAdmin.Client/_Imports.razor index a97f169..8f2ecdb 100644 --- a/src/Web/WebAdmin/WebAdmin.Client/_Imports.razor +++ b/src/Web/WebAdmin.Client/_Imports.razor @@ -5,6 +5,6 @@ @using Microsoft.AspNetCore.Components.Web @using static Microsoft.AspNetCore.Components.Web.RenderMode @using Microsoft.AspNetCore.Components.Web.Virtualization -@using Microsoft.JSInterop @using Microsoft.FluentUI.AspNetCore.Components +@using Microsoft.JSInterop @using WebAdmin.Client diff --git a/src/Web/WebAdmin/WebAdmin.Client/wwwroot/appsettings.json b/src/Web/WebAdmin.Client/wwwroot/appsettings.Development.json similarity index 100% rename from src/Web/WebAdmin/WebAdmin.Client/wwwroot/appsettings.json rename to src/Web/WebAdmin.Client/wwwroot/appsettings.Development.json diff --git a/src/Web/WebAdmin.Client/wwwroot/appsettings.json b/src/Web/WebAdmin.Client/wwwroot/appsettings.json new file mode 100644 index 0000000..0c208ae --- /dev/null +++ b/src/Web/WebAdmin.Client/wwwroot/appsettings.json @@ -0,0 +1,8 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.AspNetCore": "Warning" + } + } +} diff --git a/src/Web/WebAdmin/WebAdmin/Components/Shared/CultureSelector.razor b/src/Web/WebAdmin.Shared/Components/CultureSelector.razor similarity index 87% rename from src/Web/WebAdmin/WebAdmin/Components/Shared/CultureSelector.razor rename to src/Web/WebAdmin.Shared/Components/CultureSelector.razor index 42e3acb..ae7c62c 100644 --- a/src/Web/WebAdmin/WebAdmin/Components/Shared/CultureSelector.razor +++ b/src/Web/WebAdmin.Shared/Components/CultureSelector.razor @@ -1,9 +1,9 @@ - -
+
diff --git a/src/Web/WebAdmin/WebAdmin/Components/Shared/CultureSelector.razor.cs b/src/Web/WebAdmin.Shared/Components/CultureSelector.razor.cs similarity index 94% rename from src/Web/WebAdmin/WebAdmin/Components/Shared/CultureSelector.razor.cs rename to src/Web/WebAdmin.Shared/Components/CultureSelector.razor.cs index 9b5ab2b..5454434 100644 --- a/src/Web/WebAdmin/WebAdmin/Components/Shared/CultureSelector.razor.cs +++ b/src/Web/WebAdmin.Shared/Components/CultureSelector.razor.cs @@ -2,9 +2,9 @@ using Microsoft.AspNetCore.Components; using Microsoft.FluentUI.AspNetCore.Components; using Microsoft.JSInterop; -using WebAdmin.Configurations; +using WebAdmin.Shared.Configurations; -namespace WebAdmin.Components.Shared; +namespace WebAdmin.Shared.Components; public partial class CultureSelector { diff --git a/src/Web/WebAdmin/WebAdmin/Components/Shared/CultureSelector.razor.css b/src/Web/WebAdmin.Shared/Components/CultureSelector.razor.css similarity index 100% rename from src/Web/WebAdmin/WebAdmin/Components/Shared/CultureSelector.razor.css rename to src/Web/WebAdmin.Shared/Components/CultureSelector.razor.css diff --git a/src/Web/WebAdmin/WebAdmin/Components/Shared/SiteLinks.razor b/src/Web/WebAdmin.Shared/Components/SiteLinks.razor similarity index 70% rename from src/Web/WebAdmin/WebAdmin/Components/Shared/SiteLinks.razor rename to src/Web/WebAdmin.Shared/Components/SiteLinks.razor index 518de77..fdc6184 100644 --- a/src/Web/WebAdmin/WebAdmin/Components/Shared/SiteLinks.razor +++ b/src/Web/WebAdmin.Shared/Components/SiteLinks.razor @@ -1,10 +1,9 @@ -@rendermode InteractiveServer - - diff --git a/src/Web/WebAdmin/WebAdmin/Components/Pages/Error.razor b/src/Web/WebAdmin/Components/Pages/Error.razor similarity index 100% rename from src/Web/WebAdmin/WebAdmin/Components/Pages/Error.razor rename to src/Web/WebAdmin/Components/Pages/Error.razor diff --git a/src/Web/WebAdmin/Components/Pages/Home.razor b/src/Web/WebAdmin/Components/Pages/Home.razor new file mode 100644 index 0000000..50caea5 --- /dev/null +++ b/src/Web/WebAdmin/Components/Pages/Home.razor @@ -0,0 +1,123 @@ +@page "/" +@inject IStringLocalizer L +@inject AdminConfiguration AdminConfiguration +@inject IToastService ToastService +@inject NavigationManager NavigationManager + +@L["PageTitle"] - @AdminConfiguration.PageTitle + +

Hello, world!

+ +Welcome to new Blazor Web App Admin + + + +

MessageBar

+ + + 当你听到一些人对于精致的概念模型侃侃而谈,请保持清醒。 + + + + 物换星移 泥牛入海
黑暗好像 一颗巨石 按在胸口
独脚大盗 + 百万富翁 摸爬滚打
黑暗好像 一颗巨石 按在胸口 +
+ + + 可以照亮最黑暗的夜,也可以燃尽一切过往。
+ 在时间的长河里,我们都是匆匆的过客,留下的只有脚印和故事。
+ 一颗心被封存太久,就会生锈,忘记了如何跳动。
+ 命运之轮不停转动,我们不过是其中的一粒尘埃,飘忽不定。
+
+ + + 不会苦一辈子,但总有苦的一段时间。
+ 当我们站得太高时,忘记了脚下的路有多远。
+ 每个人的心里都有一座孤岛,时常有潮水上涨,也有退潮时刻。
+
+ + + 都有下坡的一天。
+ 当我们把昨天抛在身后,明天的路也会变得更加宽广。
+ 有些事,可以预见未来,但无法阻止发生。
+
+ + + 不是一个终点,它在于持续的努力而非偶然的机遇。 + +
+ +

Toast

+ + + + + 显示成功 + + + + 显示警告 + + + + 显示错误 + + + + 显示信息 + + + + 显示进度 + + + + 显示上传 + + + + 显示下载 + + + + 展示活动 + + + + 显示提及 + + + + 显示自定义 + + + + + 无图标 + + + (this, HandleTopAction)))"> + 有 Action + + + + 自定义超时 + + + + + 长时间 成功 + + + + +
+ +@code { + + private void HandleTopAction(ToastResult result) + { + Console.WriteLine("Toast clicked"); + } + +} \ No newline at end of file diff --git a/src/Web/WebAdmin/Components/Pages/Weather.razor b/src/Web/WebAdmin/Components/Pages/Weather.razor new file mode 100644 index 0000000..d1e493b --- /dev/null +++ b/src/Web/WebAdmin/Components/Pages/Weather.razor @@ -0,0 +1,65 @@ +@page "/weather" +@inject IStringLocalizer L +@inject AdminConfiguration AdminConfiguration +@attribute [StreamRendering] + +@L["PageTitle"] - @AdminConfiguration.PageTitle + +

Weather

+ +

该组件用于显示数据。

+ + +

DataGrid

+ + + + + + + + + + +
+ + + + +@code { + private IQueryable? forecasts; + + protected override async Task OnInitializedAsync() + { + await OnQueryAsync(); + + StateHasChanged(); + } + public async Task OnRefreshAsync() + { + await OnQueryAsync(); + + return true; + } + private async Task OnQueryAsync() + { + await Task.Delay(Random.Shared.Next(400, 800)); + + var startDate = DateOnly.FromDateTime(DateTime.Now); + var summaries = new[] { "Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching" }; + forecasts = Enumerable.Range(1, 5).Select(index => new WeatherForecast + { + Date = startDate.AddDays(index), + TemperatureC = Random.Shared.Next(-20, 55), + Summary = summaries[Random.Shared.Next(summaries.Length)] + }).AsQueryable(); + } + + private class WeatherForecast + { + public DateOnly Date { get; set; } + public int TemperatureC { get; set; } + public string? Summary { get; set; } + public int TemperatureF => 32 + (int)(TemperatureC / 0.5556); + } +} diff --git a/src/Web/WebAdmin/WebAdmin/Components/Routes.razor b/src/Web/WebAdmin/Components/Routes.razor similarity index 31% rename from src/Web/WebAdmin/WebAdmin/Components/Routes.razor rename to src/Web/WebAdmin/Components/Routes.razor index d39c7e8..c006189 100644 --- a/src/Web/WebAdmin/WebAdmin/Components/Routes.razor +++ b/src/Web/WebAdmin/Components/Routes.razor @@ -1,6 +1,8 @@ - + + + - + diff --git a/src/Web/WebAdmin/WebAdmin/Components/_Imports.razor b/src/Web/WebAdmin/Components/_Imports.razor similarity index 64% rename from src/Web/WebAdmin/WebAdmin/Components/_Imports.razor rename to src/Web/WebAdmin/Components/_Imports.razor index 84ad10d..4e38619 100644 --- a/src/Web/WebAdmin/WebAdmin/Components/_Imports.razor +++ b/src/Web/WebAdmin/Components/_Imports.razor @@ -3,17 +3,13 @@ @using Microsoft.AspNetCore.Components.Forms @using Microsoft.AspNetCore.Components.Routing @using Microsoft.AspNetCore.Components.Web +@using Microsoft.Extensions.Localization @using static Microsoft.AspNetCore.Components.Web.RenderMode @using Microsoft.AspNetCore.Components.Web.Virtualization -@using Microsoft.JSInterop @using Microsoft.FluentUI.AspNetCore.Components +@using Microsoft.JSInterop @using WebAdmin @using WebAdmin.Client +@using WebAdmin.Client.Layout @using WebAdmin.Components -@using WebAdmin.Configurations -@using Ordering.Infrastructure.Repository -@using Ordering.Infrastructure.Repository.Entities -@using System.Globalization -@using Microsoft.AspNetCore.Localization -@using WebAdmin.Components.Shared -@using System.Threading +@using WebAdmin.Shared.Configurations diff --git a/src/Web/WebAdmin/WebAdmin/Controllers/CultureController.cs b/src/Web/WebAdmin/Controllers/CultureController.cs similarity index 60% rename from src/Web/WebAdmin/WebAdmin/Controllers/CultureController.cs rename to src/Web/WebAdmin/Controllers/CultureController.cs index a59a176..06644bd 100644 --- a/src/Web/WebAdmin/WebAdmin/Controllers/CultureController.cs +++ b/src/Web/WebAdmin/Controllers/CultureController.cs @@ -1,17 +1,18 @@ using Microsoft.AspNetCore.Localization; using Microsoft.AspNetCore.Mvc; -namespace WebAdmin.Controllers; - -[Route("Culture/[action]")] +[Route("[controller]/[action]")] public class CultureController : Controller { public IActionResult SetCulture(string culture, string redirectUri) { if (culture != null) - Response.Cookies.Append( + { + HttpContext.Response.Cookies.Append( CookieRequestCultureProvider.DefaultCookieName, - CookieRequestCultureProvider.MakeCookieValue(new RequestCulture(culture))); + CookieRequestCultureProvider.MakeCookieValue( + new RequestCulture(culture, culture))); + } return LocalRedirect(redirectUri); } diff --git a/src/Web/WebAdmin/WebAdmin/Program.cs b/src/Web/WebAdmin/Program.cs similarity index 62% rename from src/Web/WebAdmin/WebAdmin/Program.cs rename to src/Web/WebAdmin/Program.cs index c009174..7f7b80f 100644 --- a/src/Web/WebAdmin/WebAdmin/Program.cs +++ b/src/Web/WebAdmin/Program.cs @@ -1,41 +1,30 @@ -using Microsoft.AspNetCore.Hosting.StaticWebAssets; +using System.Globalization; using Microsoft.FluentUI.AspNetCore.Components; using WebAdmin.Components; -using WebAdmin.Components.Shared; -using WebAdmin.Configurations; -using WebAdmin.Infrastructure; -using _Imports = WebAdmin.Client._Imports; +using WebAdmin.Shared.Configurations; +using WebAdmin.Shared.Infrastructure; var builder = WebApplication.CreateBuilder(args); -StaticWebAssetsLoader.UseStaticWebAssets(builder.Environment, builder.Configuration); - -// Add services to the container. - var adminUiOptions = new AdminUiOptions(); -adminUiOptions.BindConfiguration(builder.Configuration); +adminUiOptions.BindConfiguration(builder.Configuration); builder.Services.AddSingleton(adminUiOptions); builder.Services.AddSingleton(adminUiOptions.Admin); builder.Services.AddSingleton(adminUiOptions.Culture); builder.Services.AddSingleton(adminUiOptions.Http); - -builder.Services.AddScoped(); -builder.Services.AddSingleton(); -builder.Services.AddSingleton(); - +// Add services to the container. builder.Services.AddRazorComponents() .AddInteractiveServerComponents() .AddInteractiveWebAssemblyComponents(); -builder.Services.AddControllers(); -builder.Services.AddFluentUIComponents(); -builder.Services.AddOrderAppDataConnection(builder.Configuration); -builder.Services.AddLocalization(opt => opt.ResourcesPath = ConfigurationConsts.ResourcesPath); +builder.Services.AddLocalization(opts => opts.ResourcesPath = ConfigurationConsts.ResourcesPath); +builder.Services.AddAdminUiServerServices(); +builder.Services.AddFluentUIComponents(); +builder.Services.AddControllers(); var app = builder.Build(); - // Configure the HTTP request pipeline. if (app.Environment.IsDevelopment()) { @@ -43,7 +32,7 @@ if (app.Environment.IsDevelopment()) } else { - app.UseExceptionHandler("/Error", true); + app.UseExceptionHandler("/Error", createScopeForErrors: true); // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts. app.UseHsts(); } @@ -53,32 +42,26 @@ app.MapControllers(); app.UseRequestLocalization(options => { var cultureConfiguration = adminUiOptions.Culture; - var supportedCultureCodes = (cultureConfiguration?.Cultures?.Count > 0 ? cultureConfiguration.Cultures.Intersect(CultureConfiguration.AvailableCultures) : CultureConfiguration.AvailableCultures).ToArray(); - - if (supportedCultureCodes.Length == 0) supportedCultureCodes = CultureConfiguration.AvailableCultures; - - var defaultCultureCode = string.IsNullOrEmpty(cultureConfiguration!.DefaultCulture) + if (!supportedCultureCodes.Any()) + supportedCultureCodes = CultureConfiguration.AvailableCultures; + var defaultCultureCode = string.IsNullOrEmpty(cultureConfiguration?.DefaultCulture) ? CultureConfiguration.DefaultRequestCulture - : cultureConfiguration.DefaultCulture; - + : cultureConfiguration?.DefaultCulture; if (!supportedCultureCodes.Contains(defaultCultureCode)) defaultCultureCode = supportedCultureCodes.FirstOrDefault(); - options - .SetDefaultCulture(defaultCultureCode!) - .AddSupportedCultures(supportedCultureCodes) - .AddSupportedUICultures(supportedCultureCodes); + options.AddSupportedCultures(supportedCultureCodes) + .AddSupportedUICultures(supportedCultureCodes) + .SetDefaultCulture(defaultCultureCode!); }); app.UseStaticFiles(); app.UseAntiforgery(); - app.MapRazorComponents() .AddInteractiveServerRenderMode() .AddInteractiveWebAssemblyRenderMode() - .AddAdditionalAssemblies(typeof(_Imports).Assembly); - -app.Run(); \ No newline at end of file + .AddAdditionalAssemblies(typeof(WebAdmin.Client._Imports).Assembly); +app.Run(); diff --git a/src/Web/WebAdmin/WebAdmin/Properties/launchSettings.json b/src/Web/WebAdmin/Properties/launchSettings.json similarity index 48% rename from src/Web/WebAdmin/WebAdmin/Properties/launchSettings.json rename to src/Web/WebAdmin/Properties/launchSettings.json index ae96d44..8e35d65 100644 --- a/src/Web/WebAdmin/WebAdmin/Properties/launchSettings.json +++ b/src/Web/WebAdmin/Properties/launchSettings.json @@ -1,22 +1,12 @@ { "$schema": "http://json.schemastore.org/launchsettings.json", "profiles": { - "http": { - "commandName": "Project", - "dotnetRunMessages": true, - "launchBrowser": true, - "inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}", - "applicationUrl": "http://localhost:5103", - "environmentVariables": { - "ASPNETCORE_ENVIRONMENT": "Development" - } - }, "https": { "commandName": "Project", "dotnetRunMessages": true, "launchBrowser": true, "inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}", - "applicationUrl": "https://localhost:7039;http://localhost:5103", + "applicationUrl": "https://localhost:7273;http://localhost:5172", "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development" } diff --git a/src/Web/WebAdmin/WebAdmin/Resources/Components/Pages/CustomerList.en.resx b/src/Web/WebAdmin/Resources/Components/Pages/CustomerList.en.resx similarity index 100% rename from src/Web/WebAdmin/WebAdmin/Resources/Components/Pages/CustomerList.en.resx rename to src/Web/WebAdmin/Resources/Components/Pages/CustomerList.en.resx diff --git a/src/Web/WebAdmin/WebAdmin/Resources/Components/Pages/CustomerList.zh-Hans.resx b/src/Web/WebAdmin/Resources/Components/Pages/CustomerList.zh-Hans.resx similarity index 100% rename from src/Web/WebAdmin/WebAdmin/Resources/Components/Pages/CustomerList.zh-Hans.resx rename to src/Web/WebAdmin/Resources/Components/Pages/CustomerList.zh-Hans.resx diff --git a/src/Web/WebAdmin/WebAdmin/Resources/Components/Pages/Home.en.resx b/src/Web/WebAdmin/Resources/Components/Pages/Home.en.resx similarity index 100% rename from src/Web/WebAdmin/WebAdmin/Resources/Components/Pages/Home.en.resx rename to src/Web/WebAdmin/Resources/Components/Pages/Home.en.resx diff --git a/src/Web/WebAdmin/WebAdmin/Resources/Components/Pages/Home.zh-Hans.resx b/src/Web/WebAdmin/Resources/Components/Pages/Home.zh-Hans.resx similarity index 100% rename from src/Web/WebAdmin/WebAdmin/Resources/Components/Pages/Home.zh-Hans.resx rename to src/Web/WebAdmin/Resources/Components/Pages/Home.zh-Hans.resx diff --git a/src/Web/WebAdmin/Resources/Components/Pages/Weather.en.resx b/src/Web/WebAdmin/Resources/Components/Pages/Weather.en.resx new file mode 100644 index 0000000..ce9675e --- /dev/null +++ b/src/Web/WebAdmin/Resources/Components/Pages/Weather.en.resx @@ -0,0 +1,123 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Weather + + \ No newline at end of file diff --git a/src/Web/WebAdmin/Resources/Components/Pages/Weather.zh-Hans.resx b/src/Web/WebAdmin/Resources/Components/Pages/Weather.zh-Hans.resx new file mode 100644 index 0000000..f3223f7 --- /dev/null +++ b/src/Web/WebAdmin/Resources/Components/Pages/Weather.zh-Hans.resx @@ -0,0 +1,123 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + 天气 + + \ No newline at end of file diff --git a/src/Web/WebAdmin/WebAdmin.Client/Program.cs b/src/Web/WebAdmin/WebAdmin.Client/Program.cs deleted file mode 100644 index 9cd5f49..0000000 --- a/src/Web/WebAdmin/WebAdmin.Client/Program.cs +++ /dev/null @@ -1,24 +0,0 @@ -using System.Globalization; -using Microsoft.AspNetCore.Components.WebAssembly.Hosting; -using Microsoft.FluentUI.AspNetCore.Components; -using Microsoft.JSInterop; - -var builder = WebAssemblyHostBuilder.CreateDefault(args); - -builder.Services.AddFluentUIComponents(); -builder.Services.AddLocalization(opt => opt.ResourcesPath = "Resources"); - -var host = builder.Build(); - -const string defaultCulture = "en"; -var js = host.Services.GetRequiredService(); -var result = await js.InvokeAsync("blazorCulture.get"); -var culture = CultureInfo.GetCultureInfo(result ?? defaultCulture); - -if (result == null) await js.InvokeVoidAsync("blazorCulture.set", defaultCulture); - -CultureInfo.DefaultThreadCurrentCulture = culture; -CultureInfo.DefaultThreadCurrentUICulture = culture; - - -await host.RunAsync(); \ No newline at end of file diff --git a/src/Web/WebAdmin/WebAdmin.Client/wwwroot/appsettings.Development.json b/src/Web/WebAdmin/WebAdmin.Client/wwwroot/appsettings.Development.json deleted file mode 100644 index 2f85d82..0000000 --- a/src/Web/WebAdmin/WebAdmin.Client/wwwroot/appsettings.Development.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "Logging": { - "LogLevel": { - "Default": "Information", - "Microsoft.AspNetCore": "Warning" - } - }, - "ConnectionStrings": { - "Catalog": "Server=192.168.8.112;Port=5432;Database=dapr_catalog;User Id=dapr;Password=Local@Db;Pooling=true;MaxPoolSize=100;", - "Identity": "Server=192.168.8.112;Port=5432;Database=dapr_identity;User Id=dapr;Password=Local@Db;Pooling=true;MaxPoolSize=100;", - "Ordering": "Server=192.168.8.112;Port=5432;Database=dapr_ordering;User Id=dapr;Password=Local@Db;Pooling=true;MaxPoolSize=100;" - } -} diff --git a/src/Web/WebAdmin/WebAdmin.csproj b/src/Web/WebAdmin/WebAdmin.csproj new file mode 100644 index 0000000..3c46fc8 --- /dev/null +++ b/src/Web/WebAdmin/WebAdmin.csproj @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + Designer + + + diff --git a/src/Web/WebAdmin/WebAdmin.xml b/src/Web/WebAdmin/WebAdmin.xml new file mode 100644 index 0000000..5be91c2 --- /dev/null +++ b/src/Web/WebAdmin/WebAdmin.xml @@ -0,0 +1,8 @@ + + + + WebAdmin + + + + diff --git a/src/Web/WebAdmin/WebAdmin/Components/App.razor b/src/Web/WebAdmin/WebAdmin/Components/App.razor deleted file mode 100644 index c89570b..0000000 --- a/src/Web/WebAdmin/WebAdmin/Components/App.razor +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - diff --git a/src/Web/WebAdmin/WebAdmin/Components/Layout/MainLayout.razor.css b/src/Web/WebAdmin/WebAdmin/Components/Layout/MainLayout.razor.css deleted file mode 100644 index 669ad4d..0000000 --- a/src/Web/WebAdmin/WebAdmin/Components/Layout/MainLayout.razor.css +++ /dev/null @@ -1,31 +0,0 @@ -.siteheader { - background-color: var(--neutral-layer-4) !important; - border-bottom: calc(var(--stroke-width) * 2px) solid var(--accent-fill-rest); - margin-bottom: 0 !important; -} - -.siteheader .logo { - width: 108px; - height: 23px; - grid-column: 1; -} - -.siteheader .search { - display: flex; - align-items: center; - padding-right: 20px; -} - - -.siteheader .notifications { - display: flex; - align-items: center; -} - -.siteheader .settings { - padding-right: 6px; - display: flex; - align-items: center; - margin-left: 0; - margin-right: 10px; -} diff --git a/src/Web/WebAdmin/WebAdmin/Components/Pages/CustomerLevels.razor b/src/Web/WebAdmin/WebAdmin/Components/Pages/CustomerLevels.razor deleted file mode 100644 index 72f7d44..0000000 --- a/src/Web/WebAdmin/WebAdmin/Components/Pages/CustomerLevels.razor +++ /dev/null @@ -1,3 +0,0 @@ -@page "/customer-level" - -

CustomerLevelMgr

diff --git a/src/Web/WebAdmin/WebAdmin/Components/Pages/CustomerList.razor b/src/Web/WebAdmin/WebAdmin/Components/Pages/CustomerList.razor deleted file mode 100644 index 77e02d5..0000000 --- a/src/Web/WebAdmin/WebAdmin/Components/Pages/CustomerList.razor +++ /dev/null @@ -1,52 +0,0 @@ -@page "/customer/list" -@using Microsoft.Extensions.Localization -@attribute [StreamRendering] -@inject AdminConfiguration AdminConfiguration -@inject IStringLocalizer L - -@L["PageTitle"] - @AdminConfiguration.PageTitle - -

会员

- -

This component demonstrates showing data.

- - -@if (_customers == null) -{ -

Loading...

-} -else -{ - - - - - - -} - -@code { - private IQueryable? _customers; - - protected override async Task OnInitializedAsync() - { - // Simulate asynchronous loading to demonstrate streaming rendering - await Task.Delay(500); - - var startDate = DateOnly.FromDateTime(DateTime.Now); - var summaries = new[] { "Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching" }; - _customers = Enumerable.Range(1, 5).Select(index => new CustomerTable - { - BirthDate = startDate.AddDays(index), - Age = Random.Shared.Next(-20, 55), - Name = summaries[Random.Shared.Next(summaries.Length)] - }).AsQueryable(); - } - - private class CustomerTable - { - public int Age { get; init; } - public string? Name { get; init; } - public DateOnly BirthDate { get; init; } - } -} diff --git a/src/Web/WebAdmin/WebAdmin/Components/Pages/Home.razor b/src/Web/WebAdmin/WebAdmin/Components/Pages/Home.razor deleted file mode 100644 index cacb649..0000000 --- a/src/Web/WebAdmin/WebAdmin/Components/Pages/Home.razor +++ /dev/null @@ -1,45 +0,0 @@ -@page "/" -@using System.Globalization -@using Microsoft.Extensions.Localization -@inject AdminConfiguration AdminConfiguration -@inject IStringLocalizer L - -@L["PageTitle"] - @AdminConfiguration?.PageTitle - - - -

Hello, world!

- -

@L["PageTitle"]

- -

- 当前语言:@CultureInfo.CurrentCulture.DisplayName | @CultureInfo.CurrentCulture.Name -

- -

- The following <input> elements use - CultureInfo.InvariantCulture. -

- -
-

Welcome to your new app.

-

- TestKey: @L["TestKey"] -

-
- - - - - - @(new Emojis.Objects.Color.Default.Accordion().ToMarkup("280px")) - @(new Emojis.TravelPlaces.Color.Default.Ambulance().ToMarkup("500px")) - - - Icon: - Emoji: - Button: Click Me -
- - - \ No newline at end of file diff --git a/src/Web/WebAdmin/WebAdmin/Components/Pages/PurchaseOrder.razor b/src/Web/WebAdmin/WebAdmin/Components/Pages/PurchaseOrder.razor deleted file mode 100644 index 47fd86e..0000000 --- a/src/Web/WebAdmin/WebAdmin/Components/Pages/PurchaseOrder.razor +++ /dev/null @@ -1,81 +0,0 @@ -@page "/order" -@attribute [StreamRendering] -@rendermode InteractiveServer -@inject AppDataConnection DataConnection - -暂无数据

"))" - Items="@FilteredItems" - ResizableColumns="true" - Pagination="@_pagination" - GridTemplateColumns="0.4fr 0.2fr 0.2fr 0.2fr 0.2fr 0.2fr 0.2fr 0.2fr" - RowClass="@_rowClass" - RowStyle="@_rowStyle" - Style="height: 405px; overflow: auto;"> - - - - - - - - - - - - - -
- - - - - - - - -@code { - bool _clearItems; - IQueryable? _items; - readonly PaginationState _pagination = new() { ItemsPerPage = 10 }; - string _orderNoFilter = string.Empty; - readonly Func _rowClass = x => x.OrderNo.EndsWith("00000000") ? "highlighted-row" : null; - readonly Func _rowStyle = x => x.OrderNo.StartsWith("Au") ? "background-color: var(--highlight-bg);" : null; - - IQueryable? FilteredItems => _items?.Where(x => x.OrderNo.Contains(_orderNoFilter, StringComparison.CurrentCultureIgnoreCase)); - - protected override async Task OnInitializedAsync() - { - _items = DataConnection.PurchaseOrder.Where(x => x.DeletedTime == 0); - - await Task.CompletedTask; - } - - private void HandleOrderFilter(ChangeEventArgs args) - { - if (args.Value is string value) - { - _orderNoFilter = value; - } - } - - private void HandleClear() - { - if (string.IsNullOrWhiteSpace(_orderNoFilter)) - { - _orderNoFilter = string.Empty; - } - } - - private async Task ToggleItemsAsync() - { - _items = _clearItems ? null : DataConnection.PurchaseOrder.Where(x => x.DeletedTime == 0); - - await Task.CompletedTask; - } - -} \ No newline at end of file diff --git a/src/Web/WebAdmin/WebAdmin/WebAdmin.xml b/src/Web/WebAdmin/WebAdmin/WebAdmin.xml deleted file mode 100644 index 8536ce5..0000000 --- a/src/Web/WebAdmin/WebAdmin/WebAdmin.xml +++ /dev/null @@ -1,110 +0,0 @@ - - - - WebAdmin - - - - - 管理后台配置 - - - - 管理后台的基础配置 - - - 全球化配置 - - - HTTP 托管环境配置 - - - - 将从 appsettings 文件解析的配置应用到这些选项中。 - - 绑定到此实例的配置 - - - - 管理后台的基础配置 - - - - Page Name - - - Favicon Uri - - - Web Admin Redirect Uri - - - Scopes - - - Administration Role Name - - - Require HttpsMetadata - - - Web Admin CookieName - - - Web Admin Cookie Expires UtcHours - - - Token Validation ClaimName - - - Token Validation ClaimRole - - - IdentityServer BaseUrl - - - ClientId - - - ClientSecret - - - Oidc ResponseType - - - - 全球化配置 - - - - 可用的多语言文化 - - - 默认的文化 - - - 可用的多语言文化列表 - - - 默认的文化 - - - - Http 配置 - - - - BasePath - - - - AppVersion Service - - - - - AppVersion Service - - - - diff --git a/src/Web/WebAdmin/WebAdmin/wwwroot/favicon.png b/src/Web/WebAdmin/WebAdmin/wwwroot/favicon.png deleted file mode 100644 index 8422b59695935d180d11d5dbe99653e711097819..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1148 zcmV-?1cUpDP)9h26h2-Cs%i*@Moc3?#6qJID|D#|3|2Hn7gTIYEkr|%Xjp);YgvFmB&0#2E2b=| zkVr)lMv9=KqwN&%obTp-$<51T%rx*NCwceh-E+=&e(oLO`@Z~7gybJ#U|^tB2Pai} zRN@5%1qsZ1e@R(XC8n~)nU1S0QdzEYlWPdUpH{wJ2Pd4V8kI3BM=)sG^IkUXF2-j{ zrPTYA6sxpQ`Q1c6mtar~gG~#;lt=s^6_OccmRd>o{*=>)KS=lM zZ!)iG|8G0-9s3VLm`bsa6e ze*TlRxAjXtm^F8V`M1%s5d@tYS>&+_ga#xKGb|!oUBx3uc@mj1%=MaH4GR0tPBG_& z9OZE;->dO@`Q)nr<%dHAsEZRKl zedN6+3+uGHejJp;Q==pskSAcRcyh@6mjm2z-uG;s%dM-u0*u##7OxI7wwyCGpS?4U zBFAr(%GBv5j$jS@@t@iI8?ZqE36I^4t+P^J9D^ELbS5KMtZ z{Qn#JnSd$15nJ$ggkF%I4yUQC+BjDF^}AtB7w348EL>7#sAsLWs}ndp8^DsAcOIL9 zTOO!!0!k2`9BLk25)NeZp7ev>I1Mn={cWI3Yhx2Q#DnAo4IphoV~R^c0x&nw*MoIV zPthX?{6{u}sMS(MxD*dmd5rU(YazQE59b|TsB5Tm)I4a!VaN@HYOR)DwH1U5y(E)z zQqQU*B%MwtRQ$%x&;1p%ANmc|PkoFJZ%<-uq%PX&C!c-7ypis=eP+FCeuv+B@h#{4 zGx1m0PjS~FJt}3mdt4c!lel`1;4W|03kcZRG+DzkTy|7-F~eDsV2Tx!73dM0H0CTh zl)F-YUkE1zEzEW(;JXc|KR5{ox%YTh{$%F$a36JP6Nb<0%#NbSh$dMYF-{ z1_x(Vx)}fs?5_|!5xBTWiiIQHG<%)*e=45Fhjw_tlnmlixq;mUdC$R8v#j( zhQ$9YR-o%i5Uc`S?6EC51!bTRK=Xkyb<18FkCKnS2;o*qlij1YA@-nRpq#OMTX&RbL<^2q@0qja!uIvI;j$6>~k@IMwD42=8$$!+R^@5o6HX(*n~ div:first-child:is(.expander) { + display: none; + } + + .navmenu { + width: 100%; + } + + #navmenu-toggle { + appearance: none; + } + + #navmenu-toggle ~ nav { + display: none; + } + + #navmenu-toggle:checked ~ nav { + display: block; + } + + .navmenu-icon { + cursor: pointer; + z-index: 10; + display: block; + position: absolute; + top: 15px; + right: 20px; + width: 20px; + height: 20px; + border: none; + } +} diff --git a/src/Web/WebAdmin/wwwroot/favicon.ico b/src/Web/WebAdmin/wwwroot/favicon.ico new file mode 100644 index 0000000000000000000000000000000000000000..e189d8e579e552ab2b3c82a949bccbc5ea00f3ed GIT binary patch literal 15086 zcmeHO33OG}xxSXRYJC=8YhT~%>sqp2t?g55>7>;KUJ^jdYuD;t>%04$efIG0 z>EHjbuf=kirJrTsKnvmlmi0fiSZ=jgECUAk-mkG(Dv)*!Vt#+^n-`o?bHdy;nJmMX5oYCLpS0gU^#FbaM|CxA86yhfyqDvUTyfD?hchV9qBYK09w`PyKHoHi4Ry8WB z+hcYL71aV$fFJ(7`hdD`0S*90yB@n!E8l-q+4=5VW%&bdX>)%$Oh*0h^LpgZ2kVhP z3&eAHCkE@$HxAKbfBUkG`}3RHmQkN8$5-w2bW}E|nkppf6~I2=FTmAbXFpKi4Zu-= zYeClMmZ;m`_(F}n^=}5vqabRrG4Mj zWv(wjUgSw08!1*k{EoWhp3&O;-@Ig$**9gGr|D#cA|<<_+kuV1&%Ta6pdRkAF9BV6 z6nQ*;m$K}SZ)i~%OOEHFJ4VW#@6A(7c4T zCrWo^dD7>sRo4xkq^^GAL-pvg?W(h*%jg8k9tXJ3FM40FEHDw!RJS5?7H?H!fA_K^ z-5l@aHzP&Ok&{@Xc5G6YUGsEzgrplE1AZ{(($(25sxu2z%$c%p@=~ScR3+CE zLk;lI#m)oD4g?ypKJ}w<$tLZK?i?kLEl*M1HhTztq^GO4SS?yRMHFwGscMQlBoFEg z8#G1Lnom}!r?#i7wK=C0O&CS?To^yT=IGp)ofkvDk7n=+ z?}o;^8yI{cbAbFjEA_lJy9Ico9`lPA^t9OtSPyE@xI0>^#OWRLMb_-WYQd_HY@HQ( z?I@;|?}%+V8uQXuqMz*tg!OoaG}?DSKJuJgdrPOj?zu@C`6FV{)!63WS4Oq2jz;zP z;y2XnFNQkmvNl_V+v)!<%XiFgy%_pA<_&peI1kemXJ=R7-f2Oj6t(*d$TtEI#mR@o zyn(}Yo=qp#e#x~MH1^o1o+ERHD6OXsJ9~V)X!=Pz&qKDmZS-udwY1tlCTK!m1oSB{ zA` z`sXKW%|#|Z<=T9tw+X;^%4c!d`}*2vCu)=jFb*E@_`q>M7G3wzFT&Fw+mspcjDmfw zXsQx4Z${xTKQ3#xx^~dVO7u;jAN!4nzG%_CrEu@~)o%`n`P^q9?vMP1x#MxTkHv6XEEGj6&X106AA*=%rsPPB~0jJtXu& zzdyfJ95!cT?(WuO^G7yk&3aBL-8@@3nyUhNi$AY^IC7mDxPC}`AP!7lu0qCQ{tDpc zo_#>tBY-`Se#mBDg??10OSiSTyEt*inY1Yny0GVEds%kKequ(PF{0=CG3m#ip8x9+ zJVX8Gax97jts}fY33y1qfBk?LQ>G0G=P~}8tFy7YYX7R1?5JU#I1iM{eanTtxe79B zsQdxBLEScHPRRN<>G$nt$lqG4cQ0^VzX$a5&jX%+0+co8mrKYxTJ+6B<%xtn+`l2A zH~KwYZT6~z@y$7)J11(mQn5GAOE(UvkcxZ>E}LBi&-3)Qe%Ke#r0@S^xq$A+lH{p> z4xr!Izm7KW&p{tc^3Ofv7rG(ygsj)z=&w#)Q=K~TkIuu>|DrYK?s8Ku^^tkbsO@yE zvg}V|Ic7m?K5+bvXMA6H`>V3zP@aDs9YCf1*$2c|1BY;y=(|6R6{J7mnF*@Bwewu( zS2+H!JKO54W!oZ~vLXiAau>X=)F0U@AfIv!&eadDYxmq=z9>WJ?XidXowD%m@eBRB zC)bB5-{E;Cpcid9B<2nrrc-A*bKqEb`lE&^m^>=(k_ z7yMdmX52-nDK-M{ScTllYZ#Dv_}Za3g@$S{CT*~cYQEl6IkmAJktXA z@p!yTTYalWIf!x`bZo8ptZvFOI&>F}`eNDkXqB>PU_YQcdfH2~+o8*}Qm-N1twm{q zy0K9hKa|;yEZC%So%-oI-5dFSBa36G2AI*y0L|wqJJ!}{{MKl$j5#e|u`eEqrW!s{}$ppw;g{fNLc$01h z*xw{=0;Ii9e%WKq2hPvjTVB+$u1R}1`oD$rDS(E(tL^$ARsnxAWZD%Ey{+Z1+pD;& zc5@vgpBbnVhqFEK+{M|c^8AVY-B+WX{UEs_ zgC|iI+4#~7wRn5F0-F@{dczJF%otfv>X6}FTGPohYTBFx1@=Q>jCnX-0~sf9eEWJP z{f9nZ6L$TOeg;s$y^sjFIPW-T)YXrFpmEJc;e2C1RzLosfbCYvTfJK?+jB%K-*;3g z-+NRoNy*UCBiDI0zZ#(~x%+kFZ0(KDU_EQ(b)>7eeExp<=m%-x$KTrnqYvLfo-sfr zMS;%hM(xn7HOi{LzNcXgO7??iHS0zD2EQd8^T1cQ?+trnxbY5N+uUc)k{y`}WEO>M zl=b!2kMpHJpdWXj4+jAuVIQ;BHXG-{-pNZ8$V=+tJ73c<9|B+u8!euH^O6tVG=mSI zPsSJr^oevrzSn4vCfd)`i_E!6MnBHg2QU4rK~C@E@28(J@_ru}4MYN2Kt0yJ;_R@w zn+nVARfqE(fLfKFFN`>&K&=8Q(@!X84(6(`Yp91JR=YO6JcG7i*q6u?yz6DzeQ(Id z{L?%ih<4gjsK2MY9W6MoJ^3u@r_O`CVfSw!-94XC<{QAj0XG2;1GE>@KlC~f2P_K! z-)U2>2RxMG;HS~r%Inl)ammV>CqEJ~;Dw|IIwWn_q~~KGf%#!;m4`lGt#VBU_JMr@ z|F|gnd-kWVchKH$s~ec$Y|cdc1&-1j+g`)`6Jw{8ykB zHaWTVwOP=ShZ<`Rc{SJxNxu~^<)6OV{yM*--2uR-KpEhw&L|KKCr;zhOTWJ@yx#?s zv=moK@;%CA2WPC}T4P?W&mdjcU+z-GXq$Gk{{n_$J(c5}#$z!3qyuTs0`}Y$J5=ak z8h8TFe~$g5mx9joX#=#}52OIE_RNp8tAOo}Hmjb$ey?zMJGk!O2L9j1z9)@*2R&B+ zVeREeC$A%KMWkl~KL}UHKWZB2rC)9YP!5=S?>{QN;phV0-vq8>9Pax+Ya054V64C3 z*v%GQ6iE-5*`&-_s+$&i4+BkCD$GU+#N{HO@%)$M7JhqB>lBGUF=WyFVtK{7(7^zInYqx0JpQnGv%=gS@OkKGR@t(ogTrk&pp&_={))pnp3RARQOQOHdAbQl9`= zd9LNH-X-Waqn=A$gXc8#5_R!iuPICJ9<46DZ;YUiaNV;LMcS-20`i}Pje>UIdB9B< zG8V{B#xNFe)*UO>=wpF=EMdo$)bVl0Lq%V4XQ;{3S>5EJU%s`h2KO$C1n&XRU$gb~ z*(!7Zfx9@UMlS{E1Ng@I(1Con0(I4yg>w0W<0N%qw#)k^)IIP`hk;DmstYv5VKv^F z77!%nL4*BJ9FO0rG!{VgQAI1hKh;8J2iJ#d9qB&;odvjaW8CS&{8J7!0{pq6Xzf%F z{D(#wWLfQe+J_xaqy7qAP+~p!X`t>DG6qN+=xDdqL;uj%J~KgZ4S8FK!LOlQE!{E) z_5rGeFdu<{qIJ_cYtq(xxEB5Sdc>0Y8+8KepewMJp?foL6L4?OF+kc=u%kJ7p9c5B z)POk)X&-svugkHXOqgVY57pCgCKon_5MQu7vS736yQV%*8gM@f#SJ|(NXA6k5ZEw1 z3xEF#>{qMZY=apYdiLL&$~#rvN^}1HuENz5I*XG&Q($*C$BcPk=hb3vIcq=TI8eU> zU*J5>22B2l=UMQP8$LqtFs|!9+vh~sn=2jgW40WN9pz~)N)Kuu_DsXp@3(DvZAb9a zd>BjnA9=#V{&~RjJMf1aK8O9&;*`GHceGSH;484fmhPy{*eKlA7L#6-Wq^HQjfZxw z!1j3$0yZRBoRYyjmeZzh>#JGpUvju_YDrMhagTFT5UZQcQ3-=Gt?mw*ml8q6#H*vNd@FUK>4foP) z@JG3EKS6_i*c=1;CH(fup#J;pd$hBZ?#yETM&LH!YG5zyQigwwJfAi*q``MrEAp0( zbAtc5RHx0Pi{HQ#T<~=?WJU~f!!K!!8Mde7IoO*WJ?h5ib?h_VVdPxD;+um}@WrdJ zZE3W_m+wDj)@Q9M6s21u71;3IjmLMparUV2VL8w2T4aMC#k&SfgA183vqgOjV z_akh+(%#&`ZbbRozZTC2nhMHwo_$0hA0)4_R^}UY;BJ?zFn)rw_HZKBUb8vwHMq}9 zAI!Pzi{@O=R`mN3E!V?#zP*N48O}9+)YS^Oq>EF!*8`g=am{{L+tM857>9C-%dp2N)6(wcPKXUi!} z+@B2}X9nbk?VfH2XzcY)<&DrOvfwAyQ{IZ!(`F^;xU-<){{S+3(H0##xrTeQ`H+Ez zqMo2$;QdP6Pgn!rw+`R2>~3n4yo1QOHs|kC8;|YaIc(=&BJkY^yu$$>4(^JGTqKzPqXGYk+VM_|?5J#%u8w-G^`vqC zLew5ka!|+f71!y*!Tk<-a#Jer6pi!K0C^ypwBvq{bhg)N9c4$khtY>ZH||V3(HG;K zuE{!S_9_^Wi6Lk*@Z7t*tnd`DMe=6h~d=CbwTE$XT+@%FLG?ed;|D_~BhSzZqPr5og zalfKSv=kmt>`fI~TUoWl{b1vqGtXn3&p4-b_;HSN98t#&IE!}TY!<91XUTRQ|AT?A zb|vmczh#`|7&qK?8c+L!ajwJWqQmxKl=szfE##0f_|H;8M)dmK_}|Ns!%^!`WW*#k zrMwlzd&4^Td>d$Nh73i&oPOp&u36qcpP;25z%!P6hw|UekU`&vP3d&yp*;Emo`fD# zh_hbDeY)NLa=pbUa~am(^{8h!o-gli?syFAp#!MAw>K^cy h>tK_moz~z$C_xJ#cRer_5s?az|L8{mjpJ^y{2w+yQgr|T literal 0 HcmV?d00001 -- Gitee