fix(#I12YHP): Error 页面报错

#Comment
comment #I12YHP

#Issue
link #I12YHP #I12VKZ
This commit is contained in:
Argo Zhang 2019-10-06 10:58:21 +08:00
parent 03fa2af477
commit 781c8e076b
No known key found for this signature in database
GPG Key ID: 152E398953DDF19F
7 changed files with 97 additions and 89 deletions

View File

@ -0,0 +1,90 @@
using Bootstrap.DataAccess;
namespace Bootstrap.Admin.Models
{
/// <summary>
/// AdminModel 实体类
/// </summary>
public class AdminModel : ModelBase
{
/// <summary>
/// 默认构造函数
/// </summary>
/// <param name="appId"></param>
public AdminModel(string appId = "0")
{
Title = DictHelper.RetrieveWebTitle(appId);
Footer = DictHelper.RetrieveWebFooter(appId);
Theme = DictHelper.RetrieveActiveTheme();
IsDemo = DictHelper.RetrieveSystemModel();
ShowCardTitle = DictHelper.RetrieveCardTitleStatus() ? "" : "no-card-header";
ShowSideBar = DictHelper.RetrieveSidebarStatus() ? "" : "collapsed";
AllowMobile = DictHelper.RetrieveMobileLogin();
AllowOAuth = DictHelper.RetrieveOAuthLogin();
ShowMobile = AllowMobile ? "" : "mobile";
ShowOAuth = AllowOAuth ? "" : "oauth";
LockScreenPeriod = DictHelper.RetrieveAutoLockScreenPeriod();
EnableAutoLockScreen = DictHelper.RetrieveAutoLockScreen();
}
/// <summary>
/// 获取 网站标题
/// </summary>
public string Title { get; protected set; }
/// <summary>
/// 获取 网站页脚
/// </summary>
public string Footer { get; protected set; }
/// <summary>
/// 网站样式全局设置
/// </summary>
public string Theme { get; protected set; }
/// <summary>
/// 是否为演示系统
/// </summary>
public bool IsDemo { get; protected set; }
/// <summary>
/// 是否显示卡片标题
/// </summary>
public string ShowCardTitle { get; protected set; }
/// <summary>
/// 是否收缩侧边栏
/// </summary>
public string ShowSideBar { get; protected set; }
/// <summary>
/// 获得 是否允许短信验证码登录
/// </summary>
public bool AllowMobile { get; }
/// <summary>
/// 获得 是否允许第三方 OAuth 认证登录
/// </summary>
public bool AllowOAuth { get; }
/// <summary>
/// 获得 是否允许短信验证码登录
/// </summary>
public string ShowMobile { get; }
/// <summary>
/// 获得 是否允许第三方 OAuth 认证登录
/// </summary>
public string ShowOAuth { get; }
/// <summary>
/// 获得 自动锁屏时长 默认 1 分钟 字典表中配置
/// </summary>
public int LockScreenPeriod { get; }
/// <summary>
/// 获得 自动锁屏功能是否自动开启 默认关闭
/// </summary>
public bool EnableAutoLockScreen { get; }
}
}

View File

@ -3,7 +3,7 @@
/// <summary>
///
/// </summary>
public class ErrorModel
public class ErrorModel : ModelBase
{
/// <summary>
///

View File

@ -7,7 +7,7 @@ namespace Bootstrap.Admin.Models
/// <summary>
///
/// </summary>
public class HeaderBarModel : ModelBase
public class HeaderBarModel : AdminModel
{
/// <summary>
///

View File

@ -5,7 +5,7 @@ namespace Bootstrap.Admin.Models
/// <summary>
/// 登陆页面 Model
/// </summary>
public class LoginModel : ModelBase
public class LoginModel : AdminModel
{
/// <summary>
/// 默认构造函数

View File

@ -1,95 +1,13 @@
using Bootstrap.DataAccess;
namespace Bootstrap.Admin.Models
namespace Bootstrap.Admin.Models
{
/// <summary>
/// ModelBase 基础类
///
/// </summary>
public class ModelBase
{
/// <summary>
/// 默认构造函数
/// </summary>
/// <param name="appId"></param>
public ModelBase(string appId = "0")
{
Title = DictHelper.RetrieveWebTitle(appId);
Footer = DictHelper.RetrieveWebFooter(appId);
Theme = DictHelper.RetrieveActiveTheme();
IsDemo = DictHelper.RetrieveSystemModel();
ShowCardTitle = DictHelper.RetrieveCardTitleStatus() ? "" : "no-card-header";
ShowSideBar = DictHelper.RetrieveSidebarStatus() ? "" : "collapsed";
AllowMobile = DictHelper.RetrieveMobileLogin();
AllowOAuth = DictHelper.RetrieveOAuthLogin();
ShowMobile = AllowMobile ? "" : "mobile";
ShowOAuth = AllowOAuth ? "" : "oauth";
LockScreenPeriod = DictHelper.RetrieveAutoLockScreenPeriod();
EnableAutoLockScreen = DictHelper.RetrieveAutoLockScreen();
}
/// <summary>
/// 获取 网站 logo 小图标
/// </summary>
public string WebSiteLogo { get; protected set; } = "~/favicon.ico";
/// <summary>
/// 获取 网站标题
/// </summary>
public string Title { get; protected set; }
/// <summary>
/// 获取 网站页脚
/// </summary>
public string Footer { get; protected set; }
/// <summary>
/// 网站样式全局设置
/// </summary>
public string Theme { get; protected set; }
/// <summary>
/// 是否为演示系统
/// </summary>
public bool IsDemo { get; protected set; }
/// <summary>
/// 是否显示卡片标题
/// </summary>
public string ShowCardTitle { get; protected set; }
/// <summary>
/// 是否收缩侧边栏
/// </summary>
public string ShowSideBar { get; protected set; }
/// <summary>
/// 获得 是否允许短信验证码登录
/// </summary>
public bool AllowMobile { get; }
/// <summary>
/// 获得 是否允许第三方 OAuth 认证登录
/// </summary>
public bool AllowOAuth { get; }
/// <summary>
/// 获得 是否允许短信验证码登录
/// </summary>
public string ShowMobile { get; }
/// <summary>
/// 获得 是否允许第三方 OAuth 认证登录
/// </summary>
public string ShowOAuth { get; }
/// <summary>
/// 获得 自动锁屏时长 默认 1 分钟 字典表中配置
/// </summary>
public int LockScreenPeriod { get; }
/// <summary>
/// 获得 自动锁屏功能是否自动开启 默认关闭
/// </summary>
public bool EnableAutoLockScreen { get; }
}
}

View File

@ -1,4 +1,4 @@
@model ModelBase
@model AdminModel
<footer class="position-fixed">
<div><span id="websiteFooter">@Model.Footer</span><span asp-condition="@Model.IsDemo">(演示系统)</span></div>
<a id="gotoTop" href="#" class="go-top" title="返回顶部" data-toggle="tooltip" data-placement="left">

View File

@ -1,4 +1,4 @@
@model ModelBase
@model AdminModel
@{
Layout = "_Bootstrap";
}