fix(admin): 转码面板展示实时进度与更新时间

This commit is contained in:
Zhou Weidong committed 2026-10-22 15:12:12 +08:00
1 parent 0d5d0d841f
commit 9b2ab1a425
6 files changed
+67

No files matched your search

@@ -0,0 +1,12 @@
# 转码面板实时进度与更新时间
## 目标
- 展示后端 task progress、状态文案与 updatedAt。
- RUNNING/QUEUED 且 progress=0 时显示“处理中(等待进度上报)”。
- FAILED 保持错误信息与重新转码入口。
- 保持现有轮询停止、关闭清理与字符串 ID 逻辑。
## 验证
- `pnpm lint:eslint`、`pnpm build:dev`。
+36
View File
@@ -151,3 +151,39 @@ Build successful. Please see dist-dev directory
解读:字符串 id 链路、类型检查、ESLint 与开发构建均通过; 解读:字符串 id 链路、类型检查、ESLint 与开发构建均通过;
循环 chunk 为项目既有警告。 循环 chunk 为项目既有警告。
## 2026-10-22 转码面板实时进度与更新时间
- 分支:`feature/transcode-progress-ui`
- 基线:`develop` / `origin/develop` = `0d5d0d8`
- 计划:`docs/plans/2026-10-22-transcode-progress-ui.md`
后端将补充 task.updatedAt;前端在现有轮询面板中展示进度、状态、
最近更新时间,并在 RUNNING/QUEUED progress=0 时显示等待进度上报提示。
### 实现
- `EpisodeTranscodeItem` 增加 `updatedAt`。
- 状态区展示“最近更新”,格式沿用 `formatDateTime`。
- RUNNING/QUEUED 且 progress=0 时显示“处理中(等待进度上报)”。
- SUCCESS/FAILED 继续停止轮询;关闭面板继续清理定时器。
- 所有 id 保持字符串传递,不引入 Number 转换。
### 门禁
```text
$ pnpm lint:eslint
> eslint --fix --ext .js,.ts,.vue ./src
(0 error / 0 warning)
$ pnpm ts:check
> vue-tsc --noEmit --skipLibCheck
(通过)
$ pnpm build:dev
WARN Circular chunk: element-plus -> vue-chunks -> element-plus.
Build successful. Please see dist-dev directory
```
解读:进度与更新时间类型、ESLint、TypeScript 和开发构建全部通过;
循环 chunk 为项目既有警告。
+1
View File
@@ -311,6 +311,7 @@ export interface EpisodeTranscodeItem {
progress?: number progress?: number
retryCount?: number retryCount?: number
errorMsg?: string errorMsg?: string
updatedAt?: string
renditions: MediaRenditionItem[] renditions: MediaRenditionItem[]
thumbnails?: MediaThumbnailResult | null thumbnails?: MediaThumbnailResult | null
} }
+2
View File
@@ -535,6 +535,8 @@ export default {
statusLabel: 'Status', statusLabel: 'Status',
progress: 'Progress', progress: 'Progress',
retryCount: 'Retries', retryCount: 'Retries',
updatedAt: 'Last updated',
waitingProgress: 'Processing (waiting for progress report)',
reprocess: 'Transcode again', reprocess: 'Transcode again',
reprocessing: 'Submitting', reprocessing: 'Submitting',
triggerSuccess: 'Transcode task submitted', triggerSuccess: 'Transcode task submitted',
+2
View File
@@ -529,6 +529,8 @@ export default {
statusLabel: '状态', statusLabel: '状态',
progress: '进度', progress: '进度',
retryCount: '重试次数', retryCount: '重试次数',
updatedAt: '最近更新',
waitingProgress: '处理中(等待进度上报)',
reprocess: '重新转码', reprocess: '重新转码',
reprocessing: '正在触发', reprocessing: '正在触发',
triggerSuccess: '已提交转码任务', triggerSuccess: '已提交转码任务',
@@ -6,6 +6,7 @@ import type { EpisodeTranscodeItem } from '@/api/admin/types'
import { AppIcon } from '@/components/AppIcon' import { AppIcon } from '@/components/AppIcon'
import { AppIcons } from '@/constants/icons' import { AppIcons } from '@/constants/icons'
import { useI18n } from '@/hooks/web/useI18n' import { useI18n } from '@/hooks/web/useI18n'
import { formatDateTime } from '@/utils/format'
import type { TranscodeProgressStatus, TranscodeTagType } from './episodeTranscodeUi' import type { TranscodeProgressStatus, TranscodeTagType } from './episodeTranscodeUi'
interface StatusView { interface StatusView {
@@ -64,6 +65,10 @@ const { t } = useI18n()
<span>{{ t('episodeTranscode.retryCount') }}</span> <span>{{ t('episodeTranscode.retryCount') }}</span>
<b>{{ detail.retryCount || 0 }}</b> <b>{{ detail.retryCount || 0 }}</b>
</div> </div>
<div class="episode-transcode-status__metric">
<span>{{ t('episodeTranscode.updatedAt') }}</span>
<b>{{ formatDateTime(detail.updatedAt) }}</b>
</div>
<el-button <el-button
class="episode-transcode-status__retry" class="episode-transcode-status__retry"
type="primary" type="primary"
@@ -84,6 +89,9 @@ const { t } = useI18n()
:status="view.progressStatus" :status="view.progressStatus"
:stroke-width="8" :stroke-width="8"
/> />
<p v-if="view.isProcessing && view.progress === 0" class="episode-transcode-status__waiting">
{{ t('episodeTranscode.waitingProgress') }}
</p>
<el-alert <el-alert
v-if="detail.errorMsg" v-if="detail.errorMsg"
class="episode-transcode-status__error-alert" class="episode-transcode-status__error-alert"
@@ -138,6 +146,12 @@ const { t } = useI18n()
margin-top: 12px; margin-top: 12px;
} }
.episode-transcode-status__waiting {
margin: 8px 0 0;
font-size: 12px;
color: var(--el-color-warning);
}
.episode-transcode-status__error-alert { .episode-transcode-status__error-alert {
margin-top: 12px; margin-top: 12px;
} }