feat: 网站设置增加地理位置配置信息

This commit is contained in:
Argo Zhang 2020-02-14 18:05:13 +08:00
parent 29a7766945
commit eefed96ad5
No known key found for this signature in database
GPG Key ID: 152E398953DDF19F
5 changed files with 56 additions and 0 deletions

View File

@ -19,6 +19,8 @@ namespace Bootstrap.Admin.Models
Themes = DictHelper.RetrieveThemes();
AutoLockScreen = EnableAutoLockScreen;
DefaultApp = DictHelper.RetrieveDefaultApp();
IPLocators = DictHelper.RetireveLocators();
IPLocatorSvr = DictHelper.RetrieveLocaleIPSvr();
}
/// <summary>
@ -26,6 +28,18 @@ namespace Bootstrap.Admin.Models
/// </summary>
public IEnumerable<BootstrapDict> Themes { get; }
/// <summary>
/// 获得 地理位置信息集合
/// </summary>
/// <value></value>
public IEnumerable<BootstrapDict> IPLocators { get; }
/// <summary>
/// 获得 数据库中配置的地理位置信息接口
/// </summary>
/// <value></value>
public string IPLocatorSvr { get; }
/// <summary>
/// 获得 是否开启自动锁屏
/// </summary>

View File

@ -179,6 +179,29 @@
</div>
</div>
</div>
<div class="card" asp-auth="iplocate">
<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-group">
<div class="btn-group" role="group">
<button id="iplocator" class="btn btn-success dropdown-select dropdown-toggle" data-toggle="dropdown" data-default-val="None" value="@Model.IPLocatorSvr">@Model.IPLocatorSvr</button>
<div class="dropdown-menu">
<a href="#" data-val="None">None</a>
@foreach (var ip in Model.IPLocators)
{
<a href="#" data-val="@ip.Name">@ip.Name</a>
}
</div>
</div>
</div>
<div class="modal-footer text-right" asp-condition="@(!Model.IsDemo)">
<button data-method="saveIpLocator" 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">

View File

@ -92,6 +92,12 @@ $(function () {
}
});
break;
case 'saveIpLocator':
var iplocator = $iplocator.val();
$.bc({
url: Settings.url, data: [{ name: 'IP地理位置接口', code: iplocator, category: '网站设置' }], title: '保存地理位置服务设置', method: "post"
});
break;
}
});
@ -158,4 +164,5 @@ $(function () {
});
var $css = $('#dictCssDefine').dropdown('val');
var $iplocator = $('#iplocator').dropdown('val');
});

View File

@ -296,5 +296,11 @@ namespace Bootstrap.DataAccess
/// </summary>
/// <returns></returns>
public bool RetrieveFixedTableHeader() => (DictHelper.RetrieveDicts().FirstOrDefault(d => d.Category == "网站设置" && d.Name == "固定表头" && d.Define == 0)?.Code ?? "1") == "1";
/// <summary>
/// 获得字典表地理位置配置信息集合
/// </summary>
/// <returns></returns>
public IEnumerable<BootstrapDict> RetireveLocators() => DictHelper.RetrieveDicts().Where(d => d.Category == "地理位置");
}
}

View File

@ -281,5 +281,11 @@ namespace Bootstrap.DataAccess
/// </summary>
/// <returns></returns>
public static bool RetrieveFixedTableHeader() => DbContextManager.Create<Dict>()?.RetrieveFixedTableHeader() ?? false;
/// <summary>
/// 获得字典表地理位置配置信息集合
/// </summary>
/// <returns></returns>
public static IEnumerable<BootstrapDict> RetireveLocators() => DbContextManager.Create<Dict>()?.RetireveLocators() ?? new BootstrapDict[0];
}
}