Merge branch 'dev' into dev-blazor
# Conflicts: # src/admin/Bootstrap.Admin/BootstrapAdmin.db # src/admin/Bootstrap.Admin/Controllers/HomeController.cs # src/admin/Bootstrap.DataAccess/Bootstrap.DataAccess.csproj # src/admin/Bootstrap.DataAccess/Dict.cs # src/client/Bootstrap.Client.DataAccess/Bootstrap.Client.DataAccess.csproj
This commit is contained in:
commit
3fd62056ba
|
@ -118,9 +118,7 @@
|
|||
2. 安装 Visual Studio 2019 以上 [官方网址](https://visualstudio.microsoft.com/vs/getting-started/)
|
||||
3. 获取本项目代码 [BootstrapAdmin](https://gitee.com/LongbowEnterprise/BootstrapAdmin)
|
||||
|
||||
*注意*
|
||||
master 分支为 NETCore 3.0 框架 必须使用 Visual Studio 2019 (v16.3)
|
||||
netcore-2.2 分支为 NETCore 2.2 框架支持 Visual Studio 2017 (v15.9+)
|
||||
环境搭建教程 [详细说明](https://gitee.com/LongbowEnterprise/BootstrapAdmin/wikis/%E5%AE%89%E8%A3%85%E6%95%99%E7%A8%8B?sort_id=1333477)
|
||||
|
||||
### 安装数据库
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
version: 1.0.{build}
|
||||
version: 3.1.{build}
|
||||
branches:
|
||||
only:
|
||||
- release
|
||||
|
|
|
@ -282,6 +282,12 @@
|
|||
"Code": "0",
|
||||
"Define": NumberInt(0)
|
||||
},
|
||||
{
|
||||
"Category": "系统设置",
|
||||
"Name": "默认应用程序",
|
||||
"Code": "0",
|
||||
"Define": NumberInt(0)
|
||||
},
|
||||
{
|
||||
"Category": "测试平台",
|
||||
"Name": "favicon",
|
||||
|
|
|
@ -215,6 +215,18 @@
|
|||
"IsResource": NumberInt(2),
|
||||
"Application": "BA"
|
||||
},
|
||||
{
|
||||
"_id": ObjectId("5bd7b8445fa31256f77e4b08"),
|
||||
"ParentId": "5bd7b8445fa31256f77e4b93",
|
||||
"Name": "默认应用",
|
||||
"Order": NumberInt(80),
|
||||
"Icon": "fa fa-fa",
|
||||
"Url": "defaultApp",
|
||||
"Category": "0",
|
||||
"Target": "_self",
|
||||
"IsResource": NumberInt(2),
|
||||
"Application": "BA"
|
||||
},
|
||||
{
|
||||
"_id": ObjectId("5bd7b8445fa31256f77e4b94"),
|
||||
"ParentId": "0",
|
||||
|
|
|
@ -53,11 +53,14 @@ INSERT INTO Dicts (Category, Name, Code, Define) VALUES ('系统设置', 'Cookie
|
|||
INSERT INTO Dicts (Category, Name, Code, Define) VALUES ('系统设置', 'IP地理位置接口', 'None', 0);
|
||||
INSERT INTO Dicts (Category, Name, Code, Define) VALUES ('系统设置', 'BaiDuIPSvr', 'http://api.map.baidu.com/location/ip?ak=6lvVPMDlm2gjLpU0aiqPsHXi2OiwGQRj&ip=', 0);
|
||||
INSERT INTO Dicts (Category, Name, Code, Define) VALUES ('系统设置', 'JuheIPSvr', 'http://apis.juhe.cn/ip/ipNew?key=f57102d1b9fadd3f4a1c29072d0c0206&ip=', 0);
|
||||
|
||||
-- 时长单位 分钟
|
||||
INSERT INTO Dicts (Category, Name, Code, Define) VALUES ('系统设置', 'IP请求缓存时长', '10', 0);
|
||||
INSERT INTO Dicts (Category, Name, Code, Define) VALUES ('系统设置', '演示系统', '0', 0);
|
||||
INSERT INTO Dicts (Category, Name, Code, Define) VALUES ('系统设置', '验证码图床', 'http://imgs.sdgxgz.com/images/', 0);
|
||||
|
||||
INSERT INTO Dicts (Category, Name, Code, Define) VALUES ('系统设置', '默认应用程序', '0', 0);
|
||||
|
||||
DELETE FROM Navigations Where Category = '0';
|
||||
INSERT INTO Navigations (ParentId, Name, `Order`, Icon, Url, Category) VALUES (0, '后台管理', 10, 'fa fa-gear', '~/Admin/Index', '0');
|
||||
INSERT INTO Navigations (ParentId, Name, `Order`, Icon, Url, Category) VALUES (0, '个人中心', 20, 'fa fa-suitcase', '~/Admin/Profiles', '0');
|
||||
|
@ -77,6 +80,7 @@ INSERT INTO Navigations (ParentId, Name, `Order`, Icon, Url, Category, IsResourc
|
|||
INSERT INTO Navigations (ParentId, Name, `Order`, Icon, Url, Category, IsResource) VALUES (@@identity - 4, '清理全部缓存', 50, 'fa fa-fa', 'clearAllCache', '0', 2);
|
||||
INSERT INTO Navigations (ParentId, Name, `Order`, Icon, Url, Category, IsResource) VALUES (@@identity - 5, '登录设置', 60, 'fa fa-fa', 'loginSettings', '0', 2);
|
||||
INSERT INTO Navigations (ParentId, Name, `Order`, Icon, Url, Category, IsResource) VALUES (@@identity - 6, '自动锁屏', 70, 'fa fa-fa', 'lockScreen', '0', 2);
|
||||
INSERT INTO Navigations (ParentId, Name, `Order`, Icon, Url, Category, IsResource) VALUES (@@identity - 7, '默认应用', 80, 'fa fa-fa', 'defaultApp', '0', 2);
|
||||
INSERT INTO Navigations (ParentId, Name, `Order`, Icon, Url, Category) VALUES (0, '菜单管理', 50, 'fa fa-dashboard', '~/Admin/Menus', '0');
|
||||
INSERT INTO Navigations (ParentId, Name, `Order`, Icon, Url, Category, IsResource) VALUES (@@identity, '新增', 10, 'fa fa-fa', 'add', '0', 2);
|
||||
INSERT INTO Navigations (ParentId, Name, `Order`, Icon, Url, Category, IsResource) VALUES (@@identity - 1, '编辑', 20, 'fa fa-fa', 'edit', '0', 2);
|
||||
|
|
|
@ -53,11 +53,14 @@ INSERT INTO [Dicts] ([Category], [Name], [Code], [Define]) VALUES ('系统设置
|
|||
INSERT INTO [Dicts] ([Category], [Name], [Code], [Define]) VALUES ('系统设置', 'IP地理位置接口', 'None', 0);
|
||||
INSERT INTO [Dicts] ([Category], [Name], [Code], [Define]) VALUES ('系统设置', 'BaiDuIPSvr', 'http://api.map.baidu.com/location/ip?ak=6lvVPMDlm2gjLpU0aiqPsHXi2OiwGQRj&ip=', 0);
|
||||
INSERT INTO [Dicts] ([Category], [Name], [Code], [Define]) VALUES ('系统设置', 'JuheIPSvr', 'http://apis.juhe.cn/ip/ipNew?key=f57102d1b9fadd3f4a1c29072d0c0206&ip=', 0);
|
||||
|
||||
-- 时长单位 分钟
|
||||
INSERT INTO [Dicts] ([Category], [Name], [Code], [Define]) VALUES ('系统设置', 'IP请求缓存时长', '10', 0);
|
||||
INSERT INTO [Dicts] ([Category], [Name], [Code], [Define]) VALUES ('系统设置', '演示系统', '0', 0);
|
||||
INSERT INTO [Dicts] ([Category], [Name], [Code], [Define]) VALUES ('系统设置', '验证码图床', 'http://imgs.sdgxgz.com/images/', 0);
|
||||
|
||||
INSERT INTO [Dicts] ([Category], [Name], [Code], [Define]) VALUES ('系统设置', '默认应用程序', '0', 0);
|
||||
|
||||
DELETE FROM Navigations Where Category = '0';
|
||||
INSERT INTO [Navigations] ([ParentId], [Name], [Order], [Icon], [Url], [Category]) VALUES (0, '后台管理', 10, 'fa fa-gear', '~/Admin/Index', '0');
|
||||
INSERT INTO [Navigations] ([ParentId], [Name], [Order], [Icon], [Url], [Category]) VALUES (0, '个人中心', 20, 'fa fa-suitcase', '~/Admin/Profiles', '0');
|
||||
|
@ -77,6 +80,7 @@ INSERT INTO [Navigations] ([ParentId], [Name], [Order], [Icon], [Url], [Category
|
|||
INSERT INTO [Navigations] ([ParentId], [Name], [Order], [Icon], [Url], [Category], IsResource) VALUES (last_insert_rowid() - 4, '清理全部缓存', 50, 'fa fa-fa', 'clearAllCache', '0', 2);
|
||||
INSERT INTO [Navigations] ([ParentId], [Name], [Order], [Icon], [Url], [Category], IsResource) VALUES (last_insert_rowid() - 5, '登录设置', 60, 'fa fa-fa', 'loginSettings', '0', 2);
|
||||
INSERT INTO [Navigations] ([ParentId], [Name], [Order], [Icon], [Url], [Category], IsResource) VALUES (last_insert_rowid() - 6, '自动锁屏', 70, 'fa fa-fa', 'lockScreen', '0', 2);
|
||||
INSERT INTO [Navigations] ([ParentId], [Name], [Order], [Icon], [Url], [Category], IsResource) VALUES (last_insert_rowid() - 7, '默认应用', 80, 'fa fa-fa', 'defaultApp', '0', 2);
|
||||
INSERT INTO [Navigations] ([ParentId], [Name], [Order], [Icon], [Url], [Category]) VALUES (0, '菜单管理', 50, 'fa fa-dashboard', '~/Admin/Menus', '0');
|
||||
INSERT INTO [Navigations] ([ParentId], [Name], [Order], [Icon], [Url], [Category], IsResource) VALUES (last_insert_rowid(), '新增', 10, 'fa fa-fa', 'add', '0', 2);
|
||||
INSERT INTO [Navigations] ([ParentId], [Name], [Order], [Icon], [Url], [Category], IsResource) VALUES (last_insert_rowid() - 1, '编辑', 20, 'fa fa-fa', 'edit', '0', 2);
|
||||
|
|
|
@ -56,11 +56,14 @@ INSERT [dbo].[Dicts] ([Category], [Name], [Code], [Define]) VALUES (N'系统设
|
|||
INSERT [dbo].[Dicts] ([Category], [Name], [Code], [Define]) VALUES (N'系统设置', N'IP地理位置接口', 'None', 0)
|
||||
INSERT [dbo].[Dicts] ([Category], [Name], [Code], [Define]) VALUES (N'系统设置', N'BaiDuIPSvr', 'http://api.map.baidu.com/location/ip?ak=6lvVPMDlm2gjLpU0aiqPsHXi2OiwGQRj&ip=', 0)
|
||||
INSERT [dbo].[Dicts] ([Category], [Name], [Code], [Define]) VALUES (N'系统设置', N'JuheIPSvr', 'http://apis.juhe.cn/ip/ipNew?key=f57102d1b9fadd3f4a1c29072d0c0206&ip=', 0)
|
||||
|
||||
-- 时长单位 分钟
|
||||
INSERT [dbo].[Dicts] ([Category], [Name], [Code], [Define]) VALUES (N'系统设置', N'IP请求缓存时长', '10', 0)
|
||||
INSERT [dbo].[Dicts] ([Category], [Name], [Code], [Define]) VALUES (N'系统设置', N'演示系统', '0', 0)
|
||||
INSERT [dbo].[Dicts] ([Category], [Name], [Code], [Define]) VALUES (N'系统设置', N'验证码图床', 'http://imgs.sdgxgz.com/images/', 0)
|
||||
|
||||
INSERT [dbo].[Dicts] ([Category], [Name], [Code], [Define]) VALUES (N'系统设置', N'默认应用程序', '0', 0)
|
||||
|
||||
DELETE FROM Navigations Where Category = N'0'
|
||||
INSERT [Navigations] ([ParentId], [Name], [Order], [Icon], [Url], [Category]) VALUES (0, N'后台管理', 10, N'fa fa-gear', N'~/Admin/Index', N'0')
|
||||
INSERT [Navigations] ([ParentId], [Name], [Order], [Icon], [Url], [Category]) VALUES (0, N'个人中心', 20, N'fa fa-suitcase', N'~/Admin/Profiles', N'0')
|
||||
|
@ -80,6 +83,7 @@ INSERT INTO [Navigations] ([ParentId], [Name], [Order], [Icon], [Url], [Category
|
|||
INSERT INTO [Navigations] ([ParentId], [Name], [Order], [Icon], [Url], [Category], IsResource) VALUES (@@Identity - 4, N'清理全部缓存', 50, 'fa fa-fa', 'clearAllCache', '0', 2);
|
||||
INSERT INTO [Navigations] ([ParentId], [Name], [Order], [Icon], [Url], [Category], IsResource) VALUES (@@Identity - 5, N'登录设置', 60, 'fa fa-fa', 'loginSettings', '0', 2);
|
||||
INSERT INTO [Navigations] ([ParentId], [Name], [Order], [Icon], [Url], [Category], IsResource) VALUES (@@Identity - 6, N'自动锁屏', 70, 'fa fa-fa', 'lockScreen', '0', 2);
|
||||
INSERT INTO [Navigations] ([ParentId], [Name], [Order], [Icon], [Url], [Category], IsResource) VALUES (@@Identity - 7, N'默认应用', 80, 'fa fa-fa', 'defaultApp', '0', 2);
|
||||
INSERT INTO [Navigations] ([ParentId], [Name], [Order], [Icon], [Url], [Category]) VALUES (0, N'菜单管理', 50, N'fa fa-dashboard', N'~/Admin/Menus', N'0')
|
||||
INSERT INTO [Navigations] ([ParentId], [Name], [Order], [Icon], [Url], [Category], IsResource) VALUES (@@Identity, N'新增', 10, 'fa fa-fa', 'add', '0', 2);
|
||||
INSERT INTO [Navigations] ([ParentId], [Name], [Order], [Icon], [Url], [Category], IsResource) VALUES (@@Identity - 1, N'编辑', 20, 'fa fa-fa', 'edit', '0', 2);
|
||||
|
|
|
@ -10,10 +10,10 @@
|
|||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Longbow.Logging" Version="3.1.1-beta-01" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Mvc.Versioning" Version="4.1.0" />
|
||||
<PackageReference Include="Sentry.AspNetCore" Version="2.0.0-beta6" />
|
||||
<PackageReference Include="Swashbuckle.AspNetCore" Version="5.0.0-rc4" />
|
||||
<PackageReference Include="Longbow.Logging" Version="3.1.1-beta-02" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Mvc.Versioning" Version="4.1.1" />
|
||||
<PackageReference Include="Sentry.AspNetCore" Version="2.0.0-beta7" />
|
||||
<PackageReference Include="Swashbuckle.AspNetCore" Version="5.0.0-rc5" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
|
Binary file not shown.
|
@ -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")]
|
||||
[ButtonAuthorize(Url = "~/Admin/Settings", Auth = "saveTitle,saveFooter,saveTheme,saveUISettings,clearCache,clearAllCache,loginSettings,lockScreen,defaultApp")]
|
||||
public bool Post([FromBody]BootstrapDict value) => DictHelper.SaveSettings(value);
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -20,7 +20,7 @@ namespace Bootstrap.Admin.Controllers
|
|||
public IActionResult Index([FromServices]IConfiguration configuration)
|
||||
{
|
||||
var model = new HeaderBarModel(User.Identity.Name);
|
||||
var homeUrl = DictHelper.RetrieveHomeUrl(model.AppId);
|
||||
var homeUrl = DictHelper.RetrieveHomeUrl(User.Identity.Name, model.AppId);
|
||||
var useBlazor = configuration.GetValue("UseBlazor", false);
|
||||
return homeUrl.Equals("~/Home/Index", System.StringComparison.OrdinalIgnoreCase) ? (useBlazor ? Redirect("~/Pages") : (IActionResult)View(model)) : Redirect(homeUrl);
|
||||
}
|
||||
|
|
|
@ -18,6 +18,7 @@ namespace Bootstrap.Admin.Models
|
|||
{
|
||||
Themes = DictHelper.RetrieveThemes();
|
||||
AutoLockScreen = EnableAutoLockScreen ? "" : "lockScreen";
|
||||
DefaultApp = DictHelper.RetrieveDefaultApp() ? "" : "defaultApp";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -27,6 +28,7 @@ namespace Bootstrap.Admin.Models
|
|||
{
|
||||
Themes = DictHelper.RetrieveThemes();
|
||||
AutoLockScreen = EnableAutoLockScreen ? "" : "lockScreen";
|
||||
DefaultApp = DictHelper.RetrieveDefaultApp() ? "" : "defaultApp";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -38,5 +40,10 @@ namespace Bootstrap.Admin.Models
|
|||
/// 获得 是否开启自动锁屏
|
||||
/// </summary>
|
||||
public string AutoLockScreen { get; }
|
||||
|
||||
/// <summary>
|
||||
/// 获得 是否开启自动锁屏
|
||||
/// </summary>
|
||||
public string DefaultApp { get; }
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,14 +19,14 @@
|
|||
@section query {
|
||||
<form class="form-inline">
|
||||
<div class="row">
|
||||
<div class="form-group col-sm-6 col-md-auto">
|
||||
<label class="control-label" for="txt_dict_name">字典名称</label>
|
||||
<input type="text" class="form-control" id="txt_dict_name" />
|
||||
</div>
|
||||
<div class="form-group col-sm-6 col-md-auto">
|
||||
<label class="control-label" for="txt_dict_cate">字典标签</label>
|
||||
<input type="text" class="form-control" id="txt_dict_cate" data-provide="typeahead" />
|
||||
</div>
|
||||
<div class="form-group col-sm-6 col-md-auto">
|
||||
<label class="control-label" for="txt_dict_name">字典名称</label>
|
||||
<input type="text" class="form-control" id="txt_dict_name" />
|
||||
</div>
|
||||
<div class="form-group col-sm-6 col-md-auto">
|
||||
<label class="control-label" for="txt_dict_define">字典类型</label>
|
||||
<input class="form-control" data-toggle="lgbSelect" />
|
||||
|
|
|
@ -143,6 +143,22 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card" asp-auth="defaultApp">
|
||||
<div class="card-header">默认应用设置</div>
|
||||
<div class="card-body">
|
||||
<div class="form-inline">
|
||||
<div class="row">
|
||||
<div class="form-group col-6">
|
||||
<label class="control-label" for="defaultApp">默认应用</label>
|
||||
<input id="defaultApp" hidden type="checkbox" data-default-val="@Model.DefaultApp" 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="saveDefaultApp" 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">
|
||||
|
|
|
@ -97,19 +97,6 @@
|
|||
"sweetalert2.min.css"
|
||||
]
|
||||
},
|
||||
{
|
||||
"library": "malihu-custom-scrollbar-plugin@3.1.5",
|
||||
"destination": "wwwroot/lib/scrollbar/",
|
||||
"files": [
|
||||
"jquery.mCustomScrollbar.concat.min.js",
|
||||
"jquery.mCustomScrollbar.css",
|
||||
"jquery.mCustomScrollbar.js",
|
||||
"jquery.mCustomScrollbar.min.css",
|
||||
"jquery.mCustomScrollbar.min.js",
|
||||
"jquery.mCustomScrollbar.min.js.map",
|
||||
"mCSB_buttons.png"
|
||||
]
|
||||
},
|
||||
{
|
||||
"library": "smalot-bootstrap-datetimepicker@2.4.4",
|
||||
"destination": "wwwroot/lib/datetimepicker",
|
||||
|
@ -121,16 +108,6 @@
|
|||
"js/bootstrap-datetimepicker.min.js"
|
||||
]
|
||||
},
|
||||
{
|
||||
"provider": "unpkg",
|
||||
"library": "dcjqaccordion@2.7.1",
|
||||
"destination": "wwwroot/lib/dcjqaccordion/",
|
||||
"files": [
|
||||
"js/jquery.dcjqaccordion.2.7.js",
|
||||
"js/jquery.dcjqaccordion.2.7.min.js",
|
||||
"js/jquery.cookie.js"
|
||||
]
|
||||
},
|
||||
{
|
||||
"provider": "cdnjs",
|
||||
"library": "bootstrap-fileinput@4.5.1",
|
||||
|
|
|
@ -62,7 +62,7 @@
|
|||
}
|
||||
|
||||
.card:hover {
|
||||
border-top-color: #337ab7;
|
||||
border-top-color: #84bbe2;
|
||||
}
|
||||
|
||||
.card .card-header, .modal-header {
|
||||
|
|
|
@ -350,6 +350,10 @@ body.trans-mute * {
|
|||
}
|
||||
|
||||
.dd3-content .menuType {
|
||||
right: 100px;
|
||||
}
|
||||
|
||||
.dd3-content .menuApp {
|
||||
right: 45px;
|
||||
}
|
||||
|
||||
|
|
|
@ -587,6 +587,10 @@ input.pending {
|
|||
margin-top: -10px;
|
||||
}
|
||||
|
||||
.card .modal-footer {
|
||||
padding: 0.5rem 0rem;
|
||||
}
|
||||
|
||||
.no-card-header .card-header {
|
||||
display: none;
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
(function ($) {
|
||||
(function ($) {
|
||||
$.fn.extend({
|
||||
autoScrollSidebar: function (options) {
|
||||
var option = $.extend({ target: null, offsetTop: 0 }, options);
|
||||
|
@ -127,14 +127,18 @@
|
|||
return ret;
|
||||
};
|
||||
|
||||
var formatApplicationName = function (app) {
|
||||
return app;
|
||||
}
|
||||
|
||||
var cascadeMenu = function (menus) {
|
||||
var html = "";
|
||||
$.each(menus, function (index, menu) {
|
||||
if (menu.Menus.length === 0) {
|
||||
html += $.format('<li class="dd-item dd3-item" data-id="{0}" data-order="{4}" data-category="{3}" data-resource="{6}"><div class="dd-handle dd3-handle"></div><div class="dd3-content"><div class="checkbox"><label><input type="checkbox" value="{0}"><span><i class="{1}"></i>{2}</span></label></div><div class="radio"><label><input type="radio" name="menu" value="{0}"><span><i class="{1}"></i>{2}</span></label></div><span class="menuType">{5}</span><span class="menuOrder">{4}</span></div></li>', menu.Id, menu.Icon, menu.Name, menu.Category, menu.Order, formatCategoryName(menu), menu.IsResource);
|
||||
html += $.format('<li class="dd-item dd3-item" data-id="{0}" data-order="{4}" data-category="{3}" data-resource="{6}"><div class="dd-handle dd3-handle"></div><div class="dd3-content"><div class="checkbox"><label><input type="checkbox" value="{0}"><span><i class="{1}"></i>{2}</span></label></div><div class="radio"><label><input type="radio" name="menu" value="{0}"><span><i class="{1}"></i>{2}</span></label></div><span class="menuType">{5}</span><span class="menuApp">{7}</span><span class="menuOrder">{4}</span></div></li>', menu.Id, menu.Icon, menu.Name, menu.Category, menu.Order, formatCategoryName(menu), menu.IsResource, formatApplicationName(menu.Application));
|
||||
}
|
||||
else {
|
||||
html += $.format('<li class="dd-item dd3-item" data-id="{0}" data-order="{5}" data-category="{3}" data-resource="{7}"><div class="dd-handle dd3-handle"></div><div class="dd3-content"><div class="checkbox"><label><input type="checkbox" value="{0}"><span><i class="{1}"></i>{2}</span></label></div><div class="radio"><label><input type="radio" name="menu" value="{0}"><span><i class="{1}"></i>{2}</span></label></div><span class="menuType">{6}</span><span class="menuOrder">{5}</span></div><ol class="dd-list">{4}</ol></li>', menu.Id, menu.Icon, menu.Name, menu.Category, cascadeMenu(menu.Menus), menu.Order, formatCategoryName(menu), menu.IsResource);
|
||||
html += $.format('<li class="dd-item dd3-item" data-id="{0}" data-order="{5}" data-category="{3}" data-resource="{7}"><div class="dd-handle dd3-handle"></div><div class="dd3-content"><div class="checkbox"><label><input type="checkbox" value="{0}"><span><i class="{1}"></i>{2}</span></label></div><div class="radio"><label><input type="radio" name="menu" value="{0}"><span><i class="{1}"></i>{2}</span></label></div><span class="menuType">{6}</span><span class="menuApp">{8}</span><span class="menuOrder">{5}</span></div><ol class="dd-list">{4}</ol></li>', menu.Id, menu.Icon, menu.Name, menu.Category, cascadeMenu(menu.Menus), menu.Order, formatCategoryName(menu), menu.IsResource, formatApplicationName(menu.Application));
|
||||
}
|
||||
});
|
||||
return html;
|
||||
|
|
|
@ -67,6 +67,13 @@ $(function () {
|
|||
}
|
||||
},
|
||||
callback: function (result) {
|
||||
if (result.oper === "create") {
|
||||
$('#app').lgbSelect('enable');
|
||||
}
|
||||
if (result.oper === "edit") {
|
||||
var valid = result.data && result.data.ParentId === "0" && hasNodes(result.data.Id);
|
||||
$('#app').lgbSelect(valid ? 'enable' : 'disabled');
|
||||
}
|
||||
if (!result.success) return;
|
||||
if ((result.oper === "save") || result.oper === "del") {
|
||||
if (result.data.filter(function (element) {
|
||||
|
@ -153,6 +160,13 @@ $(function () {
|
|||
}
|
||||
});
|
||||
|
||||
var hasNodes = function (idValue) {
|
||||
var nodes = $table.bootstrapTable('getData').filter(function (row, index, data) {
|
||||
return idValue == row["ParentId"];
|
||||
});
|
||||
return nodes.length === 0;
|
||||
};
|
||||
|
||||
// validate
|
||||
$('#dataForm').on('click', '[data-method]', function () {
|
||||
var $this = $(this);
|
||||
|
@ -160,6 +174,11 @@ $(function () {
|
|||
switch ($this.attr('data-method')) {
|
||||
case 'clear':
|
||||
$input.val("");
|
||||
if ($input.attr('id') === 'parentName') {
|
||||
// 判断是否有子项
|
||||
var valid = hasNodes($("#menuID").val());
|
||||
$('#app').lgbSelect(valid ? 'enable' : 'disabled');
|
||||
}
|
||||
break;
|
||||
case 'sel':
|
||||
$input.select();
|
||||
|
@ -247,6 +266,7 @@ $(function () {
|
|||
if (check) {
|
||||
$parentMenuID.val(pId);
|
||||
$parentMenuName.val($('.dd3-content :radio:checked').next('span').text());
|
||||
$('#app').lgbSelect('disabled');
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
|
|
|
@ -76,6 +76,12 @@ $(function () {
|
|||
}
|
||||
});
|
||||
break;
|
||||
case 'saveDefaultApp':
|
||||
var defaultApp = $('#defaultApp').prop('checked') ? "1" : "0";
|
||||
$.bc({
|
||||
url: Settings.url, data: { name: '默认应用程序', code: defaultApp, category: '系统设置' }, title: '保存默认应用程序设置', method: "post"
|
||||
});
|
||||
break;
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
@ -107,9 +107,6 @@
|
|||
});
|
||||
return source;
|
||||
},
|
||||
sendHealths: function (data) {
|
||||
$.bc({ url: 'api/Interface/Healths', data: JSON.stringify(data), method: 'post' });
|
||||
},
|
||||
copyText: function (ele) {
|
||||
if (typeof ele !== "string") return false;
|
||||
var input = document.createElement('input');
|
||||
|
|
|
@ -5,10 +5,10 @@
|
|||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Bootstrap.Security.DataAccess" Version="3.1.0" />
|
||||
<PackageReference Include="Bootstrap.Security.DataAccess" Version="3.1.1-beta-01" />
|
||||
<PackageReference Include="Bootstrap.Security.Mvc" Version="3.1.1-beta-01" />
|
||||
<PackageReference Include="Longbow" Version="3.1.0" />
|
||||
<PackageReference Include="Longbow.Cache" Version="3.1.1-beta-01" />
|
||||
<PackageReference Include="Longbow.Cache" Version="3.1.1-beta-02" />
|
||||
<PackageReference Include="Longbow.Data" Version="3.1.0" />
|
||||
<PackageReference Include="Longbow.GiteeAuth" Version="3.1.0" />
|
||||
<PackageReference Include="Longbow.GitHubAuth" Version="3.1.0" />
|
||||
|
|
|
@ -114,23 +114,56 @@ namespace Bootstrap.DataAccess
|
|||
/// <summary>
|
||||
/// 获得默认的前台首页地址,默认为~/Home/Index
|
||||
/// </summary>
|
||||
/// <param name="appId"></param>
|
||||
/// <param name="userName">登录用户名</param>
|
||||
/// <param name="appId">默认应用程序编码</param>
|
||||
/// <returns></returns>
|
||||
public virtual string RetrieveHomeUrl(string appId)
|
||||
public virtual string RetrieveHomeUrl(string? userName, string appId)
|
||||
{
|
||||
// https://gitee.com/LongbowEnterprise/dashboard/issues?id=IS0WK
|
||||
// https://gitee.com/LongbowEnterprise/dashboard/issues?id=I17SD0
|
||||
var url = "~/Home/Index";
|
||||
var dicts = DictHelper.RetrieveDicts();
|
||||
if (!appId.IsNullOrEmpty())
|
||||
|
||||
if (appId.IsNullOrEmpty())
|
||||
{
|
||||
var appUrl = dicts.FirstOrDefault(d => d.Name.Equals(appId, StringComparison.OrdinalIgnoreCase) && d.Category == "应用首页" && d.Define == 0)?.Code;
|
||||
if (!string.IsNullOrEmpty(appUrl)) return appUrl;
|
||||
var defaultUrl = dicts.FirstOrDefault(d => d.Name == "前台首页" && d.Category == "网站设置" && d.Define == 0)?.Code;
|
||||
if (!string.IsNullOrEmpty(defaultUrl)) url = defaultUrl;
|
||||
}
|
||||
else if (appId.Equals("BA", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
// 使用配置项设置是否启用默认第一个应用是默认应用
|
||||
var defaultApp = (dicts.FirstOrDefault(d => d.Name == "默认应用程序" && d.Category == "系统设置" && d.Define == 0)?.Code ?? "0") == "1";
|
||||
if (defaultApp)
|
||||
{
|
||||
var app = AppHelper.RetrievesByUserName(userName).FirstOrDefault(key => !key.Equals("BA", StringComparison.OrdinalIgnoreCase)) ?? "";
|
||||
if (!string.IsNullOrEmpty(app))
|
||||
{
|
||||
// 指定应用程序的首页
|
||||
var appUrl = RetrieveDefaultHomeUrlByApp(dicts, app);
|
||||
if (!string.IsNullOrEmpty(appUrl)) url = appUrl;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// 指定应用程序的首页
|
||||
var appUrl = RetrieveDefaultHomeUrlByApp(dicts, appId);
|
||||
if (!string.IsNullOrEmpty(appUrl)) url = appUrl;
|
||||
}
|
||||
var defaultUrl = dicts.FirstOrDefault(d => d.Name == "前台首页" && d.Category == "网站设置" && d.Define == 0)?.Code;
|
||||
if (!string.IsNullOrEmpty(defaultUrl)) url = defaultUrl;
|
||||
return url;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 通过 appId 获取应用首页配置值
|
||||
/// </summary>
|
||||
/// <param name="dicts"></param>
|
||||
/// <param name="appId"></param>
|
||||
/// <returns></returns>
|
||||
protected virtual string RetrieveDefaultHomeUrlByApp(IEnumerable<BootstrapDict> dicts, string appId)
|
||||
{
|
||||
return dicts.FirstOrDefault(d => d.Name.Equals(appId, StringComparison.OrdinalIgnoreCase) && d.Category == "应用首页" && d.Define == 0)?.Code ?? "";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获得字典表中配置的所有应用程序
|
||||
/// </summary>
|
||||
|
@ -174,7 +207,7 @@ namespace Bootstrap.DataAccess
|
|||
public string RetrieveLocaleIPSvr() => DictHelper.RetrieveDicts().FirstOrDefault(d => d.Category == "系统设置" && d.Name == "IP地理位置接口" && d.Define == 0)?.Code ?? string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 获取 IP地址位置缓存时长
|
||||
/// 获得 IP请求缓存时长配置值
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public int RetrieveLocaleIPSvrCachePeriod()
|
||||
|
@ -245,5 +278,11 @@ namespace Bootstrap.DataAccess
|
|||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public bool RetrieveAutoLockScreen() => (DictHelper.RetrieveDicts().FirstOrDefault(d => d.Category == "网站设置" && d.Name == "自动锁屏" && d.Define == 0)?.Code ?? "0") == "1";
|
||||
|
||||
/// <summary>
|
||||
/// 获得默认应用是否开启 默认关闭
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public bool RetrieveDefaultApp() => (DictHelper.RetrieveDicts().FirstOrDefault(d => d.Category == "系统设置" && d.Name == "默认应用程序" && d.Define == 0)?.Code ?? "0") == "1";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -156,9 +156,10 @@ namespace Bootstrap.DataAccess
|
|||
/// <summary>
|
||||
/// 获得默认的前台首页地址,默认为 ~/Home/Index
|
||||
/// </summary>
|
||||
/// <param name="appId">应用程序编码</param>
|
||||
/// <param name="userName">登录用户名</param>
|
||||
/// <param name="appId">默认应用程序编码</param>
|
||||
/// <returns></returns>
|
||||
public static string RetrieveHomeUrl(string appId) => DbContextManager.Create<Dict>()?.RetrieveHomeUrl(appId) ?? "~/Home/Index";
|
||||
public static string RetrieveHomeUrl(string? userName, string appId) => DbContextManager.Create<Dict>()?.RetrieveHomeUrl(userName, appId) ?? "~/Home/Index";
|
||||
|
||||
/// <summary>
|
||||
/// 获取所有应用程序数据方法
|
||||
|
@ -262,5 +263,11 @@ namespace Bootstrap.DataAccess
|
|||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static bool RetrieveAutoLockScreen() => DbContextManager.Create<Dict>()?.RetrieveAutoLockScreen() ?? false;
|
||||
|
||||
/// <summary>
|
||||
/// 获得自动锁屏 默认关闭
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static bool RetrieveDefaultApp() => DbContextManager.Create<Dict>()?.RetrieveDefaultApp() ?? false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,10 +5,10 @@
|
|||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Bootstrap.Security.DataAccess" Version="3.1.0" />
|
||||
<PackageReference Include="Bootstrap.Security.DataAccess" Version="3.1.1-beta-01" />
|
||||
<PackageReference Include="Bootstrap.Security.Mvc" Version="3.1.1-beta-01" />
|
||||
<PackageReference Include="Longbow" Version="3.1.0" />
|
||||
<PackageReference Include="Longbow.Cache" Version="3.1.1-beta-01" />
|
||||
<PackageReference Include="Longbow.Cache" Version="3.1.1-beta-02" />
|
||||
<PackageReference Include="Longbow.Data" Version="3.1.0" />
|
||||
<PackageReference Include="Longbow.Web" Version="3.1.0" />
|
||||
<PackageReference Include="System.Data.SqlClient" Version="4.8.0" />
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Longbow.Logging" Version="3.1.1-beta-01" />
|
||||
<PackageReference Include="Longbow.Logging" Version="3.1.1-beta-02" />
|
||||
<PackageReference Include="Microsoft.Data.Sqlite" Version="3.1.0" />
|
||||
</ItemGroup>
|
||||
|
||||
|
|
|
@ -2,17 +2,6 @@
|
|||
"version": "1.0",
|
||||
"defaultProvider": "cdnjs",
|
||||
"libraries": [
|
||||
{
|
||||
"provider": "unpkg",
|
||||
"library": "@aspnet/signalr@1.0.4",
|
||||
"destination": "wwwroot/lib/signalr/",
|
||||
"files": [
|
||||
"dist/browser/signalr.js",
|
||||
"dist/browser/signalr.js.map",
|
||||
"dist/browser/signalr.min.js",
|
||||
"dist/browser/signalr.min.js.map"
|
||||
]
|
||||
},
|
||||
{
|
||||
"provider": "cdnjs",
|
||||
"library": "jquery@3.3.1",
|
||||
|
@ -45,16 +34,6 @@
|
|||
"toastr.min.css"
|
||||
]
|
||||
},
|
||||
{
|
||||
"provider": "cdnjs",
|
||||
"library": "jquery-treegrid@0.2.0",
|
||||
"destination": "wwwroot/lib/treegrid/",
|
||||
"files": [
|
||||
"css/jquery.treegrid.css",
|
||||
"js/jquery.treegrid.js",
|
||||
"js/jquery.treegrid.min.js"
|
||||
]
|
||||
},
|
||||
{
|
||||
"provider": "cdnjs",
|
||||
"library": "twitter-bootstrap@4.3.1",
|
||||
|
@ -86,30 +65,6 @@
|
|||
"fonts/FontAwesome.otf"
|
||||
]
|
||||
},
|
||||
{
|
||||
"provider": "cdnjs",
|
||||
"library": "limonte-sweetalert2@7.33.1",
|
||||
"destination": "wwwroot/lib/sweetalert/",
|
||||
"files": [
|
||||
"sweetalert2.js",
|
||||
"sweetalert2.min.js",
|
||||
"sweetalert2.css",
|
||||
"sweetalert2.min.css"
|
||||
]
|
||||
},
|
||||
{
|
||||
"library": "malihu-custom-scrollbar-plugin@3.1.5",
|
||||
"destination": "wwwroot/lib/scrollbar/",
|
||||
"files": [
|
||||
"jquery.mCustomScrollbar.concat.min.js",
|
||||
"jquery.mCustomScrollbar.css",
|
||||
"jquery.mCustomScrollbar.js",
|
||||
"jquery.mCustomScrollbar.min.css",
|
||||
"jquery.mCustomScrollbar.min.js",
|
||||
"jquery.mCustomScrollbar.min.js.map",
|
||||
"mCSB_buttons.png"
|
||||
]
|
||||
},
|
||||
{
|
||||
"library": "smalot-bootstrap-datetimepicker@2.4.4",
|
||||
"destination": "wwwroot/lib/datetimepicker",
|
||||
|
@ -120,54 +75,6 @@
|
|||
"js/bootstrap-datetimepicker.js",
|
||||
"js/bootstrap-datetimepicker.min.js"
|
||||
]
|
||||
},
|
||||
{
|
||||
"provider": "unpkg",
|
||||
"library": "dcjqaccordion@2.7.1",
|
||||
"destination": "wwwroot/lib/dcjqaccordion/",
|
||||
"files": [
|
||||
"js/jquery.dcjqaccordion.2.7.js",
|
||||
"js/jquery.dcjqaccordion.2.7.min.js",
|
||||
"js/jquery.cookie.js"
|
||||
]
|
||||
},
|
||||
{
|
||||
"provider": "cdnjs",
|
||||
"library": "countup.js@1.9.3",
|
||||
"destination": "wwwroot/lib/countUp/",
|
||||
"files": [
|
||||
"countUp.js",
|
||||
"countUp.min.js"
|
||||
]
|
||||
},
|
||||
{
|
||||
"provider": "cdnjs",
|
||||
"library": "radialIndicator@1.3.1",
|
||||
"destination": "wwwroot/lib/radiaIndicator",
|
||||
"files": [
|
||||
"radialIndicator.js",
|
||||
"radialIndicator.min.js"
|
||||
]
|
||||
},
|
||||
{
|
||||
"provider": "unpkg"
|
||||
"library": "highcharts@6.2.0",
|
||||
"destination": "wwwroot/lib/highcharts/",
|
||||
"files": [
|
||||
"highcharts.js",
|
||||
"highcharts.src.js"
|
||||
]
|
||||
},
|
||||
{
|
||||
"provider": "unpkg",
|
||||
"library": "bootstrap-toggle@2.2.2",
|
||||
"destination": "wwwroot/lib/bootstrap-toggle/",
|
||||
"files": [
|
||||
"css/bootstrap-toggle.css",
|
||||
"css/bootstrap-toggle.min.css",
|
||||
"js/bootstrap-toggle.js",
|
||||
"js/bootstrap-toggle.min.js"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
|
@ -17,7 +17,6 @@ namespace Bootstrap.Admin.Api
|
|||
Assert.NotNull(cates);
|
||||
cates = await Client.GetAsJsonAsync<AnalyseData>("?logType=trace");
|
||||
Assert.NotNull(cates);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
using UnitTest;
|
||||
using Xunit;
|
||||
|
||||
namespace Bootstrap.DataAccess
|
||||
namespace Bootstrap.DataAccess.SqlServer
|
||||
{
|
||||
[Collection("SQLServerContext")]
|
||||
public class RollbackTest
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
using Xunit;
|
||||
using System.Linq;
|
||||
using Xunit;
|
||||
|
||||
namespace Bootstrap.DataAccess.SQLite
|
||||
{
|
||||
|
@ -6,5 +7,21 @@ namespace Bootstrap.DataAccess.SQLite
|
|||
public class DictsTest : SqlServer.DictsTest
|
||||
{
|
||||
protected override string DatabaseName { get; set; } = "SQLite";
|
||||
|
||||
[Fact]
|
||||
public void RetrieveHomeUrl_Ok()
|
||||
{
|
||||
Assert.Equal("~/Home/Index", DictHelper.RetrieveHomeUrl("Admin", ""));
|
||||
|
||||
var dict = DictHelper.RetrieveDicts().FirstOrDefault(d => d.Category == "系统设置" && d.Name == "默认应用程序");
|
||||
Assert.NotNull(dict);
|
||||
dict.Code = "1";
|
||||
DictHelper.Save(dict);
|
||||
Assert.Equal("http://localhost:49185/", DictHelper.RetrieveHomeUrl("Admin", "BA"));
|
||||
dict.Code = "0";
|
||||
DictHelper.Save(dict);
|
||||
Assert.Equal("~/Home/Index", DictHelper.RetrieveHomeUrl("Admin", "BA"));
|
||||
Assert.Equal("http://localhost:49185/", DictHelper.RetrieveHomeUrl("Admin", "Demo"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,7 +4,7 @@ using Longbow.Web;
|
|||
using System.Linq;
|
||||
using Xunit;
|
||||
|
||||
namespace Bootstrap.DataAccess
|
||||
namespace Bootstrap.DataAccess.SqlServer
|
||||
{
|
||||
[Collection("SQLServerContext")]
|
||||
[AutoRollback]
|
||||
|
@ -145,8 +145,8 @@ namespace Bootstrap.DataAccess
|
|||
[Fact]
|
||||
public void RetrieveHomeUrl_Ok()
|
||||
{
|
||||
Assert.Equal("~/Home/Index", DictHelper.RetrieveHomeUrl("BA"));
|
||||
var url = DictHelper.RetrieveHomeUrl("Demo");
|
||||
Assert.Equal("~/Home/Index", DictHelper.RetrieveHomeUrl("Admin", "BA"));
|
||||
var url = DictHelper.RetrieveHomeUrl("Admin", "Demo");
|
||||
Assert.Equal("http://localhost:49185/", url);
|
||||
|
||||
// INSERT INTO [Dicts] ([Category], [Name], [Code], [Define]) VALUES ('应用首页', 2, 'http://localhost:49185/', 0);
|
||||
|
@ -154,11 +154,11 @@ namespace Bootstrap.DataAccess
|
|||
url = dict.Code;
|
||||
dict.Code = "BA";
|
||||
Assert.True(DictHelper.Save(dict));
|
||||
Assert.Equal("BA", DictHelper.RetrieveHomeUrl("Demo"));
|
||||
Assert.Equal("BA", DictHelper.RetrieveHomeUrl("Admin", "Demo"));
|
||||
|
||||
dict.Code = url;
|
||||
Assert.True(DictHelper.Save(dict));
|
||||
Assert.Equal(url, DictHelper.RetrieveHomeUrl("Demo"));
|
||||
Assert.Equal(url, DictHelper.RetrieveHomeUrl("Admin", "Demo"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,11 +7,11 @@
|
|||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="coverlet.msbuild" Version="2.7.0">
|
||||
<PackageReference Include="coverlet.msbuild" Version="2.8.0">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="coverlet.collector" Version="1.1.0">
|
||||
<PackageReference Include="coverlet.collector" Version="1.2.0">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
|
|
Loading…
Reference in New Issue