101 lines
3.0 KiB
Vue
101 lines
3.0 KiB
Vue
<!-- Author: fruit.com.cn -->
|
||
<!-- 转码通知页:按转码中、成功、失败查看短剧和集数。 -->
|
||
|
||
<script setup lang="ts">
|
||
import { computed, onMounted, ref } from 'vue'
|
||
import PageHeading from '@/views/components/PageHeading.vue'
|
||
import {
|
||
getTranscodeNoticesApi,
|
||
type TranscodeNotice,
|
||
type TranscodeNoticeItem
|
||
} from '@/api/admin/transcodeNotice'
|
||
import { formatDateTime } from '@/utils/format'
|
||
import { markTranscodeNoticeSeen } from '@/utils/transcodeNoticeSeen'
|
||
|
||
const loading = ref(false)
|
||
const tab = ref('RUNNING')
|
||
const notice = ref<TranscodeNotice | null>(null)
|
||
|
||
const rows = computed<TranscodeNoticeItem[]>(() => {
|
||
if (tab.value === 'SUCCESS') return notice.value?.successList || []
|
||
if (tab.value === 'FAILED') return notice.value?.failedList || []
|
||
return notice.value?.runningList || []
|
||
})
|
||
|
||
function episodeText(row: TranscodeNoticeItem) {
|
||
const no = row.episodeNo ? `第${row.episodeNo}集` : ''
|
||
if (!row.episodeTitle || row.episodeTitle === no) return no || '集数未知'
|
||
return no ? `${no} ${row.episodeTitle}` : row.episodeTitle
|
||
}
|
||
|
||
async function load() {
|
||
loading.value = true
|
||
try {
|
||
const res = await getTranscodeNoticesApi()
|
||
notice.value = res.data || null
|
||
if (notice.value) {
|
||
markTranscodeNoticeSeen({
|
||
running: Number(notice.value.running || 0),
|
||
success: Number(notice.value.success || 0),
|
||
failed: Number(notice.value.failed || 0)
|
||
})
|
||
}
|
||
} finally {
|
||
loading.value = false
|
||
}
|
||
}
|
||
|
||
onMounted(load)
|
||
</script>
|
||
|
||
<template>
|
||
<PageHeading
|
||
eyebrow="通知"
|
||
title="转码通知"
|
||
description="查看转码中、转码成功和转码失败的短剧与集数。"
|
||
>
|
||
<el-button :loading="loading" @click="load">刷新</el-button>
|
||
</PageHeading>
|
||
|
||
<section class="panel notice-panel">
|
||
<el-tabs v-model="tab">
|
||
<el-tab-pane label="转码中" name="RUNNING" />
|
||
<el-tab-pane label="转码成功" name="SUCCESS" />
|
||
<el-tab-pane label="转码失败" name="FAILED" />
|
||
</el-tabs>
|
||
|
||
<el-table
|
||
v-loading="loading"
|
||
:data="rows"
|
||
row-key="id"
|
||
border
|
||
class="drama-el-table"
|
||
empty-text="暂无通知"
|
||
>
|
||
<el-table-column prop="dramaTitle" label="短剧" min-width="220" show-overflow-tooltip />
|
||
<el-table-column label="集数" min-width="180" show-overflow-tooltip>
|
||
<template #default="{ row }">{{ episodeText(row) }}</template>
|
||
</el-table-column>
|
||
<el-table-column label="进度" width="100">
|
||
<template #default="{ row }">{{ row.progress ?? 0 }}%</template>
|
||
</el-table-column>
|
||
<el-table-column
|
||
v-if="tab === 'FAILED'"
|
||
prop="errorMsg"
|
||
label="失败原因"
|
||
min-width="220"
|
||
show-overflow-tooltip
|
||
/>
|
||
<el-table-column label="更新时间" width="180">
|
||
<template #default="{ row }">{{ formatDateTime(row.updatedAt) }}</template>
|
||
</el-table-column>
|
||
</el-table>
|
||
</section>
|
||
</template>
|
||
|
||
<style scoped>
|
||
.notice-panel {
|
||
padding: 8px 16px 16px;
|
||
}
|
||
</style>
|