fix: 修复消息管理部分格式及拼写错误

This commit is contained in:
Charles7c 2023-10-30 21:25:43 +08:00
parent 4cf9ef6d61
commit e9ee6cb1f5
10 changed files with 90 additions and 81 deletions

View File

@ -3,7 +3,7 @@
<a href="https://github.com/Charles7c/continew-admin/blob/dev/LICENSE" target="_blank"> <a href="https://github.com/Charles7c/continew-admin/blob/dev/LICENSE" target="_blank">
<img src="https://img.shields.io/badge/License-Apache--2.0-blue.svg" alt="License" /> <img src="https://img.shields.io/badge/License-Apache--2.0-blue.svg" alt="License" />
</a> </a>
<a href="https://github.com/Charles7c/continew-admin/tree/1.0.x" target="_blank"> <a href="https://github.com/Charles7c/continew-admin" target="_blank">
<img src="https://img.shields.io/badge/SNAPSHOT-v1.3.0-%23ff3f59.svg" alt="Release" /> <img src="https://img.shields.io/badge/SNAPSHOT-v1.3.0-%23ff3f59.svg" alt="Release" />
</a> </a>
<a href="https://github.com/Charles7c/continew-admin" target="_blank"> <a href="https://github.com/Charles7c/continew-admin" target="_blank">
@ -72,11 +72,12 @@ ContiNew Admin Continue New Admin中后台管理框架/脚手架,持续
> **Note** > **Note**
> 更多功能和优化正在赶来💦,最新项目计划和进展请关注 [GitHub Project](https://github.com/Charles7c/continew-admin/projects) 和 [CHANGELOG.md](https://github.com/Charles7c/continew-admin/blob/dev/CHANGELOG.md)。 > 更多功能和优化正在赶来💦,最新项目计划和进展请关注 [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 格式内容显示 - 公告管理:提供公告的发布、查看和删除等功能。管理员可以在后台发布公告,并可以设置公告的生效时间、终止时间,以 markdown-it 为内核渲染 Markdown 格式内容显示
- 消息管理:提供消息中心功能,暂时仅支持系统消息管理
- 字典管理:提供对系统公用数据字典的维护,例如:公告类型,支持字典标签背景色和排序等配置 - 字典管理:提供对系统公用数据字典的维护,例如:公告类型,支持字典标签背景色和排序等配置
- 系统配置提供修改系统标题、Logo、favicon 等基础配置功能,以方便用户系统与其自身品牌形象保持一致(暂未开放高级配置) - 系统配置提供修改系统标题、Logo、favicon 等基础配置功能,以方便用户系统与其自身品牌形象保持一致(暂未开放高级配置)
- 代码生成:提供根据数据库表自动生成相应的前后端 CRUD 代码的功能 - 代码生成:提供根据数据库表自动生成相应的前后端 CRUD 代码的功能
@ -429,6 +430,7 @@ continew-admin
│ │ ├─ dept # 部门管理 │ │ ├─ dept # 部门管理
│ │ ├─ dict # 字典管理 │ │ ├─ dict # 字典管理
│ │ ├─ menu # 菜单管理 │ │ ├─ menu # 菜单管理
│ │ ├─ message # 消息管理
│ │ ├─ role # 角色管理 │ │ ├─ role # 角色管理
│ │ └─ user # 用户模块 │ │ └─ user # 用户模块
│ │ └─ center # 个人中心 │ │ └─ center # 个人中心

View File

@ -1,19 +1,18 @@
import axios from 'axios'; import axios from 'axios';
import qs from 'query-string'; import qs from 'query-string';
import { DataRecord } from "@/api/system/dict";
const BASE_URL = '/system/message'; const BASE_URL = '/system/message';
export interface MessageRecord { export interface MessageRecord {
id?: number; id: number;
type?: string; title: string;
title?: string; content: string;
subTitle?: string; type: string;
avatar?: string; createUserString: string;
content?: string; createTime: string;
createTime?: string; subTitle: string;
readStatus?: 0 | 1; readStatus: boolean;
messageType?: number; readTime: string;
} }
export interface ChatRecord { export interface ChatRecord {
@ -30,12 +29,12 @@ export interface ListParam {
type?: string; type?: string;
page?: number; page?: number;
size?: number; size?: number;
uid?:number uid?: number;
sort?: Array<string>; sort?: Array<string>;
} }
export interface PageRes { export interface PageRes {
list: DataRecord[]; list: MessageRecord[];
total: number; total: number;
} }

View File

@ -52,8 +52,6 @@
list({ sort: ['createTime,desc'] }).then((res) => { list({ sort: ['createTime,desc'] }).then((res) => {
messageData.messageList = res.data; messageData.messageList = res.data;
}); });
} catch (err) {
// you can report use errorHandler or other
} finally { } finally {
setLoading(false); setLoading(false);
} }
@ -67,16 +65,16 @@
async function readMessage(data: MessageListType) { async function readMessage(data: MessageListType) {
const ids = data.map((item) => item.id); const ids = data.map((item) => item.id);
await read(ids); await read(ids);
fetchSourceData(); await fetchSourceData();
} }
/** /**
* 每个消息类型下的消息列表 * 每个消息类型下的消息列表
*/ */
const renderList = computed(() => { const renderList = computed(() => {
return messageData.messageList.filter( return messageData.messageList
(item) => item.type === messageType.value && !item.readStatus .filter((item) => item.type === messageType.value && !item.readStatus)
).splice(0,3); .splice(0, 3);
}); });
/** /**
@ -115,15 +113,6 @@
const handleItemClick = (items: MessageListType) => { const handleItemClick = (items: MessageListType) => {
if (renderList.value.length) readMessage([...items]); if (renderList.value.length) readMessage([...items]);
}; };
/**
* 清空消息
*/
const emptyList = () => {
read([]).then((res) => {
messageData.messageList = [];
});
};
fetchSourceData(); fetchSourceData();
</script> </script>

View File

@ -5,17 +5,11 @@
:key="item.id" :key="item.id"
action-layout="vertical" action-layout="vertical"
:style="{ :style="{
opacity: item.readStatus == 1 ? 0.5 : 1, opacity: item.readStatus ? 0.5 : 1,
}" }"
> >
<div class="item-wrap" @click="onItemClick(item)"> <div class="item-wrap" @click="onItemClick(item)">
<a-list-item-meta> <a-list-item-meta>
<template v-if="item.avatar" #avatar>
<a-avatar shape="circle">
<img v-if="item.avatar" :src="item.avatar" />
<icon-desktop v-else />
</a-avatar>
</template>
<template #title> <template #title>
<a-space :size="4"> <a-space :size="4">
<span>{{ item.title }}</span> <span>{{ item.title }}</span>
@ -90,9 +84,9 @@
/** /**
* 查看更多 * 查看更多
*/ */
const toList = ()=>{ const toList = () => {
router.push({ router.push({
path: '/system/message', name: 'Message',
}); });
}; };
@ -149,6 +143,9 @@
} }
.footer-wrap { .footer-wrap {
text-align: center; text-align: center;
.arco-link {
padding: 1px 10px;
}
} }
.arco-typography { .arco-typography {
margin-bottom: 0; margin-bottom: 0;

View File

@ -190,7 +190,7 @@
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { computed, ref, inject,watchEffect } from 'vue'; import { computed, ref, inject, watchEffect } from 'vue';
import { useDark, useToggle, useFullscreen } from '@vueuse/core'; import { useDark, useToggle, useFullscreen } from '@vueuse/core';
import { useAppStore, useUserStore } from '@/store'; import { useAppStore, useUserStore } from '@/store';
import { list } from '@/api/system/message'; import { list } from '@/api/system/message';
@ -227,7 +227,7 @@
const unReadMessageCount = ref(0); const unReadMessageCount = ref(0);
watchEffect(async () => { watchEffect(async () => {
const res = await list({ sort: ["createTime,desc"],readStatus:0 }); const res = await list({ sort: ['createTime,desc'], readStatus: 0 });
unReadMessageCount.value = res.data?.length ?? 0; unReadMessageCount.value = res.data?.length ?? 0;
}); });

View File

@ -39,6 +39,15 @@ const System: AppRouteRecordRaw = {
requiresAuth: true, requiresAuth: true,
}, },
}, },
{
name: 'Menu',
path: '/system/menu',
component: () => import('@/views/system/menu/index.vue'),
meta: {
locale: 'menu.system.menu.list',
requiresAuth: true,
},
},
{ {
name: 'Announcement', name: 'Announcement',
path: '/system/announcement', path: '/system/announcement',
@ -49,11 +58,11 @@ const System: AppRouteRecordRaw = {
}, },
}, },
{ {
name: 'Menu', name: 'Message',
path: '/system/menu', path: '/system/message',
component: () => import('@/views/system/menu/index.vue'), component: () => import('@/views/system/message/index.vue'),
meta: { meta: {
locale: 'menu.system.menu.list', locale: 'menu.system.message',
requiresAuth: true, requiresAuth: true,
}, },
}, },
@ -75,15 +84,6 @@ const System: AppRouteRecordRaw = {
requiresAuth: true, requiresAuth: true,
}, },
}, },
{
name: 'Message',
path: '/system/message',
component: () => import('@/views/system/message/index.vue'),
meta: {
locale: 'menu.system.message',
requiresAuth: true,
},
},
], ],
}; };

View File

@ -27,7 +27,12 @@
</a-form-item> </a-form-item>
<a-form-item field="type" hide-label> <a-form-item field="type" hide-label>
<a-select :style="{width:'150px'}" placeholder="是否已读" allow-clear v-model="queryParams.readStatus"> <a-select
v-model="queryParams.readStatus"
:style="{ width: '150px' }"
placeholder="是否已读"
allow-clear
>
<a-option :value="true"></a-option> <a-option :value="true"></a-option>
<a-option :value="false"></a-option> <a-option :value="false"></a-option>
</a-select> </a-select>
@ -66,7 +71,7 @@
<template #icon><icon-check /></template>全部已读 <template #icon><icon-check /></template>全部已读
</a-button> </a-button>
<a-button <a-button
v-permission="['system:announcement:delete']" v-permission="['system:message:delete']"
type="primary" type="primary"
status="danger" status="danger"
:disabled="multiple" :disabled="multiple"
@ -136,7 +141,9 @@
</a-table-column> </a-table-column>
<a-table-column title="发送时间" data-index="createTime" /> <a-table-column title="发送时间" data-index="createTime" />
<a-table-column <a-table-column
v-if="checkPermission(['system:message:delete'])" v-if="
checkPermission(['system:message:delete'])
"
title="操作" title="操作"
align="center" align="center"
> >
@ -157,7 +164,7 @@
@ok="handleDelete([record.id])" @ok="handleDelete([record.id])"
> >
<a-button <a-button
v-permission="['system:announcement:delete']" v-permission="['system:message:delete']"
type="text" type="text"
size="small" size="small"
title="删除" title="删除"
@ -202,7 +209,9 @@
<a-skeleton v-if="detailLoading" :animation="true"> <a-skeleton v-if="detailLoading" :animation="true">
<a-skeleton-line :rows="1" /> <a-skeleton-line :rows="1" />
</a-skeleton> </a-skeleton>
<span v-else-if="dataDetail.createUserString">{{ dataDetail.createUserString }}</span> <span v-else-if="dataDetail.createUserString">{{
dataDetail.createUserString
}}</span>
<dict-tag <dict-tag
v-if="dataDetail.createUserString == null" v-if="dataDetail.createUserString == null"
:value="dataDetail.type" :value="dataDetail.type"
@ -221,9 +230,9 @@
<a-skeleton v-if="detailLoading" :animation="true"> <a-skeleton v-if="detailLoading" :animation="true">
<a-skeleton-line :rows="1" /> <a-skeleton-line :rows="1" />
</a-skeleton> </a-skeleton>
<span color="green" v-else> <span v-else>
<a-tag v-if="dataDetail.readStatus" color="green">已读</a-tag> <a-tag v-if="dataDetail.readStatus" color="green"></a-tag>
<a-tag v-else color="red">未读</a-tag> <a-tag v-else color="red"></a-tag>
</span> </span>
</a-descriptions-item> </a-descriptions-item>
@ -262,7 +271,17 @@
const { message_type } = proxy.useDict('message_type'); const { message_type } = proxy.useDict('message_type');
const dataList = ref<MessageRecord[]>([]); const dataList = ref<MessageRecord[]>([]);
const dataDetail = ref<MessageRecord>({}); const dataDetail = ref<MessageRecord>({
id: 0,
title: '',
content: '',
type: '',
createUserString: '',
createTime: '',
subTitle: '',
readStatus: false,
readTime: '',
});
const total = ref(0); const total = ref(0);
const ids = ref<Array<number>>([]); const ids = ref<Array<number>>([]);
const single = ref(true); const single = ref(true);
@ -319,7 +338,6 @@
*/ */
const handleDetailCancel = () => { const handleDetailCancel = () => {
detailVisible.value = false; detailVisible.value = false;
dataDetail.value = {};
}; };
/** /**
@ -369,7 +387,7 @@
* 批量所以消息设置为已读 * 批量所以消息设置为已读
*/ */
const handleAllRedaMessage = () => { const handleAllRedaMessage = () => {
handleReadMessage([]); handleReadMessage([]);
}; };
/** /**
@ -391,14 +409,13 @@
* @param rowKeys ID 列表 * @param rowKeys ID 列表
*/ */
const handleSelectionChange = (rowKeys: Array<any>) => { const handleSelectionChange = (rowKeys: Array<any>) => {
const unReadMessageList = dataList.value.filter( const unReadMessageList = dataList.value.filter(
(item) => rowKeys.indexOf(item.id)!==-1 && !item.readStatus (item) => rowKeys.indexOf(item.id) !== -1 && !item.readStatus
); );
readMultiple.value=!unReadMessageList.length readMultiple.value = !unReadMessageList.length;
ids.value = rowKeys; ids.value = rowKeys;
single.value = rowKeys.length !== 1; single.value = rowKeys.length !== 1;
multiple.value = !rowKeys.length; multiple.value = !rowKeys.length;
}; };
/** /**
@ -439,7 +456,7 @@
<script lang="ts"> <script lang="ts">
export default { export default {
name: 'Announcement', name: 'Message',
}; };
</script> </script>

View File

@ -54,8 +54,8 @@ public class MessageController
private final MessageUserService messageUserService; private final MessageUserService messageUserService;
@Operation(description = "将消息标记已读", summary = "将消息标记已读") @Operation(description = "标记已读", summary = "将消息标记已读状态")
@Parameter(name = "ids", description = "消息ID", example = "1,2", in = ParameterIn.PATH) @Parameter(name = "ids", description = "消息ID列表", example = "1,2", in = ParameterIn.QUERY)
@PatchMapping("/read") @PatchMapping("/read")
public void readMessage(@RequestParam(required = false) List<Long> ids) { public void readMessage(@RequestParam(required = false) List<Long> ids) {
messageUserService.readMessage(ids); messageUserService.readMessage(ids);

View File

@ -5,14 +5,14 @@
INSERT IGNORE INTO `sys_menu` 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`) (`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 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), (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),
(1061, '字典新增', 1060, 3, NULL, NULL, NULL, NULL, b'0', b'0', b'0', 'system:dict:add', 1, 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),
(1062, '字典修改', 1060, 3, NULL, NULL, NULL, NULL, b'0', b'0', b'0', 'system:dict:update', 2, 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),
(1063, '字典删除', 1060, 3, NULL, NULL, NULL, NULL, b'0', b'0', b'0', 'system:dict:delete', 3, 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),
(1064, '字典导出', 1060, 3, NULL, NULL, NULL, NULL, b'0', b'0', b'0', 'system:dict:export', 4, 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),
(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), (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),
(1071, '修改配置', 1070, 3, NULL, NULL, NULL, NULL, b'0', b'0', b'0', 'system:config:update', 1, 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),
(1072, '恢复默认', 1070, 3, NULL, NULL, NULL, NULL, b'0', b'0', b'0', 'system:config:reset', 2, 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` INSERT IGNORE INTO `sys_dict`
@ -20,7 +20,6 @@ INSERT IGNORE INTO `sys_dict`
VALUES VALUES
(1, '公告类型', 'announcement_type', NULL, b'1', 1, NOW(), NULL, NULL); (1, '公告类型', 'announcement_type', NULL, b'1', 1, NOW(), NULL, NULL);
-- 初始化默认字典项
INSERT IGNORE INTO `sys_dict_item` INSERT IGNORE INTO `sys_dict_item`
(`id`, `label`, `value`, `color`, `sort`, `description`, `dict_id`, `create_user`, `create_time`, `update_user`, `update_time`) (`id`, `label`, `value`, `color`, `sort`, `description`, `dict_id`, `create_user`, `create_time`, `update_user`, `update_time`)
VALUES VALUES

View File

@ -1,13 +1,19 @@
-- liquibase formatted sql -- liquibase formatted sql
-- changeset BUSS_BCLS:1 -- 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` INSERT IGNORE INTO `sys_dict`
(`id`, `name`, `code`, `description`, `is_system`, `create_user`, `create_time`, `update_user`, `update_time`) (`id`, `name`, `code`, `description`, `is_system`, `create_user`, `create_time`, `update_user`, `update_time`)
VALUES VALUES
(2, '消息类型', 'message_type', NULL, b'1', 1, NOW(), NULL, NULL); (2, '消息类型', 'message_type', NULL, b'1', 1, NOW(), NULL, NULL);
-- 初始化默认字典项
INSERT IGNORE INTO `sys_dict_item` INSERT IGNORE INTO `sys_dict_item`
(`id`, `label`, `value`, `color`, `sort`, `description`, `dict_id`, `create_user`, `create_time`, `update_user`, `update_time`) (`id`, `label`, `value`, `color`, `sort`, `description`, `dict_id`, `create_user`, `create_time`, `update_user`, `update_time`)
VALUES VALUES