Browse Source

Merge branch 'main' into example

example
Hanpaopao 2 years ago
parent
commit
eef054ccfb
  1. 2
      .gitignore
  2. 1
      aspnet-core/modules/BasicManagement/src/Lion.AbpPro.BasicManagement.Application/Users/UserAppService.cs
  3. 23
      aspnet-core/shared/Lion.AbpPro.Shared.Hosting.Microservices/Lion/AbpPro/AbpProSharedHostingMicroserviceModule.cs
  4. 2
      vben28/package.json
  5. 2
      vben28/src/router/constant.ts
  6. 1
      vben28/src/store/modules/user.ts
  7. 7
      vben28/src/views/admin/users/AbpUser.ts
  8. 5
      vben28/src/views/admin/users/EditAbpUser.vue

2
.gitignore

@ -21,7 +21,7 @@ bld/
[Bb]in/ [Bb]in/
[Oo]bj/ [Oo]bj/
[Ll]og/ [Ll]og/
.DS_Store
# Visual Studio 2015 cache/options directory # Visual Studio 2015 cache/options directory
.vs/ .vs/
# Uncomment if you have tasks that create the project's static files in wwwroot # Uncomment if you have tasks that create the project's static files in wwwroot

1
aspnet-core/modules/BasicManagement/src/Lion.AbpPro.BasicManagement.Application/Users/UserAppService.cs

@ -109,7 +109,6 @@ namespace Lion.AbpPro.BasicManagement.Users
[Authorize(IdentityPermissions.Users.Update)] [Authorize(IdentityPermissions.Users.Update)]
public virtual async Task<IdentityUserDto> UpdateAsync(UpdateUserInput input) public virtual async Task<IdentityUserDto> UpdateAsync(UpdateUserInput input)
{ {
input.UserInfo.IsActive = true;
return await _identityUserAppService.UpdateAsync(input.UserId, input.UserInfo); return await _identityUserAppService.UpdateAsync(input.UserId, input.UserInfo);
} }

23
aspnet-core/shared/Lion.AbpPro.Shared.Hosting.Microservices/Lion/AbpPro/AbpProSharedHostingMicroserviceModule.cs

@ -1,6 +1,8 @@
using Microsoft.AspNetCore.DataProtection; using Microsoft.AspNetCore.DataProtection;
using StackExchange.Redis; using StackExchange.Redis;
using Volo.Abp.AspNetCore.MultiTenancy;
using Volo.Abp.Caching; using Volo.Abp.Caching;
using Volo.Abp.MultiTenancy;
using Volo.Abp.Settings; using Volo.Abp.Settings;
namespace Lion.AbpPro; namespace Lion.AbpPro;
@ -23,6 +25,7 @@ public class AbpProSharedHostingMicroserviceModule : AbpModule
ConfigureConsul(context, configuration); ConfigureConsul(context, configuration);
ConfigAntiForgery(); ConfigAntiForgery();
ConfigureAbpExceptions(context); ConfigureAbpExceptions(context);
ConfigureTenantResolvers();
} }
/// <summary> /// <summary>
@ -75,11 +78,11 @@ public class AbpProSharedHostingMicroserviceModule : AbpModule
.Select(o => o.RemovePostFix("/")) .Select(o => o.RemovePostFix("/"))
.ToArray() .ToArray()
) )
.WithAbpExposedHeaders() //.WithAbpExposedHeaders()
.SetIsOriginAllowedToAllowWildcardSubdomains() .SetIsOriginAllowedToAllowWildcardSubdomains()
.AllowAnyHeader() .AllowAnyHeader()
.AllowAnyMethod() .AllowAnyMethod()
.AllowCredentials() //.AllowCredentials()
// https://www.cnblogs.com/JulianHuang/p/14225515.html // https://www.cnblogs.com/JulianHuang/p/14225515.html
// https://learn.microsoft.com/zh-cn/aspnet/core/security/cors?view=aspnetcore-7.0 // https://learn.microsoft.com/zh-cn/aspnet/core/security/cors?view=aspnetcore-7.0
.SetPreflightMaxAge((TimeSpan.FromHours(24))); .SetPreflightMaxAge((TimeSpan.FromHours(24)));
@ -118,4 +121,20 @@ public class AbpProSharedHostingMicroserviceModule : AbpModule
// context.Services.AddHealthChecks().AddRedis(redisConnectionString).AddMySql(connectString); // context.Services.AddHealthChecks().AddRedis(redisConnectionString).AddMySql(connectString);
context.Services.AddHealthChecks(); context.Services.AddHealthChecks();
} }
/// <summary>
/// 配置租户解析
/// </summary>
private void ConfigureTenantResolvers()
{
Configure<AbpTenantResolveOptions>(options =>
{
options.TenantResolvers.Clear();
// 只保留通过请求头解析租户
// options.TenantResolvers.Add(new QueryStringTenantResolveContributor());
// options.TenantResolvers.Add(new RouteTenantResolveContributor());
options.TenantResolvers.Add(new HeaderTenantResolveContributor());
// options.TenantResolvers.Add(new CookieTenantResolveContributor());
});
}
} }

2
vben28/package.json

@ -70,7 +70,7 @@
"vue": "3.2.33", "vue": "3.2.33",
"vue-i18n": "^9.1.9", "vue-i18n": "^9.1.9",
"vue-json-pretty": "^2.0.6", "vue-json-pretty": "^2.0.6",
"vue-router": "^4.0.14", "vue-router": "4.0.14",
"vue-types": "^4.1.1", "vue-types": "^4.1.1",
"xlsx": "^0.18.5", "xlsx": "^0.18.5",
"oidc-client": "^1.11.5", "oidc-client": "^1.11.5",

2
vben28/src/router/constant.ts

@ -4,6 +4,8 @@ export const PARENT_LAYOUT_NAME = 'ParentLayout';
export const PAGE_NOT_FOUND_NAME = 'PageNotFound'; export const PAGE_NOT_FOUND_NAME = 'PageNotFound';
export const PAGE_NOT_FOUND_NAME_PATH = 'PageNotFoundPath';
export const EXCEPTION_COMPONENT = () => import('/@/views/sys/exception/Exception.vue'); export const EXCEPTION_COMPONENT = () => import('/@/views/sys/exception/Exception.vue');
/** /**

1
vben28/src/store/modules/user.ts

@ -224,7 +224,6 @@ export const useUserStore = defineStore({
*/ */
async logout(goLogin = false) { async logout(goLogin = false) {
try { try {
debugger;
if (this.userInfo?.isSts) { if (this.userInfo?.isSts) {
await useOidcLogout(); await useOidcLogout();
} else { } else {

7
vben28/src/views/admin/users/AbpUser.ts

@ -136,6 +136,13 @@ export const createFormSchema: FormSchema[] = [
]; ];
export const editFormSchema: FormSchema[] = [ export const editFormSchema: FormSchema[] = [
{
field: 'isActive',
component: 'Input',
label: t('routes.admin.userManagement_name'),
labelWidth: 130,
show: false,
},
{ {
field: 'userName', field: 'userName',
component: 'Input', component: 'Input',

5
vben28/src/views/admin/users/EditAbpUser.vue

@ -83,7 +83,8 @@ export default defineComponent({
name: data.record.name, name: data.record.name,
userName: data.record.userName, userName: data.record.userName,
email: data.record.email, email: data.record.email,
phoneNumber: data.record.phoneNumber phoneNumber: data.record.phoneNumber,
isActive: data.record.isActive,
}); });
}); });
@ -127,7 +128,7 @@ export default defineComponent({
userInfo.concurrencyStamp = currentUserInfo.concurrencyStamp; userInfo.concurrencyStamp = currentUserInfo.concurrencyStamp;
userInfo.roleNames = defaultRolesRef.value; userInfo.roleNames = defaultRolesRef.value;
userInfo.password = request.password; userInfo.password = request.password;
userInfo.isActive = request.isActive;
updateUserInput.userId = currentUserInfo.id; updateUserInput.userId = currentUserInfo.id;
updateUserInput.userInfo = userInfo; updateUserInput.userInfo = userInfo;
await updateUserAsync({ await updateUserAsync({

Loading…
Cancel
Save