ActivityFeed.vue
6.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
<script setup lang="ts">
import { ref } from 'vue'
import IconSet from '@/components/common/IconSet.vue'
const feedCollapsed = ref(false)
const activityItems = ref([
{ time: '14:12', tone: 'success', text: 'Query 引擎已完成初步检索' },
{ time: '14:08', tone: 'running', text: 'Media 引擎正在分析社交媒体数据' },
{ time: '14:05', tone: 'warning', text: 'Insight 引擎等待更多数据输入' },
{ time: '14:02', tone: 'info', text: 'Forum 协作物流已启动' },
{ time: '13:58', tone: 'success', text: '系统自检完成,所有服务就绪' },
{ time: '13:55', tone: 'info', text: '接收到新的研究任务' },
])
function toggleFeed() {
feedCollapsed.value = !feedCollapsed.value
}
function getToneClass(tone: string): string {
return `tone-${tone}`
}
</script>
<template>
<aside class="activity-feed" :class="{ 'activity-feed--collapsed': feedCollapsed }">
<div class="feed-header" @click="toggleFeed">
<span class="kicker">活动日志 Activity Feed</span>
<button class="toggle-btn" type="button" :title="feedCollapsed ? '展开 Expand' : '收起 Collapse'">
<IconSet :type="feedCollapsed ? 'arrow-right' : 'arrow-right'" class="toggle-icon" />
</button>
</div>
<div v-show="!feedCollapsed" class="feed-content">
<div class="feed-timeline">
<div
v-for="(item, idx) in activityItems"
:key="idx"
class="feed-item"
>
<span class="feed-item__time">{{ item.time }}</span>
<span class="feed-item__dot" :class="getToneClass(item.tone)" />
<span class="feed-item__text">{{ item.text }}</span>
</div>
</div>
<!-- 实时日志预览 -->
<div class="log-preview">
<div class="log-header">
<span class="kicker">实时控制台 Live Console</span>
<button class="refresh-btn" type="button">
<IconSet type="refresh" />
</button>
</div>
<div class="log-lines">
<div class="log-line">
<span class="log-prefix">[14:12:33]</span>
<span class="log-content">Query 引擎初始化完成</span>
</div>
<div class="log-line">
<span class="log-prefix">[14:12:34]</span>
<span class="log-content">搜索 API 已连接</span>
</div>
<div class="log-line log-line--success">
<span class="log-prefix">[14:12:35]</span>
<span class="log-content">就绪,等待查询</span>
</div>
</div>
</div>
</div>
</aside>
</template>
<style scoped>
.activity-feed {
position: fixed;
top: var(--cmd-bar-height, 64px);
right: 0;
bottom: 0;
width: var(--feed-width, 320px);
padding: 20px 16px;
background: var(--bg-base);
border-left: 1px solid var(--border-subtle);
display: flex;
flex-direction: column;
gap: 16px;
transition: all 0.3s ease;
overflow: hidden;
}
.activity-feed--collapsed {
width: 60px;
padding: 20px 12px;
}
.feed-header {
display: flex;
justify-content: space-between;
align-items: center;
cursor: pointer;
}
.toggle-btn {
display: grid;
place-items: center;
width: 28px;
height: 28px;
border: none;
border-radius: var(--radius-md);
background: var(--bg-elevated);
cursor: pointer;
transition: all 0.2s ease;
}
.toggle-btn:hover {
background: var(--primary);
}
.toggle-icon {
width: 16px;
height: 16px;
color: var(--text-secondary);
transition: transform 0.3s ease;
}
.activity-feed--collapsed .toggle-icon {
transform: rotate(180deg);
}
.feed-content {
flex: 1;
overflow-y: auto;
display: flex;
flex-direction: column;
gap: 16px;
}
.kicker {
font-family: var(--font-mono);
font-size: 10px;
letter-spacing: 0.16em;
text-transform: uppercase;
color: var(--text-muted);
}
.feed-timeline {
display: flex;
flex-direction: column;
gap: 12px;
}
.feed-item {
display: grid;
grid-template-columns: 48px 8px 1fr;
gap: 10px;
align-items: start;
padding: 10px 12px;
background: var(--bg-elevated);
border-radius: var(--radius-md);
transition: all 0.2s ease;
}
.feed-item:hover {
background: var(--primary);
}
.feed-item:hover .feed-item__text {
color: var(--text-inverse);
}
.feed-item__time {
font-family: var(--font-mono);
font-size: 10px;
color: var(--text-muted);
text-transform: uppercase;
}
.feed-item__dot {
width: 8px;
height: 8px;
border-radius: 50%;
margin-top: 4px;
}
.tone-success {
background: var(--success);
box-shadow: 0 0 6px rgba(61, 139, 110, 0.5);
}
.tone-running {
background: var(--warning);
animation: pulse-breathe 2s ease-in-out infinite;
}
.tone-warning {
background: var(--warning);
}
.tone-info {
background: var(--info);
}
.tone-danger {
background: var(--danger);
}
@keyframes pulse-breathe {
0%, 100% { opacity: 1; }
50% { opacity: 0.5; }
}
.feed-item__text {
font-size: 13px;
color: var(--text-secondary);
line-height: 1.5;
transition: color 0.2s ease;
}
/* 日志预览 */
.log-preview {
padding: 14px;
background: var(--primary);
border-radius: var(--radius-xl);
color: var(--text-inverse);
}
.log-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 12px;
}
.log-header .kicker {
color: rgba(245, 240, 232, 0.5);
}
.refresh-btn {
display: grid;
place-items: center;
width: 24px;
height: 24px;
border: none;
border-radius: var(--radius-sm);
background: rgba(255, 255, 255, 0.1);
cursor: pointer;
transition: all 0.2s ease;
}
.refresh-btn:hover {
background: rgba(255, 255, 255, 0.2);
}
.refresh-btn :deep(.icon) {
width: 14px;
height: 14px;
color: var(--text-inverse);
}
.log-lines {
display: flex;
flex-direction: column;
gap: 6px;
font-family: var(--font-mono);
font-size: 11px;
}
.log-line {
display: flex;
gap: 8px;
opacity: 0.7;
}
.log-line--success {
opacity: 1;
color: var(--success);
}
.log-prefix {
color: rgba(245, 240, 232, 0.4);
flex-shrink: 0;
}
.log-content {
color: inherit;
opacity: 0.9;
}
@media (max-width: 1024px) {
.activity-feed {
display: none;
}
}
</style>