From e9ee6cb1f5804a78494dcd8b1e65511740036dd9 Mon Sep 17 00:00:00 2001 From: Charles7c Date: Mon, 30 Oct 2023 21:25:43 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E6=B6=88=E6=81=AF?= =?UTF-8?q?=E7=AE=A1=E7=90=86=E9=83=A8=E5=88=86=E6=A0=BC=E5=BC=8F=E5=8F=8A?= =?UTF-8?q?=E6=8B=BC=E5=86=99=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 6 ++- continew-admin-ui/src/api/system/message.ts | 23 +++++---- .../src/components/message-box/index.vue | 19 ++----- .../src/components/message-box/list.vue | 15 +++--- .../src/components/navbar/index.vue | 4 +- .../src/router/routes/modules/system.ts | 26 +++++----- .../src/views/system/message/index.vue | 49 +++++++++++++------ .../controller/system/MessageController.java | 4 +- .../changelog/v1.2.0/continew-admin_data.sql | 17 +++---- .../changelog/v1.3.0/continew-admin_data.sql | 8 ++- 10 files changed, 90 insertions(+), 81 deletions(-) diff --git a/README.md b/README.md index 220a9973..23e01c52 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ License - + Release @@ -72,11 +72,12 @@ ContiNew Admin (Continue New Admin)中后台管理框架/脚手架,持续 > **Note** > 更多功能和优化正在赶来💦,最新项目计划和进展请关注 [GitHub Project](https://github.com/Charles7c/continew-admin/projects) 和 [CHANGELOG.md](https://github.com/Charles7c/continew-admin/blob/dev/CHANGELOG.md)。 -- 用户管理:提供用户的相关配置,新增用户后,默认密码为 123456,且支持第三方账号登录、邮箱登录,可在个人中心灵活修改 +- 用户管理:提供用户的相关配置,新增用户后,默认密码为 123456,且支持第三方账号登录、邮箱登录、手机号登录,可在个人中心灵活配置 - 部门管理:可配置系统组织架构,树形表格展示 - 角色管理:对权限与菜单进行分配,可根据部门设置角色的数据权限 - 菜单管理:已实现菜单动态路由,后端可配置化,支持多级菜单 - 公告管理:提供公告的发布、查看和删除等功能。管理员可以在后台发布公告,并可以设置公告的生效时间、终止时间,以 markdown-it 为内核渲染 Markdown 格式内容显示 +- 消息管理:提供消息中心功能,暂时仅支持系统消息管理 - 字典管理:提供对系统公用数据字典的维护,例如:公告类型,支持字典标签背景色和排序等配置 - 系统配置:提供修改系统标题、Logo、favicon 等基础配置功能,以方便用户系统与其自身品牌形象保持一致(暂未开放高级配置) - 代码生成:提供根据数据库表自动生成相应的前后端 CRUD 代码的功能 @@ -429,6 +430,7 @@ continew-admin │ │ ├─ dept # 部门管理 │ │ ├─ dict # 字典管理 │ │ ├─ menu # 菜单管理 + │ │ ├─ message # 消息管理 │ │ ├─ role # 角色管理 │ │ └─ user # 用户模块 │ │ └─ center # 个人中心 diff --git a/continew-admin-ui/src/api/system/message.ts b/continew-admin-ui/src/api/system/message.ts index 64ec5a94..8fd22bbd 100644 --- a/continew-admin-ui/src/api/system/message.ts +++ b/continew-admin-ui/src/api/system/message.ts @@ -1,19 +1,18 @@ import axios from 'axios'; import qs from 'query-string'; -import { DataRecord } from "@/api/system/dict"; const BASE_URL = '/system/message'; export interface MessageRecord { - id?: number; - type?: string; - title?: string; - subTitle?: string; - avatar?: string; - content?: string; - createTime?: string; - readStatus?: 0 | 1; - messageType?: number; + id: number; + title: string; + content: string; + type: string; + createUserString: string; + createTime: string; + subTitle: string; + readStatus: boolean; + readTime: string; } export interface ChatRecord { @@ -30,12 +29,12 @@ export interface ListParam { type?: string; page?: number; size?: number; - uid?:number + uid?: number; sort?: Array; } export interface PageRes { - list: DataRecord[]; + list: MessageRecord[]; total: number; } diff --git a/continew-admin-ui/src/components/message-box/index.vue b/continew-admin-ui/src/components/message-box/index.vue index 615ea5a3..f4c36278 100644 --- a/continew-admin-ui/src/components/message-box/index.vue +++ b/continew-admin-ui/src/components/message-box/index.vue @@ -52,8 +52,6 @@ list({ sort: ['createTime,desc'] }).then((res) => { messageData.messageList = res.data; }); - } catch (err) { - // you can report use errorHandler or other } finally { setLoading(false); } @@ -67,16 +65,16 @@ async function readMessage(data: MessageListType) { const ids = data.map((item) => item.id); await read(ids); - fetchSourceData(); + await fetchSourceData(); } /** * 每个消息类型下的消息列表 */ const renderList = computed(() => { - return messageData.messageList.filter( - (item) => item.type === messageType.value && !item.readStatus - ).splice(0,3); + return messageData.messageList + .filter((item) => item.type === messageType.value && !item.readStatus) + .splice(0, 3); }); /** @@ -115,15 +113,6 @@ const handleItemClick = (items: MessageListType) => { if (renderList.value.length) readMessage([...items]); }; - - /** - * 清空消息 - */ - const emptyList = () => { - read([]).then((res) => { - messageData.messageList = []; - }); - }; fetchSourceData(); diff --git a/continew-admin-ui/src/components/message-box/list.vue b/continew-admin-ui/src/components/message-box/list.vue index d9890d4a..c1e69180 100644 --- a/continew-admin-ui/src/components/message-box/list.vue +++ b/continew-admin-ui/src/components/message-box/list.vue @@ -5,17 +5,11 @@ :key="item.id" action-layout="vertical" :style="{ - opacity: item.readStatus == 1 ? 0.5 : 1, + opacity: item.readStatus ? 0.5 : 1, }" >
- diff --git a/continew-admin-webapi/src/main/java/top/charles7c/cnadmin/webapi/controller/system/MessageController.java b/continew-admin-webapi/src/main/java/top/charles7c/cnadmin/webapi/controller/system/MessageController.java index 9770bc5e..0daff216 100644 --- a/continew-admin-webapi/src/main/java/top/charles7c/cnadmin/webapi/controller/system/MessageController.java +++ b/continew-admin-webapi/src/main/java/top/charles7c/cnadmin/webapi/controller/system/MessageController.java @@ -54,8 +54,8 @@ public class MessageController private final MessageUserService messageUserService; - @Operation(description = "将消息标记已读", summary = "将消息标记已读") - @Parameter(name = "ids", description = "消息ID", example = "1,2", in = ParameterIn.PATH) + @Operation(description = "标记已读", summary = "将消息标记为已读状态") + @Parameter(name = "ids", description = "消息ID列表", example = "1,2", in = ParameterIn.QUERY) @PatchMapping("/read") public void readMessage(@RequestParam(required = false) List ids) { messageUserService.readMessage(ids); diff --git a/continew-admin-webapi/src/main/resources/db/changelog/v1.2.0/continew-admin_data.sql b/continew-admin-webapi/src/main/resources/db/changelog/v1.2.0/continew-admin_data.sql index 5678c949..e5950da6 100644 --- a/continew-admin-webapi/src/main/resources/db/changelog/v1.2.0/continew-admin_data.sql +++ b/continew-admin-webapi/src/main/resources/db/changelog/v1.2.0/continew-admin_data.sql @@ -5,14 +5,14 @@ INSERT IGNORE INTO `sys_menu` (`id`, `title`, `parent_id`, `type`, `path`, `name`, `component`, `icon`, `is_external`, `is_cache`, `is_hidden`, `permission`, `sort`, `status`, `create_user`, `create_time`, `update_user`, `update_time`) VALUES -(1060, '字典管理', 1000, 2, '/system/dict', 'Dict', 'system/dict/index', 'bookmark', b'0', b'0', b'0', 'system:dict:list', 6, 1, 1, NOW(), NULL, NULL), -(1061, '字典新增', 1060, 3, NULL, NULL, NULL, NULL, b'0', b'0', b'0', 'system:dict:add', 1, 1, 1, NOW(), NULL, NULL), -(1062, '字典修改', 1060, 3, NULL, NULL, NULL, NULL, b'0', b'0', b'0', 'system:dict:update', 2, 1, 1, NOW(), NULL, NULL), -(1063, '字典删除', 1060, 3, NULL, NULL, NULL, NULL, b'0', b'0', b'0', 'system:dict:delete', 3, 1, 1, NOW(), NULL, NULL), -(1064, '字典导出', 1060, 3, NULL, NULL, NULL, NULL, b'0', b'0', b'0', 'system:dict:export', 4, 1, 1, NOW(), NULL, NULL), -(1070, '系统配置', 1000, 2, '/system/config', 'Config', 'system/config/index', 'desktop', b'0', b'0', b'0', 'system:config:list', 7, 1, 1, NOW(), NULL, NULL), -(1071, '修改配置', 1070, 3, NULL, NULL, NULL, NULL, b'0', b'0', b'0', 'system:config:update', 1, 1, 1, NOW(), NULL, NULL), -(1072, '恢复默认', 1070, 3, NULL, NULL, NULL, NULL, b'0', b'0', b'0', 'system:config:reset', 2, 1, 1, NOW(), NULL, NULL); +(1070, '字典管理', 1000, 2, '/system/dict', 'Dict', 'system/dict/index', 'bookmark', b'0', b'0', b'0', 'system:dict:list', 7, 1, 1, NOW(), NULL, NULL), +(1071, '字典新增', 1070, 3, NULL, NULL, NULL, NULL, b'0', b'0', b'0', 'system:dict:add', 1, 1, 1, NOW(), NULL, NULL), +(1072, '字典修改', 1070, 3, NULL, NULL, NULL, NULL, b'0', b'0', b'0', 'system:dict:update', 2, 1, 1, NOW(), NULL, NULL), +(1073, '字典删除', 1070, 3, NULL, NULL, NULL, NULL, b'0', b'0', b'0', 'system:dict:delete', 3, 1, 1, NOW(), NULL, NULL), +(1074, '字典导出', 1070, 3, NULL, NULL, NULL, NULL, b'0', b'0', b'0', 'system:dict:export', 4, 1, 1, NOW(), NULL, NULL), +(1080, '系统配置', 1000, 2, '/system/config', 'Config', 'system/config/index', 'desktop', b'0', b'0', b'0', 'system:config:list', 8, 1, 1, NOW(), NULL, NULL), +(1081, '修改配置', 1080, 3, NULL, NULL, NULL, NULL, b'0', b'0', b'0', 'system:config:update', 1, 1, 1, NOW(), NULL, NULL), +(1082, '恢复默认', 1080, 3, NULL, NULL, NULL, NULL, b'0', b'0', b'0', 'system:config:reset', 2, 1, 1, NOW(), NULL, NULL); -- 初始化默认字典 INSERT IGNORE INTO `sys_dict` @@ -20,7 +20,6 @@ INSERT IGNORE INTO `sys_dict` VALUES (1, '公告类型', 'announcement_type', NULL, b'1', 1, NOW(), NULL, NULL); --- 初始化默认字典项 INSERT IGNORE INTO `sys_dict_item` (`id`, `label`, `value`, `color`, `sort`, `description`, `dict_id`, `create_user`, `create_time`, `update_user`, `update_time`) VALUES diff --git a/continew-admin-webapi/src/main/resources/db/changelog/v1.3.0/continew-admin_data.sql b/continew-admin-webapi/src/main/resources/db/changelog/v1.3.0/continew-admin_data.sql index f7427e0f..365808a1 100644 --- a/continew-admin-webapi/src/main/resources/db/changelog/v1.3.0/continew-admin_data.sql +++ b/continew-admin-webapi/src/main/resources/db/changelog/v1.3.0/continew-admin_data.sql @@ -1,13 +1,19 @@ -- liquibase formatted sql -- changeset BUSS_BCLS:1 +-- 初始化默认菜单 +INSERT IGNORE INTO `sys_menu` +(`id`, `title`, `parent_id`, `type`, `path`, `name`, `component`, `icon`, `is_external`, `is_cache`, `is_hidden`, `permission`, `sort`, `status`, `create_user`, `create_time`, `update_user`, `update_time`) +VALUES +(1060, '消息管理', 1000, 2, '/system/message', 'Message', 'system/message/index', 'notification', b'0', b'0', b'0', 'system:message:list', 6, 1, 1, NOW(), NULL, NULL), +(1061, '消息删除', 1060, 3, NULL, NULL, NULL, NULL, b'0', b'0', b'0', 'system:message:delete', 1, 1, 1, NOW(), NULL, NULL); + -- 初始化默认字典 INSERT IGNORE INTO `sys_dict` (`id`, `name`, `code`, `description`, `is_system`, `create_user`, `create_time`, `update_user`, `update_time`) VALUES (2, '消息类型', 'message_type', NULL, b'1', 1, NOW(), NULL, NULL); --- 初始化默认字典项 INSERT IGNORE INTO `sys_dict_item` (`id`, `label`, `value`, `color`, `sort`, `description`, `dict_id`, `create_user`, `create_time`, `update_user`, `update_time`) VALUES