Skip to content

Commit

Permalink
注册验证邮箱时显示目标邮箱,分页组件响应主题更新,修复轮播图闪烁的bug
Browse files Browse the repository at this point in the history
  • Loading branch information
LittleFish-233 committed Sep 8, 2022
1 parent 0f2f4c6 commit 65d53b9
Show file tree
Hide file tree
Showing 12 changed files with 118 additions and 64 deletions.
Expand Up @@ -9,7 +9,7 @@

<ItemGroup>
<PackageReference Include="BootstrapBlazor" Version="6.6.2" />
<PackageReference Include="Masa.Blazor" Version="0.6.0-preview.4" />
<PackageReference Include="Masa.Blazor" Version="0.6.0-preview.5" />
<PackageReference Include="Microsoft.AspNetCore.Identity" Version="2.2.0" />
<PackageReference Include="Microsoft.Extensions.Identity.Stores" Version="6.0.4" />
<PackageReference Include="NodaTime" Version="3.1.0" />
Expand Down
Expand Up @@ -3,10 +3,10 @@

@if (_dataCacheService.IsApp)
{
<div class="shadow-sm rounded bg-opacity p-4 pt-3 pb-0 h-100" style=" display: flex; flex-direction: column; align-items: center;">
<div class="shadow-sm rounded bg-opacity p-2 pt-3 pb-0 h-100" style=" display: flex; flex-direction: column; align-items: center;">
<a href="@("/entries/index/" + Model.Infor.Id)" class="a-font-color">
<img class="w-100 mb-2" src="@Model.Infor.MainImage" style="border-radius: 50%;">
<div class="mb-1" style="text-align: center; word-break: break-all;">@Model.Infor.Name</div>
<img class="w-100 mb-2 ps-2 pe-2" src="@Model.Infor.MainImage" style="border-radius: 50%;">
<div class="mb-1 text-truncate-2" style="text-align: center; word-break: break-all;">@Model.Infor.Name</div>
</a>
<CnGalWebSite.Shared.MasaComponent.Shared.Components.MiniModeContainer>
@if (Model.Audio.Any())
Expand All @@ -26,7 +26,7 @@ else
<div class="shadow-sm rounded bg-opacity p-4 pb-0 h-100" style=" display: flex; flex-direction: column; align-items: center;">
<a href="@("/entries/index/" + Model.Infor.Id)" class="a-font-color">
<img class="w-100 mb-4" src="@Model.Infor.MainImage" style="border-radius: 50%;">
<div class="h5 fw-bold" style="text-align: center; word-break: break-all;">@Model.Infor.Name</div>
<div class="h5 fw-bold text-truncate-2" style="text-align: center; word-break: break-all;">@Model.Infor.Name</div>
</a>
<CnGalWebSite.Shared.MasaComponent.Shared.Components.MiniModeContainer>
@if (Model.Audio.Any())
Expand Down
Expand Up @@ -3,54 +3,57 @@
@inject HttpClient Http


@if (_dataCacheService.CVThematicPageCache != null)
{
<div class="row">
@if (_dataCacheService.CVThematicPageCache.News.Any() && _dataCacheService.IsApp == false)
{
<div class="@("col-12 mb-4 "+(_dataCacheService.CVThematicPageCache.Carousels.Any()?"col-lg-5":""))">
<CnGalWebSite.Shared.MasaComponent.PC.Home.ThematicPages.Cards.NewsCard Model="_dataCacheService.CVThematicPageCache.News" />
<div>
@if (_dataCacheService.CVThematicPageCache != null)
{
<div class="row">
@if (_dataCacheService.CVThematicPageCache.News.Any() && _dataCacheService.IsApp == false)
{
<div class="@("col-12 mb-4 "+(_dataCacheService.CVThematicPageCache.Carousels.Any()?"col-lg-5":""))">
<CnGalWebSite.Shared.MasaComponent.PC.Home.ThematicPages.Cards.NewsCard Model="_dataCacheService.CVThematicPageCache.News" />

</div>
}
@if (_dataCacheService.CVThematicPageCache.Carousels.Any())
{
<div class="@("col-12 mb-4 "+(_dataCacheService.CVThematicPageCache.News.Any()&&_dataCacheService.IsApp==false?"col-lg-7":""))">
<CnGalWebSite.Shared.MasaComponent.PC.Home.ThematicPages.Cards.CarouselCard Model="_dataCacheService.CVThematicPageCache.Carousels" />
</div>
}
<div class="col-12">
<CnGalWebSite.Shared.MasaComponent.PC.Home.ThematicPages.Cards.TagsCard Model="_dataCacheService.CVThematicPageCache" OnChanged="()=>OnChanged()" />
</div>
}
@if (_dataCacheService.CVThematicPageCache.Carousels.Any())
{
<div class="@("col-12 mb-4 "+(_dataCacheService.CVThematicPageCache.News.Any()&&_dataCacheService.IsApp==false?"col-lg-7":""))">
<CnGalWebSite.Shared.MasaComponent.PC.Home.ThematicPages.Cards.CarouselCard Model="_dataCacheService.CVThematicPageCache.Carousels" />
<div class="col-12">
<CnGalWebSite.Shared.MasaComponent.PC.Home.ThematicPages.Cards.SearchCard OnChanged="()=>OnChanged()" />
</div>
}
<div class="col-12">
<CnGalWebSite.Shared.MasaComponent.PC.Home.ThematicPages.Cards.TagsCard Model="_dataCacheService.CVThematicPageCache" OnChanged="()=>OnChanged()" />
</div>
<div class="col-12">
<CnGalWebSite.Shared.MasaComponent.PC.Home.ThematicPages.Cards.SearchCard OnChanged="()=>OnChanged()" />
</div>

@foreach (var item in Model.Skip((_dataCacheService.CVThematicPageCache.CurrentPage - 1) * MaxCount).Take(MaxCount))
{
@foreach (var item in Model.Skip((_dataCacheService.CVThematicPageCache.CurrentPage - 1) * MaxCount).Take(MaxCount))
{

<div class="col-4 col-lg-3 col-xxl-2 mb-4">
<CnGalWebSite.Shared.MasaComponent.PC.Home.ThematicPages.Cards.CVInforCard Model="item" />
</div>
}
<div class="col-4 col-lg-3 col-xxl-2 mb-4">
<CnGalWebSite.Shared.MasaComponent.PC.Home.ThematicPages.Cards.CVInforCard Model="item" />
</div>
}


</div>
@if (TotalPages > 1)
{
<div class="col-12">
<MPagination Value="@_dataCacheService.CVThematicPageCache.CurrentPage" Class="my-4" Length="@TotalPages" ValueChanged="OnPageClick" Color="@_dataCacheService.ThemeSetting.Theme"></MPagination>

</div>
<CnGalWebSite.Shared.MasaComponent.Shared.Components.MasaPagination Value="@_dataCacheService.CVThematicPageCache.CurrentPage" Length="@TotalPages" ValueChanged="OnPageClick" />


}

</div>
}
else
{
<div style="height:300px">
<CnGalWebSite.Shared.AppComponent.Normal.Loading.LoadingTip Height="100%" />
</div>
}
}
else
{
<div style="height:300px">
<CnGalWebSite.Shared.AppComponent.Normal.Loading.LoadingTip Height="100%" />
</div>
}

</div>


@code {
Expand Down Expand Up @@ -131,7 +134,7 @@ else
}

//搜索
if(string.IsNullOrWhiteSpace(_dataCacheService.CVThematicPageCache.SearchString)==false)
if (string.IsNullOrWhiteSpace(_dataCacheService.CVThematicPageCache.SearchString) == false)
{
Model.RemoveAll(s => s.Infor.Name.ToUpper().Contains(_dataCacheService.CVThematicPageCache.SearchString.ToUpper()) == false && _dataCacheService.CVThematicPageCache.SearchString.ToUpper().Contains(s.Infor.Name.ToUpper()) == false);
}
Expand All @@ -140,7 +143,7 @@ else
Model = _dataCacheService.CVThematicPageCache.SortType switch
{
CVThematicPageSortType.Random => Model.Random(),
CVThematicPageSortType.None => Model.OrderByDescending(s => s.LastUploadAudioTime).ThenBy(s=>s.Infor.MainImage).ToList(),
CVThematicPageSortType.None => Model.OrderByDescending(s => s.LastUploadAudioTime).ThenBy(s => s.Infor.MainImage).ToList(),
CVThematicPageSortType.ReadCount => Model.OrderByDescending(s => s.Infor.ReaderCount).ToList(),
CVThematicPageSortType.WorkCount => Model.OrderByDescending(s => s.WorkCount).ToList(),
CVThematicPageSortType.RecentlyPublish => Model.OrderByDescending(s => s.LastPublishTime).ToList(),
Expand Down
@@ -1,22 +1,20 @@
<MCarousel Cycle Height="@("inherit")"
HideDelimiterBackground
Interval="4000"
HideDelimiters="HideDelimiters"
ShowArrowsOnHover>
@foreach(var item in Model.OrderByDescending(s=>s.Priority))
{

<MCarouselItem>
<MResponsive AspectRatio="AspectRatio">
<a href="@item.Link" target="_blank" style="width: 100%;" @onclick="@(()=>OnClick.InvokeAsync(item))">
<img src="@item.Image" alt="@item.Note" style="width: 100%;" />
</a>
</MResponsive>
</MCarouselItem>
}

<MResponsive AspectRatio="AspectRatio">
<MCarousel Cycle Height="@("inherit")"
HideDelimiterBackground
Interval="4000"
HideDelimiters="HideDelimiters"
ShowArrowsOnHover>
@foreach (var item in Model.OrderByDescending(s => s.Priority))
{

</MCarousel>
<MCarouselItem Src="@item.Image" Href="@item.Link">

</MCarouselItem>
}

</MCarousel>
</MResponsive>
@code {
[Parameter]
public List<CarouselViewModel> Model { get; set; }
Expand Down
@@ -0,0 +1,46 @@
@inject IDataCacheService _dataCacheService
@implements IDisposable


@if (TotalPages > 1)
{

<MPagination Value="@Value" Class="my-4" Length="@TotalPages" ValueChanged="OnPageClick" Color="@_dataCacheService.ThemeSetting.Theme"></MPagination>
}
@code {
[Parameter]
public int Length { get; set; }
[Parameter]
public int Value { get; set; }
[Parameter]
public EventCallback<int> ValueChanged { get; set; }

private async Task OnPageClick(int pageIndex)
{
await ValueChanged.InvokeAsync(pageIndex);
}


protected override async Task OnInitializedAsync()
{

_dataCacheService.RefreshRequsted += RefreshRequsted;

}

public async void RefreshRequsted(object sender, EventArgs args)
{
await InvokeAsync(StateHasChanged);

}
#region 释放实例

public void Dispose()
{

_dataCacheService.RefreshRequsted -= RefreshRequsted;

GC.SuppressFinalize(this);
}
#endregion
}
Expand Up @@ -37,7 +37,7 @@
</div>
@if (_dataCacheService.NewsSummaryCache.TotalPages > 1)
{
<MPagination Value="@_dataCacheService.NewsSummaryCache.CurrentPage" Class="my-4" Length="@_dataCacheService.NewsSummaryCache.TotalPages" ValueChanged="OnPageClick" Color="@_dataCacheService.ThemeSetting.Theme" TotalVisible="7"></MPagination>
<CnGalWebSite.Shared.MasaComponent.Shared.Components.MasaPagination Value="@_dataCacheService.NewsSummaryCache.CurrentPage" Length="@_dataCacheService.NewsSummaryCache.TotalPages" ValueChanged="OnPageClick"/>
}

}
Expand Down
Expand Up @@ -13,7 +13,7 @@
<CnGalWebSite.Shared.MasaComponent.Shared.Tips.LoginPagesRoot>
<div class="p-3">
<h1 class=" login-h1-text mb-3 text-center">验证电子邮箱</h1>
<span class="mb-4" style=" font-size: initial;">我们已经向你的电子邮箱发送了一封验证邮件,请在下方填写其中的验证码。如果没有在收件箱找到邮件,请检查垃圾箱</span>
<span class="mb-4" style=" font-size: initial;">我们已经向 <strong>@_dataCacheService.UserEmail</strong> 发送了一封验证邮件,请在下方填写其中的验证码。如果没有在收件箱找到邮件,请检查垃圾箱</span>
<div class="form-group mt-4 mb-0">

<div class="row">
Expand Down
Expand Up @@ -123,6 +123,7 @@
if (result.Successful)
{
_dataCacheService.UserName = Model.Name;
_dataCacheService.UserEmail = Model.Email;
NavigationManager.NavigateTo("/account/ConfirmEmailRegister/" + ReturnUrl);
}
else
Expand Down
Expand Up @@ -69,7 +69,7 @@

@if (DataModel.pagedResultDto.TotalPages > 1)
{
<MPagination Value="@DataModel.pagedResultDto.CurrentPage" Class="my-4" Length="@DataModel.pagedResultDto.TotalPages" ValueChanged="OnPageClick" Color="@_dataCacheService.ThemeSetting.Theme" ></MPagination>
<CnGalWebSite.Shared.MasaComponent.Shared.Components.MasaPagination Value="@DataModel.pagedResultDto.CurrentPage" Length="@DataModel.pagedResultDto.TotalPages" ValueChanged="OnPageClick"/>

}

Expand Down
Expand Up @@ -49,7 +49,7 @@

@if (_dataCacheService.NewsSummaryCache.TotalPages > 1)
{
<MPagination Value="@_dataCacheService.NewsSummaryCache.CurrentPage" Class="my-4" Length="@_dataCacheService.NewsSummaryCache.TotalPages" ValueChanged="OnPageClick" Color="@_dataCacheService.ThemeSetting.Theme" ></MPagination>
<CnGalWebSite.Shared.MasaComponent.Shared.Components.MasaPagination Value="@_dataCacheService.NewsSummaryCache.CurrentPage" Length="@_dataCacheService.NewsSummaryCache.TotalPages" ValueChanged="OnPageClick"/>
}
}
}
Expand Down
4 changes: 4 additions & 0 deletions CnGalWebSite/CnGalWebSite.Shared/Service/DataCatcheService.cs
Expand Up @@ -92,6 +92,10 @@ public class DataCatcheService : IDataCacheService
/// 历史用户临时储存用户名
/// </summary>
public string UserName { get; set; } = string.Empty;
/// <summary>
/// 历史用户临时储存电子邮箱
/// </summary>
public string UserEmail { get; set; } = string.Empty;
/// <summary>
/// 是否正在使用第三方登入
/// </summary>
Expand Down
2 changes: 2 additions & 0 deletions CnGalWebSite/CnGalWebSite.Shared/Service/IDataCacheService.cs
Expand Up @@ -59,6 +59,8 @@ public interface IDataCacheService

string UserName { get; set; }

string UserEmail { get; set; }

bool IsOnThirdPartyLogin { get; set; }

UserAuthenticationTypeModel UserAuthenticationTypeModel { get; set; }
Expand Down

0 comments on commit 65d53b9

Please sign in to comment.