From 418198fe80f9dd3fd8529ae49bae1b7a6f574dfe Mon Sep 17 00:00:00 2001 From: DaxPay Dev Date: Wed, 24 Jun 2026 18:48:39 +0800 Subject: [PATCH] =?UTF-8?q?refine(notify):=20=E9=93=83=E9=93=9B=E4=B8=8E?= =?UTF-8?q?=E5=85=AC=E5=91=8A=E7=BC=96=E8=BE=91=E4=BD=93=E9=AA=8C=E4=BC=98?= =?UTF-8?q?=E5=8C=96,=20=E6=96=B0=E5=A2=9E=E9=80=9A=E7=9F=A5=E4=B8=AD?= =?UTF-8?q?=E5=BF=83=E9=A1=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 铃铛: 只显示未读、红点改未读数字badge(99+)、点击查看正文、按类型切换图标(Bell/Inbox)、去除内容摘要/删除按钮/未读小点、标题省略避让已读按钮、important 标题红色、上下栏紧凑 - 公告编辑: Modal改Drawer(85%宽)、正文/标题占满(label2/wrapper22)、元信息两列横排、severity/isTop必填、生效/过期时间tooltip、正文变动关闭二次确认 - 公告列表: 操作列竖线分隔 - 通知中心(新): 铃铛查看全部跳转(/notify/center), 标题点击查看正文(Modal), important标题红色, 操作列精简 - 时间格式化(formatDateTime)、铃铛查看不再弹已读提示、i18n(zh/en)补全 --- apps/daxpay-admin/src/layouts/basic.vue | 50 +++- .../src/locales/langs/en-US/common.json | 2 + .../locales/langs/en-US/system/notify.json | 23 +- .../src/locales/langs/zh-CN/common.json | 2 + .../locales/langs/zh-CN/system/notify.json | 23 +- apps/daxpay-admin/src/router/routes/core.ts | 16 +- apps/daxpay-admin/src/router/routes/index.ts | 6 +- apps/daxpay-admin/src/store/notify.ts | 3 +- .../system/notify/center/NotifyCenter.vue | 220 ++++++++++++++++++ .../views/system/notify/notice/NoticeEdit.vue | 214 ++++++++++------- .../views/system/notify/notice/NoticeList.vue | 3 + .../src/widgets/notification/notification.vue | 80 +++---- .../layouts/src/widgets/notification/types.ts | 14 +- 13 files changed, 508 insertions(+), 148 deletions(-) create mode 100644 apps/daxpay-admin/src/views/system/notify/center/NotifyCenter.vue diff --git a/apps/daxpay-admin/src/layouts/basic.vue b/apps/daxpay-admin/src/layouts/basic.vue index a0c9dbe27..be54d8bbb 100644 --- a/apps/daxpay-admin/src/layouts/basic.vue +++ b/apps/daxpay-admin/src/layouts/basic.vue @@ -1,32 +1,45 @@ + + diff --git a/apps/daxpay-admin/src/views/system/notify/notice/NoticeEdit.vue b/apps/daxpay-admin/src/views/system/notify/notice/NoticeEdit.vue index 99db2a3f1..a505c235c 100644 --- a/apps/daxpay-admin/src/views/system/notify/notice/NoticeEdit.vue +++ b/apps/daxpay-admin/src/views/system/notify/notice/NoticeEdit.vue @@ -15,29 +15,23 @@ const emits = defineEmits(['ok']); - const { message } = useMessage(); + const { confirm, message } = useMessage(); - const { - initFormEditType, - handleCancel, - labelCol, - wrapperCol, - visible, - title, - confirmLoading, - showable, - editable, - formEditType, - } = useFormEdit(); + const { initFormEditType, handleCancel, visible, title, confirmLoading, showable, editable, formEditType } = + useFormEdit(); const formRef = ref(); // 公告表单(时间用 dayjs 对象, 提交时转 ISO 字符串) const form = ref>({ severity: 'normal', isTop: false }); + // 正文初始内容(用于关闭时检测是否有未保存修改) + const loadedContent = ref(''); // 表单校验规则 const rules = { title: [{ required: true, message: $t('system.notify.inputTitle') }], content: [{ required: true, message: $t('system.notify.inputContent') }], + severity: [{ required: true, message: $t('system.notify.severityRequired') }], + isTop: [{ required: true, message: $t('system.notify.isTopRequired') }], }; // 重要程度选项 @@ -68,6 +62,8 @@ effectiveTime: data.effectiveTime ? dayjs(data.effectiveTime) : undefined, expireTime: data.expireTime ? dayjs(data.expireTime) : undefined, }; + // 记录正文初始值, 用于关闭时检测变动 + loadedContent.value = data.content ?? ''; confirmLoading.value = false; }); } else { @@ -82,9 +78,26 @@ nextTick(() => { formRef.value?.resetFields(); form.value = { severity: 'normal', isTop: false }; + loadedContent.value = ''; }); } + /** + * 关闭抽屉(正文有未保存修改时二次确认) + */ + function closeWithConfirm() { + const content = form.value.content ?? ''; + if (content && content !== loadedContent.value) { + confirm({ + title: $t('common.warning'), + content: $t('system.notify.confirmCloseContent'), + onOk: () => handleCancel(), + }); + } else { + handleCancel(); + } + } + /** * 提交 */ @@ -116,76 +129,119 @@ + + diff --git a/apps/daxpay-admin/src/views/system/notify/notice/NoticeList.vue b/apps/daxpay-admin/src/views/system/notify/notice/NoticeList.vue index 426abd674..268a4df80 100644 --- a/apps/daxpay-admin/src/views/system/notify/notice/NoticeList.vue +++ b/apps/daxpay-admin/src/views/system/notify/notice/NoticeList.vue @@ -226,6 +226,9 @@
-
+
{{ $t('ui.widgets.notifications') }}
@@ -175,17 +165,7 @@ function navigateTo(
-
- - {{ $t('ui.widgets.clearNotifications') }} - +
{{ $t('ui.widgets.viewAll') }} diff --git a/packages/effects/layouts/src/widgets/notification/types.ts b/packages/effects/layouts/src/widgets/notification/types.ts index 4b684f280..d868a8d77 100644 --- a/packages/effects/layouts/src/widgets/notification/types.ts +++ b/packages/effects/layouts/src/widgets/notification/types.ts @@ -1,6 +1,18 @@ interface NotificationItem { id: number | string; - avatar: string; + avatar?: string; + /** + * 通知类型(notice 公告 / message 个人消息), 用于切换图标 + */ + type?: string; + /** + * 未读数, 用于铃铛图标角标显示 + */ + count?: number; + /** + * 重要程度(important 重要), 用于标题红色标注 + */ + severity?: string; date: string; isRead?: boolean; message: string;