소스 검색

fix: 修复系统通知列表的删除功能,对接已读接口

yanglzh 2 년 전
부모
커밋
18264fb7d0
2개의 변경된 파일9개의 추가작업 그리고 2개의 파일을 삭제
  1. 1 1
      src/api/message/index.ts
  2. 8 1
      src/views/system/monitor/notice/index.vue

+ 1 - 1
src/api/message/index.ts

@@ -10,7 +10,7 @@ export default {
   // 获取消息列表
   getList: (data: object) => get('/system/message/list', data),
   // 阅读消息
-  red: (id: number) => put('/system/message/red', { id }),
+  read: (id: number) => put('/system/message/read', { id }),
   // 获取所有未读消息数量
   unReadCount: () => get('/system/message/unReadCount')
 }

+ 8 - 1
src/views/system/monitor/notice/index.vue

@@ -14,7 +14,7 @@
 				</el-table-column>
 				<el-table-column label="操作" width="150" align="center">
 					<template #default="scope">
-						<el-button size="small" text type="primary" v-if="!scope.row.isRead">设为已读</el-button>
+						<el-button size="small" text type="primary" @click="read(scope.row)" v-if="!scope.row.isRead">设为已读</el-button>
 						<el-button size="small" text type="info" @click="onDel(scope.row)">删除</el-button>
 					</template>
 				</el-table-column>
@@ -50,4 +50,11 @@ const onDel = (row: ApiRow) => {
 		getList();
 	});
 };
+
+const read = (row: ApiRow) => {
+	api.read(row.id as number).then(() => {
+		ElMessage.success('已读成功');
+		getList();
+	});
+};
 </script>