Skip to content

Commit

Permalink
修复server端无法登入的bug,修改消息提示样式
Browse files Browse the repository at this point in the history
  • Loading branch information
LittleFish-233 committed Aug 22, 2023
1 parent 7e14444 commit 9a4fa4e
Show file tree
Hide file tree
Showing 8 changed files with 63 additions and 39 deletions.
2 changes: 1 addition & 1 deletion CnGalWebSite/CnGalWebSite.Helper/Helper/ToolHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public static class ToolHelper
//public static string WebApiPath = "http://172.17.0.1:2001/";
public static string WebApiPath = "https://api.cngal.org/";

public static bool? PreSetIsSSR = false; //=> WebApiPath == "http://172.17.0.1:2001/";
public static bool? PreSetIsSSR = null; //=> WebApiPath == "http://172.17.0.1:2001/";
public static bool IsSSR = true; //=> WebApiPath == "http://172.17.0.1:2001/";

public static string ImageApiPath = "https://api.cngal.top/";
Expand Down
37 changes: 27 additions & 10 deletions CnGalWebSite/CnGalWebSite.Server/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
using CnGalWebSite.Shared.Extentions;
using CnGalWebSite.Shared.Service;
using IdentityModel.AspNetCore.AccessTokenManagement;
using Masa.Blazor.Presets;
using Masa.Blazor;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Components.Authorization;
using Microsoft.AspNetCore.Diagnostics.HealthChecks;
Expand Down Expand Up @@ -92,18 +94,33 @@ public void ConfigureServices(IServiceCollection services)
.AddScoped(typeof(IPageModelCatche<>), typeof(PageModelCatche<>))
.AddScoped<IDataCacheService, DataCatcheService>()
.AddScoped(x => new ImagesLargeViewService())
.AddMasaBlazor(s => s.ConfigureTheme(s =>
{
if(DateTime.Now.ToCstTime().Day==1&& DateTime.Now.ToCstTime().Month == 4)
.AddMasaBlazor(options => {
//消息队列
options.Defaults = new Dictionary<string, IDictionary<string, object?>?>()
{
s.Themes.Light.Primary = "#4CAF50";
}
else
{
PopupComponents.SNACKBAR, new Dictionary<string, object?>()
{
{ nameof(PEnqueuedSnackbars.Outlined), true },
{ nameof(PEnqueuedSnackbars.Closeable), true },
{ nameof(PEnqueuedSnackbars.Position), SnackPosition.BottomRight }
}
}
};
//主题
options.ConfigureTheme(s =>
{
s.Themes.Light.Primary = "#f06292";
}
s.Themes.Dark.Primary = "#0078BF";
}));
if (DateTime.Now.ToCstTime().Day == 1 && DateTime.Now.ToCstTime().Month == 4)
{
s.Themes.Light.Primary = "#4CAF50";
}
else
{
s.Themes.Light.Primary = "#f06292";
}
s.Themes.Dark.Primary = "#0078BF";
});
});

//添加状态检查
services.AddHealthChecks();
Expand Down
12 changes: 10 additions & 2 deletions CnGalWebSite/CnGalWebSite.Server/wwwroot/css/cover-default.css
Original file line number Diff line number Diff line change
Expand Up @@ -343,6 +343,14 @@ input.te-image-file-input {
color: var(--main-color);
}
/*步骤条*/
.m-stepper__wrapper.active{
height:auto !important;
.m-stepper__wrapper.active {
height: auto !important;
}
/*Toast*/
.m-enqueued-snackbars .error {
height: unset !important;
}

.m-snack__content > div {
white-space: pre-line;
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
@inject NavigationManager NavigationManager
@inject IDataCacheService _dataCacheService
@inject IEventService _eventService
@inject IPopupService PopupService

<MDialog @bind-Value="Dialog"
MaxWidth="550">
Expand Down Expand Up @@ -79,8 +80,6 @@
</MCardActions>
</MCard>
</MDialog>
<PEnqueuedSnackbars @ref="_toast" MaxCount="3">
</PEnqueuedSnackbars>
<CnGalWebSite.Shared.MasaComponent.Shared.Components.DeviceIdentification @ref="deviceIdentification" />

@code {
Expand All @@ -89,7 +88,6 @@
public EventCallback OnChanged { get; set; }

public int Id { get; set; }
PEnqueuedSnackbars _toast;

public GameRecordViewModel ViewModel { get; set; }

Expand Down Expand Up @@ -143,7 +141,7 @@
{
if (Model.ScriptSocre + Model.MusicSocre + Model.PaintSocre + Model.ShowSocre + Model.TotalSocre + Model.SystemSocre + Model.CVSocre != 0)
{
_toast.EnqueueSnackbar(new SnackbarOptions
await PopupService.EnqueueSnackbarAsync(new SnackbarOptions
{
Type = AlertTypes.Error,
Title = "请填写所有项目的评分",
Expand All @@ -160,7 +158,7 @@
if (_dataCacheService.ThemeSetting.PlayedGameInforCount >= 0)
{

_toast.EnqueueSnackbar(new SnackbarOptions
await PopupService.EnqueueSnackbarAsync(new SnackbarOptions
{
Type = AlertTypes.Info,
Title = "提示",
Expand All @@ -186,7 +184,7 @@
//判断结果
if (obj.Successful == false)
{
_toast.EnqueueSnackbar(new SnackbarOptions
await PopupService.EnqueueSnackbarAsync(new SnackbarOptions
{
Type = AlertTypes.Error,
Title = obj.Error ?? "编辑游玩记录失败~",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
@inject IServiceProvider Provider
@inject NavigationManager NavigationManager
@inject IPopupService PopupService

<div class="shadow-sm rounded ps-4 pe-4 pt-3 pb-3 mb-3 bg-opacity">
<div style="display: flex; flex-direction: column;">
Expand All @@ -20,17 +21,17 @@
<div class="col-12 p-0 pt-2" style="display: flex; justify-content: flex-end;">
@if (string.IsNullOrWhiteSpace(Model.Link) == false)
{
<CnGalWebSite.Shared.MasaComponent.Shared.Components.MasaButton Text="查看" OnClick="@(()=>NavigationManager.NavigateTo(Model.Link))" XSmall/>
<CnGalWebSite.Shared.MasaComponent.Shared.Components.MasaButton Text="查看" OnClick="@(()=>NavigationManager.NavigateTo(Model.Link))" XSmall />
}
@if (CommentId != 0)
{
@if (IsReplying)
{
<CnGalWebSite.Shared.MasaComponent.Shared.Components.MasaButton Text="取消回复" OnClick="OnUnReplyClick" XSmall Class="ms-3" />
<CnGalWebSite.Shared.MasaComponent.Shared.Components.MasaButton Text="取消回复" OnClick="OnUnReplyClick" XSmall Class="ms-3" />
}
else
{
<CnGalWebSite.Shared.MasaComponent.Shared.Components.MasaButton Text="回复" OnClick="OnReplyClick" XSmall Class="ms-3" />
<CnGalWebSite.Shared.MasaComponent.Shared.Components.MasaButton Text="回复" OnClick="OnReplyClick" XSmall Class="ms-3" />
}
}

Expand All @@ -41,8 +42,6 @@
}
</div>
</div>
<PEnqueuedSnackbars @ref="_toast" MaxCount="3">
</PEnqueuedSnackbars>

@code {
[Parameter]
Expand All @@ -52,7 +51,6 @@
public long CommentId { get; set; }

private bool IsReplying { get; set; }
PEnqueuedSnackbars _toast;

public void OnReplyClick()
{
Expand All @@ -66,11 +64,11 @@
StateHasChanged();
}

public void OnRely()
public async Task OnRely()
{
IsReplying = false;
StateHasChanged();
_toast?.EnqueueSnackbar(new SnackbarOptions
await PopupService.EnqueueSnackbarAsync(new SnackbarOptions
{
Type = AlertTypes.Success,
Title = "回复成功",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
@if (isReady)
@inject IPopupService PopupService

@if (isReady)
{
<div class="@(Outline?"":"rounded shadow-sm bg-opacity h-100")">
@if (Model.UserScores.Any(s => s.Socres.IsScored))
Expand Down Expand Up @@ -30,8 +32,6 @@
</div>
}

<PEnqueuedSnackbars @ref="_toast" MaxCount="3">
</PEnqueuedSnackbars>


@code {
Expand All @@ -40,7 +40,6 @@

[Parameter]
public PlayedGameOverviewModel Model { get; set; }
PEnqueuedSnackbars _toast;

EChartsOptionModel model = new EChartsOptionModel();

Expand Down Expand Up @@ -108,7 +107,7 @@


series.AddRange(new List<double>
{
{
data.Count(s=>s==1),
data.Count(s=>s==2),
data.Count(s=>s==3),
Expand All @@ -135,7 +134,7 @@
{
if (Model.IsDubbing == false && _type == PlayedGameScoreType.CV)
{
_toast.EnqueueSnackbar(new SnackbarOptions
await PopupService.EnqueueSnackbarAsync(new SnackbarOptions
{
Type = AlertTypes.Error,
Title = "这个游戏没有配音哦~",
Expand Down
14 changes: 9 additions & 5 deletions CnGalWebSite/CnGalWebSite.Shared/Shared/PCLayout.razor
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
@inject NavigationManager NavigationManager
@inject IDataCacheService _dataCacheService
@inject IJSRuntime JS
@inject IPopupService PopupService

<MAppBar App Class="shadow-sm bg-opacity">
<div style=" word-break: keep-all;" class="ms-4 me-8">
Expand All @@ -27,11 +28,11 @@
</MAppBar>

<MMain>
<CnGalWebSite.Shared.MasaComponent.Shared.Components.MasaContainer>
<ErrorHandler>
@Body
</ErrorHandler>
</CnGalWebSite.Shared.MasaComponent.Shared.Components.MasaContainer>
<CnGalWebSite.Shared.MasaComponent.Shared.Components.MasaContainer>
<ErrorHandler>
@Body
</ErrorHandler>
</CnGalWebSite.Shared.MasaComponent.Shared.Components.MasaContainer>
</MMain>

<MFooter App Padless Absolute Class="shadow-sm bg-opacity">
Expand All @@ -51,5 +52,8 @@
await Task.Delay(500);
}
await JS.InvokeAsync<string>("navigateTo", url);

throw new Exception("测试");

}
}

0 comments on commit 9a4fa4e

Please sign in to comment.