diff --git a/src/UserPointManagement.Web/Layouts/BasicLayout.razor b/src/UserPointManagement.Web/Layouts/BasicLayout.razor
index 424db3d..2795645 100644
--- a/src/UserPointManagement.Web/Layouts/BasicLayout.razor
+++ b/src/UserPointManagement.Web/Layouts/BasicLayout.razor
@@ -23,8 +23,8 @@
new MenuDataItem
{
Path = "/",
- Name = "welcome",
- Key = "welcome",
+ Name = "用户管理",
+ Key = "user",
Icon = "smile",
}
};
diff --git a/src/UserPointManagement.Web/Pages/_Host.cshtml b/src/UserPointManagement.Web/Pages/_Host.cshtml
new file mode 100644
index 0000000..cc99eec
--- /dev/null
+++ b/src/UserPointManagement.Web/Pages/_Host.cshtml
@@ -0,0 +1,32 @@
+@page "/"
+@using Microsoft.AspNetCore.Mvc.TagHelpers
+@using UserPointManagement.Web
+@namespace MyAntDesignAppServer.Pages
+@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
+@{
+ Layout = null;
+}
+
+
+
+
+
+
+ 用户积分管理系统
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/UserPointManagement.Web/Program.cs b/src/UserPointManagement.Web/Program.cs
index dc9af71..4851bec 100644
--- a/src/UserPointManagement.Web/Program.cs
+++ b/src/UserPointManagement.Web/Program.cs
@@ -1,38 +1,28 @@
using System;
-using System.Net.Http;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
using System.Threading.Tasks;
-using AntDesign.ProLayout;
-using Microsoft.AspNetCore.Components.WebAssembly.Hosting;
-using Microsoft.EntityFrameworkCore;
+using Microsoft.AspNetCore;
+using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
-using Microsoft.Extensions.DependencyInjection;
-using UserPointManagement.Application;
-using UserPointManagement.Persistence;
+using Microsoft.Extensions.Hosting;
+using Microsoft.Extensions.Logging;
namespace UserPointManagement.Web
{
public class Program
{
- public static async Task Main(string[] args)
+ public static void Main(string[] args)
{
- var builder = WebAssemblyHostBuilder.CreateDefault(args);
- builder.RootComponents.Add("#app");
-
- builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri(builder.HostEnvironment.BaseAddress) });
- builder.Services.AddAntDesign();
- builder.Services.AddServices();
- builder.Services.AddRepositories();
- builder.Services.Configure(builder.Configuration.GetSection("ProSettings"));
-
- builder.Services.AddDbContext(option =>
- {
- option
- .UseNpgsql(builder.Configuration["Connection:UserPointManagement"])
- .UseSnakeCaseNamingConvention();
- });
-
- var host = builder.Build();
- await host.RunAsync();
+ CreateHostBuilder(args).Build().Run();
}
+
+ public static IHostBuilder CreateHostBuilder(string[] args) =>
+ Host.CreateDefaultBuilder(args)
+ .ConfigureWebHostDefaults(webBuilder =>
+ {
+ webBuilder.UseStartup();
+ });
}
-}
\ No newline at end of file
+}
diff --git a/src/UserPointManagement.Web/Startup.cs b/src/UserPointManagement.Web/Startup.cs
new file mode 100644
index 0000000..de23de9
--- /dev/null
+++ b/src/UserPointManagement.Web/Startup.cs
@@ -0,0 +1,74 @@
+using System;
+using System.Net.Http;
+using AntDesign.ProLayout;
+using Microsoft.AspNetCore.Builder;
+using Microsoft.AspNetCore.Components;
+using Microsoft.AspNetCore.Hosting;
+using Microsoft.EntityFrameworkCore;
+using Microsoft.Extensions.Configuration;
+using Microsoft.Extensions.DependencyInjection;
+using Microsoft.Extensions.Hosting;
+using UserPointManagement.Application;
+using UserPointManagement.Persistence;
+
+namespace UserPointManagement.Web
+{
+ public class Startup
+ {
+ public Startup(IConfiguration configuration)
+ {
+ Configuration = configuration;
+ }
+
+ public IConfiguration Configuration { get; }
+
+ // This method gets called by the runtime. Use this method to add services to the container.
+ // For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940
+ public void ConfigureServices(IServiceCollection services)
+ {
+ services.AddRazorPages();
+ services.AddServerSideBlazor();
+ services.AddAntDesign();
+
+ services.AddDbContext(option =>
+ {
+ option.UseNpgsql(Configuration["Connection:UserPointManagement"])
+ .UseSnakeCaseNamingConvention();
+ });
+
+ services.AddServices();
+ services.AddRepositories();
+ services.AddScoped(sp => new HttpClient
+ {
+ BaseAddress = new Uri(sp.GetService().BaseUri)
+ });
+ services.Configure(Configuration.GetSection("ProSettings"));
+ }
+
+ // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
+ public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
+ {
+ if (env.IsDevelopment())
+ {
+ app.UseDeveloperExceptionPage();
+ }
+ else
+ {
+ app.UseExceptionHandler("/Error");
+ // 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.UseStaticFiles();
+
+ app.UseRouting();
+
+ app.UseEndpoints(endpoints =>
+ {
+ endpoints.MapBlazorHub();
+ endpoints.MapFallbackToPage("/_Host");
+ });
+ }
+ }
+}
diff --git a/src/UserPointManagement.Web/UserPointManagement.Web.csproj b/src/UserPointManagement.Web/UserPointManagement.Web.csproj
index 7eeafa1..92e8682 100644
--- a/src/UserPointManagement.Web/UserPointManagement.Web.csproj
+++ b/src/UserPointManagement.Web/UserPointManagement.Web.csproj
@@ -1,4 +1,4 @@
-
+
net6
@@ -8,9 +8,6 @@
-
-
-
diff --git a/src/UserPointManagement.Web/_Imports.razor b/src/UserPointManagement.Web/_Imports.razor
index f35f054..37ec627 100644
--- a/src/UserPointManagement.Web/_Imports.razor
+++ b/src/UserPointManagement.Web/_Imports.razor
@@ -6,6 +6,5 @@
@using Microsoft.AspNetCore.Components.Forms
@using Microsoft.AspNetCore.Components.Routing
@using Microsoft.AspNetCore.Components.Web
-@using Microsoft.AspNetCore.Components.WebAssembly.Http
@using Microsoft.JSInterop
@using UserPointManagement.Web
diff --git a/src/UserPointManagement.Web/appsettings.Development.json b/src/UserPointManagement.Web/appsettings.Development.json
new file mode 100644
index 0000000..3071d03
--- /dev/null
+++ b/src/UserPointManagement.Web/appsettings.Development.json
@@ -0,0 +1,26 @@
+{
+ "DetailedErrors": true,
+ "Logging": {
+ "LogLevel": {
+ "Default": "Information",
+ "Microsoft": "Warning",
+ "Microsoft.Hosting.Lifetime": "Information"
+ }
+ },
+ "ProSettings": {
+ "NavTheme": "dark",
+ "Layout": "side",
+ "ContentWidth": "Fluid",
+ "FixedHeader": false,
+ "FixSiderbar": true,
+ "Title": "Ant Design Pro",
+ "PrimaryColor": "daybreak",
+ "ColorWeak": false,
+ "SplitMenus": false,
+ "HeaderRender": true,
+ "FooterRender": true,
+ "MenuRender": true,
+ "MenuHeaderRender": true,
+ "HeaderHeight": 48
+ }
+}
diff --git a/src/UserPointManagement.Web/appsettings.json b/src/UserPointManagement.Web/appsettings.json
new file mode 100644
index 0000000..283ee9b
--- /dev/null
+++ b/src/UserPointManagement.Web/appsettings.json
@@ -0,0 +1,27 @@
+{
+ "Logging": {
+ "LogLevel": {
+ "Default": "Information",
+ "Microsoft": "Warning",
+ "Microsoft.Hosting.Lifetime": "Information"
+ }
+ },
+ "AllowedHosts": "*",
+ "ProSettings": {
+ "NavTheme": "dark",
+ "Layout": "side",
+ "ContentWidth": "Fluid",
+ "FixedHeader": false,
+ "FixSiderbar": true,
+ "Title": "Ant Design Pro",
+ "PrimaryColor": "daybreak",
+ "ColorWeak": false,
+ "SplitMenus": false,
+ "HeaderRender": true,
+ "FooterRender": true,
+ "MenuRender": true,
+ "MenuHeaderRender": true,
+ "HeaderHeight": 48
+ },
+ "Connection:UserPointManagement": "Server=67.230.184.225;Port=58007;UserId=postgres;Password=postgres;Database=tiamo;"
+}