committed by
GitHub
25 changed files with 1267 additions and 487 deletions
@ -1,7 +1,21 @@ |
|||||
@page "/authentication/{action}" |
@page "/authentication/{action}" |
||||
@using Microsoft.AspNetCore.Components.WebAssembly.Authentication |
@using Microsoft.AspNetCore.Components.WebAssembly.Authentication |
||||
<RemoteAuthenticatorView Action="@Action" /> |
@using Volo.Abp.AspNetCore.Components.Web.Security |
||||
|
@using Volo.Abp.AspNetCore.Components.WebAssembly |
||||
|
<RemoteAuthenticatorView Action="@Action" OnLogInSucceeded="OnLogInSucceeded" OnLogOutSucceeded="OnLogOutSucceeded" /> |
||||
|
@inject WebAssemblyCachedApplicationConfigurationClient WebAssemblyCachedApplicationConfigurationClient |
||||
|
|
||||
@code{ |
@code{ |
||||
[Parameter] public string Action { get; set; } |
[Parameter] public string Action { get; set; } |
||||
|
|
||||
|
|
||||
|
private async Task OnLogInSucceeded(RemoteAuthenticationState state) |
||||
|
{ |
||||
|
await WebAssemblyCachedApplicationConfigurationClient.InitializeAsync(); |
||||
|
} |
||||
|
|
||||
|
private async Task OnLogOutSucceeded(RemoteAuthenticationState state) |
||||
|
{ |
||||
|
await WebAssemblyCachedApplicationConfigurationClient.InitializeAsync(); |
||||
|
} |
||||
} |
} |
||||
|
|||||
@ -0,0 +1,20 @@ |
|||||
|
@using Volo.Abp.SettingManagement.Localization |
||||
|
@inherits Volo.Abp.AspNetCore.Components.AbpComponentBase |
||||
|
@inject AbpBlazorMessageLocalizerHelper<AbpSettingManagementResource> LH |
||||
|
|
||||
|
<Form Layout="@FormLayout.Vertical" Model="@TimezoneSettings"> |
||||
|
|
||||
|
<FormItem Label="@L["DisplayName:Timezone"]"> |
||||
|
<Select DataSource="@context.TimeZoneItems" |
||||
|
ValueName="@nameof(Volo.Abp.NameValue.Value)" |
||||
|
LabelName="@nameof(Volo.Abp.NameValue.Name)" |
||||
|
@bind-Value="@context.Timezone"> |
||||
|
</Select> |
||||
|
</FormItem> |
||||
|
|
||||
|
<FormItem WrapperColOffset="8"> |
||||
|
<Button Type="@ButtonType.Primary" HtmlType="submit" OnClick="@UpdateSettingsAsync"> |
||||
|
@L["Submit"] |
||||
|
</Button> |
||||
|
</FormItem> |
||||
|
</Form> |
||||
@ -0,0 +1,61 @@ |
|||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.Threading.Tasks; |
||||
|
using Microsoft.AspNetCore.Components; |
||||
|
using Volo.Abp; |
||||
|
using Volo.Abp.AspNetCore.Components.Web.Configuration; |
||||
|
using Volo.Abp.SettingManagement; |
||||
|
using Volo.Abp.SettingManagement.Localization; |
||||
|
|
||||
|
namespace Lsw.Abp.SettingManagement.Blazor.AntDesignUI.Pages.SettingManagement.TimeZoneSettingGroup; |
||||
|
|
||||
|
public partial class TimeZoneSettingGroupViewComponent |
||||
|
{ |
||||
|
[Inject] |
||||
|
protected ITimeZoneSettingsAppService TimeZoneSettingsAppService { get; set; } |
||||
|
|
||||
|
[Inject] |
||||
|
protected ICurrentApplicationConfigurationCacheResetService CurrentApplicationConfigurationCacheResetService { get; set; } |
||||
|
|
||||
|
protected UpdateTimezoneSettingsViewModel TimezoneSettings = new(); |
||||
|
|
||||
|
public TimeZoneSettingGroupViewComponent() |
||||
|
{ |
||||
|
ObjectMapperContext = typeof(AbpSettingManagementBlazorAntDesignModule); |
||||
|
LocalizationResource = typeof(AbpSettingManagementResource); |
||||
|
} |
||||
|
|
||||
|
protected override async Task OnInitializedAsync() |
||||
|
{ |
||||
|
try |
||||
|
{ |
||||
|
TimezoneSettings.Timezone = await TimeZoneSettingsAppService.GetAsync(); |
||||
|
TimezoneSettings.TimeZoneItems = await TimeZoneSettingsAppService.GetTimezonesAsync(); |
||||
|
} |
||||
|
catch (Exception ex) |
||||
|
{ |
||||
|
await HandleErrorAsync(ex); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
protected virtual async Task UpdateSettingsAsync() |
||||
|
{ |
||||
|
try |
||||
|
{ |
||||
|
await TimeZoneSettingsAppService.UpdateAsync(TimezoneSettings.Timezone); |
||||
|
await CurrentApplicationConfigurationCacheResetService.ResetAsync(); |
||||
|
await Message.Success(L["SuccessfullySaved"]); |
||||
|
} |
||||
|
catch (Exception ex) |
||||
|
{ |
||||
|
await HandleErrorAsync(ex); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
public class UpdateTimezoneSettingsViewModel |
||||
|
{ |
||||
|
public string Timezone { get; set; } |
||||
|
|
||||
|
public List<NameValue> TimeZoneItems { get; set; } |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,38 @@ |
|||||
|
using System.Threading.Tasks; |
||||
|
using Lsw.Abp.SettingManagement.Blazor.AntDesignUI.Pages.SettingManagement.TimeZoneSettingGroup; |
||||
|
using Microsoft.AspNetCore.Authorization; |
||||
|
using Microsoft.Extensions.DependencyInjection; |
||||
|
using Microsoft.Extensions.Localization; |
||||
|
using Volo.Abp.SettingManagement; |
||||
|
using Volo.Abp.SettingManagement.Blazor; |
||||
|
using Volo.Abp.SettingManagement.Localization; |
||||
|
using Volo.Abp.Timing; |
||||
|
|
||||
|
namespace Lsw.Abp.SettingManagement.Blazor.AntDesignUI.Settings; |
||||
|
|
||||
|
public class AntDesignTimeZonePageContributor : ISettingComponentContributor |
||||
|
{ |
||||
|
public virtual async Task<bool> CheckPermissionsAsync(SettingComponentCreationContext context) |
||||
|
{ |
||||
|
var authorizationService = context.ServiceProvider.GetRequiredService<IAuthorizationService>(); |
||||
|
|
||||
|
return await authorizationService.IsGrantedAsync(SettingManagementPermissions.TimeZone); |
||||
|
} |
||||
|
|
||||
|
public virtual Task ConfigureAsync(SettingComponentCreationContext context) |
||||
|
{ |
||||
|
var l = context.ServiceProvider.GetRequiredService<IStringLocalizer<AbpSettingManagementResource>>(); |
||||
|
if (context.ServiceProvider.GetRequiredService<IClock>().SupportsMultipleTimezone) |
||||
|
{ |
||||
|
context.Groups.Add( |
||||
|
new SettingComponentGroup( |
||||
|
"Volo.Abp.TimeZone", |
||||
|
l["Menu:TimeZone"], |
||||
|
typeof(TimeZoneSettingGroupViewComponent) |
||||
|
) |
||||
|
); |
||||
|
} |
||||
|
|
||||
|
return Task.CompletedTask; |
||||
|
} |
||||
|
} |
||||
File diff suppressed because it is too large
File diff suppressed because one or more lines are too long
@ -0,0 +1,10 @@ |
|||||
|
{ |
||||
|
"profiles": { |
||||
|
"BookStore.DbMigrator": { |
||||
|
"commandName": "Project", |
||||
|
"environmentVariables": { |
||||
|
"DOTNET_ENVIRONMENT": "Development" |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,7 @@ |
|||||
|
namespace BookStore.Identity; |
||||
|
|
||||
|
public enum IdentityUserType |
||||
|
{ |
||||
|
Normal, |
||||
|
Basic |
||||
|
} |
||||
@ -1,8 +1,11 @@ |
|||||
{ |
{ |
||||
"culture": "zh-Hans", |
"culture": "zh-Hans", |
||||
"texts": { |
"texts": { |
||||
"Menu:Home": "首页", |
"Menu:Home": "首页", |
||||
"Welcome": "欢迎", |
"Welcome": "欢迎", |
||||
"LongWelcomeMessage": "欢迎来到该应用程序. 这是一个基于ABP框架的启动项目. 有关更多信息, 请访问 abp.io." |
"LongWelcomeMessage": "欢迎来到该应用程序. 这是一个基于ABP框架的启动项目. 有关更多信息, 请访问 abp.io.", |
||||
} |
"IdentityUserType": "用户类型", |
||||
} |
"Enum:IdentityUserType.Normal": "标准用户", |
||||
|
"Enum:IdentityUserType.Basic": "基础用户" |
||||
|
} |
||||
|
} |
||||
@ -1,28 +0,0 @@ |
|||||
using System; |
|
||||
using Microsoft.Extensions.Localization; |
|
||||
using Volo.Abp.Localization; |
|
||||
|
|
||||
namespace Lsw.Abp.AntDesignUI.Components.ObjectExtending; |
|
||||
|
|
||||
public static class EnumHelper |
|
||||
{ |
|
||||
public static string GetLocalizedMemberName(Type enumType, object value, IStringLocalizerFactory stringLocalizerFactory) |
|
||||
{ |
|
||||
var memberName = enumType.GetEnumName(value); |
|
||||
var localizedMemberName = AbpInternalLocalizationHelper.LocalizeWithFallback( |
|
||||
new[] |
|
||||
{ |
|
||||
stringLocalizerFactory.CreateDefaultOrNull() |
|
||||
}, |
|
||||
new[] |
|
||||
{ |
|
||||
$"Enum:{enumType.Name}.{memberName}", |
|
||||
$"{enumType.Name}.{memberName}", |
|
||||
memberName |
|
||||
}, |
|
||||
memberName |
|
||||
); |
|
||||
|
|
||||
return localizedMemberName; |
|
||||
} |
|
||||
} |
|
||||
Loading…
Reference in new issue