From b563d0f4279dac7c5ef3b2e3dc684d417038ec20 Mon Sep 17 00:00:00 2001 From: xiaosi <2652281683@qq.com> Date: Mon, 31 Aug 2026 12:05:31 +0800 Subject: [PATCH] =?UTF-8?q?docs:=20=E5=A2=9E=E5=8A=A0=20Alarms/Media=20?= =?UTF-8?q?=E5=8D=A1=E7=89=87=E7=BB=84=E4=BB=B6=E5=AE=9E=E7=8E=B0=E8=AE=A1?= =?UTF-8?q?=E5=88=92?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit AlarmItem + MediaCard 薄组件抽取,分 A/B/C 验收。 --- ...2026-08-28-alarms-media-card-components.md | 259 ++++++++++++++++++ 1 file changed, 259 insertions(+) create mode 100644 docs/superpowers/plans/2026-08-28-alarms-media-card-components.md diff --git a/docs/superpowers/plans/2026-08-28-alarms-media-card-components.md b/docs/superpowers/plans/2026-08-28-alarms-media-card-components.md new file mode 100644 index 0000000..bc8ce0f --- /dev/null +++ b/docs/superpowers/plans/2026-08-28-alarms-media-card-components.md @@ -0,0 +1,259 @@ +# Alarms + Media 薄卡片组件 Implementation Plan + +> **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking. + +**Goal:** 将 Alarms 列表项与 Media 网格卡抽成本地薄展示组件,页面保留数据/请求/空态,视觉与交互不变。 + +**Architecture:** 新增 `AlarmItem.vue`、`MediaCard.vue`(props + emit only)。`AlarmsView` / `MediaView` 用组件替换 `v-for` 内 `article`。继续使用全局 `prototype.css` 类名,不加 scoped 新皮肤,不引入 t-list/t-card。 + +**Tech Stack:** Vue 3 ` +``` + +- [ ] **Step 2: AlarmsView 替换循环体** + +将: + +```html + + ... + +``` + +改为: + +```html + +``` + +script 增加: + +```js +import AlarmItem from '@/components/AlarmItem.vue' +``` + +保留空态 `table-empty`、`load`、`handle`、侧栏与 metrics。 + +- [ ] **Step 3: 静态核对** + +Run: + +```bash +rg -n 'AlarmItem|alarm-item' src/components/AlarmItem.vue src/views/AlarmsView/AlarmsView.vue +``` + +Expected: 组件内有 `alarm-item`;页面循环用 `AlarmItem`,无内联 `article.alarm-item`。 + +- [ ] **Step 4: Commit** + +```bash +git add src/components/AlarmItem.vue src/views/AlarmsView/AlarmsView.vue +git commit -m "refactor: 抽取 AlarmItem 告警列表项组件" +``` + +--- + +### Task 2: MediaCard + MediaView + +**Files:** +- Create: `src/components/MediaCard.vue` +- Modify: `src/views/MediaView/MediaView.vue` + +- [ ] **Step 1: 创建 MediaCard.vue** + +```vue + + + + LIVE + + + + {{ source }} + {{ duration }} + + + {{ name }}{{ desc }} + + + + + + + + + + +``` + +- [ ] **Step 2: MediaView 替换两处网格 article** + +直播: + +```html + +``` + +视频: + +```html + +``` + +import: + +```js +import MediaCard from '@/components/MediaCard.vue' +``` + +保留 `live-media-grid` / `media-grid` 容器、空态、tabs、load、openLive、download。 + +- [ ] **Step 3: 静态核对** + +```bash +rg -n 'MediaCard|media-visual|media-card-copy' src/components/MediaCard.vue src/views/MediaView/MediaView.vue +``` + +Expected: 视觉 class 在组件内;页面用 `MediaCard`,网格容器仍在页面。 + +- [ ] **Step 4: Commit** + +```bash +git add src/components/MediaCard.vue src/views/MediaView/MediaView.vue +git commit -m "refactor: 抽取 MediaCard 媒体网格卡组件" +``` + +--- + +### Task 3: 浏览器冒烟 + +**Files:** 无代码改动(验收) + +- [ ] **Step 1: 告警页** + +登录后打开 `/alarms`: + +- 列表为 `article.alarm-item`(或组件根 article 带该类) +- 有数据时可见级别/标题/状态/「处理」 +- 无 console error + +- [ ] **Step 2: 媒体页** + +打开 `/media`(及 `?view=live`): + +- 直播卡:LIVE 角标 + 播放 + 更多 +- 视频卡:时长 + 播放 + 下载 +- tab 切换正常 + +- [ ] **Step 3: 回归抽查** + +`/monitor` 地图工具条仍在;无需改 Devices。 + +- [ ] **Step 4: 记录结果** + +若失败:修组件 class/emit 后补 commit;通过则本 plan 完成。 + +--- + +## 约束(执行时) + +- 工作目录:`/Users/qingyuan/CodeProject/laic-frontend` +- 不改后台;不 `git add -A` +- 跳过全量单测;以静态核对 + 浏览器冒烟为准 +- 中文 STATUS / commit message