From df8e4d95175ed5bf0b8a9ad1c2c61c1ce0590636 Mon Sep 17 00:00:00 2001 From: Argo-MacBookPro Date: Fri, 8 Jun 2018 12:26:59 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=8A=9F=E8=83=BD=EF=BC=9A?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E8=B7=A8=E5=9F=9F=E8=AF=B7=E6=B1=82=E6=94=AF?= =?UTF-8?q?=E6=8C=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Bootstrap.Admin/Bootstrap.Admin.csproj | 1 - Bootstrap.Admin/Startup.cs | 1 + Bootstrap.Admin/Views/Admin/Settings.cshtml | 2 +- Bootstrap.Admin/Web.config | 169 ------------------- Bootstrap.Admin/cache.json | 7 + Bootstrap.Admin/wwwroot/css/tasks.css | 2 +- Bootstrap.Admin/wwwroot/js/Longbow.Common.js | 5 +- Bootstrap.Admin/wwwroot/js/Settings.js | 128 +++++++------- 8 files changed, 78 insertions(+), 237 deletions(-) delete mode 100644 Bootstrap.Admin/Web.config diff --git a/Bootstrap.Admin/Bootstrap.Admin.csproj b/Bootstrap.Admin/Bootstrap.Admin.csproj index 5285124d..12520972 100644 --- a/Bootstrap.Admin/Bootstrap.Admin.csproj +++ b/Bootstrap.Admin/Bootstrap.Admin.csproj @@ -75,7 +75,6 @@ - diff --git a/Bootstrap.Admin/Startup.cs b/Bootstrap.Admin/Startup.cs index 31833566..353f3af0 100644 --- a/Bootstrap.Admin/Startup.cs +++ b/Bootstrap.Admin/Startup.cs @@ -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(); diff --git a/Bootstrap.Admin/Views/Admin/Settings.cshtml b/Bootstrap.Admin/Views/Admin/Settings.cshtml index 73ce81dc..d2db2a7a 100644 --- a/Bootstrap.Admin/Views/Admin/Settings.cshtml +++ b/Bootstrap.Admin/Views/Admin/Settings.cshtml @@ -58,7 +58,7 @@
-
网站缓存
+
网站缓存
    diff --git a/Bootstrap.Admin/Web.config b/Bootstrap.Admin/Web.config deleted file mode 100644 index 8a381426..00000000 --- a/Bootstrap.Admin/Web.config +++ /dev/null @@ -1,169 +0,0 @@ - - - - -
    -
    -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/Bootstrap.Admin/cache.json b/Bootstrap.Admin/cache.json index 6a90e72f..dad57eb0 100644 --- a/Bootstrap.Admin/cache.json +++ b/Bootstrap.Admin/cache.json @@ -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": [ diff --git a/Bootstrap.Admin/wwwroot/css/tasks.css b/Bootstrap.Admin/wwwroot/css/tasks.css index 0dbb37e4..d49430e1 100644 --- a/Bootstrap.Admin/wwwroot/css/tasks.css +++ b/Bootstrap.Admin/wwwroot/css/tasks.css @@ -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 { diff --git a/Bootstrap.Admin/wwwroot/js/Longbow.Common.js b/Bootstrap.Admin/wwwroot/js/Longbow.Common.js index 7539faca..bab95aea 100644 --- a/Bootstrap.Admin/wwwroot/js/Longbow.Common.js +++ b/Bootstrap.Admin/wwwroot/js/Longbow.Common.js @@ -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); }, diff --git a/Bootstrap.Admin/wwwroot/js/Settings.js b/Bootstrap.Admin/wwwroot/js/Settings.js index b2d6451e..6b624853 100644 --- a/Bootstrap.Admin/wwwroot/js/Settings.js +++ b/Bootstrap.Admin/wwwroot/js/Settings.js @@ -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 = '
  • {2}{0}{3}
    {7}
  • '; + 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('
  • {0}
  • ', 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 = '
  • {2}{0}{3}
    {6}
  • '; - 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('
  • {0}-{1}
  • ', 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(); });