2026-01-06 10:55:05 +08:00
|
|
|
@page "/login"
|
|
|
|
|
@using wtmProject.ViewModel.HomeVMs
|
|
|
|
|
@inherits BasePage
|
|
|
|
|
<div class="d-flex flex-column app-layout-login ">
|
|
|
|
|
<div class="flex-fill login-layout app-login-back-1">
|
|
|
|
|
<marquee direction="left" behavior="scroll" scrollamount="5" loop="-1" scrolldelay="100" width="100%" height="50" hspace="0" vspace="100" style="color:#cda516;font-weight:bold;font-size:20px;" onMouseOut="this.start()" onMouseOver="this.stop()">
|
|
|
|
|
以客户为中心 专业高效 信赖共赢 尊重个体 持续成长
|
|
|
|
|
</marquee>
|
|
|
|
|
@* <header class="login-header">
|
|
|
|
|
|
|
|
|
|
</header>*@
|
|
|
|
|
<div class="login-content">
|
|
|
|
|
<div class="login-form">
|
|
|
|
|
<img src="/images/logo.png" alt="" height="48" style="position:absolute;top:10%;left:50%;transform:translate(-50%,-50%);height:auto;">
|
|
|
|
|
<h5 style="text-align:center;margin-top:20px;margin-bottom:10px;font-weight:bold;color:#0D6EFD;"> 客户管理系统</h5>
|
|
|
|
|
<ValidateForm Model="@Model" OnValidSubmit="@Submit">
|
|
|
|
|
<BootstrapInput PlaceHolder="请输入账号" TValue="string" ShowLabel="false" @oninput="@(val => OnInput(val))" />
|
|
|
|
|
<BootstrapInput PlaceHolder="请输入密码" TValue="string" type="password" @oninput="@(val => OnInput2(val))" />
|
|
|
|
|
@* <BootstrapInput @bind-Value="@Model.ITCode" />
|
|
|
|
|
<BootstrapInput @bind-Value="@Model.Password" type="password" />*@
|
|
|
|
|
@if (WtmBlazor?.ConfigInfo?.EnableTenant == true)
|
|
|
|
|
{
|
|
|
|
|
<BootstrapInput @bind-Value="@Model.Tenant" PlaceHolder="@WtmBlazor.Localizer["Login.InputTenant"]" />
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
<Button ButtonType="ButtonType.Submit" Text="@WtmBlazor.Localizer["Login.Login"]" style=" width:100%;margin-top:20px;" IsAsync="true">
|
|
|
|
|
@* <PulseButton></PulseButton>*@
|
|
|
|
|
</Button>
|
|
|
|
|
</ValidateForm>
|
|
|
|
|
</div>
|
|
|
|
|
<div style="position:absolute;top:90%;left:50%;transform:translate(-30%,-50%);height:auto;color:#4f897a">
|
|
|
|
|
<p>Copyright ©2024-2025 厦门鸣鹤管理咨询股份有限公司</p>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@code {
|
|
|
|
|
|
|
|
|
|
[Parameter]
|
|
|
|
|
public bool? LoginSuccess { get; set; }
|
|
|
|
|
[Parameter]
|
|
|
|
|
public EventCallback<bool?> LoginSuccessChanged { get; set; }
|
|
|
|
|
[Parameter]
|
|
|
|
|
public EventCallback OnUserInfoSet { get; set; }
|
|
|
|
|
|
|
|
|
|
private int bgnumber;
|
|
|
|
|
private LoginVM Model = new LoginVM();
|
|
|
|
|
protected override void OnInitialized()
|
|
|
|
|
{
|
|
|
|
|
//bgnumber = new Random().Next(1, 6);
|
|
|
|
|
if (WtmBlazor.ConfigInfo.IsQuickDebug == true)
|
|
|
|
|
{
|
|
|
|
|
Model.ITCode = "admin";
|
|
|
|
|
Model.Password = "000000";
|
|
|
|
|
}
|
|
|
|
|
base.OnInitialized();
|
|
|
|
|
}
|
|
|
|
|
private Task OnInput(ChangeEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
Model.ITCode = e.Value.ToString();
|
|
|
|
|
return Task.CompletedTask;
|
|
|
|
|
}
|
|
|
|
|
private Task OnInput2(ChangeEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
Model.Password = e.Value.ToString();
|
|
|
|
|
return Task.CompletedTask;
|
|
|
|
|
}
|
|
|
|
|
private async Task Submit(EditContext context)
|
|
|
|
|
{
|
|
|
|
|
var rv = await WtmBlazor.Api.CallAPI<DynamicData>("/api/_account/loginjwt", HttpMethodEnum.POST, new { Account = Model.ITCode, Password = Model.Password, Tenant = Model.Tenant });
|
|
|
|
|
if (rv.StatusCode == System.Net.HttpStatusCode.OK)
|
|
|
|
|
{
|
|
|
|
|
var token = rv.Data.Fields["access_token"].ToString();
|
|
|
|
|
var rtoken = rv.Data.Fields["refresh_token"].ToString();
|
|
|
|
|
await SetToken(token, rtoken);
|
|
|
|
|
var userinfo = await WtmBlazor.Api.CallAPI<LoginUserInfo>("/api/_account/checkuserinfo", HttpMethodEnum.GET, new { });
|
|
|
|
|
|
|
|
|
|
if (userinfo.StatusCode == System.Net.HttpStatusCode.OK)
|
|
|
|
|
{
|
|
|
|
|
await SetUserInfo(userinfo.Data);
|
|
|
|
|
await OnUserInfoSet.InvokeAsync();
|
|
|
|
|
await LoginSuccessChanged.InvokeAsync(true);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
await WtmBlazor.Toast.Error(WtmBlazor.Localizer["Sys.Error"], rv.Errors.Message[0]);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
await WtmBlazor.Toast.Error(WtmBlazor.Localizer["Sys.Error"], rv.Errors?.Message[0]);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|