41 changed files with 577 additions and 231 deletions
@ -1,17 +1,16 @@ |
|||||
<Project Sdk="Microsoft.NET.Sdk"> |
<Project Sdk="Microsoft.NET.Sdk"> |
||||
|
<Import Project="..\..\..\..\common.props" /> |
||||
<PropertyGroup> |
<PropertyGroup> |
||||
<TargetFramework>net5.0</TargetFramework> |
<TargetFramework>net5.0</TargetFramework> |
||||
</PropertyGroup> |
</PropertyGroup> |
||||
<ItemGroup> |
<ItemGroup> |
||||
|
|
||||
<PackageReference Include="Savorboard.CAP.InMemoryMessageQueue" Version="5.1.1" /> |
<PackageReference Include="Savorboard.CAP.InMemoryMessageQueue" Version="5.1.1" /> |
||||
<PackageReference Include="Volo.Abp.Core" Version="4.4.0" /> |
<PackageReference Include="Volo.Abp.Core" Version="$(AbpPackageVersion)" /> |
||||
<PackageReference Include="Volo.Abp.EventBus" Version="4.4.0" /> |
<PackageReference Include="Volo.Abp.EventBus" Version="$(AbpPackageVersion)" /> |
||||
<PackageReference Include="DotNetCore.CAP" Version="5.1.4" /> |
<PackageReference Include="DotNetCore.CAP" Version="$(DotNetCoreCAPVersion)" /> |
||||
<PackageReference Include="DotNetCore.CAP.MySql" Version="5.1.4" /> |
<PackageReference Include="DotNetCore.CAP.MySql" Version="$(DotNetCoreCAPVersion)" /> |
||||
<PackageReference Include="DotNetCore.CAP.RabbitMQ" Version="5.1.4" /> |
<PackageReference Include="DotNetCore.CAP.RabbitMQ" Version="$(DotNetCoreCAPVersion)" /> |
||||
<PackageReference Include="DotNetCore.CAP.Dashboard" Version="5.1.4" /> |
<PackageReference Include="DotNetCore.CAP.Dashboard" Version="$(DotNetCoreCAPVersion)" /> |
||||
<PackageReference Include="DotNetCore.CAP.InMemoryStorage" Version="5.1.4" /> |
<PackageReference Include="DotNetCore.CAP.InMemoryStorage" Version="$(DotNetCoreCAPVersion)" /> |
||||
</ItemGroup> |
</ItemGroup> |
||||
</Project> |
</Project> |
||||
|
|||||
@ -0,0 +1,161 @@ |
|||||
|
@page |
||||
|
@model CompanyName.ProjectName.Pages.Login |
||||
|
|
||||
|
@{ |
||||
|
Layout = null; |
||||
|
} |
||||
|
|
||||
|
<!DOCTYPE html> |
||||
|
|
||||
|
<html> |
||||
|
<head> |
||||
|
<title>后台服务登录</title> |
||||
|
<link href="http://cdn.bootcss.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"> |
||||
|
<link href="http://cdn.bootcss.com/font-awesome/4.6.3/css/font-awesome.min.css" rel="stylesheet"> |
||||
|
</head> |
||||
|
<body> |
||||
|
<div class="container"> |
||||
|
<div class="row"> |
||||
|
<div class="col-md-offset-3 col-md-6"> |
||||
|
<form class="form-horizontal" method="post"> |
||||
|
@Html.AntiForgeryToken() |
||||
|
<span class="heading">后台服务登录</span> |
||||
|
<div class="form-group"> |
||||
|
<input type="text" class="form-control" name="userName" placeholder="用户名"> |
||||
|
<i class="fa fa-user"></i> |
||||
|
</div> |
||||
|
<div class="form-group help"> |
||||
|
<input type="password" class="form-control" name="password" placeholder="密码"> |
||||
|
<i class="fa fa-lock"></i> |
||||
|
</div> |
||||
|
<div class="form-group"> |
||||
|
<button type="submit" class="btn btn-default">登录</button> |
||||
|
</div> |
||||
|
</form> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
</body> |
||||
|
</html> |
||||
|
<style> |
||||
|
.row { |
||||
|
width: 800 px; |
||||
|
height: auto; |
||||
|
margin: auto; |
||||
|
box-sizing: border-box; |
||||
|
transform: translate(0, 50%); |
||||
|
} |
||||
|
.form-horizontal { |
||||
|
background: #fff; |
||||
|
padding-bottom: 40px; |
||||
|
border-radius: 15px; |
||||
|
text-align: center; |
||||
|
} |
||||
|
.form-horizontal .heading { |
||||
|
display: block; |
||||
|
font-size: 35px; |
||||
|
font-weight: 700; |
||||
|
padding: 35px 0; |
||||
|
border-bottom: 1px solid #f0f0f0; |
||||
|
margin-bottom: 30px; |
||||
|
} |
||||
|
.form-horizontal .form-group { |
||||
|
padding: 0 40px; |
||||
|
margin: 0 0 25px 0; |
||||
|
position: relative; |
||||
|
} |
||||
|
.form-horizontal .form-control { |
||||
|
background: #f0f0f0; |
||||
|
border: none; |
||||
|
border-radius: 20px; |
||||
|
box-shadow: none; |
||||
|
padding: 0 20px 0 45px; |
||||
|
height: 40px; |
||||
|
transition: all 0.3s ease 0s; |
||||
|
} |
||||
|
.form-horizontal .form-control:focus { |
||||
|
background: #e0e0e0; |
||||
|
box-shadow: none; |
||||
|
outline: 0 none; |
||||
|
} |
||||
|
.form-horizontal .form-group i { |
||||
|
position: absolute; |
||||
|
top: 12px; |
||||
|
left: 60px; |
||||
|
font-size: 17px; |
||||
|
color: #c8c8c8; |
||||
|
transition: all 0.5s ease 0s; |
||||
|
} |
||||
|
.form-horizontal .form-control:focus + i { |
||||
|
color: #00b4ef; |
||||
|
} |
||||
|
.form-horizontal .fa-question-circle { |
||||
|
display: inline-block; |
||||
|
position: absolute; |
||||
|
top: 12px; |
||||
|
right: 60px; |
||||
|
font-size: 20px; |
||||
|
color: #808080; |
||||
|
transition: all 0.5s ease 0s; |
||||
|
} |
||||
|
.form-horizontal .fa-question-circle:hover { |
||||
|
color: #000; |
||||
|
} |
||||
|
.form-horizontal .main-checkbox { |
||||
|
float: left; |
||||
|
width: 20px; |
||||
|
height: 20px; |
||||
|
background: #11a3fc; |
||||
|
border-radius: 50%; |
||||
|
position: relative; |
||||
|
margin: 5px 0 0 5px; |
||||
|
border: 1px solid #11a3fc; |
||||
|
} |
||||
|
.form-horizontal .main-checkbox label { |
||||
|
width: 20px; |
||||
|
height: 20px; |
||||
|
position: absolute; |
||||
|
top: 0; |
||||
|
left: 0; |
||||
|
cursor: pointer; |
||||
|
} |
||||
|
.form-horizontal .main-checkbox label:after { |
||||
|
content: ""; |
||||
|
width: 10px; |
||||
|
height: 5px; |
||||
|
position: absolute; |
||||
|
top: 5px; |
||||
|
left: 4px; |
||||
|
border: 3px solid #fff; |
||||
|
border-top: none; |
||||
|
border-right: none; |
||||
|
background: transparent; |
||||
|
opacity: 0; |
||||
|
-webkit-transform: rotate(-45deg); |
||||
|
transform: rotate(-45deg); |
||||
|
} |
||||
|
.form-horizontal .main-checkbox input[type="checkbox"] { |
||||
|
visibility: hidden; |
||||
|
} |
||||
|
.form-horizontal .main-checkbox input[type="checkbox"]:checked + label:after { |
||||
|
opacity: 1; |
||||
|
} |
||||
|
.form-horizontal .text { |
||||
|
float: left; |
||||
|
margin-left: 7px; |
||||
|
line-height: 20px; |
||||
|
padding-top: 5px; |
||||
|
text-transform: capitalize; |
||||
|
} |
||||
|
.form-horizontal .btn { |
||||
|
text-align: center; |
||||
|
font-size: 14px; |
||||
|
color: #fff; |
||||
|
background: #00b4ef; |
||||
|
border-radius: 30px; |
||||
|
padding: 10px 25px; |
||||
|
border: none; |
||||
|
text-transform: capitalize; |
||||
|
transition: all 0.5s ease 0s; |
||||
|
} |
||||
|
</style> |
||||
@ -0,0 +1,67 @@ |
|||||
|
using System; |
||||
|
using System.Threading.Tasks; |
||||
|
using CompanyName.ProjectName.Users; |
||||
|
using CompanyName.ProjectName.Users.Dtos; |
||||
|
using Microsoft.AspNetCore.Http; |
||||
|
using Microsoft.AspNetCore.Mvc.RazorPages; |
||||
|
using Microsoft.Extensions.Hosting; |
||||
|
using Microsoft.Extensions.Logging; |
||||
|
|
||||
|
|
||||
|
namespace CompanyName.ProjectName.Pages |
||||
|
{ |
||||
|
public class Login : PageModel |
||||
|
{ |
||||
|
private readonly IAccountAppService _accountAppService; |
||||
|
private readonly ILogger<Login> _logger; |
||||
|
private readonly IHostEnvironment _hostEnvironment; |
||||
|
|
||||
|
public Login(IAccountAppService accountAppService, ILogger<Login> logger, IHostEnvironment hostEnvironment) |
||||
|
{ |
||||
|
_accountAppService = accountAppService; |
||||
|
_logger = logger; |
||||
|
_hostEnvironment = hostEnvironment; |
||||
|
} |
||||
|
|
||||
|
public void OnGet() |
||||
|
{ |
||||
|
} |
||||
|
|
||||
|
public async Task OnPost() |
||||
|
{ |
||||
|
string userName = Request.Form["userName"]; |
||||
|
string password = Request.Form["password"]; |
||||
|
if (userName.IsNullOrWhiteSpace() || password.IsNullOrWhiteSpace()) |
||||
|
{ |
||||
|
Response.Redirect("/Login"); |
||||
|
} |
||||
|
|
||||
|
try |
||||
|
{ |
||||
|
var options = new CookieOptions |
||||
|
{ |
||||
|
Expires = DateTime.Now.AddHours(2), |
||||
|
SameSite = SameSiteMode.Unspecified, |
||||
|
}; |
||||
|
|
||||
|
if (!_hostEnvironment.IsDevelopment()) |
||||
|
{ |
||||
|
// 设置cookies domain
|
||||
|
options.Domain = "ProjectName.cn"; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
var result = await _accountAppService.LoginAsync(new LoginInput() |
||||
|
{ Name = userName, Password = password }); |
||||
|
Response.Cookies.Append(ProjectNameHttpApiHostConsts.DefaultCookieName, result.Token,options); |
||||
|
} |
||||
|
catch (Exception e) |
||||
|
{ |
||||
|
_logger.LogError($"登录失败:{e.Message}"); |
||||
|
Response.Redirect("/Login"); |
||||
|
} |
||||
|
|
||||
|
Response.Redirect("/monitor"); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,173 @@ |
|||||
|
@page |
||||
|
@using CompanyName.ProjectName |
||||
|
@model CompanyName.ProjectName.Pages.Monitor |
||||
|
|
||||
|
|
||||
|
@{ |
||||
|
Layout = null; |
||||
|
} |
||||
|
|
||||
|
<!DOCTYPE html> |
||||
|
|
||||
|
<html lang="en"> |
||||
|
<head> |
||||
|
<meta charset="UTF-8"/> |
||||
|
<meta http-equiv="X-UA-Compatible" content="IE=edge"/> |
||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0"/> |
||||
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap@3.3.7/dist/css/bootstrap.min.css" rel="stylesheet"/> |
||||
|
<title>后端服务</title> |
||||
|
</head> |
||||
|
|
||||
|
<body> |
||||
|
<div class="container projects"> |
||||
|
<div class="projects-header page-header"> |
||||
|
<h2>后端服务列表</h2> |
||||
|
@* <p>这些项目或者是对Bootstrap进行了有益的补充,或者是基于Bootstrap开发的</p> *@ |
||||
|
</div> |
||||
|
<div class="row"> |
||||
|
<div class="col-sm-6 col-md-4 col-lg-3"> |
||||
|
<div class="thumbnail" style="height: 180px"> |
||||
|
<a href="@ProjectNameHttpApiHostConsts.SwaggerUiEndPoint" target="_blank"> |
||||
|
<img class="lazy" src="/images/swagger.png" width="300" height="150"/> |
||||
|
</a> |
||||
|
<div class="caption"> |
||||
|
<h3> |
||||
|
<a href="@ProjectNameHttpApiHostConsts.SwaggerUiEndPoint" target="_blank">SwaggerUI</a> |
||||
|
</h3> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
|
||||
|
<div class="col-sm-6 col-md-4 col-lg-3"> |
||||
|
<div class="thumbnail" style="height: 180px"> |
||||
|
<a href="@ProjectNameHttpApiHostConsts.CapDashboardEndPoint" target="_blank"> |
||||
|
<img class="lazy" src="/images/cap.png" width="300" height="150"/> |
||||
|
</a> |
||||
|
<div class="caption"> |
||||
|
<h3> |
||||
|
<a href="@ProjectNameHttpApiHostConsts.CapDashboardEndPoint" target="_blank">CAP面板</a> |
||||
|
</h3> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
|
||||
|
<div class="col-sm-6 col-md-4 col-lg-3"> |
||||
|
<div class="thumbnail" style="height: 180px"> |
||||
|
<a href="@ProjectNameHttpApiHostConsts.HangfireDashboardEndPoint" target="_blank"> |
||||
|
<img class="lazy" src="/images/hangfire.png" width="300" height="150"/> |
||||
|
</a> |
||||
|
<div class="caption"> |
||||
|
<h3> |
||||
|
<a href="@ProjectNameHttpApiHostConsts.HangfireDashboardEndPoint" target="_blank">Hangfire面板</a> |
||||
|
</h3> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
|
||||
|
<div class="col-sm-6 col-md-4 col-lg-3"> |
||||
|
<div class="thumbnail" style="height: 180px"> |
||||
|
<a href="@ProjectNameHttpApiHostConsts.MoreEndPoint" target="_blank"> |
||||
|
<img class="lazy" src="/images/more.png" width="300" height="150"/> |
||||
|
</a> |
||||
|
<div class="caption"> |
||||
|
<h3> |
||||
|
<a href="@ProjectNameHttpApiHostConsts.MoreEndPoint" target="_blank">了解更多...</a> |
||||
|
</h3> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
</body> |
||||
|
</html> |
||||
|
<style> |
||||
|
*:before, |
||||
|
*:after { |
||||
|
-webkit-box-sizing: border-box; |
||||
|
-moz-box-sizing: border-box; |
||||
|
box-sizing: border-box; |
||||
|
} |
||||
|
.container { |
||||
|
width: 1170 px; |
||||
|
padding-right: 15 px; |
||||
|
padding-left: 15 px; |
||||
|
margin-right: auto; |
||||
|
margin-left: auto; |
||||
|
} |
||||
|
.projects-header { |
||||
|
width: 60%; |
||||
|
text-align: center; |
||||
|
font-weight: 200; |
||||
|
display: block; |
||||
|
margin: 60 px auto 40 px !important; |
||||
|
} |
||||
|
.page-header { |
||||
|
padding-bottom: 9px; |
||||
|
margin: 40px auto; |
||||
|
border-bottom: 1 px solid #eee; |
||||
|
} |
||||
|
.projects-header h2 { |
||||
|
font-size: 42px; |
||||
|
letter-spacing: -1px; |
||||
|
} |
||||
|
h2 { |
||||
|
margin-top: 20 px; |
||||
|
margin-bottom: 10 px; |
||||
|
font-weight: 500; |
||||
|
line-height: 1.1; |
||||
|
color: inherit; |
||||
|
/* text-align: center; */ |
||||
|
} |
||||
|
p { |
||||
|
margin: 0 0 10 px; |
||||
|
} |
||||
|
.row { |
||||
|
margin-right: -15 px; |
||||
|
margin-left: -15 px; |
||||
|
} |
||||
|
.col-lg-3 { |
||||
|
width: 25%; |
||||
|
} |
||||
|
.projects .thumbnail { |
||||
|
display: block; |
||||
|
margin-right: auto; |
||||
|
margin-left: auto; |
||||
|
text-align: center; |
||||
|
margin-bottom: 30 px; |
||||
|
border-radius: 0; |
||||
|
} |
||||
|
.thumbnail { |
||||
|
display: block; |
||||
|
padding: 4px; |
||||
|
line-height: 1.42857143; |
||||
|
background-color: #fff; |
||||
|
border: 1 px solid #ddd; |
||||
|
.transition(border 0.2s ease-in-out); |
||||
|
} |
||||
|
a { |
||||
|
color: #337ab7; |
||||
|
text-decoration: none; |
||||
|
background-color: transparent; |
||||
|
} |
||||
|
.projects .thumbnail img { |
||||
|
max-width: 100%; |
||||
|
height: auto; |
||||
|
} |
||||
|
.thumbnail a > img, |
||||
|
.thumbnail > img { |
||||
|
margin-right: auto; |
||||
|
margin-left: auto; |
||||
|
} |
||||
|
img { |
||||
|
vertical-align: middle; |
||||
|
} |
||||
|
/* .projects .thumbnail .caption { |
||||
|
overflow-y: hidden; |
||||
|
color: #555; |
||||
|
} */ |
||||
|
.caption { |
||||
|
padding: 9px; |
||||
|
overflow-y: hidden; |
||||
|
color: #555; |
||||
|
} |
||||
|
</style> |
||||
@ -0,0 +1,12 @@ |
|||||
|
using Microsoft.AspNetCore.Mvc.RazorPages; |
||||
|
|
||||
|
namespace CompanyName.ProjectName.Pages |
||||
|
{ |
||||
|
public class Monitor : PageModel |
||||
|
{ |
||||
|
public void OnGet() |
||||
|
{ |
||||
|
|
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,34 @@ |
|||||
|
namespace CompanyName.ProjectName |
||||
|
{ |
||||
|
public class ProjectNameHttpApiHostConsts |
||||
|
{ |
||||
|
/// <summary>
|
||||
|
/// 跨域策略名
|
||||
|
/// </summary>
|
||||
|
public const string DefaultCorsPolicyName = "Default"; |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Cookies名称
|
||||
|
/// </summary>
|
||||
|
public const string DefaultCookieName = "CompanyName.ProjectName.Http.Api"; |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// SwaggerUi 端点
|
||||
|
/// </summary>
|
||||
|
public const string SwaggerUiEndPoint = "/swagger"; |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Hangfire 端点
|
||||
|
/// </summary>
|
||||
|
public const string HangfireDashboardEndPoint = "/hangfire"; |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// CAP 端点
|
||||
|
/// </summary>
|
||||
|
public const string CapDashboardEndPoint = "/cap"; |
||||
|
|
||||
|
|
||||
|
public const string MoreEndPoint = "https://doc.cncore.club/"; |
||||
|
|
||||
|
} |
||||
|
} |
||||
|
After Width: | Height: | Size: 11 KiB |
|
After Width: | Height: | Size: 35 KiB |
|
After Width: | Height: | Size: 20 KiB |
|
After Width: | Height: | Size: 38 KiB |
|
After Width: | Height: | Size: 25 KiB |
Loading…
Reference in new issue