feat(#I184LO): 网站设置增加 Blazor 配置项
#Issue close https://gitee.com/LongbowEnterprise/dashboard/issues?id=I184LO
This commit is contained in:
parent
ad3b64481f
commit
ce0fcb99bf
|
@ -22,7 +22,7 @@ namespace Bootstrap.Admin.Controllers.Api
|
|||
/// <param name="value"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
[ButtonAuthorize(Url = "~/Admin/Settings", Auth = "saveTitle,saveFooter,saveTheme,saveUISettings,clearCache,clearAllCache,loginSettings,lockScreen,defaultApp")]
|
||||
[ButtonAuthorize(Url = "~/Admin/Settings", Auth = "saveTitle,saveFooter,saveTheme,saveUISettings,clearCache,clearAllCache,loginSettings,lockScreen,defaultApp,blazor")]
|
||||
public bool Post([FromBody]BootstrapDict value) => DictHelper.SaveSettings(value);
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -11,7 +11,7 @@ namespace Bootstrap.Admin.Models
|
|||
public class SettingsModel : NavigatorBarModel
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// 构造函数
|
||||
/// </summary>
|
||||
/// <param name="controller"></param>
|
||||
public SettingsModel(ControllerBase controller) : base(controller)
|
||||
|
@ -19,6 +19,7 @@ namespace Bootstrap.Admin.Models
|
|||
Themes = DictHelper.RetrieveThemes();
|
||||
AutoLockScreen = EnableAutoLockScreen ? "" : "lockScreen";
|
||||
DefaultApp = DictHelper.RetrieveDefaultApp() ? "" : "defaultApp";
|
||||
EnableBlazor = DictHelper.RetrieveEnableBlazor() ? "" : "blazor";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -29,6 +30,7 @@ namespace Bootstrap.Admin.Models
|
|||
Themes = DictHelper.RetrieveThemes();
|
||||
AutoLockScreen = EnableAutoLockScreen ? "" : "lockScreen";
|
||||
DefaultApp = DictHelper.RetrieveDefaultApp() ? "" : "defaultApp";
|
||||
EnableBlazor = DictHelper.RetrieveEnableBlazor() ? "" : "blazor";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -45,5 +47,10 @@ namespace Bootstrap.Admin.Models
|
|||
/// 获得 是否开启自动锁屏
|
||||
/// </summary>
|
||||
public string DefaultApp { get; }
|
||||
|
||||
/// <summary>
|
||||
/// 获得 是否开启 Blazor
|
||||
/// </summary>
|
||||
public string EnableBlazor { get; }
|
||||
}
|
||||
}
|
||||
|
|
|
@ -146,6 +146,9 @@
|
|||
<div class="card" asp-auth="defaultApp">
|
||||
<div class="card-header">默认应用设置</div>
|
||||
<div class="card-body">
|
||||
<div class="alert alert-info" role="alert">
|
||||
<span>开启此功能后用户登录时默认导航到第一个已授权的前台应用</span>
|
||||
</div>
|
||||
<div class="form-inline">
|
||||
<div class="row">
|
||||
<div class="form-group col-6">
|
||||
|
@ -159,6 +162,25 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card" asp-auth="blazor">
|
||||
<div class="card-header">网站设置</div>
|
||||
<div class="card-body">
|
||||
<div class="alert alert-info" role="alert">
|
||||
<span>开启此功能后后台应用使用 Blazor 多标签形式</span>
|
||||
</div>
|
||||
<div class="form-inline">
|
||||
<div class="row">
|
||||
<div class="form-group col-6">
|
||||
<label class="control-label" for="blazor">Blazor</label>
|
||||
<input id="blazor" hidden type="checkbox" data-default-val="@Model.EnableBlazor" data-toggle="toggle" data-width="120" data-onstyle="success" data-on="开启" data-off="关闭" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer text-right">
|
||||
<button data-method="saveBlazor" class="btn btn-secondary" type="button"><i class="fa fa-save"></i><span>保存</span></button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<div class="d-flex align-items-center">
|
||||
|
|
|
@ -79,9 +79,15 @@ $(function () {
|
|||
case 'saveDefaultApp':
|
||||
var defaultApp = $('#defaultApp').prop('checked') ? "1" : "0";
|
||||
$.bc({
|
||||
url: Settings.url, data: { name: '默认应用程序', code: defaultApp, category: '系统设置' }, title: '保存默认应用程序设置', method: "post"
|
||||
url: Settings.url, data: { name: '默认应用程序', code: defaultApp, category: '网站设置' }, title: '保存默认应用程序设置', method: "post"
|
||||
});
|
||||
break;
|
||||
break;
|
||||
case 'saveBlazor':
|
||||
var blazor = $('#blazor').prop('checked') ? "1" : "0";
|
||||
$.bc({
|
||||
url: Settings.url, data: { name: 'Blazor', code: blazor, category: '网站设置' }, title: 'Blazor 设置', method: "post"
|
||||
});
|
||||
break;
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
@ -284,5 +284,11 @@ namespace Bootstrap.DataAccess
|
|||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public bool RetrieveDefaultApp() => (DictHelper.RetrieveDicts().FirstOrDefault(d => d.Category == "系统设置" && d.Name == "默认应用程序" && d.Define == 0)?.Code ?? "0") == "1";
|
||||
|
||||
/// <summary>
|
||||
/// 获得是否开启 Blazor 功能 默认关闭
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public bool RetrieveEnableBlazor() => (DictHelper.RetrieveDicts().FirstOrDefault(d => d.Category == "网站设置" && d.Name == "Blazor" && d.Define == 0)?.Code ?? "0") == "1";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -265,9 +265,15 @@ namespace Bootstrap.DataAccess
|
|||
public static bool RetrieveAutoLockScreen() => DbContextManager.Create<Dict>()?.RetrieveAutoLockScreen() ?? false;
|
||||
|
||||
/// <summary>
|
||||
/// 获得自动锁屏 默认关闭
|
||||
/// 获得是否开启默认应用功能 默认关闭
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static bool RetrieveDefaultApp() => DbContextManager.Create<Dict>()?.RetrieveDefaultApp() ?? false;
|
||||
|
||||
/// <summary>
|
||||
/// 获得是否开启 Blazor 功能 默认关闭
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static bool RetrieveEnableBlazor() => DbContextManager.Create<Dict>()?.RetrieveEnableBlazor() ?? false;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue