Skip to content

Commit

Permalink
修复周年庆页面库存统计时错误地展示steam用户的bug
Browse files Browse the repository at this point in the history
  • Loading branch information
LittleFish-233 committed Jul 3, 2023
1 parent 3ffe13c commit ed5e9a1
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 35 deletions.
Expand Up @@ -15,13 +15,13 @@
<div class="rounded shadow-sm bg-opacity mb-4">
<div style="display: flex; justify-content: space-around; flex-wrap: wrap; " class="pt-4">

<div class="ps-4 pe-4" style=" display: flex; max-width: 400px; width: 100%; align-items: center;">
<div class="ps-4 pe-4" style="@((_dataCacheService.IsApp?" max-width: 400px;":" max-width: 200px;")+" display: flex; width: 100%; align-items: center;")">
<MTextField Placeholder="可以搜索哦~" TValue="string" Value="@_dataCacheService.ThemeSetting.AnniversariesSetting.PlayedGameSetting.SearchString" ValueChanged="SearchValueChanged" OnKeyDown="OnKeyDown" Class="pt-0"></MTextField>
</div>
<div class="ps-4 pe-4" style="max-width: 400px; width: 100%;">
<div class="ps-4 pe-4" style="@((_dataCacheService.IsApp?" max-width: 400px;":" max-width: 200px;")+" width: 100%;")">
<CnGalWebSite.Shared.MasaComponent.Shared.Components.MasaSelecte Value="_dataCacheService.ThemeSetting.AnniversariesSetting.PlayedGameSetting.SortType" ValueChanged="SortValueChanged" TValue="PlayedGamesSortType" Class="pt-0" />
</div>
<div class="ps-4 pe-4" style="max-width: 400px; width: 100%;">
<div class="ps-4 pe-4" style="@((_dataCacheService.IsApp?" max-width: 400px;":" max-width: 200px;")+" width: 100%;")">
<CnGalWebSite.Shared.MasaComponent.Shared.Components.MasaSelecte Value="_dataCacheService.ThemeSetting.AnniversariesSetting.PlayedGameSetting.DisplayType" ValueChanged="DisplayValueChanged" TValue="PlayedGamesDisplayType" Class="pt-0" />
</div>
@*@if (IsAnniversary)
Expand Down
@@ -1,36 +1,32 @@

@inject IEventService _eventService

@if (IsAnniversary)
{
foreach (var item in SteamUserInfors)
{
<a href="@("https://steamcommunity.com/profiles/"+item.SteamId)" rel="noreferrer" class="a-font-color" target="_blank">
<a @onclick="OnClick" class="a-font-color">

<div class="a-font-color shadow-sm rounded bg-opacity p-3 mb-4 user-steam-card">
<div class="user-info">
<img src="@item.Image" alt="@item.Name" class="image" />
<div class="name"> @item.Name</div>
</div>
<div class="goal">
<div class="value">@(GameRecords.Count)</div>
<div class="key">总库存</div>
</div>
<div class="goal">
<div class="value">@((GameRecords.Count*100.0/ TotalCount).ToString("0.0")+" %")</div>
<div class="key">@($"收集率(站内总计 {TotalCount})")</div>
</div>
<div class="goal">
<div class="value">@((GameRecords.Sum(s=>s.PlayDuration)/60.0).ToString("0.0")+" h")</div>
<div class="key">总时长</div>
</div>
<div class="goal">
<div class="value">@(item.Price.ToString("0")+ " ¥")</div>
<div class="key">总价格</div>
</div>
<div class="a-font-color shadow-sm rounded bg-opacity p-3 mb-4 user-steam-card">
<div class="user-info">
<img src="@UserInfoModel.BasicInfor.PhotoPath" alt="@UserInfoModel.BasicInfor.Name" class="image" />
<div class="name"> @UserInfoModel.BasicInfor.Name</div>
</div>
</a>
}

<div class="goal">
<div class="value">@(GameRecords.Count)</div>
<div class="key">总库存</div>
</div>
<div class="goal">
<div class="value">@((GameRecords.Count*100.0/ TotalCount).ToString("0.0")+" %")</div>
<div class="key">@($"收集率(站内总计 {TotalCount})")</div>
</div>
<div class="goal">
<div class="value">@((GameRecords.Sum(s=>s.PlayDuration)/60.0).ToString("0.0")+" h")</div>
<div class="key">总时长</div>
</div>
<div class="goal">
<div class="value">@(SteamUserInfors.Sum(s=>s.Price).ToString("0")+ " ¥")</div>
<div class="key">总价格</div>
</div>
</div>
</a>
}
else
{
Expand Down Expand Up @@ -160,10 +156,19 @@ else
public bool IsAnniversary { get; set; }
[Parameter]
public int TotalCount { get; set; }

[Parameter]
public PersonalSpaceViewModel UserInfoModel { get; set; }


[CascadingParameter]
public ErrorHandler ErrorHandler { get; set; }

public async Task OnClick()
{
foreach (var item in SteamUserInfors)
{
await _eventService.OpenNewPage("https://steamcommunity.com/profiles/" + item.SteamId);
}
}

}
Expand Up @@ -7,7 +7,7 @@
@inject IEventService _eventService

<div>
<CnGalWebSite.Shared.MasaComponent.Shared.Components.MasaTitleContainer Title="@(IsAnniversary?"我的游戏库":"游玩记录")" Icon="@IconType.Steam.ToIconString()" Class="mb-4" Outline>
<CnGalWebSite.Shared.MasaComponent.Shared.Components.MasaTitleContainer Title="@(IsAnniversary?"我的游戏库":"游玩记录")" Icon="@((IsAnniversary?IconType.GameRecord: IconType.Steam).ToIconString())" Class="mb-4" Outline>
<ButtonContent>
@if (IsCurrentUser)
{
Expand All @@ -30,7 +30,7 @@
</CnGalWebSite.Shared.MasaComponent.Shared.Components.MasaTitleContainer>
@if (isReady)
{
<CnGalWebSite.Shared.Component.PlayedGames.SteamUserInforCard GameRecords="GameRecords" SteamUserInfors="SteamUserInfors" IsAnniversary="IsAnniversary" TotalCount="TotalCount" />
<CnGalWebSite.Shared.Component.PlayedGames.SteamUserInforCard GameRecords="GameRecords" SteamUserInfors="SteamUserInfors" IsAnniversary="IsAnniversary" TotalCount="TotalCount" UserInfoModel="UserInfoModel"/>
@if (GameRecords.Count == 0)
{
<div class="mb-3">
Expand Down Expand Up @@ -61,6 +61,9 @@
public bool IsAnniversary { get; set; }
[Parameter]
public int TotalCount { get; set; }
[Parameter]
public PersonalSpaceViewModel UserInfoModel { get; set; }

[CascadingParameter]
public ErrorHandler ErrorHandler { get; set; }

Expand Down
Expand Up @@ -19,7 +19,7 @@
{
<div id="game-library-card">

<UserPlayedGameListView IsCurrentUser="true" SteamId="@Model.SteamId" UserId="@Model.Id" IsAnniversary TotalCount="OverviewModel.Count" />
<UserPlayedGameListView IsCurrentUser="true" SteamId="@Model.SteamId" UserId="@Model.Id" IsAnniversary TotalCount="OverviewModel.Count" UserInfoModel="Model"/>

</div>
}
Expand Down

0 comments on commit ed5e9a1

Please sign in to comment.