From a60430b55adb6394d8456c6070305f907401903f Mon Sep 17 00:00:00 2001 From: colin Date: Mon, 9 Jun 2025 15:40:24 +0800 Subject: [PATCH] =?UTF-8?q?fix(single):=20=E4=BF=AE=E5=A4=8Dmvc=E9=A1=B5?= =?UTF-8?q?=E9=9D=A2=E6=95=B0=E6=8D=AE=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - ajax中增加不包装返回结果标头 --- .../Bundling/SingleGlobalScriptContributor.cs | 14 ++++++++++++++ .../GlobalUsings.cs | 7 +++++++ ...roServiceApplicationsSingleModule.Configure.cs | 15 +++++++++------ .../gulpfile.js | 10 ---------- .../wwwroot/scripts/abp-wrapper.js | 11 +++++++++++ 5 files changed, 41 insertions(+), 16 deletions(-) create mode 100644 aspnet-core/services/LY.MicroService.Applications.Single/Bundling/SingleGlobalScriptContributor.cs delete mode 100644 aspnet-core/services/LY.MicroService.Applications.Single/gulpfile.js create mode 100644 aspnet-core/services/LY.MicroService.Applications.Single/wwwroot/scripts/abp-wrapper.js diff --git a/aspnet-core/services/LY.MicroService.Applications.Single/Bundling/SingleGlobalScriptContributor.cs b/aspnet-core/services/LY.MicroService.Applications.Single/Bundling/SingleGlobalScriptContributor.cs new file mode 100644 index 000000000..881399528 --- /dev/null +++ b/aspnet-core/services/LY.MicroService.Applications.Single/Bundling/SingleGlobalScriptContributor.cs @@ -0,0 +1,14 @@ +using Volo.Abp.AspNetCore.Mvc.UI.Packages.JQuery; + +namespace LY.MicroService.Applications.Single.Bundling; + +[DependsOn(typeof(JQueryScriptContributor))] +public class SingleGlobalScriptContributor : BundleContributor +{ + public override Task ConfigureBundleAsync(BundleConfigurationContext context) + { + context.Files.Add("/scripts/abp-wrapper.js"); + + return Task.CompletedTask; + } +} \ No newline at end of file diff --git a/aspnet-core/services/LY.MicroService.Applications.Single/GlobalUsings.cs b/aspnet-core/services/LY.MicroService.Applications.Single/GlobalUsings.cs index c4b0eb6e3..b063a8e22 100644 --- a/aspnet-core/services/LY.MicroService.Applications.Single/GlobalUsings.cs +++ b/aspnet-core/services/LY.MicroService.Applications.Single/GlobalUsings.cs @@ -52,6 +52,7 @@ global using LINGYUN.Abp.Identity.AspNetCore.Session; global using LINGYUN.Abp.Identity.EntityFrameworkCore; global using LINGYUN.Abp.Identity.Notifications; global using LINGYUN.Abp.Identity.OrganizaztionUnits; +global using LINGYUN.Abp.Identity.QrCode; global using LINGYUN.Abp.Identity.Session; global using LINGYUN.Abp.Identity.Session.AspNetCore; global using LINGYUN.Abp.Identity.WeChat; @@ -126,6 +127,7 @@ global using LINGYUN.Platform.HttpApi; global using LINGYUN.Platform.Localization; global using LINGYUN.Platform.Settings.VueVbenAdmin; global using LINGYUN.Platform.Theme.VueVbenAdmin; +global using LY.MicroService.Applications.Single.Bundling; global using LY.MicroService.Applications.Single.EntityFrameworkCore.MySql; //global using LY.MicroService.Applications.Single.EntityFrameworkCore.SqlServer; global using LY.MicroService.Applications.Single.Messages; @@ -134,14 +136,17 @@ global using Medallion.Threading.Redis; global using Microsoft.AspNetCore.Authentication.JwtBearer; global using Microsoft.AspNetCore.Cors; global using Microsoft.AspNetCore.DataProtection; +global using Microsoft.AspNetCore.Extensions.DependencyInjection; global using Microsoft.AspNetCore.Identity; global using Microsoft.AspNetCore.Server.Kestrel.Core; global using Microsoft.Extensions.Caching.StackExchangeRedis; +global using Microsoft.Extensions.DependencyInjection; global using Microsoft.IdentityModel.Logging; global using Microsoft.OpenApi.Models; global using MiniExcelLibs.Attributes; global using OpenIddict.Server; global using OpenIddict.Server.AspNetCore; +global using OpenIddict.Validation.AspNetCore; global using Quartz; global using StackExchange.Redis; global using System.Security.Cryptography; @@ -155,12 +160,14 @@ global using Volo.Abp.AspNetCore.Mvc.AntiForgery; global using Volo.Abp.AspNetCore.Mvc.UI.Bundling; //global using Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic; global using Volo.Abp.AspNetCore.Mvc.UI.Theme.LeptonXLite; +global using Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Bundling; global using Volo.Abp.AspNetCore.Serilog; global using Volo.Abp.Auditing; global using Volo.Abp.Authorization.Permissions; global using Volo.Abp.Autofac; global using Volo.Abp.BlobStoring; global using Volo.Abp.BlobStoring.FileSystem; +global using Volo.Abp.BlobStoring.Minio; global using Volo.Abp.Caching; global using Volo.Abp.Caching.StackExchangeRedis; global using Volo.Abp.Data; diff --git a/aspnet-core/services/LY.MicroService.Applications.Single/MicroServiceApplicationsSingleModule.Configure.cs b/aspnet-core/services/LY.MicroService.Applications.Single/MicroServiceApplicationsSingleModule.Configure.cs index 897e53079..4efae197c 100644 --- a/aspnet-core/services/LY.MicroService.Applications.Single/MicroServiceApplicationsSingleModule.Configure.cs +++ b/aspnet-core/services/LY.MicroService.Applications.Single/MicroServiceApplicationsSingleModule.Configure.cs @@ -1,9 +1,3 @@ -using LINGYUN.Abp.Identity.QrCode; -using Microsoft.AspNetCore.Authentication; -using Microsoft.AspNetCore.Extensions.DependencyInjection; -using Microsoft.Extensions.DependencyInjection; -using OpenIddict.Validation.AspNetCore; -using Volo.Abp.BlobStoring.Minio; using VoloAbpExceptionHandlingOptions = Volo.Abp.AspNetCore.ExceptionHandling.AbpExceptionHandlingOptions; namespace LY.MicroService.Applications.Single; @@ -773,6 +767,15 @@ public partial class MicroServiceApplicationsSingleModule private void ConfigureSingleModule(IServiceCollection services, bool isDevelopment) { + Configure(options => + { + options.ScriptBundles + .Configure(StandardBundles.Styles.Global, bundle => + { + bundle.AddContributors(typeof(SingleGlobalScriptContributor)); + }); + }); + Configure(options => { // 允许第三方调用集成服务 diff --git a/aspnet-core/services/LY.MicroService.Applications.Single/gulpfile.js b/aspnet-core/services/LY.MicroService.Applications.Single/gulpfile.js deleted file mode 100644 index bec4d578f..000000000 --- a/aspnet-core/services/LY.MicroService.Applications.Single/gulpfile.js +++ /dev/null @@ -1,10 +0,0 @@ -"use strict"; - -var gulp = require("gulp"), - path = require('path'), - copyResources = require('./node_modules/@abp/aspnetcore.mvc.ui/gulp/copy-resources.js'); - -exports.default = function(done){ - copyResources(path.resolve('./')); - done(); -}; \ No newline at end of file diff --git a/aspnet-core/services/LY.MicroService.Applications.Single/wwwroot/scripts/abp-wrapper.js b/aspnet-core/services/LY.MicroService.Applications.Single/wwwroot/scripts/abp-wrapper.js new file mode 100644 index 000000000..333d12949 --- /dev/null +++ b/aspnet-core/services/LY.MicroService.Applications.Single/wwwroot/scripts/abp-wrapper.js @@ -0,0 +1,11 @@ +var abp = abp || {}; +(function ($) { + + if (!abp.ajax || !abp.ajax.defaultOpts) { + throw "abp/jquery library requires the jquery library included to the page!"; + } + + var headers = abp.ajax.defaultOpts.headers || {}; + headers['_abpdontwrapresult'] = 'true'; + +})(jQuery); \ No newline at end of file