diff --git a/src/admin/Bootstrap.Admin/Controllers/Api/SettingsController.cs b/src/admin/Bootstrap.Admin/Controllers/Api/SettingsController.cs
index 12a9743b..14633922 100644
--- a/src/admin/Bootstrap.Admin/Controllers/Api/SettingsController.cs
+++ b/src/admin/Bootstrap.Admin/Controllers/Api/SettingsController.cs
@@ -1,12 +1,10 @@
-using Bootstrap.Admin.Query;
-using Bootstrap.DataAccess;
+using Bootstrap.DataAccess;
using Bootstrap.Security;
using Longbow.Cache;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Filters;
using System.Collections.Generic;
-using System.Linq;
namespace Bootstrap.Admin.Controllers.Api
{
diff --git a/src/admin/Bootstrap.Admin/Views/Admin/Settings.cshtml b/src/admin/Bootstrap.Admin/Views/Admin/Settings.cshtml
index cdcae6b5..d3548662 100644
--- a/src/admin/Bootstrap.Admin/Views/Admin/Settings.cshtml
+++ b/src/admin/Bootstrap.Admin/Views/Admin/Settings.cshtml
@@ -352,6 +352,14 @@
+
+
+
+
+
+
+
+
diff --git a/src/admin/Bootstrap.Admin/wwwroot/js/settings.js b/src/admin/Bootstrap.Admin/wwwroot/js/settings.js
index 613a5991..16dd4b76 100644
--- a/src/admin/Bootstrap.Admin/wwwroot/js/settings.js
+++ b/src/admin/Bootstrap.Admin/wwwroot/js/settings.js
@@ -166,6 +166,8 @@ $(function () {
$('#appUrl').val('');
$('#appTitle').val('');
$('#appFooter').val('');
+ $('#appIcon').val('');
+ $('#appFavicon').val('');
$('#appId').val('new');
$dialog.modal('show');
break;
@@ -176,8 +178,10 @@ $(function () {
var appTitle = $('#appTitle').val();
var appFooter = $('#appFooter').val();
var appId = $('#appId').val();
+ var appIcon = $('#appIcon').val();
+ var appFavicon = $('#appFavicon').val();
$.bc({
- url: Settings.url, data: { AppName: appName, AppCode: appKey, AppUrl: appPath, AppTitle: appTitle, AppFooter: appFooter, AppId: appId }, title: "保存" + appName, method: "put",
+ url: Settings.url, data: { AppIcon: appIcon, AppFavicon: appFavicon, AppName: appName, AppCode: appKey, AppUrl: appPath, AppTitle: appTitle, AppFooter: appFooter, AppId: appId }, title: "保存" + appName, method: "put",
callback: function (result) {
if (result) {
$dialog.modal('hide');
@@ -211,6 +215,8 @@ $(function () {
$('#appName').val(result.AppName);
$('#appTitle').val(result.AppTitle);
$('#appFooter').val(result.AppFooter);
+ $('#appIcon').val(result.AppIcon);
+ $('#appFavicon').val(result.AppFavicon);
$dialog.modal('show');
}
}
diff --git a/src/admin/Bootstrap.DataAccess/Helper/DictHelper.cs b/src/admin/Bootstrap.DataAccess/Helper/DictHelper.cs
index d7e62031..1ce3c93d 100644
--- a/src/admin/Bootstrap.DataAccess/Helper/DictHelper.cs
+++ b/src/admin/Bootstrap.DataAccess/Helper/DictHelper.cs
@@ -394,44 +394,55 @@ namespace Bootstrap.DataAccess
///
/// 保存前台应用配置信息
///
- ///
- ///
- ///
- ///
- ///
- ///
+ ///
///
- public static bool SaveAppSettings(string appKey, string appName, string appUrl, string appTitle, string appFooter, bool update)
+ public static bool SaveAppSettings(QueryAppOption option)
{
+ bool update = option.AppId == "edit";
+
// dict define == 1 时为新建前台应用
bool ret;
// 前台网站配置地址 不允许以 / 结尾
- appUrl = appUrl.TrimEnd('/');
+ option.AppUrl = option.AppUrl.TrimEnd('/');
if (update)
{
// Update
ret = SaveSettings(new BootstrapDict[] {
new BootstrapDict()
{
- Category = appName,
+ Category = option.AppName,
Name = "网站标题",
- Code = appTitle,
+ Code = option.AppTitle,
Define = 1
},
new BootstrapDict()
{
- Category = appName,
+ Category = option.AppName,
Name = "网站页脚",
- Code = appFooter,
+ Code = option.AppFooter,
Define = 1
},
new BootstrapDict()
{
Category = "应用首页",
- Name = appKey,
- Code = appUrl,
+ Name = option.AppCode,
+ Code = option.AppUrl,
Define = 0
+ },
+ new BootstrapDict()
+ {
+ Category = option.AppName,
+ Name = "网站图标",
+ Code = option.AppFavicon,
+ Define = 1
+ },
+ new BootstrapDict()
+ {
+ Category = option.AppName,
+ Name = "favicon",
+ Code = option.AppIcon,
+ Define = 1
}
});
}
@@ -440,52 +451,66 @@ namespace Bootstrap.DataAccess
ret = Save(new BootstrapDict()
{
Category = "应用程序",
- Name = appName,
- Code = appKey,
+ Name = option.AppName,
+ Code = option.AppCode,
Define = 0
});
if (ret) ret = Save(new BootstrapDict()
{
Category = "应用首页",
- Name = appKey,
- Code = appUrl,
+ Name = option.AppCode,
+ Code = option.AppUrl,
Define = 0
});
if (ret) ret = Save(new BootstrapDict()
{
- Category = appName,
+ Category = option.AppName,
Name = "网站标题",
- Code = appTitle,
+ Code = option.AppTitle,
Define = 1
});
if (ret) ret = Save(new BootstrapDict()
{
- Category = appName,
+ Category = option.AppName,
Name = "网站页脚",
- Code = appFooter,
+ Code = option.AppFooter,
Define = 1
});
if (ret) ret = Save(new BootstrapDict()
{
- Category = appName,
+ Category = option.AppName,
Name = "个人中心地址",
Code = "/Admin/Profiles",
Define = 1
});
if (ret) ret = Save(new BootstrapDict()
{
- Category = appName,
+ Category = option.AppName,
Name = "系统设置地址",
Code = "/Admin/Index",
Define = 1
});
if (ret) ret = Save(new BootstrapDict()
{
- Category = appName,
+ Category = option.AppName,
Name = "系统通知地址",
Code = "/Admin/Notifications",
Define = 1
});
+ if (ret) ret = Save(new BootstrapDict()
+ {
+ Category = option.AppName,
+ Name = "网站图标",
+ Code = option.AppFavicon,
+ Define = 1
+ });
+ if (ret) ret = Save(new BootstrapDict()
+ {
+ Category = option.AppName,
+ Name = "favicon",
+ Code = option.AppIcon,
+ Define = 1
+ });
}
return ret;
}
diff --git a/src/admin/Bootstrap.Admin/Query/QueryAppOption.cs b/src/admin/Bootstrap.DataAccess/Helper/QueryAppOption.cs
similarity index 76%
rename from src/admin/Bootstrap.Admin/Query/QueryAppOption.cs
rename to src/admin/Bootstrap.DataAccess/Helper/QueryAppOption.cs
index 34fcf79f..7ff14e5e 100644
--- a/src/admin/Bootstrap.Admin/Query/QueryAppOption.cs
+++ b/src/admin/Bootstrap.DataAccess/Helper/QueryAppOption.cs
@@ -1,7 +1,6 @@
using System.Linq;
-using Bootstrap.DataAccess;
-namespace Bootstrap.Admin.Query
+namespace Bootstrap.DataAccess
{
///
/// 前台应用查询类
@@ -11,7 +10,6 @@ namespace Bootstrap.Admin.Query
///
/// 应用操作 new 为新建 edit 为保存
///
- ///
public string AppId { get; set; } = "edit";
///
@@ -39,13 +37,23 @@ namespace Bootstrap.Admin.Query
///
public string AppFooter { get; set; } = "未设置";
+ ///
+ /// 前台应用图标
+ ///
+ public string AppIcon { get; set; } = "/favicon.ico";
+
+ ///
+ /// 前台应用收藏图标
+ ///
+ public string AppFavicon { get; set; } = "/favicon.png";
+
///
/// 保存前台应用方法
///
///
public bool Save()
{
- var ret = DictHelper.SaveAppSettings(AppCode, AppName, AppUrl, AppTitle, AppFooter, AppId == "edit");
+ var ret = DictHelper.SaveAppSettings(this);
return true;
}
@@ -62,6 +70,8 @@ namespace Bootstrap.Admin.Query
ret.AppUrl = dicts.FirstOrDefault(d => d.Category == "应用首页" && d.Name == key).Code ?? "";
ret.AppTitle = dicts.FirstOrDefault(d => d.Category == ret.AppName && d.Name == "网站标题").Code ?? "";
ret.AppFooter = dicts.FirstOrDefault(d => d.Category == ret.AppName && d.Name == "网站页脚").Code ?? "";
+ ret.AppFavicon = dicts.FirstOrDefault(d => d.Category == ret.AppName && d.Name == "网站图标").Code ?? "";
+ ret.AppIcon = dicts.FirstOrDefault(d => d.Category == ret.AppName && d.Name == "favicon").Code ?? "";
return ret;
}
}