调整公共页面位置

This commit is contained in:
Diego
2024-11-14 15:13:34 +08:00
parent 1acd4d8d58
commit 77bbca9bb3
20 changed files with 401 additions and 10 deletions

View File

@@ -1,9 +1,9 @@
<Project>
<PropertyGroup>
<AdminVersion>7.2.0.5</AdminVersion>
<PluginVersion>9.0.2.8</PluginVersion>
<ProPluginVersion>9.0.2.6</ProPluginVersion>
<AdminVersion>7.2.0.6</AdminVersion>
<PluginVersion>9.0.2.9</PluginVersion>
<ProPluginVersion>9.0.2.8</ProPluginVersion>
</PropertyGroup>
<PropertyGroup>

View File

@@ -74,9 +74,16 @@
<Content Include="..\ThingsGateway.Server\Index\GatewayIndex.razor" Link="Index\GatewayIndex.razor" />
<Compile Include="..\ThingsGateway.Server\Index\GatewayIndex.razor.cs" Link="Index\GatewayIndex.razor.cs" />
<None Include="..\ThingsGateway.Server\Index\GatewayIndex.razor.css" Link="Index\GatewayIndex.razor.css" />
<Content Include="..\ThingsGateway.Server\Program\MainLayout.razor" Link="Program\MainLayout.razor" />
<Compile Include="..\ThingsGateway.Server\Program\MainLayout.razor.cs" Link="Program\MainLayout.razor.cs" />
<Content Include="..\ThingsGateway.Server\Program\MainLayout.razor.css" Link="Program\MainLayout.razor.css" />
<Content Include="..\ThingsGateway.Server\Layout\MainLayout.razor" Link="Layout\MainLayout.razor" />
<Compile Include="..\ThingsGateway.Server\Layout\MainLayout.razor.cs" Link="Layout\MainLayout.razor.cs" />
<Content Include="..\ThingsGateway.Server\Layout\MainLayout.razor.css" Link="Layout\MainLayout.razor.css" />
<Content Include="..\ThingsGateway.Server\Layout\AccessDenied.razor" Link="Layout\AccessDenied.razor" />
<Compile Include="..\ThingsGateway.Server\Layout\AccessDenied.razor.cs" Link="Layout\AccessDenied.razor.cs" />
<Content Include="..\ThingsGateway.Server\Layout\Login.razor" Link="Layout\Login.razor" />
<Compile Include="..\ThingsGateway.Server\Layout\Login.razor.cs" Link="Layout\Login.razor.cs" />
<Content Include="..\ThingsGateway.Server\Layout\Login.razor.css" Link="Layout\Login.razor.css" />
<Content Include="..\ThingsGateway.Server\Layout\NotFound404.razor" Link="Layout\NotFound404.razor" />
<Compile Include="..\ThingsGateway.Server\Layout\NotFound404.razor.cs" Link="Layout\NotFound404.razor.cs" />
<Content Include="..\ThingsGateway.Server\Index\GatewayIndexComponent.razor" Link="Index\GatewayIndexComponent.razor" />
<Compile Include="..\ThingsGateway.Server\Index\GatewayIndexComponent.razor.cs" Link="Index\GatewayIndexComponent.razor.cs" />

View File

@@ -0,0 +1,26 @@
@page "/Account/AccessDenied"
@layout BaseLayout
@namespace ThingsGateway.Admin.Razor
@using BootstrapBlazor.Components
@using ThingsGateway.Admin.Application;
@using ThingsGateway.Extension;
@using ThingsGateway.Razor
<div class="d-flex flex-column justify-content-center align-items-center" style="height:100vh;">
<div>
<img alt="401" src="@($"{WebsiteConst.DefaultResourceUrl}images/401.png")" style="max-width: 100%;" />
</div>
<h5>@Localizer["401"]</h5>
<div>
<Button class="mx-2" Color="Color.Primary" OnClick=@(()=>
{
var url = AppService.GetReturnUrl(NavigationManager.ToBaseRelativePath(NavigationManager.Uri));
NavigationManager.NavigateTo(url,true);
}
)>
@Localizer["Login"]
</Button>
<Button class="mx-2" Color="Color.Primary" OnClick=@(()=>NavigationManager.NavigateTo("/",true))>@Localizer["Home"]</Button>
</div>
</div>

View File

@@ -0,0 +1,37 @@
//------------------------------------------------------------------------------
// 此代码版权声明为全文件覆盖,如有原作者特别声明,会在下方手动补充
// 此代码版权除特别声明外的代码归作者本人Diego所有
// 源代码使用协议遵循本仓库的开源协议及附加协议
// Gitee源代码仓库https://gitee.com/diego2098/ThingsGateway
// Github源代码仓库https://github.com/kimdiego2098/ThingsGateway
// 使用文档https://thingsgateway.cn/
// QQ群605534569
//------------------------------------------------------------------------------
using Microsoft.AspNetCore.Components;
using Microsoft.Extensions.Localization;
using System.ComponentModel;
using System.Diagnostics.CodeAnalysis;
namespace ThingsGateway.Admin.Razor;
public partial class AccessDenied
{
[SupplyParameterFromQuery]
[Parameter]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public string? ReturnUrl { get; set; }
[Inject]
[NotNull]
private IAppService? AppService { get; set; }
[Inject]
[NotNull]
private IStringLocalizer<NotFound404>? Localizer { get; set; }
[Inject]
[NotNull]
private NavigationManager? NavigationManager { get; set; }
}

View File

@@ -0,0 +1,54 @@
@page "/Account/Login"
@layout BaseLayout
@namespace ThingsGateway.Admin.Razor
@using BootstrapBlazor.Components
@using ThingsGateway.Admin.Application;
@using ThingsGateway.Extension;
@using ThingsGateway.Razor
<div class="login h-100">
@* 左侧说明 *@
<div class="row form-inline h-100">
<div class="col-0 col-xl-8 p-5 login-left">
<div style="width:100%; height:100%;" class="d-flex align-items-start flex-column mb-6">
<div class="d-flex align-items-center justify-content-center ms-5 mt-5">
<span class="avatar">
@WebsiteOption.Value.Title?.GetNameLen2()
</span>
<h4>@($"{WebsiteOption.Value.Title} {_versionString}")</h4>
</div>
<div class="d-flex flex-column align-items-start ms-5 mt-5 mb-auto">
<div class="mb-3">
<h5>@Localizer["Remark1"]</h5>
</div>
<div class="mb-3">
<h5>@Localizer["Remark2"]</h5>
</div>
<div class="mb-3">
<h5>@Localizer["Remark3"]</h5>
</div>
</div>
<div class="d-flex align-items-center p-2" style="width:100%;height:100%;">
<img src=@($"{WebsiteConst.DefaultResourceUrl}images/login-left.svg") />
</div>
</div>
</div>
@* 右侧登录 *@
<div class="col-12 col-xl-4">
<div style="width:100%; height:100%;" class="d-flex align-items-center justify-content-center">
<div class="login-form d-flex align-items-center flex-column">
<img src=@($"{WebsiteConst.DefaultResourceUrl}images/defaultUser.svg") style="width:36px;height:36px;" />
<h5 class="mt-2 mb-12 ">@Localizer["Welcome"] 👋</h5>
<UserLogin Model="loginModel" OnLogin="LoginAsync"></UserLogin>
</div>
</div>
</div>
</div>
</div>

View File

@@ -0,0 +1,110 @@
//------------------------------------------------------------------------------
// 此代码版权声明为全文件覆盖,如有原作者特别声明,会在下方手动补充
// 此代码版权除特别声明外的代码归作者本人Diego所有
// 源代码使用协议遵循本仓库的开源协议及附加协议
// Gitee源代码仓库https://gitee.com/diego2098/ThingsGateway
// Github源代码仓库https://github.com/kimdiego2098/ThingsGateway
// 使用文档https://thingsgateway.cn/
// QQ群605534569
//------------------------------------------------------------------------------
using BootstrapBlazor.Components;
using Mapster;
using Microsoft.AspNetCore.Components;
using Microsoft.AspNetCore.Components.Forms;
using Microsoft.Extensions.Localization;
using Microsoft.Extensions.Options;
using System.ComponentModel;
using System.Diagnostics.CodeAnalysis;
using ThingsGateway.Admin.Application;
using ThingsGateway.NewLife.Extension;
using ThingsGateway.Razor;
namespace ThingsGateway.Admin.Razor;
public partial class Login
{
private string _versionString = string.Empty;
private LoginInput loginModel = new LoginInput();
[SupplyParameterFromQuery]
[Parameter]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public string? ReturnUrl { get; set; }
[Inject]
[NotNull]
private AjaxService? AjaxService { get; set; }
[Inject]
[NotNull]
private IAuthRazorService? AuthRazorService { get; set; }
[Inject]
[NotNull]
private IStringLocalizer<Login>? Localizer { get; set; }
[Inject]
[NotNull]
private ToastService? ToastService { get; set; }
[Inject]
[NotNull]
private IAppVersionService? VersionService { get; set; }
[Inject]
[NotNull]
private IAppService? AppService { get; set; }
[Inject]
[NotNull]
private IOptions<WebsiteOptions>? WebsiteOption { get; set; }
protected override Task OnInitializedAsync()
{
_versionString = $"v{VersionService.Version}";
return base.OnInitializedAsync();
}
private async Task LoginAsync(EditContext context)
{
var model = loginModel.Adapt<LoginInput>();
model.Password = DESCEncryption.Encrypt(model.Password);
model.Device = AppService.ClientInfo.Device.Family;
try
{
var ret = await AuthRazorService.LoginAsync(model);
if (ret.Code != 200)
{
await ToastService.Error(Localizer["LoginErrorh1"], $"{ret.Msg}");
}
else
{
await ToastService.Information(Localizer["LoginSuccessh1"], Localizer["LoginSuccessc1"]);
await Task.Delay(1000);
if (ReturnUrl.IsNullOrWhiteSpace() || ReturnUrl == @"/")
{
await AjaxService.Goto(ret.Data!.Razor ?? ReturnUrl ?? "/");
}
else
{
await AjaxService.Goto(ReturnUrl);
}
}
}
catch
{
await ToastService.Error(Localizer["LoginErrorh2"], Localizer["LoginErrorc2"]);
}
}
}

View File

@@ -0,0 +1,38 @@
.login {
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
height: 100%;
width: 100%;
}
.login-form {
padding: 5rem 5rem 3rem 5rem;
font-size: 0.875rem;
box-shadow: 0px 20px 40px 0px rgba(0,0,0,0.3);
border-radius: 6px;
}
.login-left {
box-shadow: 0 0px 3px 0 rgba(0,0,0,0.1),0 0 4px 0 rgba(0,0,0,0.1);
}
@media (max-width: 1200px) {
.login-left {
display: none
}
}
::deep .avatar {
border-radius: 1.5rem;
width: 36px;
height: 36px;
background-color: var(--bs-green);
color: #fff;
}
::deep .h1, .h2, .h3, .h4, .h5, .h6, h1, h2, h3, h4, h5, h6 {
margin-bottom: 0;
}

View File

@@ -0,0 +1,15 @@
@page "/404"
@layout BaseLayout
@namespace ThingsGateway.Admin.Razor
@using BootstrapBlazor.Components
@using ThingsGateway.Admin.Application;
@using ThingsGateway.Extension;
@using ThingsGateway.Razor
<div class="d-flex flex-column justify-content-center align-items-center" style="height:100vh;">
<div>
<img alt="404" src="@($"{WebsiteConst.DefaultResourceUrl}images/404.png")" style="max-width: 100%;" />
</div>
<h5>@Localizer["404"]</h5>
<Button class="mt-2" Color="Color.Primary" OnClick=@(()=>NavigationManager.NavigateTo("/"))>@Localizer["Home"]</Button>
</div>

View File

@@ -0,0 +1,27 @@
//------------------------------------------------------------------------------
// 此代码版权声明为全文件覆盖,如有原作者特别声明,会在下方手动补充
// 此代码版权除特别声明外的代码归作者本人Diego所有
// 源代码使用协议遵循本仓库的开源协议及附加协议
// Gitee源代码仓库https://gitee.com/diego2098/ThingsGateway
// Github源代码仓库https://github.com/kimdiego2098/ThingsGateway
// 使用文档https://thingsgateway.cn/
// QQ群605534569
//------------------------------------------------------------------------------
using Microsoft.AspNetCore.Components;
using Microsoft.Extensions.Localization;
using System.Diagnostics.CodeAnalysis;
namespace ThingsGateway.Admin.Razor;
public partial class NotFound404
{
[Inject]
[NotNull]
private IStringLocalizer<NotFound404>? Localizer { get; set; }
[Inject]
[NotNull]
private NavigationManager? NavigationManager { get; set; }
}

View File

@@ -1,4 +1,22 @@
{
"ThingsGateway.Admin.Razor.NotFound404": {
"404": "Sorry, the page you are looking for does not exist.",
"401": "Sorry, you do not have permission to access this page.",
"Home": "Back to Home",
"Login": "Login"
},
"ThingsGateway.Admin.Razor.Login": {
"LoginErrorh1": "Login Error",
"LoginSuccessh1": "Login Success",
"LoginSuccessc1": "Redirecting to the page",
"LoginErrorh2": "Login Failed",
"LoginErrorc2": "Please contact the administrator!",
"Remark1": "Edge Collection Gateway",
"Remark2": "Data Aggregation, Multi-path Forwarding",
"Remark3": "Edge Computing, Efficient Processing",
"Welcome": "Welcome"
},
"ThingsGateway.Razor.MainLayout": {
"About": "About",
"FullScreenButton": "Full Screen",

View File

@@ -1,4 +1,23 @@
{
"ThingsGateway.Admin.Razor.NotFound404": {
"404": "抱歉,您访问的页面不存在。",
"401": "抱歉,您无权限访问该页面。",
"Home": "回到首页",
"Login": "重新登录"
},
"ThingsGateway.Admin.Razor.Login": {
"LoginErrorh1": "登录异常",
"LoginSuccessh1": "登录成功",
"LoginSuccessc1": "即将跳转页面",
"LoginErrorh2": "登录失败",
"LoginErrorc2": "请联系管理员!",
"Remark1": "边缘采集网关",
"Remark2": "数据集中,多路转发",
"Remark3": "边缘计算,高效处理",
"Welcome": "欢迎使用"
},
"ThingsGateway.Razor.MainLayout": {
"About": "关于",
"FullScreenButton": "全屏",

View File

@@ -1,4 +1,24 @@
{
"ThingsGateway.Admin.Razor.NotFound404": {
"404": "抱歉,您訪問的頁面不存在。",
"401": "抱歉,您無權限訪問該頁面。",
"Home": "回到首頁",
"Login": "重新登錄"
},
"ThingsGateway.Admin.Razor.Login": {
"LoginErrorh1": "登錄異常",
"LoginSuccessh1": "登錄成功",
"LoginSuccessc1": "即將跳轉頁面",
"LoginErrorh2": "登錄失敗",
"LoginErrorc2": "請聯繫管理員!",
"Remark1": "邊緣採集網關",
"Remark2": "數據集中,多路轉發",
"Remark3": "邊緣計算,高效處理",
"Welcome": "歡迎使用"
},
"ThingsGateway.Razor.MainLayout": {
"About": "關於",
"FullScreenButton": "全螢幕",

View File

@@ -114,4 +114,17 @@
</ItemGroup>
<ItemGroup>
<Content Update="Layout\BlazorApp.razor">
<ExcludeFromSingleFile>true</ExcludeFromSingleFile>
</Content>
<Content Update="Layout\MainLayout.razor">
<ExcludeFromSingleFile>true</ExcludeFromSingleFile>
</Content>
<Content Update="Layout\Routes.razor">
<ExcludeFromSingleFile>true</ExcludeFromSingleFile>
</Content>
</ItemGroup>
</Project>

View File

@@ -62,9 +62,16 @@
<Content Include="..\ThingsGateway.Server\Index\GatewayIndex.razor" Link="Index\GatewayIndex.razor" />
<Compile Include="..\ThingsGateway.Server\Index\GatewayIndex.razor.cs" Link="Index\GatewayIndex.razor.cs" />
<None Include="..\ThingsGateway.Server\Index\GatewayIndex.razor.css" Link="Index\GatewayIndex.razor.css" />
<Content Include="..\ThingsGateway.Server\Program\MainLayout.razor" Link="Program\MainLayout.razor" />
<Compile Include="..\ThingsGateway.Server\Program\MainLayout.razor.cs" Link="Program\MainLayout.razor.cs" />
<Content Include="..\ThingsGateway.Server\Program\MainLayout.razor.css" Link="Program\MainLayout.razor.css" />
<Content Include="..\ThingsGateway.Server\Layout\MainLayout.razor" Link="Layout\MainLayout.razor" />
<Compile Include="..\ThingsGateway.Server\Layout\MainLayout.razor.cs" Link="Layout\MainLayout.razor.cs" />
<Content Include="..\ThingsGateway.Server\Layout\MainLayout.razor.css" Link="Layout\MainLayout.razor.css" />
<Content Include="..\ThingsGateway.Server\Layout\AccessDenied.razor" Link="Layout\AccessDenied.razor" />
<Compile Include="..\ThingsGateway.Server\Layout\AccessDenied.razor.cs" Link="Layout\AccessDenied.razor.cs" />
<Content Include="..\ThingsGateway.Server\Layout\Login.razor" Link="Layout\Login.razor" />
<Compile Include="..\ThingsGateway.Server\Layout\Login.razor.cs" Link="Layout\Login.razor.cs" />
<Content Include="..\ThingsGateway.Server\Layout\Login.razor.css" Link="Layout\Login.razor.css" />
<Content Include="..\ThingsGateway.Server\Layout\NotFound404.razor" Link="Layout\NotFound404.razor" />
<Compile Include="..\ThingsGateway.Server\Layout\NotFound404.razor.cs" Link="Layout\NotFound404.razor.cs" />
<Content Include="..\ThingsGateway.Server\Index\GatewayIndexComponent.razor" Link="Index\GatewayIndexComponent.razor" />
<Compile Include="..\ThingsGateway.Server\Index\GatewayIndexComponent.razor.cs" Link="Index\GatewayIndexComponent.razor.cs" />

View File

@@ -1,6 +1,6 @@
<Project>
<PropertyGroup>
<Version>7.2.0.5</Version>
<Version>7.2.0.6</Version>
</PropertyGroup>
<ItemGroup>