Skip to content

Commit f884135

Browse files
committed
新增打赏功能 #14
1 parent 01cd842 commit f884135

File tree

4 files changed

+31
-5
lines changed

4 files changed

+31
-5
lines changed

src/Components/Pay.razor

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<MudDialog DefaultFocus="DefaultFocus.FirstChild">
2+
<DialogContent>
3+
<div class="d-flex flex-column mx-3 my-3">
4+
<MudChip T="string" Label="true">请使用微信扫一扫</MudChip>
5+
<MudImage Src="images/wxPay.jpg" Width="320" Height="320" Elevation="25" Class="mt-3 rounded-lg" />
6+
</div>
7+
</DialogContent>
8+
</MudDialog>

src/Shared/MainLayout.razor

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,32 +28,37 @@
2828
<MudSpacer />
2929

3030
<div class="d-flex" @onmouseup:stopPropagation="true" @onmousedown:stopPropagation="true">
31+
<MudTooltip Text="打赏" Delay="300">
32+
<MudIconButton Icon="@Icons.Material.Filled.Coffee"
33+
Size="Size.Medium"
34+
OnClick="OpenPayDialog" />
35+
</MudTooltip>
3136

3237
@if (AppSettings.AppThemeInt == 0)
3338
{
34-
<MudTooltip Text="浅色主题" Delay="600">
39+
<MudTooltip Text="浅色主题" Delay="300">
3540
<MudIconButton Icon="@Icons.Material.Filled.WbSunny"
3641
Size="Size.Medium"
3742
OnClick="ChangeTheme" />
3843
</MudTooltip>
3944
}
4045
else if (AppSettings.AppThemeInt == 1)
4146
{
42-
<MudTooltip Text="深色主题" Delay="600">
47+
<MudTooltip Text="深色主题" Delay="300">
4348
<MudIconButton Icon="@Icons.Material.Filled.DarkMode"
4449
Size="Size.Medium"
4550
OnClick="ChangeTheme" />
4651
</MudTooltip>
4752
}
4853
else
4954
{
50-
<MudTooltip Text="使用系统主题" Delay="600">
55+
<MudTooltip Text="使用系统主题" Delay="300">
5156
<MudIconButton Icon="@Icons.Material.Filled.AutoMode"
5257
Size="Size.Medium"
5358
OnClick="ChangeTheme" />
5459
</MudTooltip>
5560
}
56-
<MudTooltip Text="设置" Delay="600">
61+
<MudTooltip Text="设置" Delay="300">
5762
<MudIconButton Icon="@Icons.Material.Filled.Settings"
5863
Size="Size.Medium"
5964
OnClick="OpenSettingsDialog" />
@@ -65,5 +70,5 @@
6570
@Body
6671
</MudMainContent>
6772

68-
<Setting @ref="@_settings" />
73+
<Setting @ref="@_settings" />
6974
</MudLayout>

src/Shared/MainLayout.razor.cs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ public partial class MainLayout
1818
[Inject]
1919
private IStringLocalizer<Lang> Lang { get; set; } = default!;
2020

21+
[Inject]
22+
private IDialogService Dialog { get; set; } = default!;
2123
protected override async Task OnInitializedAsync()
2224
{
2325
await base.OnInitializedAsync();
@@ -107,4 +109,15 @@ private async Task OpenSettingsDialog()
107109
{
108110
await _settings.OpenAsync();
109111
}
112+
113+
private async Task OpenPayDialog()
114+
{
115+
var noHeader = new DialogOptions()
116+
{
117+
NoHeader = true,
118+
BackgroundClass = "dialog-blurry",
119+
CloseOnEscapeKey = false,
120+
};
121+
var dialog = await Dialog.ShowAsync<Pay>("", noHeader);
122+
}
110123
}

src/wwwroot/images/wxPay.jpg

82.7 KB
Loading

0 commit comments

Comments
 (0)