Admin LTE是功能强大的模板,可以在ABP项目中使用这个模板,具体方法如下。
假定已经存在基于ABP MVC/Rage Page结构的项目,在这个项目中使用Admin LTE theme 替换缺省的Basic Theme。首先,在项目的src目录中创建子目录theme,在控制台中进入这个目录,执行
git clone https://github.com/mucahiddanis/Abp.AspNetCore.Mvc.UI.Theme.AdminLTE.git
将AdminLTE theme的源代码克隆到本地。然后使用Visual Studio 2019 打开Abp项目的解决方案,将Abp.AspNetCore.Mvc.UI.Theme.AdminLTE项目添加到解决方案中。添加完成后,进入Nuget管理器,将这个项目的依赖项升级到最新版本。
接下来,在启动Web项目中,增加对Abp.AspNetCore.Mvc.UI.Theme.AdminLTE项目的依赖关系。然后修改Web模块的代码, 去掉对BasicTheme的依赖,增加对AdminLTETheme的依赖:
[DependsOn(
typeof(WebFlowDesignerHttpApiModule),
typeof(WebFlowDesignerApplicationModule),
typeof(WebFlowDesignerEntityFrameworkCoreDbMigrationsModule),
typeof(AbpAutofacModule),
typeof(AbpIdentityWebModule),
typeof(AbpAccountWebIdentityServerModule),
//typeof(AbpAspNetCoreMvcUiBasicThemeModule),
typeof(AbpAspNetCoreMvcUiAdminLTEThemeModule),
typeof(AbpAspNetCoreAuthenticationJwtBearerModule),
typeof(AbpTenantManagementWebModule),
typeof(AbpAspNetCoreSerilogModule),
typeof(AbpSwashbuckleModule)
)]
最后,修改ConfigureVirtualFileSystem,增加到AdminLTE的路径映射:
private void ConfigureVirtualFileSystem(IWebHostEnvironment hostingEnvironment)
{
if (hostingEnvironment.IsDevelopment())
{
Configure<AbpVirtualFileSystemOptions>(options =>
{
options.FileSets.ReplaceEmbeddedByPhysical<WebFlowDesignerDomainSharedModule>(Path.Combine(hostingEnvironment.ContentRootPath, $"..{Path.DirectorySeparatorChar}Plat.WebFlowDesigner.Domain.Shared"));
options.FileSets.ReplaceEmbeddedByPhysical<WebFlowDesignerDomainModule>(Path.Combine(hostingEnvironment.ContentRootPath, $"..{Path.DirectorySeparatorChar}Plat.WebFlowDesigner.Domain"));
options.FileSets.ReplaceEmbeddedByPhysical<WebFlowDesignerApplicationContractsModule>(Path.Combine(hostingEnvironment.ContentRootPath, $"..{Path.DirectorySeparatorChar}Plat.WebFlowDesigner.Application.Contracts"));
options.FileSets.ReplaceEmbeddedByPhysical<WebFlowDesignerApplicationModule>(Path.Combine(hostingEnvironment.ContentRootPath, $"..{Path.DirectorySeparatorChar}Plat.WebFlowDesigner.Application"));
options.FileSets.ReplaceEmbeddedByPhysical<WebFlowDesignerWebModule>(hostingEnvironment.ContentRootPath);
// AdminLTE teması
options.FileSets.ReplaceEmbeddedByPhysical<WebFlowDesignerApplicationModule>(Path.Combine(hostingEnvironment.ContentRootPath, $"..{Path.DirectorySeparatorChar}..{Path.DirectorySeparatorChar}Abp.AspNetCore.Mvc.UI.Theme.AdminLTE"));
});
}
}
到此,修改完成,编译执行项目就可以了。
网友评论