填充代码
|
|
@ -1,25 +0,0 @@
|
|||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 17
|
||||
VisualStudioVersion = 17.9.34407.89
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HZY.Admin.Blazor.Client", "HZY.Admin.Blazor.Client\HZY.Admin.Blazor.Client.csproj", "{3AAA4515-690C-4A6B-959F-1DAD8EBD4533}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{3AAA4515-690C-4A6B-959F-1DAD8EBD4533}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{3AAA4515-690C-4A6B-959F-1DAD8EBD4533}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{3AAA4515-690C-4A6B-959F-1DAD8EBD4533}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{3AAA4515-690C-4A6B-959F-1DAD8EBD4533}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {A41AE26B-CF96-48EA-9EEB-202ABA63D2AA}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
|
|
@ -1,14 +0,0 @@
|
|||
<Router AppAssembly="@typeof(App).Assembly">
|
||||
<Found Context="routeData">
|
||||
<RouteView RouteData="@routeData" DefaultLayout="@typeof(MainLayout)" />
|
||||
<FocusOnNavigate RouteData="@routeData" Selector="h1" />
|
||||
</Found>
|
||||
<NotFound>
|
||||
<LayoutView Layout="@typeof(MainLayout)">
|
||||
<Result Status="404" />
|
||||
</LayoutView>
|
||||
</NotFound>
|
||||
</Router>
|
||||
|
||||
@* antd *@
|
||||
<AntContainer />
|
||||
|
|
@ -1,26 +0,0 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk.BlazorWebAssembly">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Content Remove="compilerconfig.json" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Include="compilerconfig.json" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="AntDesign" Version="0.19.0" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="8.0.2" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="8.0.2" PrivateAssets="all" />
|
||||
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="8.0.0" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
||||
<PackageReference Include="Flurl.Http" Version="4.0.2" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
|
@ -1,7 +0,0 @@
|
|||
@inherits LayoutComponentBase
|
||||
|
||||
@Body
|
||||
|
||||
@code {
|
||||
|
||||
}
|
||||
|
|
@ -1,84 +0,0 @@
|
|||
@inherits LayoutComponentBase
|
||||
|
||||
<Layout>
|
||||
<Header Class="header">
|
||||
<div class="logo" />
|
||||
<Menu Theme="MenuTheme.Dark" Mode="MenuMode.Horizontal" DefaultSelectedKeys=@(new []{"2"})>
|
||||
<MenuItem Key="1">nav 1</MenuItem>
|
||||
<MenuItem Key="2">nav 2</MenuItem>
|
||||
<MenuItem Key="3">nav 3</MenuItem>
|
||||
</Menu>
|
||||
</Header>
|
||||
<Layout>
|
||||
<Sider Width="200" Class="site-layout-background">
|
||||
<Menu Mode="MenuMode.Inline"
|
||||
DefaultSelectedKeys=@(new[] {"1"})
|
||||
DefaultOpenKeys=@(new[] {"sub1"})
|
||||
Style="height: 100%; border-right: 0;">
|
||||
@{
|
||||
RenderFragment sub1Title =
|
||||
@<span>
|
||||
<Icon Type="user" Theme="outline" />
|
||||
subnav 1
|
||||
</span>;
|
||||
}
|
||||
<SubMenu Key="sub1" Title=sub1Title>
|
||||
<MenuItem Key="1">option1</MenuItem>
|
||||
<MenuItem Key="2">option2</MenuItem>
|
||||
<MenuItem Key="3">option3</MenuItem>
|
||||
<MenuItem Key="4">option4</MenuItem>
|
||||
</SubMenu>
|
||||
@{
|
||||
RenderFragment sub2Title =
|
||||
@<span>
|
||||
<Icon Type="laptop" Theme="outline" />
|
||||
subnav 2
|
||||
</span>;
|
||||
}
|
||||
<SubMenu Key="sub2" Title=sub2Title>
|
||||
<MenuItem Key="5">option5</MenuItem>
|
||||
<MenuItem Key="6">option6</MenuItem>
|
||||
<MenuItem Key="7">option7</MenuItem>
|
||||
<MenuItem Key="8">option8</MenuItem>
|
||||
</SubMenu>
|
||||
@{
|
||||
RenderFragment sub3Title =
|
||||
@<span>
|
||||
<Icon Type="notification" Theme="outline" />
|
||||
subnav 3
|
||||
</span>;
|
||||
}
|
||||
<SubMenu Key="sub3" Title=sub3Title>
|
||||
<MenuItem Key="9">option9</MenuItem>
|
||||
<MenuItem Key="10">option10</MenuItem>
|
||||
<MenuItem Key="11">option11</MenuItem>
|
||||
<MenuItem Key="12">option12</MenuItem>
|
||||
</SubMenu>
|
||||
</Menu>
|
||||
</Sider>
|
||||
<Layout Style=" padding: 0 24px 24px;">
|
||||
<Breadcrumb Style="margin: 16px 0;">
|
||||
<BreadcrumbItem>Home</BreadcrumbItem>
|
||||
<BreadcrumbItem>List</BreadcrumbItem>
|
||||
<BreadcrumbItem>App</BreadcrumbItem>
|
||||
</Breadcrumb>
|
||||
<Content Class="site-layout-background" Style=" padding: 24px; margin: 0; min-height: 280px;">
|
||||
@Body
|
||||
</Content>
|
||||
</Layout>
|
||||
</Layout>
|
||||
</Layout>
|
||||
|
||||
<style>
|
||||
#components-layout-demo-top-side-2 .logo {
|
||||
width: 120px;
|
||||
height: 31px;
|
||||
background: rgba(255, 255, 255, 0.2);
|
||||
margin: 16px 28px 16px 0;
|
||||
float: left;
|
||||
}
|
||||
|
||||
.site-layout-background {
|
||||
background: #fff;
|
||||
}
|
||||
</style>
|
||||
|
|
@ -1,53 +0,0 @@
|
|||
using AntDesign;
|
||||
using Flurl.Http;
|
||||
|
||||
namespace HZY.Admin.Blazor.Client.Layout;
|
||||
|
||||
public partial class MainLayout
|
||||
{
|
||||
[Inject] public HttpClient? HttpClient { get; set; }
|
||||
|
||||
[Inject] public NavigationManager _navigationManager { get; set; }
|
||||
[Inject] public IJSRuntime _jSRuntime { get; set; }
|
||||
|
||||
[Inject] public IMessageService Message { get; set; } = null!;
|
||||
|
||||
// 加载用户信息
|
||||
string urlPrefix = "http://localhost:5500/api/v1/admin/SysUser";
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
await base.OnInitializedAsync();
|
||||
}
|
||||
|
||||
protected override async Task OnAfterRenderAsync(bool firstRender)
|
||||
{
|
||||
if (firstRender)
|
||||
{
|
||||
// http://localhost:5500/api/v1/admin/SysUser/info
|
||||
|
||||
var token = await _jSRuntime.GetLocalStorageItemAsync<string>("token");
|
||||
|
||||
if (string.IsNullOrWhiteSpace(token))
|
||||
{
|
||||
_navigationManager.NavigateTo("/login");
|
||||
return;
|
||||
}
|
||||
|
||||
var result = await $"{urlPrefix}/info"
|
||||
.WithHeader("Authorization", "Bearer " + token)
|
||||
.GetStringAsync();
|
||||
//var data = result.Data;
|
||||
//if (result.Code != 200)
|
||||
//{
|
||||
// await Message.Error(result.Message);
|
||||
// return;
|
||||
//}
|
||||
|
||||
//await Message.Info("拿到了用户信息 : " + JsonConvert.SerializeObject(data));
|
||||
}
|
||||
|
||||
await base.OnAfterRenderAsync(firstRender);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,77 +0,0 @@
|
|||
.page {
|
||||
position: relative;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
main {
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.sidebar {
|
||||
background-image: linear-gradient(180deg, rgb(5, 39, 103) 0%, #3a0647 70%);
|
||||
}
|
||||
|
||||
.top-row {
|
||||
background-color: #f7f7f7;
|
||||
border-bottom: 1px solid #d6d5d5;
|
||||
justify-content: flex-end;
|
||||
height: 3.5rem;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.top-row ::deep a, .top-row ::deep .btn-link {
|
||||
white-space: nowrap;
|
||||
margin-left: 1.5rem;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.top-row ::deep a:hover, .top-row ::deep .btn-link:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
.top-row ::deep a:first-child {
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
@media (max-width: 640.98px) {
|
||||
.top-row {
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.top-row ::deep a, .top-row ::deep .btn-link {
|
||||
margin-left: 0;
|
||||
}
|
||||
}
|
||||
|
||||
@media (min-width: 641px) {
|
||||
.page {
|
||||
flex-direction: row;
|
||||
}
|
||||
|
||||
.sidebar {
|
||||
width: 250px;
|
||||
height: 100vh;
|
||||
position: sticky;
|
||||
top: 0;
|
||||
}
|
||||
|
||||
.top-row {
|
||||
position: sticky;
|
||||
top: 0;
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
.top-row.auth ::deep a:first-child {
|
||||
flex: 1;
|
||||
text-align: right;
|
||||
width: 0;
|
||||
}
|
||||
|
||||
.top-row, article {
|
||||
padding-left: 2rem !important;
|
||||
padding-right: 1.5rem !important;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,20 +0,0 @@
|
|||
@page "/counter"
|
||||
|
||||
<PageTitle>Counter</PageTitle>
|
||||
|
||||
<h1>Counter</h1>
|
||||
|
||||
<p role="status">Current count: @currentCount</p>
|
||||
|
||||
<button class="btn btn-primary" @onclick="IncrementCount">Click me</button>
|
||||
|
||||
<Button Type="primary" @onclick="IncrementCount">Hello World!</Button>
|
||||
|
||||
@code {
|
||||
private int currentCount = 0;
|
||||
|
||||
private void IncrementCount()
|
||||
{
|
||||
currentCount++;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,7 +0,0 @@
|
|||
@page "/"
|
||||
|
||||
<PageTitle>Home</PageTitle>
|
||||
|
||||
<h1>Hello, world!</h1>
|
||||
|
||||
Welcome to your new app.
|
||||
|
|
@ -1,47 +0,0 @@
|
|||
@layout AppLayout
|
||||
@page "/login"
|
||||
|
||||
<div class="login">
|
||||
<div class="login-card">
|
||||
<div class="flex-left">
|
||||
<img src="/images/info_service.png" alt="" />
|
||||
</div>
|
||||
<div class="flex-right p-30">
|
||||
<div class="title">欢迎登录 HzyAdmin</div>
|
||||
|
||||
<div class="mt-16">
|
||||
<Input Placeholder="large size" Size="@InputSize.Large" @bind-Value="@UserName">
|
||||
<Prefix>
|
||||
<Icon Type="user" Theme="outline" style="color: #1890ff; font-size: 14px" />
|
||||
</Prefix>
|
||||
</Input>
|
||||
|
||||
@* <a-input v-model:value="state.userName" placeholder="请输入" size="large" allow-clear>
|
||||
<template #prefix>
|
||||
<Icon Type="user" Theme="outline" style="color: #1890ff; font-size: 14px" />
|
||||
</template>
|
||||
</a-input> *@
|
||||
</div>
|
||||
|
||||
<div class="mt-16">
|
||||
<InputPassword Placeholder="large size" Size="@InputSize.Large" @bind-Value="@Password">
|
||||
<Prefix>
|
||||
<Icon Type="lock" Theme="outline" style="color: #1890ff; font-size: 14px" />
|
||||
</Prefix>
|
||||
</InputPassword>
|
||||
|
||||
@* <AInputPassword type="password" v-model:value="state.userPassword" size="large" ref="inputPassword" @keyup.enter="check()">
|
||||
<template #prefix>
|
||||
<Icon Type="lock" Theme="outline" style="color: #1890ff; font-size: 14px" />
|
||||
</template>
|
||||
</AInputPassword> *@
|
||||
</div>
|
||||
|
||||
<div class="mt-40">
|
||||
<Button Type="@ButtonType.Primary" @onclick="CheckAsync" Loading="Loading" Size="large" Block>
|
||||
登录 @Loading
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -1,84 +0,0 @@
|
|||
using AntDesign;
|
||||
using Flurl;
|
||||
using Flurl.Http;
|
||||
|
||||
namespace HZY.Admin.Blazor.Client.Pages.Login;
|
||||
|
||||
public partial class Login
|
||||
{
|
||||
public string UserName { get; set; }
|
||||
|
||||
public string Password { get; set; }
|
||||
|
||||
public bool Loading { get; set; } = false;
|
||||
|
||||
[Inject]
|
||||
public NavigationManager NavigationManager { get; set; } = null!;
|
||||
|
||||
[Inject]
|
||||
public IJSRuntime JSRuntime { get; set; } = null!;
|
||||
|
||||
[Inject] public HttpClient? HttpClient { get; set; }
|
||||
|
||||
[Inject] public IMessageService Message { get; set; } = null!;
|
||||
|
||||
public async Task CheckAsync()
|
||||
{
|
||||
Loading = true;
|
||||
StateHasChanged();
|
||||
|
||||
try
|
||||
{
|
||||
var result = await (await $"http://localhost:5500/api/v1/identity/Account/Login".PostJsonAsync(new
|
||||
{
|
||||
UserName,
|
||||
UserPassword = Password
|
||||
})).GetJsonAsync<R<LoginResultDto>>();
|
||||
|
||||
var data = result.Data;
|
||||
if (result.Code != 200)
|
||||
{
|
||||
await Message.Error(result.Message);
|
||||
return;
|
||||
}
|
||||
|
||||
string? token = result.Data?.Token;
|
||||
if (string.IsNullOrWhiteSpace(token))
|
||||
{
|
||||
await Message.Error("错误 token");
|
||||
return;
|
||||
}
|
||||
|
||||
await JSRuntime.SetLocalStorageItemAsync("token", token);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw;
|
||||
}
|
||||
finally
|
||||
{
|
||||
Loading = false;
|
||||
StateHasChanged();
|
||||
|
||||
}
|
||||
|
||||
//var result = HttpClient!.PostAsJsonAsync($"/api/v1/identity/Account/Login", new
|
||||
//{
|
||||
// UserName,
|
||||
// Password
|
||||
//}).Result;
|
||||
|
||||
NavigationManager.NavigateTo("/");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public class LoginResultDto
|
||||
{
|
||||
|
||||
|
||||
public string? Token { get; set; }
|
||||
|
||||
public string? TokenType { get; set; }
|
||||
|
||||
}
|
||||
|
|
@ -1,76 +0,0 @@
|
|||
body {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
overflow: hidden;
|
||||
}
|
||||
.login {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
height: 100vh;
|
||||
background: url("/images/login-1.jpg") no-repeat;
|
||||
background-size: cover;
|
||||
}
|
||||
.login .login-card {
|
||||
height: 600px;
|
||||
width: 1000px;
|
||||
box-shadow: 0px 16px 48px 16px rgba(0, 0, 0, 0.72), 0px 12px 32px #000000, 0px 8px 16px -8px #000000;
|
||||
display: flex;
|
||||
border-radius: 5px;
|
||||
}
|
||||
.login .login-card .flex-left {
|
||||
flex: 1;
|
||||
width: 450px;
|
||||
}
|
||||
.login .login-card .flex-left img {
|
||||
height: 100%;
|
||||
}
|
||||
.login .login-card .flex-right {
|
||||
flex: 1;
|
||||
background-color: #ffffff;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
flex-direction: column;
|
||||
border-top-right-radius: 5px;
|
||||
border-bottom-right-radius: 5px;
|
||||
}
|
||||
.login .login-card .title {
|
||||
text-align: center;
|
||||
font-size: 30px;
|
||||
padding: 20px;
|
||||
font-weight: bold;
|
||||
}
|
||||
.login .login-card .el-input-group__append {
|
||||
padding: 0 !important;
|
||||
}
|
||||
.login .login-card .el-input-group__append .login-code {
|
||||
height: 38px;
|
||||
}
|
||||
@media (max-width: 1024px) {
|
||||
.flex-left {
|
||||
display: none;
|
||||
flex: 0 !important;
|
||||
}
|
||||
.flex-left img {
|
||||
height: auto !important;
|
||||
width: 80% !important;
|
||||
}
|
||||
.flex-right {
|
||||
border-radius: 5px;
|
||||
}
|
||||
}
|
||||
@media (min-width: 600px) and (max-width: 1024px) {
|
||||
.login-card {
|
||||
width: 70% !important;
|
||||
}
|
||||
}
|
||||
@media (max-width: 600px) {
|
||||
.login-card {
|
||||
width: 100% !important;
|
||||
}
|
||||
}
|
||||
.lang-content {
|
||||
position: absolute;
|
||||
right: 24px;
|
||||
top: 20px;
|
||||
}
|
||||
|
|
@ -1,93 +0,0 @@
|
|||
body {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.login {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
height: 100vh;
|
||||
//可以解开一下注解 放置一个背景图片
|
||||
background: url("/images/login-1.jpg") no-repeat;
|
||||
background-size: cover;
|
||||
|
||||
.login-card {
|
||||
height: 600px;
|
||||
width: 1000px;
|
||||
box-shadow: 0px 16px 48px 16px rgba(0, 0, 0, 0.72), 0px 12px 32px #000000, 0px 8px 16px -8px #000000;
|
||||
display: flex;
|
||||
border-radius: 5px;
|
||||
|
||||
.flex-left {
|
||||
flex: 1;
|
||||
width: 450px;
|
||||
|
||||
img {
|
||||
height: 100%;
|
||||
}
|
||||
}
|
||||
|
||||
.flex-right {
|
||||
flex: 1;
|
||||
background-color: #ffffff;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
flex-direction: column;
|
||||
border-top-right-radius: 5px;
|
||||
border-bottom-right-radius: 5px;
|
||||
}
|
||||
|
||||
.title {
|
||||
text-align: center;
|
||||
font-size: 30px;
|
||||
padding: 20px;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.el-input-group__append {
|
||||
padding: 0 !important;
|
||||
|
||||
.login-code {
|
||||
height: 38px;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//小于 1024 像素 选择采用此样式
|
||||
@media (max-width: 1024px) {
|
||||
.flex-left {
|
||||
display: none;
|
||||
flex: 0 !important;
|
||||
|
||||
img {
|
||||
height: auto !important;
|
||||
width: 80% !important;
|
||||
}
|
||||
}
|
||||
|
||||
.flex-right {
|
||||
border-radius: 5px;
|
||||
}
|
||||
}
|
||||
|
||||
@media (min-width: 600px) and (max-width: 1024px) {
|
||||
.login-card {
|
||||
width: 70% !important;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 600px) {
|
||||
.login-card {
|
||||
// flex-direction: column;
|
||||
width: 100% !important;
|
||||
}
|
||||
}
|
||||
|
||||
.lang-content {
|
||||
position: absolute;
|
||||
right: 24px;
|
||||
top: 20px;
|
||||
}
|
||||
|
|
@ -1 +0,0 @@
|
|||
body{margin:0;padding:0;overflow:hidden;}.login{display:flex;justify-content:center;align-items:center;height:100vh;background:url("/images/login-1.jpg") no-repeat;background-size:cover;}.login .login-card{height:600px;width:1000px;box-shadow:0 16px 48px 16px rgba(0,0,0,.72),0 12px 32px #000,0 8px 16px -8px #000;display:flex;border-radius:5px;}.login .login-card .flex-left{flex:1;width:450px;}.login .login-card .flex-left img{height:100%;}.login .login-card .flex-right{flex:1;background-color:#fff;display:flex;justify-content:center;flex-direction:column;border-top-right-radius:5px;border-bottom-right-radius:5px;}.login .login-card .title{text-align:center;font-size:30px;padding:20px;font-weight:bold;}.login .login-card .el-input-group__append{padding:0!important;}.login .login-card .el-input-group__append .login-code{height:38px;}@media(max-width:1024px){.flex-left{display:none;flex:0!important;}.flex-left img{height:auto!important;width:80%!important;}.flex-right{border-radius:5px;}}@media(min-width:600px) and (max-width:1024px){.login-card{width:70%!important;}}@media(max-width:600px){.login-card{width:100%!important;}}.lang-content{position:absolute;right:24px;top:20px;}
|
||||
|
|
@ -1,57 +0,0 @@
|
|||
@page "/weather"
|
||||
@inject HttpClient Http
|
||||
|
||||
<PageTitle>Weather</PageTitle>
|
||||
|
||||
<h1>Weather</h1>
|
||||
|
||||
<p>This component demonstrates fetching data from the server.</p>
|
||||
|
||||
@if (forecasts == null)
|
||||
{
|
||||
<p><em>Loading...</em></p>
|
||||
}
|
||||
else
|
||||
{
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Date</th>
|
||||
<th>Temp. (C)</th>
|
||||
<th>Temp. (F)</th>
|
||||
<th>Summary</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach (var forecast in forecasts)
|
||||
{
|
||||
<tr>
|
||||
<td>@forecast.Date.ToShortDateString()</td>
|
||||
<td>@forecast.TemperatureC</td>
|
||||
<td>@forecast.TemperatureF</td>
|
||||
<td>@forecast.Summary</td>
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
}
|
||||
|
||||
@code {
|
||||
private WeatherForecast[]? forecasts;
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
forecasts = await Http.GetFromJsonAsync<WeatherForecast[]>("sample-data/weather.json");
|
||||
}
|
||||
|
||||
public 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);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,18 +0,0 @@
|
|||
var builder = WebAssemblyHostBuilder.CreateDefault(args);
|
||||
builder.RootComponents.Add<App>("#app");
|
||||
builder.RootComponents.Add<HeadOutlet>("head::after");
|
||||
|
||||
builder.Services.AddTransient<HttpClientDelegatingHandler>();
|
||||
builder.Services.AddScoped(sp =>
|
||||
{
|
||||
var httpClientDelegatingHandler = sp.GetRequiredService<HttpClientDelegatingHandler>();
|
||||
|
||||
return new HttpClient(httpClientDelegatingHandler)
|
||||
{
|
||||
BaseAddress = new Uri("http://localhost:5500")//builder.HostEnvironment.BaseAddress
|
||||
};
|
||||
});
|
||||
|
||||
builder.Services.AddAntDesign();
|
||||
|
||||
await builder.Build().RunAsync();
|
||||
|
|
@ -1,15 +0,0 @@
|
|||
{
|
||||
"$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:5176",
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
global using HZY.Admin.Blazor.Client;
|
||||
global using HZY.Admin.Blazor.Client.Utils;
|
||||
global using Microsoft.AspNetCore.Components.Web;
|
||||
global using Microsoft.AspNetCore.Components.WebAssembly.Hosting;
|
||||
global using Microsoft.AspNetCore.Components;
|
||||
global using System.Net.Http.Json;
|
||||
global using Microsoft.JSInterop;
|
||||
global using Newtonsoft.Json;
|
||||
|
|
@ -1,62 +0,0 @@
|
|||
using Microsoft.AspNetCore.Components.WebAssembly.Http;
|
||||
|
||||
namespace HZY.Admin.Blazor.Client.Utils;
|
||||
|
||||
/// <summary>
|
||||
/// http 拦截器
|
||||
/// </summary>
|
||||
public class HttpClientDelegatingHandler : DelegatingHandler
|
||||
{
|
||||
private readonly NavigationManager _navigationManager;
|
||||
private readonly IJSRuntime _jSRuntime;
|
||||
|
||||
public HttpClientDelegatingHandler(NavigationManager navigationManager, IJSRuntime jSRuntime)
|
||||
{
|
||||
_navigationManager = navigationManager;
|
||||
_jSRuntime = jSRuntime;
|
||||
}
|
||||
|
||||
protected override async Task<HttpResponseMessage> SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
|
||||
{
|
||||
var token = await _jSRuntime.GetLocalStorageItemAsync<string>("token");
|
||||
|
||||
if (string.IsNullOrWhiteSpace(token))
|
||||
{
|
||||
_navigationManager.NavigateTo("/login");
|
||||
return new HttpResponseMessage();
|
||||
}
|
||||
|
||||
// 跨域配置
|
||||
request.SetBrowserRequestCredentials(BrowserRequestCredentials.Include);
|
||||
|
||||
// 在发送请求之前进行JSON序列化
|
||||
//if (request.Content != null && request.Content.Headers.ContentType?.MediaType == "application/json")
|
||||
//{
|
||||
// var content = await request.Content.ReadAsStringAsync();
|
||||
// var serializedContent = JsonConvert.SerializeObject(JsonConvert.DeserializeObject(content));
|
||||
// request.Content = new StringContent(serializedContent, System.Text.Encoding.UTF8, "application/json");
|
||||
//}
|
||||
|
||||
try
|
||||
{
|
||||
// 发送请求
|
||||
var response = await base.SendAsync(request, cancellationToken);
|
||||
|
||||
// 在收到响应后进行JSON反序列化
|
||||
//if (response.Content != null && response.Content.Headers.ContentType?.MediaType == "application/json")
|
||||
//{
|
||||
// var content = await response.Content.ReadAsStringAsync();
|
||||
// var deserializedContent = JsonConvert.DeserializeObject(content);
|
||||
// response.Content = new StringContent(JsonConvert.SerializeObject(deserializedContent), System.Text.Encoding.UTF8, "application/json");
|
||||
//}
|
||||
|
||||
return response;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
||||
throw;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -1,168 +0,0 @@
|
|||
using System.Net;
|
||||
|
||||
namespace HZY.Admin.Blazor.Client.Utils;
|
||||
|
||||
/// <summary>
|
||||
/// Api 消息返回类
|
||||
/// </summary>
|
||||
public class R : R<object>
|
||||
{
|
||||
public R() : base()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public R(int code, string? message, object? data) : base(code, message, data)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
#region result
|
||||
|
||||
/// <summary>
|
||||
/// 返回消息
|
||||
/// </summary>
|
||||
/// <param name="code"></param>
|
||||
/// <param name="message"></param>
|
||||
/// <returns></returns>
|
||||
public static R ResultMessage(HttpStatusCode code, string message)
|
||||
=> new R((int)code, message, null);
|
||||
|
||||
/// <summary>
|
||||
/// 返回数据
|
||||
/// </summary>
|
||||
/// <param name="code"></param>
|
||||
/// <param name="data"></param>
|
||||
/// <returns></returns>
|
||||
public static R ResultData(HttpStatusCode code, object data)
|
||||
=> new R((int)code, null, data);
|
||||
|
||||
/// <summary>
|
||||
/// 可返回消息和数据
|
||||
/// </summary>
|
||||
/// <param name="code"></param>
|
||||
/// <param name="message"></param>
|
||||
/// <param name="data"></param>
|
||||
/// <returns></returns>
|
||||
public static R Result(HttpStatusCode code, string message, object data)
|
||||
=> new R((int)code, message, data);
|
||||
|
||||
#endregion
|
||||
|
||||
#region result code 可传入 int
|
||||
|
||||
/// <summary>
|
||||
/// 返回消息
|
||||
/// </summary>
|
||||
/// <param name="code"></param>
|
||||
/// <param name="message"></param>
|
||||
/// <returns></returns>
|
||||
public static R ResultMessage(int code, string message)
|
||||
=> new R(code, message, null);
|
||||
|
||||
/// <summary>
|
||||
/// 返回数据
|
||||
/// </summary>
|
||||
/// <param name="code"></param>
|
||||
/// <param name="data"></param>
|
||||
/// <returns></returns>
|
||||
public static R ResultData(int code, object data)
|
||||
=> new R(code, null, data);
|
||||
|
||||
/// <summary>
|
||||
/// 可返回消息和数据
|
||||
/// </summary>
|
||||
/// <param name="code"></param>
|
||||
/// <param name="message"></param>
|
||||
/// <param name="data"></param>
|
||||
/// <returns></returns>
|
||||
public static R Result(int code, string message, object data)
|
||||
=> new R(code, message, data);
|
||||
|
||||
#endregion
|
||||
|
||||
#region Ok
|
||||
|
||||
/// <summary>
|
||||
/// 成功 可返回消息
|
||||
/// </summary>
|
||||
/// <param name="message"></param>
|
||||
/// <returns></returns>
|
||||
public static R OkMessage(string message)
|
||||
=> ResultMessage(HttpStatusCode.OK, message);
|
||||
|
||||
/// <summary>
|
||||
/// 成功 可返回数据
|
||||
/// </summary>
|
||||
/// <param name="data"></param>
|
||||
/// <returns></returns>
|
||||
public static R OkData(object data)
|
||||
=> ResultData(HttpStatusCode.OK, data);
|
||||
|
||||
/// <summary>
|
||||
/// 成功 可返回 消息和数据
|
||||
/// </summary>
|
||||
/// <param name="message"></param>
|
||||
/// <param name="data"></param>
|
||||
/// <returns></returns>
|
||||
public static R Ok(string message, object data)
|
||||
=> Result(HttpStatusCode.OK, message, data);
|
||||
|
||||
#endregion
|
||||
|
||||
#region Error
|
||||
|
||||
/// <summary>
|
||||
/// Error 可返回消息
|
||||
/// </summary>
|
||||
/// <param name="message"></param>
|
||||
/// <returns></returns>
|
||||
public static R ErrorMessage(string message)
|
||||
=> ResultMessage(HttpStatusCode.InternalServerError, message);
|
||||
|
||||
/// <summary>
|
||||
/// Error 可返回数据
|
||||
/// </summary>
|
||||
/// <param name="data"></param>
|
||||
/// <returns></returns>
|
||||
public static R ErrorData(object data)
|
||||
=> ResultData(HttpStatusCode.InternalServerError, data);
|
||||
|
||||
/// <summary>
|
||||
/// Error 可返回 消息和数据
|
||||
/// </summary>
|
||||
/// <param name="message"></param>
|
||||
/// <param name="data"></param>
|
||||
/// <returns></returns>
|
||||
public static R Error(string message, object data)
|
||||
=> Result(HttpStatusCode.InternalServerError, message, data);
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Api 消息返回类
|
||||
/// </summary>
|
||||
public class R<T>
|
||||
{
|
||||
public R()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public R(int code, string? message, T? data)
|
||||
{
|
||||
this.Code = code;
|
||||
this.Message = message;
|
||||
this.Data = data;
|
||||
}
|
||||
|
||||
public int Code { get; set; }
|
||||
public string? Message { get; set; }
|
||||
public T? Data { get; set; }
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -1,35 +0,0 @@
|
|||
namespace HZY.Admin.Blazor.Client.Utils;
|
||||
|
||||
/// <summary>
|
||||
/// 工具
|
||||
/// </summary>
|
||||
public static class Tools
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取浏览器内存数据
|
||||
/// </summary>
|
||||
/// <typeparam name="T"></typeparam>
|
||||
/// <param name="jSRuntime"></param>
|
||||
/// <param name="key"></param>
|
||||
/// <returns></returns>
|
||||
public static async Task<T> GetLocalStorageItemAsync<T>(this IJSRuntime jSRuntime, string key)
|
||||
{
|
||||
var token = await jSRuntime.InvokeAsync<T>("localStorage.getItem", key);
|
||||
|
||||
return token;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 存储数据到浏览器
|
||||
/// </summary>
|
||||
/// <typeparam name="T"></typeparam>
|
||||
/// <param name="jSRuntime"></param>
|
||||
/// <param name="key"></param>
|
||||
/// <param name="data"></param>
|
||||
/// <returns></returns>
|
||||
public static async Task SetLocalStorageItemAsync<T>(this IJSRuntime jSRuntime, string key, T data)
|
||||
{
|
||||
await jSRuntime.InvokeAsync<T>("localStorage.setItem", key, JsonConvert.SerializeObject(data));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,11 +0,0 @@
|
|||
@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 Microsoft.AspNetCore.Components.Web.Virtualization
|
||||
@using Microsoft.AspNetCore.Components.WebAssembly.Http
|
||||
@using Microsoft.JSInterop
|
||||
@using HZY.Admin.Blazor.Client
|
||||
@using HZY.Admin.Blazor.Client.Layout
|
||||
@using AntDesign
|
||||
|
|
@ -1,10 +0,0 @@
|
|||
[
|
||||
{
|
||||
"outputFile": "Pages/Login/Login.razor.css",
|
||||
"inputFile": "Pages/Login/Login.razor.less"
|
||||
},
|
||||
{
|
||||
"outputFile": "wwwroot/css/hzy-admin-ui-tools.css",
|
||||
"inputFile": "wwwroot/css/hzy-admin-ui-tools.less"
|
||||
}
|
||||
]
|
||||
|
|
@ -1,71 +0,0 @@
|
|||
{
|
||||
"compilers": {
|
||||
"less": {
|
||||
"autoPrefix": "",
|
||||
"cssComb": "none",
|
||||
"ieCompat": true,
|
||||
"math": null,
|
||||
"strictMath": false,
|
||||
"strictUnits": false,
|
||||
"relativeUrls": true,
|
||||
"rootPath": "",
|
||||
"sourceMapRoot": "",
|
||||
"sourceMapBasePath": "",
|
||||
"sourceMap": false
|
||||
},
|
||||
"sass": {
|
||||
"autoPrefix": "",
|
||||
"loadPaths": "",
|
||||
"style": "expanded",
|
||||
"relativeUrls": true,
|
||||
"sourceMap": false
|
||||
},
|
||||
"nodesass": {
|
||||
"autoPrefix": "",
|
||||
"includePath": "",
|
||||
"indentType": "space",
|
||||
"indentWidth": 2,
|
||||
"outputStyle": "nested",
|
||||
"precision": 5,
|
||||
"relativeUrls": true,
|
||||
"sourceMapRoot": "",
|
||||
"lineFeed": "",
|
||||
"sourceMap": false
|
||||
},
|
||||
"stylus": {
|
||||
"sourceMap": false
|
||||
},
|
||||
"babel": {
|
||||
"sourceMap": false
|
||||
},
|
||||
"coffeescript": {
|
||||
"bare": false,
|
||||
"runtimeMode": "node",
|
||||
"sourceMap": false
|
||||
},
|
||||
"handlebars": {
|
||||
"root": "",
|
||||
"noBOM": false,
|
||||
"name": "",
|
||||
"namespace": "",
|
||||
"knownHelpersOnly": false,
|
||||
"forcePartial": false,
|
||||
"knownHelpers": [],
|
||||
"commonjs": "",
|
||||
"amd": false,
|
||||
"sourceMap": false
|
||||
}
|
||||
},
|
||||
"minifiers": {
|
||||
"css": {
|
||||
"enabled": true,
|
||||
"termSemicolons": true,
|
||||
"gzip": false
|
||||
},
|
||||
"javascript": {
|
||||
"enabled": true,
|
||||
"termSemicolons": true,
|
||||
"gzip": false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,103 +0,0 @@
|
|||
html, body {
|
||||
font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
|
||||
}
|
||||
|
||||
h1:focus {
|
||||
outline: none;
|
||||
}
|
||||
|
||||
a, .btn-link {
|
||||
color: #0071c1;
|
||||
}
|
||||
|
||||
.btn-primary {
|
||||
color: #fff;
|
||||
background-color: #1b6ec2;
|
||||
border-color: #1861ac;
|
||||
}
|
||||
|
||||
.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
|
||||
box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;
|
||||
}
|
||||
|
||||
.content {
|
||||
padding-top: 1.1rem;
|
||||
}
|
||||
|
||||
.valid.modified:not([type=checkbox]) {
|
||||
outline: 1px solid #26b050;
|
||||
}
|
||||
|
||||
.invalid {
|
||||
outline: 1px solid red;
|
||||
}
|
||||
|
||||
.validation-message {
|
||||
color: red;
|
||||
}
|
||||
|
||||
#blazor-error-ui {
|
||||
background: lightyellow;
|
||||
bottom: 0;
|
||||
box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
|
||||
display: none;
|
||||
left: 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,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCBpZD0iY2xpcDAiPjxyZWN0IHg9IjIzNSIgeT0iNTEiIHdpZHRoPSI1NiIgaGVpZ2h0PSI0OSIvPjwvY2xpcFBhdGg+PC9kZWZzPjxnIGNsaXAtcGF0aD0idXJsKCNjbGlwMCkiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0yMzUgLTUxKSI+PHBhdGggZD0iTTI2My41MDYgNTFDMjY0LjcxNyA1MSAyNjUuODEzIDUxLjQ4MzcgMjY2LjYwNiA1Mi4yNjU4TDI2Ny4wNTIgNTIuNzk4NyAyNjcuNTM5IDUzLjYyODMgMjkwLjE4NSA5Mi4xODMxIDI5MC41NDUgOTIuNzk1IDI5MC42NTYgOTIuOTk2QzI5MC44NzcgOTMuNTEzIDI5MSA5NC4wODE1IDI5MSA5NC42NzgyIDI5MSA5Ny4wNjUxIDI4OS4wMzggOTkgMjg2LjYxNyA5OUwyNDAuMzgzIDk5QzIzNy45NjMgOTkgMjM2IDk3LjA2NTEgMjM2IDk0LjY3ODIgMjM2IDk0LjM3OTkgMjM2LjAzMSA5NC4wODg2IDIzNi4wODkgOTMuODA3MkwyMzYuMzM4IDkzLjAxNjIgMjM2Ljg1OCA5Mi4xMzE0IDI1OS40NzMgNTMuNjI5NCAyNTkuOTYxIDUyLjc5ODUgMjYwLjQwNyA1Mi4yNjU4QzI2MS4yIDUxLjQ4MzcgMjYyLjI5NiA1MSAyNjMuNTA2IDUxWk0yNjMuNTg2IDY2LjAxODNDMjYwLjczNyA2Ni4wMTgzIDI1OS4zMTMgNjcuMTI0NSAyNTkuMzEzIDY5LjMzNyAyNTkuMzEzIDY5LjYxMDIgMjU5LjMzMiA2OS44NjA4IDI1OS4zNzEgNzAuMDg4N0wyNjEuNzk1IDg0LjAxNjEgMjY1LjM4IDg0LjAxNjEgMjY3LjgyMSA2OS43NDc1QzI2Ny44NiA2OS43MzA5IDI2Ny44NzkgNjkuNTg3NyAyNjcuODc5IDY5LjMxNzkgMjY3Ljg3OSA2Ny4xMTgyIDI2Ni40NDggNjYuMDE4MyAyNjMuNTg2IDY2LjAxODNaTTI2My41NzYgODYuMDU0N0MyNjEuMDQ5IDg2LjA1NDcgMjU5Ljc4NiA4Ny4zMDA1IDI1OS43ODYgODkuNzkyMSAyNTkuNzg2IDkyLjI4MzcgMjYxLjA0OSA5My41Mjk1IDI2My41NzYgOTMuNTI5NSAyNjYuMTE2IDkzLjUyOTUgMjY3LjM4NyA5Mi4yODM3IDI2Ny4zODcgODkuNzkyMSAyNjcuMzg3IDg3LjMwMDUgMjY2LjExNiA4Ni4wNTQ3IDI2My41NzYgODYuMDU0N1oiIGZpbGw9IiNGRkU1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=) no-repeat 1rem/1.8rem, #b32121;
|
||||
padding: 1rem 1rem 1rem 3.7rem;
|
||||
color: white;
|
||||
}
|
||||
|
||||
.blazor-error-boundary::after {
|
||||
content: "An error has occurred."
|
||||
}
|
||||
|
||||
.loading-progress {
|
||||
position: relative;
|
||||
display: block;
|
||||
width: 8rem;
|
||||
height: 8rem;
|
||||
margin: 20vh auto 1rem auto;
|
||||
}
|
||||
|
||||
.loading-progress circle {
|
||||
fill: none;
|
||||
stroke: #e0e0e0;
|
||||
stroke-width: 0.6rem;
|
||||
transform-origin: 50% 50%;
|
||||
transform: rotate(-90deg);
|
||||
}
|
||||
|
||||
.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 {
|
||||
position: absolute;
|
||||
text-align: center;
|
||||
font-weight: bold;
|
||||
inset: calc(20vh + 3.25rem) 0 auto 0.2rem;
|
||||
}
|
||||
|
||||
.loading-progress-text:after {
|
||||
content: var(--blazor-load-percentage-text, "Loading");
|
||||
}
|
||||
|
||||
code {
|
||||
color: #c02d76;
|
||||
}
|
||||
|
|
@ -1,114 +0,0 @@
|
|||
//工具样式库
|
||||
|
||||
/* 全局样式 */
|
||||
|
||||
// ======================================================text
|
||||
.text-danger {
|
||||
color: #F56C6C !important;
|
||||
}
|
||||
|
||||
.text-blue {
|
||||
color: #91d5ff !important;
|
||||
}
|
||||
|
||||
.text-lime {
|
||||
color: #d3f261 !important;
|
||||
}
|
||||
|
||||
.text-cyan {
|
||||
color: #87e8de !important;
|
||||
}
|
||||
|
||||
.text-left {
|
||||
text-align: left !important;
|
||||
}
|
||||
|
||||
.text-right {
|
||||
text-align: right !important;
|
||||
}
|
||||
|
||||
.text-center {
|
||||
text-align: center !important;
|
||||
}
|
||||
|
||||
// ======================================================height / width
|
||||
.h100 {
|
||||
height: 100% !important;
|
||||
}
|
||||
|
||||
.w100 {
|
||||
width: 100% !important;
|
||||
}
|
||||
|
||||
.bg-white {
|
||||
background-color: #fff;
|
||||
}
|
||||
|
||||
/*
|
||||
循环
|
||||
*/
|
||||
.go_for(@count, @stylename, @name, @base) when (@count >=0) {
|
||||
.@{name}-@{count} {
|
||||
@{stylename}: @base * @count !important;
|
||||
}
|
||||
|
||||
.go_for((@count - 1), (@stylename), (@name), @base);
|
||||
}
|
||||
|
||||
/*
|
||||
end
|
||||
*/
|
||||
|
||||
// ======================================================padding
|
||||
.go_for(100, padding, p, 1px);
|
||||
.go_for(100, padding-left, pl, 1px);
|
||||
.go_for(100, padding-top, pt, 1px);
|
||||
.go_for(100, padding-bottom, pb, 1px);
|
||||
.go_for(100, padding-right, pr, 1px);
|
||||
//负数
|
||||
.go_for(100, padding, p-, -1px);
|
||||
.go_for(100, padding-left, pl-, -1px);
|
||||
.go_for(100, padding-top, pt-, -1px);
|
||||
.go_for(100, padding-bottom, pb-, -1px);
|
||||
.go_for(100, padding-right, pr-, -1px);
|
||||
// ======================================================margin
|
||||
.go_for(100, margin, m, 1px);
|
||||
.go_for(100, margin-left, ml, 1px);
|
||||
.go_for(100, margin-top, mt, 1px);
|
||||
.go_for(100, margin-bottom, mb, 1px);
|
||||
.go_for(100, margin-right, mr, 1px);
|
||||
//负数
|
||||
.go_for(100, margin, m-, -1px);
|
||||
.go_for(100, margin-left, ml-, -1px);
|
||||
.go_for(100, margin-top, mt-, -1px);
|
||||
.go_for(100, margin-bottom, mb-, -1px);
|
||||
.go_for(100, margin-right, mr-, -1px);
|
||||
// ======================================================font size
|
||||
.go_for(100, font-size, fs, 1px);
|
||||
// ======================================================Width
|
||||
.go_for(100, width, w, 1px);
|
||||
.go_for(100, width, w-, -1px);
|
||||
// ======================================================Height
|
||||
.go_for(100, height, h, 1px);
|
||||
.go_for(100, height, h-, -1px);
|
||||
|
||||
// ======================================================Height
|
||||
@media (max-width: 768px) {
|
||||
.xs-hide {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
.logo {
|
||||
width: 200px;
|
||||
}
|
||||
|
||||
.xs-w100 {
|
||||
width: 100% !important;
|
||||
}
|
||||
}
|
||||
|
||||
@media (min-width:768px) and (max-width: 1200px) {
|
||||
.xs-w100 {
|
||||
width: 85% !important;
|
||||
}
|
||||
}
|
||||
|
Before Width: | Height: | Size: 1.1 KiB |
|
Before Width: | Height: | Size: 2.6 KiB |
|
Before Width: | Height: | Size: 336 KiB |
|
Before Width: | Height: | Size: 25 KiB |
|
Before Width: | Height: | Size: 244 KiB |
|
Before Width: | Height: | Size: 45 KiB |
|
Before Width: | Height: | Size: 336 KiB |
|
Before Width: | Height: | Size: 328 KiB |
|
Before Width: | Height: | Size: 332 KiB |
|
Before Width: | Height: | Size: 200 KiB |
|
Before Width: | Height: | Size: 194 KiB |
|
Before Width: | Height: | Size: 192 KiB |
|
Before Width: | Height: | Size: 115 KiB |
|
Before Width: | Height: | Size: 568 KiB |
|
Before Width: | Height: | Size: 569 KiB |
|
Before Width: | Height: | Size: 196 KiB |
|
Before Width: | Height: | Size: 169 KiB |
|
Before Width: | Height: | Size: 440 KiB |
|
|
@ -1,37 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="zh-cn">
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>HZY.Admin.Blazor.Client</title>
|
||||
<base href="/" />
|
||||
<link rel="stylesheet" href="css/bootstrap/bootstrap.min.css" />
|
||||
<link rel="stylesheet" href="css/app.css" />
|
||||
<link rel="icon" type="image/png" href="favicon.png" />
|
||||
<link href="HZY.Admin.Blazor.Client.styles.css" rel="stylesheet" />
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<link href="/wwwroot/css/hzy-admin-ui-tools.min.css" rel="stylesheet">
|
||||
<!-- blazor -->
|
||||
<link href="_content/AntDesign/css/ant-design-blazor.css" rel="stylesheet">
|
||||
|
||||
<div id="app">
|
||||
<svg class="loading-progress">
|
||||
<circle r="40%" cx="50%" cy="50%" />
|
||||
<circle r="40%" cx="50%" cy="50%" />
|
||||
</svg>
|
||||
<div class="loading-progress-text"></div>
|
||||
</div>
|
||||
|
||||
<div id="blazor-error-ui">
|
||||
An unhandled error has occurred.
|
||||
<a href="" class="reload">Reload</a>
|
||||
<a class="dismiss">🗙</a>
|
||||
</div>
|
||||
<script src="_framework/blazor.webassembly.js"></script>
|
||||
<script src="_content/AntDesign/js/ant-design-blazor.js"></script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
|
@ -1,27 +0,0 @@
|
|||
[
|
||||
{
|
||||
"date": "2022-01-06",
|
||||
"temperatureC": 1,
|
||||
"summary": "Freezing"
|
||||
},
|
||||
{
|
||||
"date": "2022-01-07",
|
||||
"temperatureC": 14,
|
||||
"summary": "Bracing"
|
||||
},
|
||||
{
|
||||
"date": "2022-01-08",
|
||||
"temperatureC": -13,
|
||||
"summary": "Freezing"
|
||||
},
|
||||
{
|
||||
"date": "2022-01-09",
|
||||
"temperatureC": -16,
|
||||
"summary": "Balmy"
|
||||
},
|
||||
{
|
||||
"date": "2022-01-10",
|
||||
"temperatureC": -2,
|
||||
"summary": "Chilly"
|
||||
}
|
||||
]
|
||||
|
|
@ -1,19 +0,0 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="FreeSql" Version="3.2.691" />
|
||||
<PackageReference Include="FreeSql.Provider.SqlServer" Version="3.2.691" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Folder Include="codes\" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
|
@ -1,223 +0,0 @@
|
|||
using GenerateSeeds;
|
||||
using System.Text;
|
||||
|
||||
var connectionString = "Server=.;Database=hzy_microservices_sqlserver_20230227;User ID=sa;Password=123456;MultipleActiveResultSets=true;Encrypt=True;TrustServerCertificate=True;";
|
||||
|
||||
IFreeSql fsql = new FreeSql.FreeSqlBuilder()
|
||||
.UseConnectionString(FreeSql.DataType.SqlServer, connectionString)
|
||||
.UseAutoSyncStructure(false) //自动同步实体结构到数据库
|
||||
.Build(); //请务必定义成 Singleton 单例模式
|
||||
|
||||
var tables = fsql.DbFirst.GetTablesByDatabase();
|
||||
|
||||
var useStringBuilder = new StringBuilder();
|
||||
foreach (var table in tables)
|
||||
{
|
||||
var list = fsql.Ado.Query<Dictionary<string, object>>($"select * from {table.Name}");
|
||||
|
||||
if (list.Count == 0) continue;
|
||||
|
||||
if (table.Name.ToLower().Contains("log".ToLower())) continue;
|
||||
|
||||
if (table.Name.ToLower().StartsWith("__".ToLower())) continue;
|
||||
|
||||
var sb = new StringBuilder();
|
||||
|
||||
var entityName = Util.LineToHump(table.Name);
|
||||
|
||||
var className = $"Migrations{entityName}ModelBuilderExtensions";
|
||||
|
||||
// MigrationsLowCodeTableInfoModelBuilderExtensions.Seed(modelBuilder);
|
||||
useStringBuilder.Append(className + ".Seed(modelBuilder);");
|
||||
|
||||
sb.Append($@"
|
||||
namespace HZY.Repository.EntityFramework.Admin.Migrations.SeedsDatas.Datas;
|
||||
|
||||
public static class {className}
|
||||
{{
|
||||
public static void Seed(this ModelBuilder modelBuilder)
|
||||
{{
|
||||
// ===============================================表:{table.Name} 种子数据=============================================
|
||||
modelBuilder.Entity<{entityName}>().HasData(");
|
||||
|
||||
var codes = new List<string>();
|
||||
foreach (var item in list)
|
||||
{
|
||||
var rows = $"new {entityName}(){{";
|
||||
|
||||
var fileds = new List<string>();
|
||||
foreach (var column in table.Columns)
|
||||
{
|
||||
var value = item[column.Name] ?? null;
|
||||
|
||||
if (value is string)
|
||||
{
|
||||
if (value != null && value.ToString().Count(w => w == '"') > 1)
|
||||
{
|
||||
var start = "\"";
|
||||
var end = "\\\"";
|
||||
var newValue = value.ToString().Replace(start, end);
|
||||
fileds.Add($"{column.Name}=\"{newValue}\"");
|
||||
}
|
||||
else
|
||||
{
|
||||
fileds.Add($"{column.Name}=\"{(value == null ? null : value)}\"");
|
||||
}
|
||||
|
||||
}
|
||||
else if (value is Guid)
|
||||
{
|
||||
fileds.Add($"{column.Name}=Guid.Parse(\"{value}\")");
|
||||
}
|
||||
else if (value is DateTime || value is DateTime?)
|
||||
{
|
||||
fileds.Add($"{column.Name}=DateTime.Parse(\"{value}\")");
|
||||
}
|
||||
else if (value is bool)
|
||||
{
|
||||
fileds.Add($"{column.Name}=bool.Parse(\"{value}\")");
|
||||
}
|
||||
else if (column.Name == "PermissionType" && table.Name == "sys_data_authority")
|
||||
{
|
||||
fileds.Add($"{column.Name}=SysDataAuthorityPermissionTypeEnum.Self");
|
||||
}
|
||||
else if (column.Name == "Type" && table.Name == "sys_menu")
|
||||
{
|
||||
//SysMenuTypeEnum.菜单
|
||||
if (value is int || value is int?)
|
||||
{
|
||||
if ((int)value == (int)SysMenuTypeEnum.菜单)
|
||||
{
|
||||
fileds.Add($"{column.Name}=SysMenuTypeEnum.菜单");
|
||||
}
|
||||
else
|
||||
{
|
||||
fileds.Add($"{column.Name}=SysMenuTypeEnum.目录");
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (column.Name == "Mode" && table.Name == "sys_menu")
|
||||
{
|
||||
if (value is int || value is int?)
|
||||
{
|
||||
if ((int)value == (int)SysMenuModeEnum.普通)
|
||||
{
|
||||
fileds.Add($"{column.Name}=SysMenuModeEnum.普通");
|
||||
}
|
||||
else
|
||||
{
|
||||
fileds.Add($"{column.Name}=SysMenuModeEnum.微前端");
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (column.Name == "State" && (table.Name == "sys_post" || table.Name == "sys_organization"))
|
||||
{
|
||||
fileds.Add($"{column.Name}=StateEnum.正常");
|
||||
}
|
||||
else if (column.Name == "State" && table.Name == "quartz_job_task")
|
||||
{
|
||||
if (value is int || value is int?)
|
||||
{
|
||||
if ((int)value == (int)QuartzJobTaskStateEnum.运行中)
|
||||
{
|
||||
fileds.Add($"{column.Name}=QuartzJobTaskStateEnum.运行中");
|
||||
}
|
||||
else
|
||||
{
|
||||
fileds.Add($"{column.Name}=QuartzJobTaskStateEnum.未运行");
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (column.Name == "Type" && table.Name == "quartz_job_task")
|
||||
{
|
||||
if (value is int || value is int?)
|
||||
{
|
||||
if ((int)value == (int)QuartzJobTaskTypeEnum.Local)
|
||||
{
|
||||
fileds.Add($"{column.Name}=QuartzJobTaskTypeEnum.Local");
|
||||
}
|
||||
else
|
||||
{
|
||||
fileds.Add($"{column.Name}=QuartzJobTaskTypeEnum.WebApi");
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (column.Name == "RequsetMode" && table.Name == "quartz_job_task")
|
||||
{
|
||||
if (value is int || value is int?)
|
||||
{
|
||||
if ((int)value == (int)QuartzJobTaskRequsetModeEnum.Delete)
|
||||
{
|
||||
fileds.Add($"{column.Name}=QuartzJobTaskRequsetModeEnum.Delete");
|
||||
}
|
||||
|
||||
if ((int)value == (int)QuartzJobTaskRequsetModeEnum.Get)
|
||||
{
|
||||
fileds.Add($"{column.Name}=QuartzJobTaskRequsetModeEnum.Get");
|
||||
}
|
||||
|
||||
if ((int)value == (int)QuartzJobTaskRequsetModeEnum.Post)
|
||||
{
|
||||
fileds.Add($"{column.Name}=QuartzJobTaskRequsetModeEnum.Post");
|
||||
}
|
||||
|
||||
if (value == null)
|
||||
{
|
||||
fileds.Add($"{column.Name}=null");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (value == null || string.IsNullOrWhiteSpace(value.ToString()))
|
||||
{
|
||||
fileds.Add($"{column.Name}=null");
|
||||
}
|
||||
else
|
||||
{
|
||||
fileds.Add($"{column.Name}={value}");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
rows += string.Join(",", fileds);
|
||||
|
||||
rows += $"}}";
|
||||
|
||||
codes.Add(rows);
|
||||
}
|
||||
|
||||
sb.Append(string.Join(",", codes));
|
||||
|
||||
sb.Append(@");
|
||||
|
||||
}
|
||||
}
|
||||
");
|
||||
|
||||
//验证文件是否存在
|
||||
if (!Directory.Exists(AppDomain.CurrentDomain.BaseDirectory + "codes"))
|
||||
{
|
||||
Directory.CreateDirectory(AppDomain.CurrentDomain.BaseDirectory + "/codes");
|
||||
}
|
||||
|
||||
var fileName = "/codes/" + className + ".cs";
|
||||
|
||||
if (File.Exists(AppDomain.CurrentDomain.BaseDirectory + fileName))
|
||||
{
|
||||
File.Delete(AppDomain.CurrentDomain.BaseDirectory + fileName);
|
||||
}
|
||||
|
||||
File.WriteAllTextAsync(AppDomain.CurrentDomain.BaseDirectory + fileName, sb.ToString());
|
||||
|
||||
}
|
||||
|
||||
Console.WriteLine(useStringBuilder.ToString());
|
||||
Console.WriteLine("完成!!!");
|
||||
|
||||
Console.ReadKey();
|
||||
|
||||
|
||||
|
|
@ -1,50 +0,0 @@
|
|||
namespace GenerateSeeds;
|
||||
|
||||
public enum SysMenuTypeEnum
|
||||
{
|
||||
目录 = 1,
|
||||
菜单
|
||||
}
|
||||
|
||||
public enum SysMenuModeEnum
|
||||
{
|
||||
普通 = 1,
|
||||
微前端
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 状态情况
|
||||
/// </summary>
|
||||
public enum QuartzJobTaskStateEnum
|
||||
{
|
||||
未运行,
|
||||
运行中
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 类型
|
||||
/// </summary>
|
||||
public enum QuartzJobTaskTypeEnum
|
||||
{
|
||||
/// <summary>
|
||||
/// webapi 远程程序
|
||||
/// </summary>
|
||||
WebApi = 1,
|
||||
/// <summary>
|
||||
/// 本地程序
|
||||
/// </summary>
|
||||
Local
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 请求方式
|
||||
/// </summary>
|
||||
public enum QuartzJobTaskRequsetModeEnum
|
||||
{
|
||||
Post,
|
||||
Get,
|
||||
Delete
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -1,34 +0,0 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace GenerateSeeds
|
||||
{
|
||||
public static class Util
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// 蛇形命名 转化为 驼峰命名
|
||||
/// </summary>
|
||||
/// <param name="name"></param>
|
||||
/// <returns></returns>
|
||||
public static string LineToHump(string name)
|
||||
{
|
||||
if (!name.Contains('_') && name != name.ToLower())
|
||||
{
|
||||
return name;
|
||||
}
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
foreach (var item in name.Split("_", StringSplitOptions.RemoveEmptyEntries))
|
||||
{
|
||||
sb.Append(Thread.CurrentThread.CurrentCulture.TextInfo.ToTitleCase(item));
|
||||
}
|
||||
|
||||
return sb.ToString();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -1,25 +0,0 @@
|
|||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 17
|
||||
VisualStudioVersion = 17.2.32516.85
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GenerateSeeds", "GenerateSeeds\GenerateSeeds.csproj", "{EFCB00CC-7292-43B7-AE08-8276E3EC46EB}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{EFCB00CC-7292-43B7-AE08-8276E3EC46EB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{EFCB00CC-7292-43B7-AE08-8276E3EC46EB}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{EFCB00CC-7292-43B7-AE08-8276E3EC46EB}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{EFCB00CC-7292-43B7-AE08-8276E3EC46EB}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {50793FB2-A9CD-4EC4-A6AA-E5FF627188D9}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||