feat: 网站设置提供后台地址设置

This commit is contained in:
Argo Zhang 2020-02-26 18:13:24 +08:00
parent 4bc7ccb12a
commit da31d6522d
No known key found for this signature in database
GPG Key ID: 152E398953DDF19F
5 changed files with 48 additions and 7 deletions

View File

@ -28,6 +28,7 @@ namespace Bootstrap.Admin.Models
CookiePeriod = DictHelper.RetrieveCookieExpiresPeriod();
IPCachePeriod = DictHelper.RetrieveLocaleIPSvrCachePeriod();
EnableDemo = DictHelper.RetrieveSystemModel();
AdminPathBase = DictHelper.RetrievePathBase();
}
/// <summary>
@ -89,5 +90,10 @@ namespace Bootstrap.Admin.Models
/// 获得/设置 是否为演示系统
/// </summary>
public bool EnableDemo { get; set; }
/// <summary>
/// 获得/设置 后台管理网站地址
/// </summary>
public string AdminPathBase { get; set; } = "";
}
}

View File

@ -26,10 +26,10 @@
<script src="~/js/settings.js" asp-append-version="true"></script>
}
<div class="card" asp-auth="saveTitle">
<div class="card-header">系统名称设置</div>
<div class="card-body" data-toggle="LgbValidate" data-valid-button="#sysSave">
<div class="card-header">网站名称设置</div>
<div class="card-body" data-toggle="LgbValidate" data-valid-button="[data-method='title']">
<div class="alert alert-danger" role="alert" asp-condition="@Model.IsDemo">
<span>演示系统禁止更改系统名称</span>
<span>演示系统禁止更改网站名称</span>
</div>
<div class="form-group">
<div class="input-group">
@ -42,10 +42,10 @@
</div>
</div>
<div class="card" asp-auth="saveFooter">
<div class="card-header">页脚设置</div>
<div class="card-body" data-toggle="LgbValidate" data-valid-button="#footSave">
<div class="card-header">网站页脚设置</div>
<div class="card-body" data-toggle="LgbValidate" data-valid-button="[data-method='footer']">
<div class="alert alert-danger" role="alert" asp-condition="@Model.IsDemo">
<span>演示系统禁止更改页脚</span>
<span>演示系统禁止更改网站页脚</span>
</div>
<div class="form-group">
<div class="input-group">
@ -57,6 +57,22 @@
</div>
</div>
</div>
<div class="card">
<div class="card-header">后台管理地址设置</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-header">网站样式</div>
<div class="card-body">

View File

@ -140,6 +140,12 @@ $(function () {
}
});
break;
case 'appPath':
var appPath = $('#sysAppPath').val();
$.bc({
url: Settings.url, data: [{ name: 'AppPath', code: appPath }], title: '后台管理地址设置', method: "post"
});
break;
}
});

View File

@ -313,5 +313,11 @@ namespace Bootstrap.DataAccess
/// </summary>
/// <returns></returns>
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"] = "登录日志保留时长",
["TraceLog"] = "访问日志保留时长",
["CookiePeriod"] = "Cookie保留时长",
["IPCachePeriod"] = "IP请求缓存时长"
["IPCachePeriod"] = "IP请求缓存时长",
["AppPath"] = "后台地址"
};
var ret = SaveSettings(items.Where(i => cache.Any(c => c.Key == i.Name)).Select(i => new BootstrapDict()
{
@ -340,5 +341,11 @@ namespace Bootstrap.DataAccess
/// </summary>
/// <returns></returns>
public static IEnumerable<BootstrapDict> RetireveLocators() => DbContextManager.Create<Dict>()?.RetireveLocators() ?? new BootstrapDict[0];
/// <summary>
/// 获得个人中心地址
/// </summary>
/// <returns></returns>
public static string RetrievePathBase() => DbContextManager.Create<Dict>()?.RetrievePathBase() ?? "";
}
}