!73 增加功能:网站设置增加前台站点配置功能

Merge pull request !73 from Argo/dev-pathbase
This commit is contained in:
Argo 2020-02-27 15:53:03 +08:00 committed by Gitee
commit fe30ec09e8
18 changed files with 336 additions and 48 deletions

View File

@ -158,25 +158,25 @@
{ {
"Category": "测试平台", "Category": "测试平台",
"Name": "个人中心地址", "Name": "个人中心地址",
"Code": "http://localhost:50852/Admin/Profiles", "Code": "/Admin/Profiles",
"Define": NumberInt(1) "Define": NumberInt(1)
}, },
{ {
"Category": "测试平台", "Category": "测试平台",
"Name": "系统设置地址", "Name": "系统设置地址",
"Code": "http://localhost:50852/Admin/Index", "Code": "/Admin/Index",
"Define": NumberInt(1) "Define": NumberInt(1)
}, },
{ {
"Category": "测试平台", "Category": "测试平台",
"Name": "系统通知地址", "Name": "系统通知地址",
"Code": "http://localhost:50852/Admin/Notifications", "Code": "/Admin/Notifications",
"Define": NumberInt(1) "Define": NumberInt(1)
}, },
{ {
"Category": "应用首页", "Category": "应用首页",
"Name": "Demo", "Name": "Demo",
"Code": "http://localhost:49185/", "Code": "http://localhost:49185",
"Define": NumberInt(0) "Define": NumberInt(0)
}, },
{ {
@ -324,16 +324,22 @@
"Code": "0", "Code": "0",
"Define": NumberInt(0) "Define": NumberInt(0)
}, },
{
"Category": "网站设置",
"Name": "后台地址",
"Code": "http://localhost:50852",
"Define": NumberInt(0)
},
{ {
"Category": "测试平台", "Category": "测试平台",
"Name": "favicon", "Name": "favicon",
"Code": "http://localhost:49185/favicon.ico", "Code": "/favicon.ico",
"Define": NumberInt(1) "Define": NumberInt(1)
}, },
{ {
"Category": "测试平台", "Category": "测试平台",
"Name": "网站图标", "Name": "网站图标",
"Code": "http://localhost:49185/favicon.png", "Code": "/favicon.png",
"Define": NumberInt(1) "Define": NumberInt(1)
} }
]; ];

View File

@ -69,6 +69,8 @@ INSERT INTO Dicts (Category, Name, Code, Define) VALUES ('网站设置', '验证
INSERT INTO Dicts (Category, Name, Code, Define) VALUES ('网站设置', '默认应用程序', '0', 0); INSERT INTO Dicts (Category, Name, Code, Define) VALUES ('网站设置', '默认应用程序', '0', 0);
INSERT INTO Dicts (Category, Name, Code, Define) VALUES ('网站设置', '后台地址', 'http://localhost:50852', 0);
DELETE FROM Navigations Where Category = '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, '后台管理', 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'); INSERT INTO Navigations (ParentId, Name, `Order`, Icon, Url, Category) VALUES (0, '个人中心', 20, 'fa fa-suitcase', '~/Admin/Profiles', '0');
@ -170,16 +172,16 @@ INSERT INTO NavigationRole (NavigationID, RoleID) SELECT n.Id, r.Id FROM Navigat
Delete From Dicts Where Category = '应用程序' and Code = 'Demo'; Delete From Dicts Where Category = '应用程序' and Code = 'Demo';
INSERT INTO Dicts (Category, Name, Code, Define) VALUES ('应用程序', '测试平台', 'Demo', 0); INSERT INTO Dicts (Category, Name, Code, Define) VALUES ('应用程序', '测试平台', 'Demo', 0);
Delete From Dicts Where Category = '应用首页' and Name = 'Demo'; Delete From Dicts Where Category = '应用首页' and Name = 'Demo';
INSERT INTO Dicts (Category, Name, Code, Define) VALUES ('应用首页', 'Demo', 'http://localhost:49185/', 0); INSERT INTO Dicts (Category, Name, Code, Define) VALUES ('应用首页', 'Demo', 'http://localhost:49185', 0);
Delete From Dicts Where Category = '测试平台'; Delete From Dicts Where Category = '测试平台';
Insert into Dicts (Category, Name, Code, Define) values ('测试平台', '网站标题', '前台演示系统', 1); Insert into Dicts (Category, Name, Code, Define) values ('测试平台', '网站标题', '前台演示系统', 1);
Insert into Dicts (Category, Name, Code, Define) values ('测试平台', '网站页脚', '前台演示程序后台权限管理框架', 1); Insert into Dicts (Category, Name, Code, Define) values ('测试平台', '网站页脚', '前台演示程序后台权限管理框架', 1);
Insert into Dicts (Category, Name, Code, Define) values ('测试平台', '个人中心地址', 'http://localhost:50852/Admin/Profiles', 1); Insert into Dicts (Category, Name, Code, Define) values ('测试平台', '个人中心地址', '/Admin/Profiles', 1);
Insert into Dicts (Category, Name, Code, Define) values ('测试平台', '系统设置地址', 'http://localhost:50852/Admin/Index', 1); Insert into Dicts (Category, Name, Code, Define) values ('测试平台', '系统设置地址', '/Admin/Index', 1);
Insert into Dicts (Category, Name, Code, Define) values ('测试平台', '系统通知地址', 'http://localhost:50852/Admin/Notifications', 1); Insert into Dicts (Category, Name, Code, Define) values ('测试平台', '系统通知地址', '/Admin/Notifications', 1);
INSERT INTO Dicts (Category, Name, Code, Define) VALUES ('测试平台', 'favicon', 'http://localhost:49185/favicon.ico', 1); INSERT INTO Dicts (Category, Name, Code, Define) VALUES ('测试平台', 'favicon', '/favicon.ico', 1);
INSERT INTO Dicts (Category, Name, Code, Define) VALUES ('测试平台', '网站图标', 'http://localhost:49185/favicon.png', 1); INSERT INTO Dicts (Category, Name, Code, Define) VALUES ('测试平台', '网站图标', '/favicon.png', 1);
Delete from Navigations where Application = 'Demo'; Delete from Navigations where Application = 'Demo';
INSERT into Navigations (ParentId, Name, `Order`, Icon, Url, Category, Application) VALUES (0, '首页', 10, 'fa fa-fa', '~/Home/Index', '1', 'Demo'); INSERT into Navigations (ParentId, Name, `Order`, Icon, Url, Category, Application) VALUES (0, '首页', 10, 'fa fa-fa', '~/Home/Index', '1', 'Demo');

View File

@ -69,6 +69,8 @@ INSERT INTO Dicts (Id, Category, Name, Code, Define) Values (SEQ_DICTS_ID.NEXTVA
INSERT INTO Dicts (Id, Category, Name, Code, Define) Values (SEQ_DICTS_ID.NEXTVAL, '网站设置', '默认应用程序', '0', 0); INSERT INTO Dicts (Id, Category, Name, Code, Define) Values (SEQ_DICTS_ID.NEXTVAL, '网站设置', '默认应用程序', '0', 0);
INSERT INTO Dicts (Id, Category, Name, Code, Define) Values (SEQ_DICTS_ID.NEXTVAL, '网站设置', '后台地址', 'http://localhost:50852', 0);
DELETE FROM Navigations Where Category = '0'; DELETE FROM Navigations Where Category = '0';
INSERT INTO Navigations (Id, ParentId, Name, "ORDER", Icon, Url, Category) Values (SEQ_NAVIGATIONS_ID.NEXTVAL, 0, '后台管理', 10, 'fa fa-gear', '~/Admin/Index', '0'); INSERT INTO Navigations (Id, ParentId, Name, "ORDER", Icon, Url, Category) Values (SEQ_NAVIGATIONS_ID.NEXTVAL, 0, '后台管理', 10, 'fa fa-gear', '~/Admin/Index', '0');
INSERT INTO Navigations (Id, ParentId, Name, "ORDER", Icon, Url, Category) Values (SEQ_NAVIGATIONS_ID.NEXTVAL, 0, '个人中心', 20, 'fa fa-suitcase', '~/Admin/Profiles', '0'); INSERT INTO Navigations (Id, ParentId, Name, "ORDER", Icon, Url, Category) Values (SEQ_NAVIGATIONS_ID.NEXTVAL, 0, '个人中心', 20, 'fa fa-suitcase', '~/Admin/Profiles', '0');
@ -170,16 +172,16 @@ INSERT INTO NavigationRole (Id, NavigationID, RoleID) SELECT SEQ_NAVIGATIONROLE_
Delete From Dicts Where Category = '应用程序' and Code = 'Demo'; Delete From Dicts Where Category = '应用程序' and Code = 'Demo';
INSERT INTO Dicts (Id, Category, Name, Code, Define) VALUES (SEQ_DICTS_ID.NEXTVAL, '应用程序', '测试平台', 'Demo', 0); INSERT INTO Dicts (Id, Category, Name, Code, Define) VALUES (SEQ_DICTS_ID.NEXTVAL, '应用程序', '测试平台', 'Demo', 0);
Delete From Dicts Where Category = '应用首页' and Name = 'Demo'; Delete From Dicts Where Category = '应用首页' and Name = 'Demo';
INSERT INTO Dicts (Id, Category, Name, Code, Define) VALUES (SEQ_DICTS_ID.NEXTVAL, '应用首页', 'Demo', 'http://localhost:49185/', 0); INSERT INTO Dicts (Id, Category, Name, Code, Define) VALUES (SEQ_DICTS_ID.NEXTVAL, '应用首页', 'Demo', 'http://localhost:49185', 0);
Delete From Dicts Where Category = '测试平台'; Delete From Dicts Where Category = '测试平台';
Insert into Dicts (Id, Category, Name, Code, Define) values (SEQ_DICTS_ID.NEXTVAL, '测试平台', '网站标题', '前台演示系统', 1); Insert into Dicts (Id, Category, Name, Code, Define) values (SEQ_DICTS_ID.NEXTVAL, '测试平台', '网站标题', '前台演示系统', 1);
Insert into Dicts (Id, Category, Name, Code, Define) values (SEQ_DICTS_ID.NEXTVAL, '测试平台', '网站页脚', '前台演示程序后台权限管理框架', 1); Insert into Dicts (Id, Category, Name, Code, Define) values (SEQ_DICTS_ID.NEXTVAL, '测试平台', '网站页脚', '前台演示程序后台权限管理框架', 1);
Insert into Dicts (Id, Category, Name, Code, Define) values (SEQ_DICTS_ID.NEXTVAL, '测试平台', '个人中心地址', 'http://localhost:50852/Admin/Profiles', 1); Insert into Dicts (Id, Category, Name, Code, Define) values (SEQ_DICTS_ID.NEXTVAL, '测试平台', '个人中心地址', '/Admin/Profiles', 1);
Insert into Dicts (Id, Category, Name, Code, Define) values (SEQ_DICTS_ID.NEXTVAL, '测试平台', '系统设置地址', 'http://localhost:50852/Admin/Index', 1); Insert into Dicts (Id, Category, Name, Code, Define) values (SEQ_DICTS_ID.NEXTVAL, '测试平台', '系统设置地址', '/Admin/Index', 1);
Insert into Dicts (Id, Category, Name, Code, Define) values (SEQ_DICTS_ID.NEXTVAL, '测试平台', '系统通知地址', 'http://localhost:50852/Admin/Notifications', 1); Insert into Dicts (Id, Category, Name, Code, Define) values (SEQ_DICTS_ID.NEXTVAL, '测试平台', '系统通知地址', '/Admin/Notifications', 1);
INSERT INTO Dicts (Id, Category, Name, Code, Define) VALUES (SEQ_DICTS_ID.NEXTVAL, '测试平台', 'favicon', 'http://localhost:49185/favicon.ico', 1); INSERT INTO Dicts (Id, Category, Name, Code, Define) VALUES (SEQ_DICTS_ID.NEXTVAL, '测试平台', 'favicon', '/favicon.ico', 1);
INSERT INTO Dicts (Id, Category, Name, Code, Define) VALUES (SEQ_DICTS_ID.NEXTVAL, '测试平台', '网站图标', 'http://localhost:49185/favicon.png', 1); INSERT INTO Dicts (Id, Category, Name, Code, Define) VALUES (SEQ_DICTS_ID.NEXTVAL, '测试平台', '网站图标', '/favicon.png', 1);
Delete from Navigations where Application = 'Demo'; Delete from Navigations where Application = 'Demo';
INSERT into Navigations (Id, ParentId, Name, "ORDER", Icon, Url, Category, Application) VALUES (SEQ_NAVIGATIONS_ID.NEXTVAl, 0, '首页', 10, 'fa fa-fa', '~/Home/Index', '1', 'Demo'); INSERT into Navigations (Id, ParentId, Name, "ORDER", Icon, Url, Category, Application) VALUES (SEQ_NAVIGATIONS_ID.NEXTVAl, 0, '首页', 10, 'fa fa-fa', '~/Home/Index', '1', 'Demo');

View File

@ -70,6 +70,8 @@ INSERT INTO [Dicts] ([Category], [Name], [Code], [Define]) VALUES ('网站设置
INSERT INTO [Dicts] ([Category], [Name], [Code], [Define]) VALUES ('网站设置', '默认应用程序', '0', 0); INSERT INTO [Dicts] ([Category], [Name], [Code], [Define]) VALUES ('网站设置', '默认应用程序', '0', 0);
INSERT INTO [Dicts] ([Category], [Name], [Code], [Define]) VALUES ('网站设置', '后台地址', 'http://localhost:50852', 0);
DELETE FROM Navigations Where Category = '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, '后台管理', 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'); INSERT INTO [Navigations] ([ParentId], [Name], [Order], [Icon], [Url], [Category]) VALUES (0, '个人中心', 20, 'fa fa-suitcase', '~/Admin/Profiles', '0');
@ -171,16 +173,16 @@ INSERT INTO NavigationRole (NavigationID, RoleID) SELECT n.Id, r.Id FROM Navigat
Delete From [Dicts] Where Category = '应用程序' and Code = 'Demo'; Delete From [Dicts] Where Category = '应用程序' and Code = 'Demo';
INSERT INTO [Dicts] ([Category], [Name], [Code], [Define]) VALUES ('应用程序', '测试平台', 'Demo', 0); INSERT INTO [Dicts] ([Category], [Name], [Code], [Define]) VALUES ('应用程序', '测试平台', 'Demo', 0);
Delete From [Dicts] Where Category = '应用首页' and Name = 'Demo'; Delete From [Dicts] Where Category = '应用首页' and Name = 'Demo';
INSERT INTO [Dicts] ([Category], [Name], [Code], [Define]) VALUES ('应用首页', 'Demo', 'http://localhost:49185/', 0); INSERT INTO [Dicts] ([Category], [Name], [Code], [Define]) VALUES ('应用首页', 'Demo', 'http://localhost:49185', 0);
Delete From [Dicts] Where Category = '测试平台'; Delete From [Dicts] Where Category = '测试平台';
Insert into Dicts (Category, [Name], Code, Define) values ('测试平台', '网站标题', '前台演示系统', 1); Insert into Dicts (Category, [Name], Code, Define) values ('测试平台', '网站标题', '前台演示系统', 1);
Insert into Dicts (Category, [Name], Code, Define) values ('测试平台', '网站页脚', '前台演示程序后台权限管理框架', 1); Insert into Dicts (Category, [Name], Code, Define) values ('测试平台', '网站页脚', '前台演示程序后台权限管理框架', 1);
Insert into Dicts (Category, [Name], Code, Define) values ('测试平台', '个人中心地址', 'http://localhost:50852/Admin/Profiles', 1); Insert into Dicts (Category, [Name], Code, Define) values ('测试平台', '个人中心地址', '/Admin/Profiles', 1);
Insert into Dicts (Category, [Name], Code, Define) values ('测试平台', '系统设置地址', 'http://localhost:50852/Admin/Index', 1); Insert into Dicts (Category, [Name], Code, Define) values ('测试平台', '系统设置地址', '/Admin/Index', 1);
Insert into Dicts (Category, [Name], Code, Define) values ('测试平台', '系统通知地址', 'http://localhost:50852/Admin/Notifications', 1); Insert into Dicts (Category, [Name], Code, Define) values ('测试平台', '系统通知地址', '/Admin/Notifications', 1);
INSERT INTO Dicts (Category, [Name], Code, Define) VALUES ('测试平台', 'favicon', 'http://localhost:49185/favicon.ico', 1); INSERT INTO Dicts (Category, [Name], Code, Define) VALUES ('测试平台', 'favicon', '/favicon.ico', 1);
INSERT INTO Dicts (Category, [Name], Code, Define) VALUES ('测试平台', '网站图标', 'http://localhost:49185/favicon.png', 1); INSERT INTO Dicts (Category, [Name], Code, Define) VALUES ('测试平台', '网站图标', '/favicon.png', 1);
Delete from [Navigations] where Application = 'Demo'; Delete from [Navigations] where Application = 'Demo';
INSERT into [Navigations] ([ParentId], [Name], [Order], [Icon], [Url], [Category], [Application]) VALUES (0, '首页', 10, 'fa fa-fa', '~/Home/Index', '1', 'Demo'); INSERT into [Navigations] ([ParentId], [Name], [Order], [Icon], [Url], [Category], [Application]) VALUES (0, '首页', 10, 'fa fa-fa', '~/Home/Index', '1', 'Demo');

View File

@ -74,6 +74,8 @@ INSERT [dbo].[Dicts] ([Category], [Name], [Code], [Define]) VALUES (N'网站设
INSERT [dbo].[Dicts] ([Category], [Name], [Code], [Define]) VALUES (N'网站设置', N'默认应用程序', '0', 0) INSERT [dbo].[Dicts] ([Category], [Name], [Code], [Define]) VALUES (N'网站设置', N'默认应用程序', '0', 0)
INSERT [dbo].[Dicts] ([Category], [Name], [Code], [Define]) VALUES (N'网站设置', N'后台地址', 'http://localhost:50852', 0)
DELETE FROM Navigations Where Category = N'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'后台管理', 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') INSERT [Navigations] ([ParentId], [Name], [Order], [Icon], [Url], [Category]) VALUES (0, N'个人中心', 20, N'fa fa-suitcase', N'~/Admin/Profiles', N'0')
@ -179,16 +181,16 @@ set @AppName = N'测试平台'
Delete From [dbo].[Dicts] Where Category = N'应用程序' and Code = @AppId Delete From [dbo].[Dicts] Where Category = N'应用程序' and Code = @AppId
INSERT [dbo].[Dicts] ([Category], [Name], [Code], [Define]) VALUES (N'应用程序', @AppName, @AppId, 0) INSERT [dbo].[Dicts] ([Category], [Name], [Code], [Define]) VALUES (N'应用程序', @AppName, @AppId, 0)
Delete From [Dicts] Where Category = '应用首页' and Name = @AppId Delete From [Dicts] Where Category = '应用首页' and Name = @AppId
INSERT [dbo].[Dicts] ([Category], [Name], [Code], [Define]) VALUES (N'应用首页', @AppId, 'http://localhost:49185/', 0) INSERT [dbo].[Dicts] ([Category], [Name], [Code], [Define]) VALUES (N'应用首页', @AppId, 'http://localhost:49185', 0)
Delete From [dbo].[Dicts] Where Category = @AppName Delete From [dbo].[Dicts] Where Category = @AppName
Insert Dicts (Category, Name, Code, Define) values (@AppName, N'网站标题', N'前台演示程序', 1); Insert Dicts (Category, Name, Code, Define) values (@AppName, N'网站标题', N'前台演示程序', 1);
Insert Dicts (Category, Name, Code, Define) values (@AppName, N'网站页脚', N'前台演示程序后台权限管理框架', 1); Insert Dicts (Category, Name, Code, Define) values (@AppName, N'网站页脚', N'前台演示程序后台权限管理框架', 1);
Insert Dicts (Category, Name, Code, Define) values (@AppName, N'个人中心地址', N'http://localhost:50852/Admin/Profiles', 1); Insert Dicts (Category, Name, Code, Define) values (@AppName, N'个人中心地址', N'/Admin/Profiles', 1);
Insert Dicts (Category, Name, Code, Define) values (@AppName, N'系统设置地址', N'http://localhost:50852/Admin/Index', 1); Insert Dicts (Category, Name, Code, Define) values (@AppName, N'系统设置地址', N'/Admin/Index', 1);
Insert Dicts (Category, Name, Code, Define) values (@AppName, N'系统通知地址', N'http://localhost:50852/Admin/Notifications', 1); Insert Dicts (Category, Name, Code, Define) values (@AppName, N'系统通知地址', N'/Admin/Notifications', 1);
INSERT Dicts (Category, Name, Code, Define) VALUES (@AppName, N'favicon', N'http://localhost:49185/favicon.ico', 1); INSERT Dicts (Category, Name, Code, Define) VALUES (@AppName, N'favicon', N'/favicon.ico', 1);
INSERT Dicts (Category, Name, Code, Define) VALUES (@AppName, N'网站图标', 'http://localhost:49185/favicon.png', 1); INSERT Dicts (Category, Name, Code, Define) VALUES (@AppName, N'网站图标', '/favicon.png', 1);
-- 菜单 -- 菜单
DELETE FROM Navigations Where [Application] = @AppId DELETE FROM Navigations Where [Application] = @AppId

View File

@ -10,7 +10,7 @@ namespace Bootstrap.Admin.Controllers.Api
/// 健康检查控制器 /// 健康检查控制器
/// </summary> /// </summary>
[Route("api/[controller]")] [Route("api/[controller]")]
[Authorize] [AllowAnonymous]
[ApiController] [ApiController]
public class HealthsController : ControllerBase public class HealthsController : ControllerBase
{ {

View File

@ -5,6 +5,7 @@ using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Filters; using Microsoft.AspNetCore.Mvc.Filters;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq;
namespace Bootstrap.Admin.Controllers.Api namespace Bootstrap.Admin.Controllers.Api
{ {
@ -29,13 +30,31 @@ namespace Bootstrap.Admin.Controllers.Api
/// 保存网站是否为演示系统时调用 /// 保存网站是否为演示系统时调用
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
[HttpPut("{id}")] [HttpPost("{id}")]
public bool Put(string id, [FromBody]BootstrapDict dict) => DictHelper.UpdateSystemModel(dict.Code == "1", dict.Name); public bool Post(string id, [FromBody]BootstrapDict dict) => id switch
{
"Demo" => DictHelper.UpdateSystemModel(dict.Code == "1", dict.Name),
"AppPath" => DictHelper.SaveAppSettings(dict),
_ => false
};
/// <summary> /// <summary>
/// 获取网站缓存站点集合 /// 获取网站缓存站点集合
/// </summary> /// </summary>
[HttpGet] [HttpGet]
public IEnumerable<ICacheCorsItem> Get() => CacheManager.CorsSites; public IEnumerable<ICacheCorsItem> Get() => CacheManager.CorsSites;
/// <summary>
/// 删除指定键值的前台应用配置信息
/// </summary>
/// <param name="id"></param>
/// <param name="dict"></param>
/// <returns></returns>
[HttpDelete("{id}")]
public bool Delete(string id, [FromBody]BootstrapDict dict) => id switch
{
"AppPath" => DictHelper.DeleteApp(dict),
_ => false
};
} }
} }

View File

@ -102,6 +102,8 @@ namespace Bootstrap.Admin.HealthChecks
{ {
data.Add("Exception", error.Message); data.Add("Exception", error.Message);
if (error.Message.Contains("Could not load", StringComparison.OrdinalIgnoreCase)) data.Add("解决办法", "Nuget 引用相对应的数据库驱动 dll");
// UNDONE: Json 序列化循环引用导致异常 NET 5.0 修复此问题 // UNDONE: Json 序列化循环引用导致异常 NET 5.0 修复此问题
// 目前使用 new Exception() 临时解决 // 目前使用 new Exception() 临时解决
return Task.FromResult(HealthCheckResult.Unhealthy("Error", new Exception(error.Message), data)); return Task.FromResult(HealthCheckResult.Unhealthy("Error", new Exception(error.Message), data));

View File

@ -1,7 +1,9 @@
using Bootstrap.DataAccess; using Bootstrap.DataAccess;
using Bootstrap.Security; using Bootstrap.Security;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq;
namespace Bootstrap.Admin.Models namespace Bootstrap.Admin.Models
{ {
@ -28,6 +30,14 @@ namespace Bootstrap.Admin.Models
CookiePeriod = DictHelper.RetrieveCookieExpiresPeriod(); CookiePeriod = DictHelper.RetrieveCookieExpiresPeriod();
IPCachePeriod = DictHelper.RetrieveLocaleIPSvrCachePeriod(); IPCachePeriod = DictHelper.RetrieveLocaleIPSvrCachePeriod();
EnableDemo = DictHelper.RetrieveSystemModel(); EnableDemo = DictHelper.RetrieveSystemModel();
AdminPathBase = DictHelper.RetrievePathBase();
var dicts = DictHelper.RetrieveDicts();
Apps = DictHelper.RetrieveApps().Where(d => !d.Key.Equals("BA", StringComparison.OrdinalIgnoreCase)).Select(k =>
{
var url = dicts.FirstOrDefault(d => d.Category == "应用首页" && d.Name == k.Key && d.Define == 0)?.Code ?? "未设置";
return (k.Key, k.Value, url);
});
} }
/// <summary> /// <summary>
@ -89,5 +99,15 @@ namespace Bootstrap.Admin.Models
/// 获得/设置 是否为演示系统 /// 获得/设置 是否为演示系统
/// </summary> /// </summary>
public bool EnableDemo { get; set; } public bool EnableDemo { get; set; }
/// <summary>
/// 获得/设置 后台管理网站地址
/// </summary>
public string AdminPathBase { get; set; }
/// <summary>
/// 获得/设置 系统应用程序集合
/// </summary>
public IEnumerable<(string Key, string Name, string Url)> Apps { get; set; }
} }
} }

View File

@ -25,11 +25,52 @@
<script src="~/lib/longbow/longbow.validate.js"></script> <script src="~/lib/longbow/longbow.validate.js"></script>
<script src="~/js/settings.js" asp-append-version="true"></script> <script src="~/js/settings.js" asp-append-version="true"></script>
} }
@section modal {
<div class="modal fade" id="dialogNew" tabindex="-1" role="dialog" data-backdrop="static" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog modal-dialog-centered modal-lg" role="document">
<div class="modal-content" data-toggle="LgbValidate" data-valid-button="[data-method='saveNewApp']" data-valid-modal="#dialogNew">
<div class="modal-header">
<h5 class="modal-title" id="myModalLabel">前台应用设置</h5>
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
</div>
<div class="modal-body">
<form class="form-inline">
<div class="row">
<div class="form-group col-sm-6">
<label class="control-label" for="appKey">应用ID</label>
<input type="text" class="form-control" id="appKey" placeholder="不可为空50字以内" maxlength="50" data-valid="true" />
</div>
<div class="form-group col-sm-6">
<input type="hidden" id="roleID" />
<label class="control-label" for="appName">应用名称</label>
<input type="text" class="form-control" id="appName" placeholder="不可为空50字以内" maxlength="50" data-valid="true" />
</div>
<div class="form-group col-sm-12">
<label class="control-label" for="appUrl">应用首页</label>
<input type="text" class="form-control flex-fill" id="appUrl" placeholder="不可为空2000字以内" maxlength="2000" data-valid="true" />
</div>
</div>
</form>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">
<i class="fa fa-times"></i>
<span>关闭</span>
</button>
<button type="button" class="btn btn-primary" data-method="saveNewApp">
<i class="fa fa-save"></i>
<span>保存</span>
</button>
</div>
</div>
</div>
</div>
}
<div class="card" asp-auth="saveTitle"> <div class="card" asp-auth="saveTitle">
<div class="card-header">系统名称设置</div> <div class="card-header">网站名称设置</div>
<div class="card-body" data-toggle="LgbValidate" data-valid-button="#sysSave"> <div class="card-body" data-toggle="LgbValidate" data-valid-button="[data-method='title']">
<div class="alert alert-danger" role="alert" asp-condition="@Model.IsDemo"> <div class="alert alert-danger" role="alert" asp-condition="@Model.IsDemo">
<span>演示系统禁止更改系统名称</span> <span>演示系统禁止更改网站名称</span>
</div> </div>
<div class="form-group"> <div class="form-group">
<div class="input-group"> <div class="input-group">
@ -42,10 +83,10 @@
</div> </div>
</div> </div>
<div class="card" asp-auth="saveFooter"> <div class="card" asp-auth="saveFooter">
<div class="card-header">页脚设置</div> <div class="card-header">网站页脚设置</div>
<div class="card-body" data-toggle="LgbValidate" data-valid-button="#footSave"> <div class="card-body" data-toggle="LgbValidate" data-valid-button="[data-method='footer']">
<div class="alert alert-danger" role="alert" asp-condition="@Model.IsDemo"> <div class="alert alert-danger" role="alert" asp-condition="@Model.IsDemo">
<span>演示系统禁止更改页脚</span> <span>演示系统禁止更改网站页脚</span>
</div> </div>
<div class="form-group"> <div class="form-group">
<div class="input-group"> <div class="input-group">
@ -57,6 +98,22 @@
</div> </div>
</div> </div>
</div> </div>
<div class="card">
<div class="card-header"><label class="control-label" data-toggle="lgbinfo" data-content="此功能给前台网站拼接后台功能菜单时使用">后台管理地址设置</label></div>
<div class="card-body" data-toggle="LgbValidate" data-valid-button="[data-method='appPath']">
<div class="alert alert-danger" role="alert" asp-condition="@Model.IsDemo">
<span>演示系统禁止更改后台管理地址</span>
</div>
<div class="form-group">
<div class="input-group">
<input type="text" class="form-control flex-fill" id="sysAppPath" placeholder="请输入后台管理地址2000字以内" value="@Model.AdminPathBase" maxlength="2000" data-valid="true" />
<div class="input-group-append" asp-condition="!@Model.IsDemo">
<button class="btn btn-secondary" type="button" data-method="appPath">保存</button>
</div>
</div>
</div>
</div>
</div>
<div class="card" asp-auth="saveTheme"> <div class="card" asp-auth="saveTheme">
<div class="card-header">网站样式</div> <div class="card-header">网站样式</div>
<div class="card-body"> <div class="card-body">
@ -152,7 +209,7 @@
<div class="card-body"> <div class="card-body">
<div class="form-inline"> <div class="form-inline">
<div class="row"> <div class="row">
<div class="form-group col-6"> <div class="form-group col-12">
<label class="control-label" data-toggle="lgbinfo" data-content="开启此功能后登录时默认导航到第一个已授权的前台应用" for="defaultApp">默认应用</label> <label class="control-label" data-toggle="lgbinfo" data-content="开启此功能后登录时默认导航到第一个已授权的前台应用" 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="关闭" /> <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>
@ -163,6 +220,34 @@
</div> </div>
</div> </div>
</div> </div>
<div class="card" asp-auth="app">
<div class="card-header">前台应用设置</div>
<div class="card-body">
<div class="alert alert-danger" role="alert" asp-condition="@Model.IsDemo">
<span>演示系统禁止更改前台应用设置</span>
</div>
<div class="form-inline">
<div class="row" id="appList">
@foreach (var app in Model.Apps)
{
<div class="form-group col-12" data-toggle="LgbValidate" data-valid-button="[data-method='saveApp']">
<label class="control-label" for="@app.Key">@app.Name</label>
<div class="input-group flex-fill">
<input id="@app.Key" class="form-control" placeholder="请输入应用首页2000字以内" value="@app.Url" maxlength="2000" data-valid="true" />
<div class="input-group-append" asp-condition="@(!Model.IsDemo)">
<button class="btn btn-danger" type="button" data-key="@app.Key" data-method="delApp"><i class="fa fa-trash-o"></i><span>删除</span></button>
<button class="btn btn-secondary" type="button" data-key="@app.Key" data-method="saveApp"><i class="fa fa-save"></i><span>保存</span></button>
</div>
</div>
</div>
}
</div>
</div>
<div class="modal-footer text-right" asp-condition="@(!Model.IsDemo)">
<button class="btn btn-secondary" type="button" data-method="addApp"><i class="fa fa-plus"></i><span>新增</span></button>
</div>
</div>
</div>
<div class="card" asp-auth="blazor"> <div class="card" asp-auth="blazor">
<div class="card-header">网站设置</div> <div class="card-header">网站设置</div>
<div class="card-body"> <div class="card-body">

View File

@ -76,6 +76,10 @@ body.trans-mute * {
margin-bottom: 15px; margin-bottom: 15px;
} }
.card-header label.control-label {
margin-bottom: 0;
}
.modal-body .dd { .modal-body .dd {
margin-bottom: 15px; margin-bottom: 15px;
} }

View File

@ -564,7 +564,7 @@ input.pending {
padding: 0.5rem 1rem; padding: 0.5rem 1rem;
} }
.card .card-header a { .card .card-header a:not([data-toggle="popover"]) {
color: #797979; color: #797979;
} }

View File

@ -18,6 +18,7 @@
<link href="../css/site-responsive.css" rel="stylesheet" asp-append-version="true" /> <link href="../css/site-responsive.css" rel="stylesheet" asp-append-version="true" />
<style> <style>
@media (min-width: 768px) { @media (min-width: 768px) {
.card-body .bootstrap-table tr td:nth-child(5), .card-body .bootstrap-table tr td:nth-child(5),
.card-body .bootstrap-table tr th:nth-child(5), .card-body .bootstrap-table tr th:nth-child(5),
.card-body .bootstrap-table tr td:last-child, .card-body .bootstrap-table tr td:last-child,
@ -30,6 +31,10 @@
word-break: keep-all; word-break: keep-all;
white-space: nowrap; white-space: nowrap;
} }
td:not(:nth-child(3)) {
white-space: nowrap;
}
} }
</style> </style>
<!--[if lt IE 10 ]> <!--[if lt IE 10 ]>
@ -57,7 +62,7 @@
</div> </div>
<a id="pathBase" href="../" hidden></a> <a id="pathBase" href="../" hidden></a>
<div class="modal fade" id="dialogNew" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" <div class="modal fade" id="dialogNew" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"
aria-hidden="true"> aria-hidden="true">
<div class="modal-dialog modal-dialog-centered modal-lg" role="document"> <div class="modal-dialog modal-dialog-centered modal-lg" role="document">
<div class="modal-content"> <div class="modal-content">
<div class="modal-header"> <div class="modal-header">

View File

@ -1,10 +1,22 @@
$(function () { $(function () {
var swalDeleteOptions = {
title: "删除前台站点配置",
type: "warning",
showCancelButton: true,
confirmButtonColor: '#dc3545',
cancelButtonColor: '#6c757d',
confirmButtonText: "我要删除",
cancelButtonText: "取消"
};
var dataBinder = new DataEntity({ var dataBinder = new DataEntity({
Title: "#sysName", Title: "#sysName",
Footer: "#sysFoot" Footer: "#sysFoot"
}); });
$('button[data-method]').on('click', function (e) { var $dialog = $('#dialogNew');
$(document).on('click', 'button[data-method]', function (e) {
var $this = $(this); var $this = $(this);
var data = {}; var data = {};
switch ($this.attr('data-method')) { switch ($this.attr('data-method')) {
@ -132,7 +144,7 @@ $(function () {
var demo = $('#demo').prop('checked') ? "1" : "0"; var demo = $('#demo').prop('checked') ? "1" : "0";
var authKey = $('#authKey').val(); var authKey = $('#authKey').val();
$.bc({ $.bc({
url: Settings.url + '/Demo', data: { name: authKey, code: demo }, title: '演示系统设置', method: "put", url: Settings.url + '/Demo', data: { name: authKey, code: demo }, title: '演示系统设置', method: "post",
callback: function (result) { callback: function (result) {
if (result) { if (result) {
window.setTimeout(function () { window.location.reload(true); }, 1000); window.setTimeout(function () { window.location.reload(true); }, 1000);
@ -140,6 +152,61 @@ $(function () {
} }
}); });
break; break;
case 'appPath':
var appPath = $('#sysAppPath').val();
$.bc({
url: Settings.url, data: [{ name: 'AppPath', code: appPath }], title: '后台管理地址设置', method: "post"
});
break;
case 'addApp':
$('#appKey').val('');
$('#appName').val('');
$('#appUrl').val('');
$dialog.modal('show');
break;
case 'saveApp':
var appPath = $(this).parents('.input-group').find(':text').val();
var appKey = $(this).attr('data-key');
var appName = $(this).parents('.input-group').prev().text();
$.bc({
url: Settings.url + '/AppPath', data: { category: appName, name: appKey, code: appPath, define: 0 }, title: "保存" + appName, method: "post"
});
break;
case 'saveNewApp':
var appPath = $('#appUrl').val();
var appKey = $('#appKey').val();
var appName = $('#appName').val();
$.bc({
url: Settings.url + '/AppPath', data: { category: appName, name: appKey, code: appPath }, title: "保存" + appName, method: "post",
callback: function (result) {
if (result) {
$dialog.modal('hide');
// 保存成功创建新 dom
var segment = $.format('<div class="form-group col-12" data-toggle="LgbValidate" data-valid-button="[data-method=\'saveApp\']"><label class="control-label" for="{0}">{1}</label> <div class="input-group flex-fill"><input id="{0}" class="form-control" placeholder="请输入应用首页2000字以内" value="{2}" maxlength="2000" data-valid="true" /><div class="input-group-append"> <button class="btn btn-danger" type="button" data-key="{0}" data-method="delApp"><i class="fa fa-trash-o"></i><span>删除</span></button><button class="btn btn-secondary" type="button" data-key="{0}" data-method="saveApp"><i class="fa fa-save"></i><span>保存</span></button></div></div></div>', appKey, appName, appPath);
// append dom
$('#appList').append($(segment));
}
}
});
break;
case 'delApp':
var appKey = $(this).attr('data-key');
var appName = $(this).parents('.input-group').prev().text();
var $this = $(this);
swal($.extend({}, swalDeleteOptions, { html: "您确定要删除" + appName + "前台站点配置吗" })).then(function (result) {
if (result.value) {
$.bc({
url: Settings.url + '/AppPath', data: { name: appName, code: appKey }, title: "删除" + appName, method: "delete",
callback: function (result) {
// remove dom
$this.parents('.form-group').remove();
}
});
}
});
break;
} }
}); });

View File

@ -313,5 +313,11 @@ namespace Bootstrap.DataAccess
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
public IEnumerable<BootstrapDict> RetireveLocators() => DictHelper.RetrieveDicts().Where(d => d.Category == "地理位置服务"); public IEnumerable<BootstrapDict> RetireveLocators() => DictHelper.RetrieveDicts().Where(d => d.Category == "地理位置服务");
/// <summary>
/// 获得个人中心地址
/// </summary>
/// <returns></returns>
public string RetrievePathBase() => DictHelper.RetrieveDicts().FirstOrDefault(d => d.Category == "网站设置" && d.Name == "后台地址" && d.Define == 0)?.Code ?? "";
} }
} }

View File

@ -142,7 +142,8 @@ namespace Bootstrap.DataAccess
["LogLog"] = "登录日志保留时长", ["LogLog"] = "登录日志保留时长",
["TraceLog"] = "访问日志保留时长", ["TraceLog"] = "访问日志保留时长",
["CookiePeriod"] = "Cookie保留时长", ["CookiePeriod"] = "Cookie保留时长",
["IPCachePeriod"] = "IP请求缓存时长" ["IPCachePeriod"] = "IP请求缓存时长",
["AppPath"] = "后台地址"
}; };
var ret = SaveSettings(items.Where(i => cache.Any(c => c.Key == i.Name)).Select(i => new BootstrapDict() var ret = SaveSettings(items.Where(i => cache.Any(c => c.Key == i.Name)).Select(i => new BootstrapDict()
{ {
@ -340,5 +341,67 @@ namespace Bootstrap.DataAccess
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
public static IEnumerable<BootstrapDict> RetireveLocators() => DbContextManager.Create<Dict>()?.RetireveLocators() ?? new BootstrapDict[0]; public static IEnumerable<BootstrapDict> RetireveLocators() => DbContextManager.Create<Dict>()?.RetireveLocators() ?? new BootstrapDict[0];
/// <summary>
/// 获得个人中心地址
/// </summary>
/// <returns></returns>
public static string RetrievePathBase() => DbContextManager.Create<Dict>()?.RetrievePathBase() ?? "";
/// <summary>
/// 保存前台应用配置信息
/// </summary>
/// <param name="dict"></param>
/// <returns></returns>
public static bool SaveAppSettings(BootstrapDict dict)
{
// dict define == 1 时为新建前台应用
bool ret;
if (dict.Define == 0)
{
// Update
ret = SaveSettings(new BootstrapDict[] {
new BootstrapDict()
{
Category = "应用首页",
Name = dict.Name,
Code = dict.Code,
Define = 0
}
});
}
else
{
ret = Save(new BootstrapDict()
{
Category = "应用程序",
Name = dict.Category,
Code = dict.Name,
Define = 0
});
if (ret) ret = Save(new BootstrapDict()
{
Category = "应用首页",
Name = dict.Name,
Code = dict.Code,
Define = 0
});
}
return ret;
}
/// <summary>
/// 删除指定前台应用
/// </summary>
/// <param name="dict"></param>
/// <returns></returns>
public static bool DeleteApp(BootstrapDict dict)
{
var ids = new List<string>();
ids.AddRange(RetrieveDicts().Where(d => d.Category == "应用程序" && d.Name == dict.Name && d.Code == dict.Code).Select(d => d.Id ?? ""));
ids.AddRange(RetrieveDicts().Where(d => d.Category == "应用首页" && d.Name == dict.Code).Select(d => d.Id ?? ""));
return Delete(ids);
}
} }
} }

View File

@ -91,22 +91,25 @@ namespace Bootstrap.Client.DataAccess
/// <returns></returns> /// <returns></returns>
public virtual string RetrieveWebFooter(string appId) => DbHelper.RetrieveFooter(appId); public virtual string RetrieveWebFooter(string appId) => DbHelper.RetrieveFooter(appId);
private string RetrieveAdminPath() => DictHelper.RetrieveDicts().FirstOrDefault(d => d.Category == "网站设置" && d.Name == "后台地址" && d.Define == 0)?.Code ?? "";
/// <summary> /// <summary>
/// 获得系统设置地址 /// 获得系统设置地址
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
public virtual string RetrieveSettingsUrl(string appId) => DbHelper.RetrieveSettingsUrl(appId); public virtual string RetrieveSettingsUrl(string appId) => $"{RetrieveAdminPath()}{DbHelper.RetrieveSettingsUrl(appId)}";
/// <summary> /// <summary>
/// 获得系统个人中心地址 /// 获得系统个人中心地址
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
public virtual string RetrieveProfilesUrl(string appId) => DbHelper.RetrieveProfilesUrl(appId); public virtual string RetrieveProfilesUrl(string appId) => $"{RetrieveAdminPath()}{DbHelper.RetrieveProfilesUrl(appId)}";
/// <summary> /// <summary>
/// 获得系统通知地址地址 /// 获得系统通知地址地址
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
public virtual string RetrieveNotisUrl(string appId) => DbHelper.RetrieveNotisUrl(appId); public virtual string RetrieveNotisUrl(string appId) => $"{RetrieveAdminPath()}{DbHelper.RetrieveNotisUrl(appId)}";
} }
} }