From 55a43762c85b40c038bcfcdb8f2105f4b22ac8bb Mon Sep 17 00:00:00 2001 From: cKey <35512826+colinin@users.noreply.github.com> Date: Sat, 6 Jun 2020 21:14:29 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E7=BB=84=E7=BB=87=E6=9C=BA?= =?UTF-8?q?=E6=9E=84=E9=85=8D=E7=BD=AE=E9=A1=B9;=E5=8F=98=E6=9B=B4?= =?UTF-8?q?=E9=80=9A=E7=9F=A5=E6=B6=88=E6=81=AF=E6=A0=87=E8=AF=86=E4=B8=BA?= =?UTF-8?q?string=E7=B1=BB=E5=9E=8B,=E4=BB=A5=E8=A7=A3=E5=86=B3js=E4=BC=A0?= =?UTF-8?q?=E9=80=92long=E7=B1=BB=E5=9E=8B=E6=BA=A2=E5=87=BA=E7=9A=84?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../LINGYUN/Abp/Account/AccountAppService.cs | 1 + .../SignalR/Hubs/NotificationsHub.cs | 4 +- .../Abp/Notifications/NotificationInfo.cs | 8 +- .../Notifications/NotificationStore.cs | 8 +- .../EfCoreUserNotificationRepository.cs | 3 +- .../Controllers/NotificationController.cs | 2 - .../Identity/Localization/zh-Hans.json | 4 +- .../Notification/components/UserMessages.vue | 0 .../components/UserNofitications.vue | 190 ++++++++++ vueJs/src/components/Notification/index.vue | 179 +-------- vueJs/src/lang/zh.ts | 4 + vueJs/src/utils/request.ts | 46 +-- .../components/GlobalSettingEditForm.vue | 358 ++++++++++++++++-- vueJs/src/views/login/index.vue | 4 +- vueJs/src/views/register/index.vue | 3 +- vueJs/src/views/reset-password/index.vue | 3 +- 16 files changed, 564 insertions(+), 253 deletions(-) create mode 100644 vueJs/src/components/Notification/components/UserMessages.vue create mode 100644 vueJs/src/components/Notification/components/UserNofitications.vue diff --git a/aspnet-core/modules/account/LINGYUN.Abp.Account.Application/LINGYUN/Abp/Account/AccountAppService.cs b/aspnet-core/modules/account/LINGYUN.Abp.Account.Application/LINGYUN/Abp/Account/AccountAppService.cs index e73ac96ac..0f493118a 100644 --- a/aspnet-core/modules/account/LINGYUN.Abp.Account.Application/LINGYUN/Abp/Account/AccountAppService.cs +++ b/aspnet-core/modules/account/LINGYUN.Abp.Account.Application/LINGYUN/Abp/Account/AccountAppService.cs @@ -9,6 +9,7 @@ using Volo.Abp.Identity; using Volo.Abp.Settings; using Volo.Abp.Sms; using Volo.Abp.Uow; +using Microsoft.AspNetCore.Cryptography; namespace LINGYUN.Abp.Account { diff --git a/aspnet-core/modules/common/LINGYUN.Abp.Notifications.SignalR/LINGYUN/Abp/Notifications/SignalR/Hubs/NotificationsHub.cs b/aspnet-core/modules/common/LINGYUN.Abp.Notifications.SignalR/LINGYUN/Abp/Notifications/SignalR/Hubs/NotificationsHub.cs index 5cd3ab3f1..67f7c60e5 100644 --- a/aspnet-core/modules/common/LINGYUN.Abp.Notifications.SignalR/LINGYUN/Abp/Notifications/SignalR/Hubs/NotificationsHub.cs +++ b/aspnet-core/modules/common/LINGYUN.Abp.Notifications.SignalR/LINGYUN/Abp/Notifications/SignalR/Hubs/NotificationsHub.cs @@ -22,9 +22,9 @@ namespace LINGYUN.Abp.Notifications.SignalR.Hubs } [HubMethodName("ChangeState")] - public virtual async Task ChangeStateAsync(long id, NotificationReadState readState = NotificationReadState.Read) + public virtual async Task ChangeStateAsync(string id, NotificationReadState readState = NotificationReadState.Read) { - await NotificationStore.ChangeUserNotificationReadStateAsync(CurrentTenant.Id, CurrentUser.GetId(), id, readState); + await NotificationStore.ChangeUserNotificationReadStateAsync(CurrentTenant.Id, CurrentUser.GetId(), long.Parse(id), readState); } diff --git a/aspnet-core/modules/common/LINGYUN.Abp.Notifications/LINGYUN/Abp/Notifications/NotificationInfo.cs b/aspnet-core/modules/common/LINGYUN.Abp.Notifications/LINGYUN/Abp/Notifications/NotificationInfo.cs index 6b0b5bc98..6f4d96b21 100644 --- a/aspnet-core/modules/common/LINGYUN.Abp.Notifications/LINGYUN/Abp/Notifications/NotificationInfo.cs +++ b/aspnet-core/modules/common/LINGYUN.Abp.Notifications/LINGYUN/Abp/Notifications/NotificationInfo.cs @@ -7,8 +7,7 @@ namespace LINGYUN.Abp.Notifications { public Guid? TenantId { get; set; } public string Name { get; set; } - [JsonConverter(typeof(HexLongConverter))] - public long Id { get; set; } + public string Id { get; set; } public NotificationData Data { get; set; } public DateTime CreationTime { get; set; } public NotificationType NotificationType { get; set; } @@ -21,5 +20,10 @@ namespace LINGYUN.Abp.Notifications CreationTime = DateTime.Now; } + + public long GetId() + { + return long.Parse(Id); + } } } diff --git a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Notifications/NotificationStore.cs b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Notifications/NotificationStore.cs index d0130281e..c9de3a3c0 100644 --- a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Notifications/NotificationStore.cs +++ b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Notifications/NotificationStore.cs @@ -60,7 +60,7 @@ namespace LINGYUN.Abp.MessageService.Notifications { using (CurrentTenant.Change(notification.TenantId)) { - var notify = await NotificationRepository.GetByIdAsync(notification.Id); + var notify = await NotificationRepository.GetByIdAsync(notification.GetId()); await NotificationRepository.DeleteAsync(notify.Id); await unitOfWork.SaveChangesAsync(); @@ -171,7 +171,7 @@ namespace LINGYUN.Abp.MessageService.Notifications await NotificationRepository.InsertAsync(notify); - notification.Id = notify.NotificationId; + notification.Id = notify.NotificationId.ToString(); await unitOfWork.SaveChangesAsync(); } @@ -185,7 +185,7 @@ namespace LINGYUN.Abp.MessageService.Notifications { using (CurrentTenant.Change(notification.TenantId)) { - var userNotification = new UserNotification(notification.Id, userId); + var userNotification = new UserNotification(notification.GetId(), userId); await UserNotificationRepository.InsertAsync(userNotification); await unitOfWork.SaveChangesAsync(); @@ -245,7 +245,7 @@ namespace LINGYUN.Abp.MessageService.Notifications var userNofitications = new List(); foreach(var userId in userIds) { - var userNofitication = new UserNotification(notification.Id, userId); + var userNofitication = new UserNotification(notification.GetId(), userId); userNofitications.Add(userNofitication); } await UserNotificationRepository.InsertUserNotificationsAsync(userNofitications); diff --git a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.EntityFrameworkCore/LINGYUN/Abp/MessageService/Notifications/EfCoreUserNotificationRepository.cs b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.EntityFrameworkCore/LINGYUN/Abp/MessageService/Notifications/EfCoreUserNotificationRepository.cs index 96d4f55e7..41d5a37b7 100644 --- a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.EntityFrameworkCore/LINGYUN/Abp/MessageService/Notifications/EfCoreUserNotificationRepository.cs +++ b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.EntityFrameworkCore/LINGYUN/Abp/MessageService/Notifications/EfCoreUserNotificationRepository.cs @@ -49,7 +49,8 @@ namespace LINGYUN.Abp.MessageService.Notifications join n in DbContext.Set() on un.NotificationId equals n.NotificationId where un.UserId.Equals(userId) && un.ReadStatus.Equals(readState) - select n) + orderby n.NotificationId descending + select n) .Take(maxResultCount) .ToListAsync(); return userNofitications; diff --git a/aspnet-core/services/messages/LINGYUN.Abp.MessageService.HttpApi.Host/Controllers/NotificationController.cs b/aspnet-core/services/messages/LINGYUN.Abp.MessageService.HttpApi.Host/Controllers/NotificationController.cs index fc87e40a4..200f1be92 100644 --- a/aspnet-core/services/messages/LINGYUN.Abp.MessageService.HttpApi.Host/Controllers/NotificationController.cs +++ b/aspnet-core/services/messages/LINGYUN.Abp.MessageService.HttpApi.Host/Controllers/NotificationController.cs @@ -26,11 +26,9 @@ namespace LINGYUN.Abp.MessageService.Controllers TenantId = null, NotificationSeverity = notification.Severity, NotificationType = NotificationType.Application, - Id = new Random().Next(int.MinValue, int.MaxValue), Name = "TestApplicationNotofication", CreationTime = Clock.Now }; - notificationInfo.Data.Properties["id"] = notificationInfo.Id.ToString(); notificationInfo.Data.Properties["title"] = notification.Title; notificationInfo.Data.Properties["message"] = notification.Message; notificationInfo.Data.Properties["datetime"] = Clock.Now; diff --git a/aspnet-core/services/platform/LINGYUN.Platform.HttpApi.Host/LINGYUN/Platform/Identity/Localization/zh-Hans.json b/aspnet-core/services/platform/LINGYUN.Platform.HttpApi.Host/LINGYUN/Platform/Identity/Localization/zh-Hans.json index 83575a629..10c8c6196 100644 --- a/aspnet-core/services/platform/LINGYUN.Platform.HttpApi.Host/LINGYUN/Platform/Identity/Localization/zh-Hans.json +++ b/aspnet-core/services/platform/LINGYUN.Platform.HttpApi.Host/LINGYUN/Platform/Identity/Localization/zh-Hans.json @@ -2,6 +2,8 @@ "culture": "zh-Hans", "texts": { "DisplayName:Abp.Identity.SignIn.EnablePhoneNumberConfirmation": "启用电话号码确认", - "Description:Abp.Identity.SignIn.EnablePhoneNumberConfirmation": "用户是否可以确认电话号码." + "Description:Abp.Identity.SignIn.EnablePhoneNumberConfirmation": "用户是否可以确认电话号码.", + "Identity.OrganizationUnit.MaxUserMembershipCount": "最大组织机构数", + "Description:Abp.Identity.OrganizationUnit.MaxUserMembershipCount": "单个用户允许加入的最大组织机构数." } } \ No newline at end of file diff --git a/vueJs/src/components/Notification/components/UserMessages.vue b/vueJs/src/components/Notification/components/UserMessages.vue new file mode 100644 index 000000000..e69de29bb diff --git a/vueJs/src/components/Notification/components/UserNofitications.vue b/vueJs/src/components/Notification/components/UserNofitications.vue new file mode 100644 index 000000000..c0b14ba73 --- /dev/null +++ b/vueJs/src/components/Notification/components/UserNofitications.vue @@ -0,0 +1,190 @@ + + + + + diff --git a/vueJs/src/components/Notification/index.vue b/vueJs/src/components/Notification/index.vue index 0f4e776ac..827ea7ea1 100644 --- a/vueJs/src/components/Notification/index.vue +++ b/vueJs/src/components/Notification/index.vue @@ -1,9 +1,9 @@ @@ -207,8 +58,4 @@ export default class extends Vue { .item.el-dropdown-selfdefine > .el-badge__content.el-badge__content--undefined.is-fixed { top: 10px; } -.notification > .ivu-list.ivu-list-small.ivu-list-horizontal.ivu-list-split{ - max-height: 200px; - overflow: auto; -} diff --git a/vueJs/src/lang/zh.ts b/vueJs/src/lang/zh.ts index 692e49ad1..230393785 100644 --- a/vueJs/src/lang/zh.ts +++ b/vueJs/src/lang/zh.ts @@ -610,5 +610,9 @@ export default { correctEmailAddress: '正确的邮件地址', correctPhoneNumber: '正确的手机号码', operatingFast: '您的操作过快,请稍后再试!' + }, + messages: { + noNotifications: '没有通知', + noMessages: '没有消息' } } diff --git a/vueJs/src/utils/request.ts b/vueJs/src/utils/request.ts index 3b53611d6..3e3a71927 100644 --- a/vueJs/src/utils/request.ts +++ b/vueJs/src/utils/request.ts @@ -97,40 +97,18 @@ service.interceptors.response.use( }, (error) => { showError(error.response.data, error.response.status) - if (error.response.status === 401) { - if (UserModule.refreshToken) { - UserModule.RefreshSession().then(() => { - return service.request(error.config) - }).catch(() => { - MessageBox.confirm( - l('login.tokenExprition'), - l('login.confirmLogout'), - { - confirmButtonText: l('login.relogin'), - cancelButtonText: l('global.cancel'), - type: 'error' - }).then(() => { - UserModule.ResetToken() - location.reload() // To prevent bugs from vue-router - return Promise.reject(error) - }) - }) - } else { - MessageBox.confirm( - l('login.tokenExprition'), - l('login.confirmLogout'), - { - confirmButtonText: l('login.relogin'), - cancelButtonText: l('global.cancel'), - type: 'error' - }).then(() => { - UserModule.ResetToken() - location.reload() // To prevent bugs from vue-router - return Promise.reject(error) - }) - } - } - return Promise.reject(error) + MessageBox.confirm( + l('login.tokenExprition'), + l('login.confirmLogout'), + { + confirmButtonText: l('login.relogin'), + cancelButtonText: l('global.cancel'), + type: 'error' + }).then(() => { + UserModule.ResetToken() + location.reload() // To prevent bugs from vue-router + return Promise.reject(error) + }) } ) diff --git a/vueJs/src/views/admin/settings/components/GlobalSettingEditForm.vue b/vueJs/src/views/admin/settings/components/GlobalSettingEditForm.vue index 96cbe86d1..4f81d06ae 100644 --- a/vueJs/src/views/admin/settings/components/GlobalSettingEditForm.vue +++ b/vueJs/src/views/admin/settings/components/GlobalSettingEditForm.vue @@ -1,5 +1,5 @@