perf(short-drama-agent-front): 优化制作工作台交互与移动端布局
This commit is contained in:
1 parent
b5eaed3981
commit
54a381ebd3
37 files changed
+1217
-426
No files matched your search
@@ -0,0 +1,108 @@
|
||||
<script setup lang="ts">
|
||||
import { computed } from 'vue'
|
||||
import { NAlert, NButton, NTag } from 'naive-ui'
|
||||
import { AssetOpenLink, StatusBadge } from '../../../components/ui'
|
||||
import { mediaAssetUrl } from '../../../lib/assets'
|
||||
import { formatDate } from '../../../lib/format'
|
||||
import { productionStatusLabel } from '../model'
|
||||
import type { ShotVideo } from '../types'
|
||||
|
||||
/** 主视频与候选视频共用的播放、质量检查和主视频切换参数。 */
|
||||
const props = defineProps<{
|
||||
/** 当前视频记录。 */
|
||||
item: ShotVideo
|
||||
/** 当前镜头编号,用于播放区域的可访问名称。 */
|
||||
shotNo: number
|
||||
/** 视频未返回时长时使用当前镜头时长。 */
|
||||
durationSeconds?: number
|
||||
/** 当前主视频是否需要更新。 */
|
||||
stale: boolean
|
||||
/** 当前状态是否禁止切换主视频。 */
|
||||
blocked: boolean
|
||||
/** 当前会话的检查结论,null 表示没有检查。 */
|
||||
validationPassed: boolean | null
|
||||
/** 此视频已有的持久化检查结论,仅用于展示,不改变候选晋升条件。 */
|
||||
recordedValidationPassed?: boolean | null
|
||||
/** 是否正在确认切换当前候选。 */
|
||||
confirming: boolean
|
||||
}>()
|
||||
/** 交由父面板执行检查与切换,卡片不直接调用生成接口。 */
|
||||
const emit = defineEmits<{ quality: []; history: []; select: []; confirm: []; cancel: [] }>()
|
||||
/** 播放和外链共用经过协议与资源路径校验的地址。 */
|
||||
const videoUrl = computed(() => (props.item.videoUrl ? mediaAssetUrl(props.item.videoUrl) : null))
|
||||
/** 优先显示本次会话的检查结果,否则显示此视频已有的记录。 */
|
||||
const previousValidation = computed(() => props.validationPassed ?? props.recordedValidationPassed ?? null)
|
||||
/** 只有已完成且在当前会话检查通过的候选才能发起切换。 */
|
||||
const canSelect = computed(
|
||||
() =>
|
||||
props.item.status === 'completed' &&
|
||||
!!videoUrl.value &&
|
||||
!props.item.isPrimary &&
|
||||
props.validationPassed === true
|
||||
)
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<!-- 以下是视频播放与候选操作卡片模块 -->
|
||||
<article class="min-w-0 overflow-hidden bg-(--app-subtle)">
|
||||
<!-- 以下是正方形视频画面与右上角打开原文件入口模块 -->
|
||||
<div class="relative aspect-square w-full overflow-hidden bg-(--app-subtle)">
|
||||
<video
|
||||
v-if="item.status === 'completed' && videoUrl"
|
||||
:src="videoUrl"
|
||||
:aria-label="`镜头 ${shotNo} ${item.isPrimary ? '主视频' : '候选视频'}`"
|
||||
controls
|
||||
preload="metadata"
|
||||
class="block aspect-square w-full bg-[#080808] object-contain"
|
||||
></video>
|
||||
<!-- 以下是尚无可播放视频时的正方形占位模块,与完成记录保持相同尺寸 -->
|
||||
<div v-else class="flex h-full w-full items-center justify-center p-5 text-xs text-muted">
|
||||
{{
|
||||
item.status === 'failed'
|
||||
? '视频生成失败'
|
||||
: item.status === 'completed'
|
||||
? '暂无视频文件'
|
||||
: '视频任务进行中'
|
||||
}}
|
||||
</div>
|
||||
<AssetOpenLink v-if="item.status === 'completed'" :src="videoUrl" label="打开视频" />
|
||||
</div>
|
||||
<div class="min-w-0 p-3">
|
||||
<div class="flex flex-wrap items-center gap-2">
|
||||
<StatusBadge :status="item.status" :label="productionStatusLabel(item.status)" />
|
||||
<NTag size="small" :bordered="false">{{ item.isPrimary ? '主视频' : '候选视频' }}</NTag>
|
||||
<NTag v-if="item.isPrimary && stale" size="small" type="warning" :bordered="false">需更新</NTag>
|
||||
<span class="text-[10px] text-muted">{{ item.durationSeconds || durationSeconds || '—' }}s</span>
|
||||
</div>
|
||||
<!-- 以下是此视频此前检查结果模块,历史通过不代表当前素材仍然适用 -->
|
||||
<p v-if="previousValidation !== null" class="mt-2 text-[11px] text-muted">
|
||||
{{ previousValidation ? '此前画面检查通过' : '此前画面检查未通过' }}
|
||||
</p>
|
||||
<NAlert v-if="item.error" role="alert" type="error" :show-icon="false" class="mt-3">{{
|
||||
item.error
|
||||
}}</NAlert>
|
||||
<p class="mt-3 break-all text-[10px] text-muted">
|
||||
{{ item.provider }} · {{ item.model }} · {{ formatDate(item.createdAt) }}
|
||||
</p>
|
||||
<div class="mt-3 flex flex-wrap gap-3">
|
||||
<NButton v-if="item.status === 'completed' && videoUrl" text size="small" @click="emit('quality')">
|
||||
质量检查
|
||||
</NButton>
|
||||
<NButton text size="small" @click="emit('history')">查看质量记录</NButton>
|
||||
<NButton v-if="canSelect" :disabled="blocked" text size="small" @click="emit('select')">
|
||||
设为主视频
|
||||
</NButton>
|
||||
</div>
|
||||
<!-- 以下是候选切换确认模块,不更改已有费用确认与质量检查流程 -->
|
||||
<NAlert v-if="confirming" type="info" :show-icon="false" class="mt-3 text-xs">
|
||||
<p>确认把此候选设为当前镜头主视频?旧成片仍会保留。</p>
|
||||
<div class="mt-2 flex gap-3">
|
||||
<NButton :disabled="blocked || !canSelect" type="primary" @click="emit('confirm')"
|
||||
>确认切换</NButton
|
||||
>
|
||||
<NButton text size="small" @click="emit('cancel')">取消</NButton>
|
||||
</div>
|
||||
</NAlert>
|
||||
</div>
|
||||
</article>
|
||||
</template>
|
||||
Reference in new issue
Block a user