增加功能:增加跨域请求支持
This commit is contained in:
parent
a540711916
commit
df8e4d9517
|
@ -75,7 +75,6 @@
|
|||
<None Include="wwwroot\images\logo6.jpg" />
|
||||
<None Include="wwwroot\images\nav-expand.png" />
|
||||
<None Include="wwwroot\images\success.png" />
|
||||
<None Include="wwwroot\images\uploader\Admin.jpg" />
|
||||
<None Include="wwwroot\images\uploader\default.jpg" />
|
||||
<None Include="wwwroot\images\uploader\readme.txt" />
|
||||
<None Include="wwwroot\css\jquery.nestable.css" />
|
||||
|
|
|
@ -29,6 +29,7 @@ namespace Bootstrap.Admin
|
|||
// This method gets called by the runtime. Use this method to add services to the container.
|
||||
public void ConfigureServices(IServiceCollection services)
|
||||
{
|
||||
services.AddCors();
|
||||
services.AddLogging(builder => builder.AddFileLogger());
|
||||
services.AddConfigurationManager();
|
||||
services.AddCacheManager();
|
||||
|
|
|
@ -58,7 +58,7 @@
|
|||
</div>
|
||||
</div>
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading">网站缓存<a id="clearCache" href="#" class="clearcache fa fa-times-circle-o" data-admin="@User.IsInRole("Administrators")" title="全部清除(WebAdmin可用)" role="tooltip" data-placement="left"></a><a id="refreshCache" href="#" class="pull-right fa fa-refresh" title="点击刷新" role="tooltip"></a></div>
|
||||
<div class="panel-heading">网站缓存<a id="refreshCache" href="#" class="pull-right fa fa-refresh" title="点击刷新" data-placement="left" role="tooltip"></a></div>
|
||||
<div class="panel-body">
|
||||
<div class="tasks-widget">
|
||||
<ul id="sortable" class="task-list ui-sortable"></ul>
|
||||
|
|
|
@ -1,169 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
For more information on how to configure your ASP.NET application, please visit
|
||||
http://go.microsoft.com/fwlink/?LinkId=169433
|
||||
-->
|
||||
<configuration>
|
||||
<configSections>
|
||||
<section name="exceptionManagement" type="Longbow.ExceptionManagement.Configuration.ExceptionManagerSectionHandler, Longbow.ExceptionManagement" />
|
||||
<section name="cacheManager" type="Longbow.Caching.Configuration.CacheSection, Longbow" />
|
||||
<section name="cacheManagerList" type="Longbow.Caching.Configuration.CacheListSection, Longbow" />
|
||||
<section name="licenseManagement" type="Longbow.ComponentModel.LgbLicenseSection, Longbow.ComponentModel" />
|
||||
</configSections>
|
||||
|
||||
<appSettings>
|
||||
<add key="webpages:Version" value="3.0.0.0" />
|
||||
<add key="webpages:Enabled" value="false" />
|
||||
<add key="PreserveLoginUrl" value="true" />
|
||||
<add key="ClientValidationEnabled" value="true" />
|
||||
<add key="UnobtrusiveJavaScriptEnabled" value="true" />
|
||||
<add key="Admins" value="Argo;Test" />
|
||||
<add key="Passwords" value="3oXfIiPEbZVE+d8JeeLCCcgrTFBq813HGCFv9StZ8EA=;OYefBWRKrVPOrADTAe/YjY3LAOCuv2WCEXwE2An1X68=" />
|
||||
</appSettings>
|
||||
|
||||
<connectionStrings>
|
||||
<add name="SQL" providerName="System.Data.SqlClient" connectionString="Data Source=.;Initial Catalog=BootstrapAdmin;User ID=sa;Password=sa" />
|
||||
<add name="ba" providerName="System.Data.SqlClient" connectionString="Data Source=.;Initial Catalog=BootstrapAdmin;User ID=sa;Password=sa" />
|
||||
</connectionStrings>
|
||||
|
||||
<cacheManager>
|
||||
<add key="BootstrapAdminPrincipal-RetrieveRoles" interval="600" desc="系统所有角色列表数据" />
|
||||
<add key="BootstrapAdminPrincipal-RetrieveRolesByUrl" interval="600" desc="指定菜单的角色数据缓存" />
|
||||
<add key="BootstrapAdminPrincipal-RetrieveRolesByUserName" interval="600" desc="指定用户名角色数据缓存" />
|
||||
<add key="BootstrapMenu-RetrieveMenus" interval="600" desc="所有菜单数据缓存" />
|
||||
<add key="BootstrapDict-RetrieveDicts" interval="600" desc="所有字典数据缓存" />
|
||||
<add key="BootstrapUser-RetrieveUsers" interval="600" desc="所有用户数据缓存" />
|
||||
<add key="BootstrapUser-RetrieveUsersByName" interval="600" desc="指定用户数据缓存" />
|
||||
<add key="BootstrapUser-RetrieveUsersByRoleId" interval="600" desc="指定角色用户数据缓存" />
|
||||
<add key="BootstrapUser-RetrieveUsersByGroupId" interval="600" desc="指定组用户数据缓存" />
|
||||
|
||||
<add key="UserHelper-RetrieveNewUsers" interval="30" desc="新用户数据缓存" />
|
||||
<add key="MenuHelper-RetrieveMenusByRoleId" interval="600" desc="角色菜单信息缓存" />
|
||||
|
||||
<add key="RoleHelper-RetrieveRoles" interval="600" desc="所有角色数据缓存" />
|
||||
<add key="RoleHelper-RetrieveRolesByUserId" interval="600" desc="指定用户角色数据缓存" />
|
||||
<add key="RoleHelper-RetrieveRolesByMenuId" interval="600" desc="指定菜单角色数据缓存" />
|
||||
<add key="RoleHelper-RetrieveRolesByGroupId" interval="600" desc="指定组角色数据缓存" />
|
||||
|
||||
<add key="GroupHelper-RetrieveGroups" interval="600" desc="所有组数据缓存" />
|
||||
<add key="GroupHelper-RetrieveGroupsByUserId" interval="600" desc="指定用户组数据缓存" />
|
||||
<add key="GroupHelper-RetrieveGroupsByRoleId" interval="600" desc="指定角色组数据缓存" />
|
||||
<add key="LogHelper-RetrieveLogs" interval="600" desc="所有日志数据缓存" />
|
||||
<add key="DictHelper-RetrieveDictsCategory" interval="6000" desc="字典分类数据缓存" />
|
||||
<add key="NotificationHelper-RetrieveNotifications" interval="600" desc="通知管理数据缓存" />
|
||||
<add key="ExceptionHelper-RetrieveExceptions" interval="600" desc="程序异常数据缓存" />
|
||||
<add key="MessageHelper-RetrieveMessages" interval="600" desc="站内消息数据缓存" />
|
||||
<add key="TaskHelper-RetrieveTasks" interval="600" desc="所有任务数据缓存" />
|
||||
<add key="WebApi" interval="21600" desc="WebApi 数据缓存" />
|
||||
<add key="Token" interval="21600" desc="Token 数据缓存" />
|
||||
</cacheManager>
|
||||
|
||||
|
||||
<cacheManagerList>
|
||||
<add key="bd" url="http://localhost:53233/CacheList.axd?cacheKey={0}" desc="系统缓存模块" />
|
||||
<add key="bccs" url="http://localhost:49823/CacheList.axd?cacheKey={0}" desc="集控系统缓存模块" />
|
||||
<add key="cps" url="http://localhost:43112/CacheList.axd?cacheKey={0}" desc="云心理后台缓存" />
|
||||
</cacheManagerList>
|
||||
|
||||
<exceptionManagement>
|
||||
<publisher name="default" mode="On" exceptionFormat="File" />
|
||||
<publisher name="db" mode="On" assembly="Bootstrap.Admin" type="Bootstrap.Admin.DBPublisher" />
|
||||
</exceptionManagement>
|
||||
|
||||
<licenseManagement licenseKey="4q01gzG5cWBr2moT7/9pMProPA0BIHpWimETcWj/gAutBuPANJR1uSrTbrdxyNWl" permissionKey="FB457BEDB2D84B091B1C4C8AA0F06D77" />
|
||||
|
||||
<system.web>
|
||||
<caching>
|
||||
<outputCache enableOutputCache="true"></outputCache>
|
||||
<outputCacheSettings>
|
||||
<outputCacheProfiles>
|
||||
<add name="IconView" duration="3600" location="Any" />
|
||||
</outputCacheProfiles>
|
||||
</outputCacheSettings>
|
||||
</caching>
|
||||
|
||||
<compilation debug="true" targetFramework="4.5" />
|
||||
<httpRuntime targetFramework="4.5" />
|
||||
<authentication mode="Forms">
|
||||
<forms defaultUrl="~/" loginUrl="~/Home/Login" name="__bd__" protection="All" path="/" timeout="360" />
|
||||
</authentication>
|
||||
<pages>
|
||||
<namespaces>
|
||||
<add namespace="System.Web.Helpers" />
|
||||
<add namespace="System.Web.Mvc" />
|
||||
<add namespace="System.Web.Mvc.Ajax" />
|
||||
<add namespace="System.Web.Mvc.Html" />
|
||||
<add namespace="System.Web.Routing" />
|
||||
<add namespace="System.Web.WebPages" />
|
||||
</namespaces>
|
||||
</pages>
|
||||
<httpModules>
|
||||
</httpModules>
|
||||
<machineKey validation="SHA1" validationKey="78EA3850338FBADCE59D8DDF58C9E4518E75AC149C46142D7AAD7F1AD49D95D4" decryptionKey="684FC9301F404DE1B9565E7D9520AC579E823307BED44885" />
|
||||
</system.web>
|
||||
|
||||
<system.webServer>
|
||||
<httpProtocol>
|
||||
<customHeaders>
|
||||
<add name="Access-Control-Allow-Origin" value="*" />
|
||||
<add name="Access-Control-Allow-Methods" value="GET,POST,PUT,DELETE,OPTIONS" />
|
||||
<add name="Access-Control-Allow-Headers" value="Token" />
|
||||
<add name="Access-Control-Max-Age" value="30" />
|
||||
</customHeaders>
|
||||
</httpProtocol>
|
||||
<staticContent>
|
||||
<remove fileExtension=".woff" />
|
||||
<mimeMap fileExtension=".woff" mimeType="application/x-font-woff" />
|
||||
<remove fileExtension=".woff2" />
|
||||
<mimeMap fileExtension=".woff2" mimeType="application/x-font-woff2" />
|
||||
<remove fileExtension=".ttf" />
|
||||
<mimeMap fileExtension=".ttf" mimeType="application/x-font-truetype" />
|
||||
<remove fileExtension=".svg" />
|
||||
<mimeMap fileExtension=".svg" mimeType="image/svg+xml" />
|
||||
<remove fileExtension=".otf" />
|
||||
<mimeMap fileExtension=".otf" mimeType="application/x-font-opentype" />
|
||||
<remove fileExtension=".eot" />
|
||||
<mimeMap fileExtension=".eot" mimeType="application/vnd.ms-fontobject" />
|
||||
</staticContent>
|
||||
<validation validateIntegratedModeConfiguration="false" />
|
||||
<handlers>
|
||||
<remove name="ExtensionlessUrlHandler-Integrated-4.0" />
|
||||
<remove name="OPTIONSVerbHandler" />
|
||||
<remove name="TRACEVerbHandler" />
|
||||
<add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="*" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0" />
|
||||
<add name="CacheListHandler" verb="*" path="CacheList.axd" type="Longbow.Caching.CacheListHandler, Longbow" />
|
||||
</handlers>
|
||||
<modules runAllManagedModulesForAllRequests="true">
|
||||
<add name="ExceptionManagement" type="Longbow.ExceptionManagement.ExceptionManagementModule, Longbow.ExceptionManagement" />
|
||||
</modules>
|
||||
</system.webServer>
|
||||
|
||||
<runtime>
|
||||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="Newtonsoft.Json" culture="neutral" publicKeyToken="30ad4fe6b2a6aeed" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-9.0.0.0" newVersion="9.0.0.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35" />
|
||||
<bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
|
||||
<bindingRedirect oldVersion="1.0.0.0-5.2.0.0" newVersion="5.2.0.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Web.Optimization" publicKeyToken="31bf3856ad364e35" />
|
||||
<bindingRedirect oldVersion="1.0.0.0-1.1.0.0" newVersion="1.1.0.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Web.WebPages" publicKeyToken="31bf3856ad364e35" />
|
||||
<bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="WebGrease" publicKeyToken="31bf3856ad364e35" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-1.5.2.14234" newVersion="1.5.2.14234" />
|
||||
</dependentAssembly>
|
||||
</assemblyBinding>
|
||||
</runtime>
|
||||
</configuration>
|
|
@ -8,6 +8,13 @@
|
|||
"Url": "http://localhost:50852/CacheList.axd?cacheKey={0}",
|
||||
"Desc": "后台管理数据缓存接口",
|
||||
"Self": true
|
||||
},
|
||||
{
|
||||
"Enabled": true,
|
||||
"Name": "ba",
|
||||
"Url": "http://localhost:49823/CacheList.axd?cacheKey={0}",
|
||||
"Desc": "托盘组垛系统数据缓存接口",
|
||||
"Self": false
|
||||
}
|
||||
],
|
||||
"CacheItems": [
|
||||
|
|
|
@ -122,7 +122,7 @@
|
|||
.tasks-widget .task-list li .task-title .task-title-sp {
|
||||
margin-right: 5px;
|
||||
max-width: 120px;
|
||||
padding-top: 15px;
|
||||
margin-top: 15px;
|
||||
}
|
||||
|
||||
.tasks-widget .task-list li.task-done .task-title-sp {
|
||||
|
|
|
@ -129,7 +129,8 @@
|
|||
callback: null,
|
||||
$element: null,
|
||||
async: true,
|
||||
toastr: false
|
||||
toastr: false,
|
||||
crossDomain: null
|
||||
}, options);
|
||||
|
||||
if (!options.url || options.url === "") {
|
||||
|
@ -155,6 +156,8 @@
|
|||
contentType: options.contentType,
|
||||
dataType: options.dataType,
|
||||
async: options.async,
|
||||
crossDomain: options.crossDomain,
|
||||
xhrFields: options.xhrFields,
|
||||
success: function (result) {
|
||||
success(result);
|
||||
},
|
||||
|
|
|
@ -51,7 +51,7 @@
|
|||
|
||||
var $sortable = $('#sortable');
|
||||
var listCacheUrl = function (options) {
|
||||
options = $.extend({ clear: false }, options);
|
||||
options = $.extend({ key: '' }, options);
|
||||
$sortable.html('');
|
||||
$.bc({
|
||||
url: Settings.url,
|
||||
|
@ -60,7 +60,63 @@
|
|||
callback: function (result) {
|
||||
if (result && $.isArray(result)) {
|
||||
$.each(result, function (index, item) {
|
||||
listCache($.extend({ item: item, url: item.Url }, options));
|
||||
$.bc({
|
||||
url: $.format(item.Url, options.key),
|
||||
crossDomain: !item.Self,
|
||||
xhrFields: {
|
||||
withCredentials: !item.Self
|
||||
},
|
||||
swal: false,
|
||||
callback: function (result) {
|
||||
if ($.isArray(result)) {
|
||||
var html = '<li class="{4}"><i class="fa fa-ellipsis-v"></i><div class="task-title"><span class="task-title-sp" role="tooltip" title="{1}">{2}</span><span class="badge badge-sm label-success">{0}</span><span class="task-value" title="{3}">{3}</span><div class="pull-right hidden-phone"><span>{7}</span><button class="btn btn-danger btn-xs fa fa-trash-o" title="{1}" data-url="{5}" role="tooltip" data-self="{6}" data-placement="left"></button></div></div></li>';
|
||||
var content = result.sort(function (x, y) {
|
||||
return x.Key > y.Key ? 1 : -1;
|
||||
}).map(function (ele) {
|
||||
var key = ele.Key.split('-')[0];
|
||||
var css = 'list-default';
|
||||
switch (key) {
|
||||
case "MenuHelper":
|
||||
css = 'list-primary';
|
||||
break;
|
||||
case "UserHelper":
|
||||
css = 'list-success';
|
||||
break;
|
||||
case "RoleHelper":
|
||||
css = 'list-danger';
|
||||
break;
|
||||
case "GroupHelper":
|
||||
css = 'list-warning';
|
||||
break;
|
||||
case "LogHelper":
|
||||
css = 'list-info';
|
||||
break;
|
||||
case "DictHelper":
|
||||
css = 'list-inverse';
|
||||
break;
|
||||
case "ExceptionHelper":
|
||||
css = 'list-Exception';
|
||||
break;
|
||||
case "MessageHelper":
|
||||
css = 'list-Message';
|
||||
break;
|
||||
case "TaskHelper":
|
||||
css = 'list-Task';
|
||||
break;
|
||||
case "NotificationHelper":
|
||||
css = 'list-Notification';
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return $.format(html, ele.Interval, ele.Key, ele.Desc, ele.Value, css, $.format(item.Url, ele.Key), item.Self, Math.max(0, ele.Interval - Math.round((new Date() - new Date(ele.CreateTime.replace(/-/g, '/'))) / 1000)));
|
||||
}).join('');
|
||||
$sortable.append($.format('<li class="title">{0}</li>', item.Desc));
|
||||
$sortable.append(content);
|
||||
$sortable.find('[role="tooltip"]').lgbTooltip({ container: 'body' });
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -68,75 +124,19 @@
|
|||
}
|
||||
|
||||
var listCache = function (options) {
|
||||
options = $.extend({ clear: false, key: '' }, options);
|
||||
if (options.key != '') {
|
||||
options.url = $.format(options.url, options.key);
|
||||
}
|
||||
if (options.clear) {
|
||||
options.url += '&clear=clear';
|
||||
}
|
||||
$.bc({
|
||||
url: options.url,
|
||||
swal: false,
|
||||
callback: function (result) {
|
||||
if (result && options.key == '') {
|
||||
result = $.parseJSON(result);
|
||||
if ($.isArray(result)) {
|
||||
var html = '<li class="{4}"><i class="fa fa-ellipsis-v"></i><div class="task-title"><span class="task-title-sp" role="tooltip" title="{1}">{2}</span><span class="badge badge-sm label-success">{0}</span><span class="task-value" title="{3}">{3}</span><div class="pull-right hidden-phone"><span>{6}</span><button class="btn btn-danger btn-xs fa fa-trash-o" title="{1}" data-key="{1}" data-url="{5}" role="tooltip" data-placement="left"></button></div></div></li>';
|
||||
var content = result.sort(function (x, y) {
|
||||
return x.Key > y.Key ? 1 : -1;
|
||||
}).map(function (ele) {
|
||||
var key = ele.Key.split('-')[0];
|
||||
var css = 'list-default';
|
||||
switch (key) {
|
||||
case "MenuHelper":
|
||||
css = 'list-primary';
|
||||
break;
|
||||
case "UserHelper":
|
||||
css = 'list-success';
|
||||
break;
|
||||
case "RoleHelper":
|
||||
css = 'list-danger';
|
||||
break;
|
||||
case "GroupHelper":
|
||||
css = 'list-warning';
|
||||
break;
|
||||
case "LogHelper":
|
||||
css = 'list-info';
|
||||
break;
|
||||
case "DictHelper":
|
||||
css = 'list-inverse';
|
||||
break;
|
||||
case "ExceptionHelper":
|
||||
css = 'list-Exception';
|
||||
break;
|
||||
case "MessageHelper":
|
||||
css = 'list-Message';
|
||||
break;
|
||||
case "TaskHelper":
|
||||
css = 'list-Task';
|
||||
break;
|
||||
case "NotificationHelper":
|
||||
css = 'list-Notification';
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return $.format(html, ele.Interval, ele.Key, ele.Desc, ele.Value, css, options.url, Math.max(0, ele.Interval - Math.round((new Date() - new Date(ele.CreateTime.replace(/-/g, '/'))) / 1000)));
|
||||
}).join('');
|
||||
$sortable.append($.format('<li class="title">{0}-{1}</li>', options.item.Desc, options.item.Key));
|
||||
$sortable.append(content);
|
||||
$sortable.find('[role="tooltip"]').lgbTooltip();
|
||||
}
|
||||
}
|
||||
}
|
||||
crossDomain: !options.self,
|
||||
xhrFields: {
|
||||
withCredentials: !options.self
|
||||
},
|
||||
swal: false
|
||||
});
|
||||
}
|
||||
$('#refreshCache').click(function () { listCacheUrl(); }).trigger('click');
|
||||
$('#clearCache').click(function () { listCacheUrl({ clear: true }); });
|
||||
$sortable.on('click', '.btn', function () {
|
||||
$(this).lgbTooltip('destroy');
|
||||
listCache({ key: $(this).attr('data-key'), url: $(this).attr('data-url') });
|
||||
listCache({ self: $(this).attr('data-self') === "true", url: $(this).attr('data-url') });
|
||||
listCacheUrl();
|
||||
});
|
||||
|
||||
|
|
Loading…
Reference in New Issue