feat: 前台应用配置增加了网站图标与 Icon 的设置
This commit is contained in:
parent
4de4630dbc
commit
f27843d493
|
@ -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
|
||||
{
|
||||
|
|
|
@ -352,6 +352,14 @@
|
|||
<label class="control-label" for="appFooter">网站页脚</label>
|
||||
<input type="text" class="form-control flex-fill" id="appFooter" placeholder="不可为空,50字以内" maxlength="50" data-valid="true" />
|
||||
</div>
|
||||
<div class="form-group col-sm-12">
|
||||
<label class="control-label" for="appIcon">网站图标</label>
|
||||
<input type="text" class="form-control flex-fill" id="appIcon" placeholder="不可为空,2000字以内" maxlength="2000" data-valid="true" />
|
||||
</div>
|
||||
<div class="form-group col-sm-12">
|
||||
<label class="control-label" for="appFavicon">favicon</label>
|
||||
<input type="text" class="form-control flex-fill" id="appFavicon" placeholder="不可为空,2000字以内" maxlength="2000" data-valid="true" />
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
|
|
@ -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');
|
||||
}
|
||||
}
|
||||
|
|
|
@ -394,44 +394,55 @@ namespace Bootstrap.DataAccess
|
|||
/// <summary>
|
||||
/// 保存前台应用配置信息
|
||||
/// </summary>
|
||||
/// <param name="appKey"></param>
|
||||
/// <param name="appName"></param>
|
||||
/// <param name="appUrl"></param>
|
||||
/// <param name="appTitle"></param>
|
||||
/// <param name="appFooter"></param>
|
||||
/// <param name="update"></param>
|
||||
/// <param name="option"></param>
|
||||
/// <returns></returns>
|
||||
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;
|
||||
}
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
using System.Linq;
|
||||
using Bootstrap.DataAccess;
|
||||
|
||||
namespace Bootstrap.Admin.Query
|
||||
namespace Bootstrap.DataAccess
|
||||
{
|
||||
/// <summary>
|
||||
/// 前台应用查询类
|
||||
|
@ -11,7 +10,6 @@ namespace Bootstrap.Admin.Query
|
|||
/// <summary>
|
||||
/// 应用操作 new 为新建 edit 为保存
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
public string AppId { get; set; } = "edit";
|
||||
|
||||
/// <summary>
|
||||
|
@ -39,13 +37,23 @@ namespace Bootstrap.Admin.Query
|
|||
/// </summary>
|
||||
public string AppFooter { get; set; } = "未设置";
|
||||
|
||||
/// <summary>
|
||||
/// 前台应用图标
|
||||
/// </summary>
|
||||
public string AppIcon { get; set; } = "/favicon.ico";
|
||||
|
||||
/// <summary>
|
||||
/// 前台应用收藏图标
|
||||
/// </summary>
|
||||
public string AppFavicon { get; set; } = "/favicon.png";
|
||||
|
||||
/// <summary>
|
||||
/// 保存前台应用方法
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
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;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue