From 78786799bba78424673b31a6aec4faab489d6f29 Mon Sep 17 00:00:00 2001 From: engigu Date: Wed, 4 Mar 2026 22:02:50 +0800 Subject: [PATCH] feat: opt message ways style --- internal/services/notification_service.go | 22 +++--- web/src/api/index.ts | 1 + .../views/notify/components/ChannelList.vue | 78 ++++++++++++------- 3 files changed, 62 insertions(+), 39 deletions(-) diff --git a/internal/services/notification_service.go b/internal/services/notification_service.go index c2d4d59..89c8a80 100644 --- a/internal/services/notification_service.go +++ b/internal/services/notification_service.go @@ -16,11 +16,12 @@ import ( // NotifyChannel 通知渠道配置 type NotifyChannel struct { - ID string `json:"id"` - Name string `json:"name"` - Type string `json:"type"` - Enabled bool `json:"enabled"` - Config map[string]string `json:"config"` + ID string `json:"id"` + Name string `json:"name"` + Type string `json:"type"` + Enabled bool `json:"enabled"` + CreatedAt models.LocalTime `json:"created_at"` + Config map[string]string `json:"config"` } // NotifyMessage 通知消息 @@ -312,11 +313,12 @@ func (s *NotificationService) getChannelsInternal() []NotifyChannel { continue } channels = append(channels, NotifyChannel{ - ID: nw.ID, - Name: nw.Name, - Type: nw.Type, - Enabled: nw.Enabled, - Config: config, + ID: nw.ID, + Name: nw.Name, + Type: nw.Type, + Enabled: nw.Enabled, + CreatedAt: nw.CreatedAt, + Config: config, }) } return channels diff --git a/web/src/api/index.ts b/web/src/api/index.ts index 7fa1a2d..a97ba83 100644 --- a/web/src/api/index.ts +++ b/web/src/api/index.ts @@ -532,6 +532,7 @@ export interface NotifyChannel { name: string type: string enabled: boolean + created_at?: string config: Record } diff --git a/web/src/views/notify/components/ChannelList.vue b/web/src/views/notify/components/ChannelList.vue index f7f7e4c..0621b82 100644 --- a/web/src/views/notify/components/ChannelList.vue +++ b/web/src/views/notify/components/ChannelList.vue @@ -2,7 +2,7 @@ import { Button } from '@/components/ui/button' import { Badge } from '@/components/ui/badge' import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@/components/ui/card' -import { Plus, Trash2, TestTube, Pencil, Bell } from 'lucide-vue-next' +import { Plus, Trash2, TestTube, Pencil, Bell, Calendar } from 'lucide-vue-next' import type { NotifyChannel, ChannelType } from '@/api' defineProps<{ @@ -43,37 +43,57 @@ function getChannelTypeName(type: string, channelTypes: ChannelType[]): string {

暂无通知渠道

点击"添加渠道"开始配置

-
-
-
-
-
- {{ ch.name }} - {{ getChannelTypeName(ch.type, channelTypes) }} - - {{ ch.enabled ? '启用' : '禁用' }} - +
+
+ +
+ {{ index + 1 }} +
+ +
+
+
+ +
+
+ {{ ch.name }} +
+ {{ getChannelTypeName(ch.type, + channelTypes) }} + + {{ ch.enabled ? '启用' : '禁用' }} + +
-
- - - + +
+
+ + {{ ch.created_at.split(' ')[0] }} +
+
+ + + +