perf(short-drama-agent-front): 优化制作工作台交互与移动端布局

This commit is contained in:
GJ committed 2026-10-10 19:28:47 +08:00
1 parent b5eaed3981
commit 54a381ebd3
37 files changed
+1217 -426

No files matched your search

+5 -1
View File
@@ -13,6 +13,8 @@ withDefaults(
busy?: boolean
/** 使用宽弹窗布局。 */
wide?: boolean
/** 指定弹窗宽度,单位为像素;实际宽度仍受视口限制。 */
width?: number
}>(),
{ description: '', busy: false, wide: false }
)
@@ -78,13 +80,15 @@ onBeforeUnmount(() => {
<template>
<slot name="trigger" />
<!-- 以下是关闭打开时自动聚焦的公共弹窗模块 -->
<NModal
v-model:show="open"
preset="card"
:auto-focus="false"
:closable="!busy"
:mask-closable="!busy"
:close-on-esc="!busy"
:style="{ width: wide ? '1040px' : '600px' }"
:style="{ width: `${width ?? (wide ? 1040 : 600)}px` }"
class="app-dialog"
role="dialog"
:aria-label="title"
+41
View File
@@ -0,0 +1,41 @@
<script setup lang="ts">
import { computed } from 'vue'
import { ExternalLink } from '@lucide/vue'
import { mediaAssetUrl } from '../../lib/assets'
/** 图片与视频共用的右上角原文件入口参数。 */
const props = defineProps<{
/** 原始素材地址,为空或不安全时隐藏入口。 */
src: string | null
/** 无障碍名称与悬停说明,界面仅显示图标。 */
label: string
}>()
/** 外链沿用素材地址的协议与存储路径校验。 */
const href = computed(() => (props.src ? mediaAssetUrl(props.src) : null))
</script>
<template>
<!-- 以下是素材画面右上角打开原文件的图标模块,点击不触发图片预览 -->
<a
v-if="href"
:href="href"
target="_blank"
rel="noopener noreferrer"
:aria-label="label"
:title="label"
class="asset-open-link absolute right-2 top-2 z-10 flex size-7 items-center justify-center bg-black/65 text-white hover:bg-black/85 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-white"
@click.stop
>
<ExternalLink :size="14" />
</a>
</template>
<style>
/* 手机端扩大点击区域,桌面继续使用紧凑图标。 */
@reference "../../styles/styles.css";
@media (max-width: 760px) {
.asset-open-link {
@apply size-11;
}
}
</style>
+3 -1
View File
@@ -12,6 +12,8 @@ const props = withDefaults(
label?: string
/** 问题对应的反馈级别。 */
type?: 'warning' | 'error' | 'info'
/** 与状态同行展示时移除独立模块的顶部间距。 */
inline?: boolean
}>(),
{ label: '查看原因', type: 'warning' }
)
@@ -31,7 +33,7 @@ function showReasons() {
<template>
<!-- 以下是按需查看问题说明的操作模块 -->
<div v-if="messages.length" class="mt-3 flex items-center gap-2">
<div v-if="messages.length" class="flex items-center gap-2" :class="{ 'mt-3': !inline }">
<NButton text size="small" @click="showReasons">{{ label }}</NButton>
</div>
</template>
+15 -5
View File
@@ -12,9 +12,13 @@ interface Props {
loading?: boolean
/** 当前查询错误。 */
error?: string
/** 是否允许折叠;关闭时直接展示内容,适用于独立弹窗。 */
collapsible?: boolean
/** 是否显示标题、说明与操作栏;独立弹窗可隐藏重复标题。 */
showHeader?: boolean
}
/** 多个历史和诊断入口共用折叠、刷新与错误展示。 */
defineProps<Props>()
withDefaults(defineProps<Props>(), { collapsible: true, showHeader: true })
/** 展开状态由调用方决定,只在展开后读取诊断。 */
const open = defineModel<boolean>('open', { default: false })
/** 显式刷新只发出读取事件,不产生任何生成或修复操作。 */
@@ -24,14 +28,20 @@ const emit = defineEmits<{ refresh: [] }>()
<template>
<!-- 以下是只读诊断的标题、展开与手动刷新模块 -->
<section class="workspace-panel text-xs leading-6" :aria-label="title">
<div class="flex flex-wrap items-center justify-between gap-3">
<div v-if="showHeader" class="flex flex-wrap items-center justify-between gap-3">
<strong><FieldLabel :label="title" :description="description" /></strong>
<div class="flex items-center gap-3">
<NButton text size="small" :aria-label="`${open ? '收起' : '查看'}${title}`" @click="open = !open">
<NButton
v-if="collapsible !== false"
text
size="small"
:aria-label="`${open ? '收起' : '查看'}${title}`"
@click="open = !open"
>
{{ open ? '收起' : '查看' }}
</NButton>
<NButton
v-if="open"
v-if="open || collapsible === false"
text
size="small"
:loading="loading"
@@ -43,7 +53,7 @@ const emit = defineEmits<{ refresh: [] }>()
</div>
</div>
<!-- 以下是读取状态、错误与实际诊断结果模块 -->
<div v-if="open" class="mt-3">
<div v-if="open || collapsible === false" :class="{ 'mt-3': showHeader }">
<NAlert v-if="error" type="error" :show-icon="false" role="alert">{{ error }}</NAlert>
<p v-if="loading" class="text-muted" role="status">正在加载…</p>
<slot v-else />
+13 -3
View File
@@ -1,10 +1,20 @@
<script setup lang="ts">
import { NScrollbar } from 'naive-ui'
/** 工作区固定标题和操作区;仅内容容器滚动,不向 document 传播滚动。 */
defineProps<{ split?: boolean; compact?: boolean }>()
/** 工作区默认固定标题和操作区,可让手机提示、目录与正文在项目内容区一起滚动。 */
defineProps<{
/** 是否采用目录与详情分栏。 */
split?: boolean
/** 是否使用紧凑内容布局。 */
compact?: boolean
/** 手机是否让提示、工具、目录和正文一起滚动,项目顶栏仍固定。 */
mobileScroll?: boolean
}>()
</script>
<template>
<section class="workspace-page" :class="{ 'content-first-workspace': compact }">
<section
class="workspace-page"
:class="{ 'content-first-workspace': compact, 'mobile-reading-workspace': mobileScroll }"
>
<!-- 以下是统一对齐的页面提示、标题与正文模块 -->
<div v-if="$slots.notice" class="workspace-notice"><slot name="notice" /></div>
<NScrollbar v-if="$slots.header" class="workspace-heading-scroll"
+2 -1
View File
@@ -17,13 +17,14 @@ const open = defineModel<boolean>('open', { default: false })
class="workspace-tools-trigger"
data-workspace-tools
:aria-label="label"
:title="label"
aria-haspopup="dialog"
:aria-expanded="open"
@click="open = true"
>
<template #icon><Settings2 :size="15" /></template>
<span class="workspace-tools-label">{{ label }}</span
><span v-if="hasReceipt" class="text-xs text-muted"> · 有回执</span>
><span v-if="hasReceipt" class="workspace-tools-receipt text-xs text-muted"> · 有回执</span>
</NButton>
<AppDialog v-model:open="open" :title="title" description="" wide>
<div class="workspace-tools-body"><slot /></div>
+1
View File
@@ -5,6 +5,7 @@ export { default as EmptyState } from './EmptyState.vue'
export { default as StatusBadge } from './StatusBadge.vue'
export { default as StudioLogo } from './StudioLogo.vue'
export { default as AssetImage } from './AssetImage.vue'
export { default as AssetOpenLink } from './AssetOpenLink.vue'
export { default as RevealImage } from './RevealImage.vue'
export { default as DirectoryItem } from './DirectoryItem.vue'
export { default as WorkspaceTools } from './WorkspaceTools.vue'
+75
View File
@@ -0,0 +1,75 @@
import { nextTick, onScopeDispose, watch, type Ref } from 'vue'
/**
* 为主体、分镜和生产目录共用选中项定位:桌面靠上、手机靠左,末尾遵守自然边界。
* @param root 目录条目的根节点,位于目录自身的滚动容器内
* @param getActiveId 读取当前选中项 ID
* @param getItemIds 读取当前可见目录项 ID
* @param stickyHeadingSelector 桌面粘性分组标题选择器
*/
export function useDirectorySelection(
root: Ref<HTMLElement | null>,
getActiveId: () => string,
getItemIds: () => string[],
stickyHeadingSelector?: string
): void {
/** 观察目录视口变化,兼容首次异步加载、屏幕缩放及手机横竖屏。 */
let observer: ResizeObserver | undefined
/**
* 只滚动目录自身,避免手机定位目录时改变整页阅读位置。
* @param animate 是否为用户切换使用平滑滚动
* @returns 目录渲染和定位完成
*/
async function locate(animate = false): Promise<void> {
const activeId = getActiveId()
await nextTick()
const element = root.value
const selected = element?.querySelector<HTMLElement>('[aria-current="true"]')
const viewport = element?.closest<HTMLElement>('.n-scrollbar-container')
if (!selected || !viewport || activeId !== getActiveId()) return
const mobile = window.matchMedia('(max-width: 760px)').matches
const behavior =
animate && !window.matchMedia('(prefers-reduced-motion: reduce)').matches ? 'smooth' : 'instant'
if (mobile) {
viewport.scrollTo({
left:
viewport.scrollLeft + selected.getBoundingClientRect().left - viewport.getBoundingClientRect().left,
behavior
})
return
}
const heading = stickyHeadingSelector
? selected.parentElement?.parentElement?.querySelector<HTMLElement>(stickyHeadingSelector)
: null
viewport.scrollTo({
top:
viewport.scrollTop +
selected.getBoundingClientRect().top -
viewport.getBoundingClientRect().top -
(heading?.offsetHeight ?? 0),
behavior
})
}
/** 初次加载和可见项变化立即定位,切换选中项平滑定位,状态刷新不打断浏览。 */
watch(
[root, getActiveId, () => getItemIds().join(',')],
(targets, previous) => void locate(!!previous?.[1] && previous[0] === targets[0] && previous[1] !== targets[1]),
{ immediate: true, flush: 'post' }
)
/** 根节点可能在接口数据返回后才出现,出现时绑定尺寸监听,移除时释放旧监听。 */
watch(
root,
element => {
observer?.disconnect()
const viewport = element?.closest('.n-scrollbar-container')
if (!viewport) return
observer = new ResizeObserver(() => void locate())
observer.observe(viewport)
},
{ flush: 'post' }
)
/** 页面或目录卸载后释放监听。 */
onScopeDispose(() => observer?.disconnect())
}
+98 -20
View File
@@ -4,9 +4,9 @@ import { NFormItem } from 'naive-ui'
import { integerRule, fieldRule } from '../../lib/form-rules'
import WorkspacePage from '../../components/ui/WorkspacePage.vue'
import ActionMenu from '../../components/ui/ActionMenu.vue'
import { NScrollbar, NAlert, NButton, NCheckbox, NInputNumber, NProgress, NTab, NTable, NTabs, NTag } from 'naive-ui'
import { NScrollbar, NAlert, NButton, NCheckbox, NInputNumber, NProgress, NTab, NTable, NTabs } from 'naive-ui'
import { computed, onScopeDispose, ref, watch } from 'vue'
import { Layers, LoaderCircle, ArrowRight } from '@lucide/vue'
import { Layers, LoaderCircle, ArrowRight, Settings2 } from '@lucide/vue'
import { EmptyState, StatusBadge, WorkspaceTools } from '../../components/ui'
import { useProjectContext } from '../projects/context'
import { breakdownApi } from './api'
@@ -159,7 +159,8 @@ const rules = {
</script>
<template>
<WorkspacePage split compact class="breakdown-workspace-page">
<!-- 以下是手机完成提示自然滚走、分类导航与设置入口吸顶的拆解工作区 -->
<WorkspacePage split compact mobile-scroll class="breakdown-workspace-page">
<template #notice>
<!-- 以下是拆解完成后的下一步提示模块 -->
<NAlert v-if="stageComplete" type="success" :show-icon="false">
@@ -201,9 +202,9 @@ const rules = {
集剧本。每个分组分别抽取所选模块,再生成主体与分镜。
</p>
</div>
<NTag size="small" :bordered="false">来源:正式剧集</NTag>
</div>
<AppForm
class="breakdown-settings-form"
:model="formModel"
:rules="rules"
:disabled="operation.pending"
@@ -449,17 +450,35 @@ const rules = {
><NTab v-for="option in moduleOptions" :key="option.value" :name="option.value"
>{{ option.label
}}<span>{{ subjects.filter(item => item.module === option.value).length }}</span></NTab
><NTab name="storyboard">分镜</NTab><NTab name="tasks">任务明细</NTab>
><NTab name="storyboard">分镜</NTab
><NTab name="tasks"
><span class="breakdown-task-label-desktop">任务明细</span
><span class="breakdown-task-label-mobile">任务</span></NTab
>
<template #suffix
><div class="tabs-toolbar-actions">
<ActionMenu
label="拆解更多操作"
:items="[
{ key: 'history', label: showHistory ? '收起执行记录' : '执行记录' },
{ key: 'export', label: '导出 JSON', disabled: !snapshot }
]"
@select="$event === 'history' ? (showHistory = !showHistory) : exportResult()"
/></div
<!-- 以下是手机分类导航中的拆解设置入口,共用原有设置弹窗 -->
<NButton
quaternary
class="icon-button breakdown-mobile-tools"
aria-label="拆解设置与恢复"
title="拆解设置与恢复"
aria-haspopup="dialog"
:aria-expanded="toolsOpen"
@click="toolsOpen = true"
>
<template #icon><Settings2 :size="15" /></template>
</NButton>
<!-- 以下是桌面低频操作入口,手机不显示省略号菜单 -->
<span class="breakdown-more-actions"
><ActionMenu
label="拆解更多操作"
:items="[
{ key: 'history', label: showHistory ? '收起执行记录' : '执行记录' },
{ key: 'export', label: '导出 JSON', disabled: !snapshot }
]"
@select="$event === 'history' ? (showHistory = !showHistory) : exportResult()"
/></span></div
></template>
</NTabs>
</div>
@@ -566,6 +585,10 @@ const rules = {
.breakdown-settings-panel {
container: breakdown-settings / inline-size;
}
/* 说明与表单留出 16px,避免移除来源标签后紧贴首个字段。 */
.breakdown-settings-form {
margin-top: 16px;
}
.breakdown-config {
@apply grid grid-cols-[180px_minmax(0,_1fr)_auto] items-start gap-y-4 gap-x-6;
--breakdown-label-offset: 29px;
@@ -588,7 +611,8 @@ const rules = {
@apply m-0 p-0 border-0;
}
.breakdown-module-options {
@apply w-full grid grid-cols-[repeat(3,_minmax(0,_1fr))] gap-y-3 gap-x-4;
/* 模块内部收紧为 8px,说明到字段和字段之间仍保持 16px 的层级间距。 */
@apply w-full grid grid-cols-[repeat(3,_minmax(0,_1fr))] gap-y-2 gap-x-4;
}
.breakdown-module-description {
@apply mt-1 mx-0 mb-0 pl-6 text-muted text-[11px] leading-[18px] wrap-anywhere;
@@ -619,27 +643,81 @@ const rules = {
@apply inline-flex gap-1.5;
}
.breakdown-results-section {
@apply flex flex-col flex-1 min-h-0 min-w-0 gap-2;
@apply flex flex-col flex-1 min-h-0 min-w-0;
/* 提示到导航、导航到搜索、搜索到列表共用同一个模块间距。 */
gap: var(--app-content-gap);
}
.breakdown-results-section > .result-toolbar {
@apply shrink-0;
}
.breakdown-results-section > .content-with-history {
@apply flex-1 h-auto min-h-0 grid-rows-[minmax(0,_1fr)];
}
/* 亮色模式为结果正文增加浅灰背景,保持与页面底色的层次。 */
:root:not([data-theme='dark']) .breakdown-results-section > .content-with-history {
background: var(--app-subtle);
/* 外层透明,搜索框和各条目使用自身背景,模块间距不再铺底色。 */
background: transparent;
}
.breakdown-results-scroll .n-scrollbar-content {
@apply wrap-anywhere;
}
.breakdown-result-pad {
@apply p-4;
/* 条目保留自身背景和内边距,外层不再重复缩进搜索和结果。 */
@apply p-0;
}
.breakdown-result-pad .subject-list-toolbar {
margin-bottom: var(--app-content-gap);
}
.breakdown-results-section > .content-with-history.history-hidden {
@apply grid-cols-[minmax(0,_1fr)] grid-rows-[minmax(0,_1fr)];
}
.breakdown-workspace-page .breakdown-mobile-tools.n-button {
display: none;
}
.breakdown-task-label-mobile {
display: none;
}
@media (max-width: 760px) {
/* 手机隐藏整行统计和旧设置入口,设置功能移到分类导航右侧。 */
.breakdown-workspace-page .workspace-heading-scroll.n-scrollbar {
display: none;
}
.breakdown-more-actions,
.breakdown-task-label-desktop {
display: none;
}
.breakdown-task-label-mobile {
display: inline;
}
/* 缩短标签文字并收紧间距,让手机分类与设置图标完整显示在同一行。 */
.breakdown-workspace-page .workspace-tabs.n-tabs .n-tabs-nav .n-tabs-tab {
padding-inline: 8px;
}
.breakdown-workspace-page .breakdown-mobile-tools.n-button {
display: inline-flex;
width: 44px;
min-width: 44px;
height: 44px;
padding: 0;
}
/* 分类导航与设置共用完整吸顶背景,正文不会从导航区域透出。 */
.breakdown-workspace-page .breakdown-results-section > .result-toolbar {
position: sticky;
top: 0;
z-index: 19;
background: var(--app-body);
}
/* 正文交给项目内容区滚动,绿色提示随页面位置自然移出,不做透明度收起。 */
.breakdown-workspace-page .breakdown-results-section {
flex: none;
overflow: visible;
}
.breakdown-workspace-page .content-with-history,
.breakdown-workspace-page .content-with-history > main,
.breakdown-workspace-page .breakdown-results-scroll,
.breakdown-workspace-page .breakdown-results-scroll > .n-scrollbar-container {
height: auto;
max-height: none;
overflow: visible;
}
}
@media (max-width: 800px) {
.breakdown-workspace-page .workspace-toolbar {
@apply min-h-0 flex-nowrap gap-2;
@@ -80,7 +80,8 @@ const filtered = computed(() =>
>查看形态图片/生图</RouterLink
>
</div>
<NCollapse class="subject-details mt-4" :default-expanded-names="['details']"
<!-- 以下是默认收起的外观描述与形态模块,点击后展开详情 -->
<NCollapse class="subject-details mt-4"
><NCollapseItem name="details"
><template #header
>外观描述与形态
@@ -284,6 +284,12 @@ function exportScript() {
.stage-arrow {
@apply ml-3 text-muted;
}
@media (max-width: 760px) {
/* 手机直接通过内容 Tab 查看结果,隐藏重复的流程进度行以增加正文空间。 */
.script-workspace-page .workspace-heading-scroll {
display: none;
}
}
.json-view {
@apply whitespace-pre-wrap wrap-anywhere p-4 bg-(--app-subtle) rounded-none font-mono text-[11px] leading-[1.9];
}
+50 -27
View File
@@ -24,6 +24,7 @@ import { productionStatusLabel } from './model'
import { useProduction } from './useProduction'
import ProductionReceipt from './components/ProductionReceipt.vue'
import ShotProductionAssets from './components/ShotProductionAssets.vue'
import ActionMenu from '../../components/ui/ActionMenu.vue'
import AdvancedProduction from './components/AdvancedProduction.vue'
import StaleKeyframeNotice from './components/StaleKeyframeNotice.vue'
import { routeLocationKey } from 'vue-router'
@@ -70,6 +71,14 @@ const {
promptExecution,
videoExecution
} = useProduction()
/** 当前镜头资产组件引用,标题菜单仅操作此镜头的只读检查弹窗。 */
const shotAssetsRef = ref<InstanceType<typeof ShotProductionAssets> | null>(null)
/** 标题状态只描述最近视频任务,不能表示质量通过或当前主视频仍可用。 */
const latestVideoTaskLabel = computed(() =>
videoStatusItem.value?.status === 'completed'
? '最近视频任务:生成完成'
: `最近视频任务:${productionStatusLabel(videoStatusItem.value?.status ?? 'not_started')}`
)
/** 首帧质量任务在关闭弹窗后仍可观察,刷新页面后恢复持久化句柄。 */
const keyframeQualityExecution = useWorkflowExecution(id, 'keyframe-quality')
@@ -254,7 +263,7 @@ const videoRules = { videoLimit: integerRule('本批镜头上限'), videoRepairA
</script>
<template>
<WorkspacePage split compact class="production-workspace-page"
<WorkspacePage split compact mobile-scroll class="production-workspace-page compact-shot-workspace"
><template #header
><div class="workspace-toolbar">
<div class="toolbar-episode">
@@ -278,7 +287,17 @@ const videoRules = { videoLimit: integerRule('本批镜头上限'), videoRepairA
></span
>
<div class="toolbar-actions">
<NButton :disabled="blocked || !episodeNo" @click="qualityOpen = true">首帧质量生成</NButton>
<!-- 以下是移动端图标入口模块,桌面保留完整文字,手机保留中文无障碍说明 -->
<NButton
class="mobile-toolbar-icon"
:disabled="blocked || !episodeNo"
aria-label="首帧质量生成"
title="首帧质量生成"
@click="qualityOpen = true"
>
<Image :size="18" class="mobile-action-icon" />
<span class="workspace-action-label">首帧质量生成</span>
</NButton>
<WorkspaceTools
v-model:open="toolsOpen"
@@ -696,10 +715,11 @@ const videoRules = { videoLimit: integerRule('本批镜头上限'), videoRepairA
}}<span v-if="query.data.value"> 当前保留上次读取的数据,生产操作已暂停。</span></NAlert
></NScrollbar
>
<!-- 以下是需要处理的项目状态摘要模块,数量为零的项目不占空间 -->
<div v-if="staleKeyframes || staleVideos || identityBlocked" class="workspace-inline-status">
<span
>首帧待更新 {{ staleKeyframes }} · 视频待更新 {{ staleVideos }} · 身份待确认 {{ identityBlocked }}</span
>
<span v-if="staleKeyframes">首帧待更新 {{ staleKeyframes }}</span>
<span v-if="staleVideos">视频待更新 {{ staleVideos }}</span>
<span v-if="identityBlocked">身份待确认 {{ identityBlocked }}</span>
</div>
<div v-if="shots.length" class="panel production-workspace workspace-surface">
<nav class="production-shot-list directory-panel" aria-label="本集生产镜头">
@@ -763,22 +783,37 @@ const videoRules = { videoLimit: integerRule('本批镜头上限'), videoRepairA
</NScrollbar>
</nav>
<article class="production-detail min-w-0">
<NScrollbar v-if="shot" class="panel-scroll" content-class="p-5 lg:p-7">
<NScrollbar v-if="shot" class="panel-scroll" content-class="shot-detail-content p-5 lg:p-7">
<header class="mb-5 pb-5">
<NAlert v-if="linkedShotMissing" type="warning" :show-icon="false" class="mb-4"
>链接中的镜头已不存在或不属于该剧集,请在左侧重新选择。</NAlert
>
<div class="flex flex-wrap items-start justify-between gap-3">
<div>
<p class="eyebrow">段落 {{ shot.beatNo }} · 镜头 {{ shot.shotNo }}</p>
<h3 class="mt-2 text-lg font-semibold">{{ shot.title }}</h3>
</div>
<!-- 以下是镜头编号与最近视频任务状态模块,分别对齐左右边缘 -->
<div class="flex flex-wrap items-center justify-between gap-3">
<p class="eyebrow">段落 {{ shot.beatNo }} · 镜头 {{ shot.shotNo }}</p>
<StatusBadge
v-if="videoStatusItem"
:status="videoStatusItem.status"
:label="productionStatusLabel(videoStatusItem.status)"
:label="latestVideoTaskLabel"
/>
</div>
<!-- 以下是镜头标题与低频生成检查菜单模块,菜单固定在标题行最右侧 -->
<div class="mt-2 flex items-center justify-between gap-3">
<h3 class="min-w-0 flex-1 break-words text-lg font-semibold">{{ shot.title }}</h3>
<div class="shrink-0">
<ActionMenu
label="镜头资产更多操作"
:items="[
{
key: 'specs',
label: '检查生成规格与模型限制',
disabled: !shotAssetsRef || shotAssetsRef.inspecting
}
]"
@select="shotAssetsRef?.inspectSpecs()"
/>
</div>
</div>
<p v-if="shot.description" class="mt-3 text-sm leading-7">{{ shot.description }}</p>
<NAlert
v-if="videoStatusItem?.status === 'failed'"
@@ -817,6 +852,7 @@ const videoRules = { videoLimit: integerRule('本批镜头上限'), videoRepairA
</NAlert>
</header>
<ShotProductionAssets
ref="shotAssetsRef"
:key="shot.shotId"
:project-id="id"
:shot="shot"
@@ -994,22 +1030,9 @@ const videoRules = { videoLimit: integerRule('本批镜头上限'), videoRepairA
}
}
@media (max-width: 760px) {
/* 移动端隐藏可由镜头目录获知的重复统计,并让操作从左侧连续排列。 */
.production-workspace-page .workspace-toolbar {
@apply grid grid-cols-[minmax(0,_1fr)] gap-2;
}
.production-workspace-page .toolbar-episode,
.production-workspace-page .toolbar-actions {
@apply w-full min-w-0 m-0;
}
.production-workspace-page .toolbar-summary {
@apply hidden;
}
.production-workspace-page .toolbar-actions {
@apply justify-start;
}
/* 手机目录按实际内容占高,将剩余空间交给镜头正文。 */
.production-workspace {
@apply grid-cols-[minmax(0,_1fr)] grid-rows-[184px_minmax(0,_1fr)] gap-3;
@apply grid-cols-[minmax(0,_1fr)] grid-rows-[auto_minmax(0,_1fr)] gap-2;
}
.production-pipeline {
@apply grid-cols-[1fr];
@@ -4,9 +4,8 @@ import { productionMessage } from '../production-messages'
import { computed } from 'vue'
import { useQuery } from '../../../composables/useQuery'
import { qualityApi } from '../quality-api'
import { BadgeCheck } from '@lucide/vue'
import { NAlert, NButton, NTag } from 'naive-ui'
import { AssetImage, StatusBadge } from '../../../components/ui'
import { AssetImage, AssetOpenLink, StatusBadge } from '../../../components/ui'
import { formatDate } from '../../../lib/format'
import { productionStatusLabel } from '../model'
import type { ShotKeyframe } from '../types'
@@ -25,16 +24,21 @@ const props = defineProps<{
}>()
const emit = defineEmits<{ quality: []; select: []; confirm: []; cancel: []; history: [] }>()
/** 质量状态以数据库为准;会话内检查仅在历史状态未知时兜底。 */
const reviewKey = computed(() => props.item.status === 'completed'
? JSON.stringify([props.shotId, props.item.id, props.reviewRevision ?? 0]) : '')
const reviewKey = computed(() =>
props.item.status === 'completed' ? JSON.stringify([props.shotId, props.item.id, props.reviewRevision ?? 0]) : ''
)
const reviewQuery = useQuery(reviewKey, (value, signal) => {
if (!value) return Promise.resolve(null)
const [shotId, keyframeId] = JSON.parse(value) as [string, string, number]
return qualityApi.keyframeQualityReview(shotId, keyframeId, signal)
})
const effectiveStatus = computed(() => reviewQuery.data.value?.effectiveQualityStatus ?? 'unknown')
const isPassed = computed(() => effectiveStatus.value === 'passed' || effectiveStatus.value === 'manual_accepted' ||
(effectiveStatus.value === 'unknown' && props.validationPassed === true))
const isPassed = computed(
() =>
effectiveStatus.value === 'passed' ||
effectiveStatus.value === 'manual_accepted' ||
(effectiveStatus.value === 'unknown' && props.validationPassed === true)
)
const canSelect = computed(
() =>
props.item.status === 'completed' &&
@@ -47,29 +51,44 @@ const canSelect = computed(
<template>
<article class="keyframe-card">
<div class="keyframe-image">
<!-- 以下是首帧画面模块,主图身份通过下方文字标签说明 -->
<div class="relative">
<AssetImage
:src="item.status === 'completed' ? item.imageUrl : null"
:alt="`镜头 ${shotNo} 首帧`"
preview
:empty-text="item.status === 'failed' ? '首帧生成失败' : '首帧生成中'"
/>
<span v-if="item.isPrimary" class="primary-keyframe-mark" aria-label="当前主首帧" title="当前主首帧">
<BadgeCheck :size="15" />
</span>
<AssetOpenLink :src="item.status === 'completed' ? item.imageUrl : null" label="打开图片" />
</div>
<div class="p-3">
<div class="flex flex-wrap items-center gap-2">
<StatusBadge :status="item.status" :label="productionStatusLabel(item.status)" />
<NTag v-if="effectiveStatus === 'manual_accepted'" size="small" type="success" :bordered="false">人工已接受</NTag>
<NTag v-if="item.source !== 'provider_variant'" size="small" :bordered="false">
{{ item.isPrimary ? '主首帧' : '候选首帧' }}
</NTag>
<NTag v-if="effectiveStatus === 'manual_accepted'" size="small" type="success" :bordered="false"
>人工已接受</NTag
>
<NTag v-else-if="isPassed" size="small" type="success" :bordered="false">质量通过</NTag>
<NTag v-else-if="effectiveStatus === 'needs_review'" size="small" type="warning" :bordered="false">待人工复核</NTag>
<NTag v-else-if="effectiveStatus === 'failed' || (effectiveStatus === 'unknown' && validationPassed === false)" size="small" type="error" :bordered="false"
<NTag v-else-if="effectiveStatus === 'needs_review'" size="small" type="warning" :bordered="false"
>待人工复核</NTag
>
<NTag
v-else-if="
effectiveStatus === 'failed' || (effectiveStatus === 'unknown' && validationPassed === false)
"
size="small"
type="error"
:bordered="false"
>质量未通过</NTag
>
<NTag v-if="item.source === 'provider_variant'" size="small" :bordered="false">视频参考图</NTag>
<NTag v-if="item.isPrimary && stale" size="small" :bordered="false">已过期</NTag>
<span class="text-[10px] text-muted">{{ item.width || '—' }} × {{ item.height || '—' }}</span>
<NTag v-if="item.isPrimary && stale" size="small" type="warning" :bordered="false">已过期</NTag>
<!-- 以下是完整尺寸信息模块,数据缺失时隐藏 -->
<span v-if="item.width && item.height" class="text-[10px] text-muted"
>{{ item.width }} × {{ item.height }}</span
>
</div>
<IssueHint v-if="item.error" :messages="[productionMessage(item.error)]" type="error" />
<p class="mt-2 text-[10px] text-muted">{{ formatDate(item.createdAt) }}</p>
@@ -77,7 +96,9 @@ const canSelect = computed(
<NButton text size="small" @click="emit('quality')">
{{ validationPassed === null ? '质量检查' : '重新检查' }}
</NButton>
<NButton v-if="item.status === 'completed'" text size="small" @click="emit('history')">查看首帧校验历史</NButton>
<NButton v-if="item.status === 'completed'" text size="small" @click="emit('history')"
>查看首帧校验历史</NButton
>
<NButton v-if="canSelect" :disabled="blocked" text size="small" @click="emit('select')">
设为主首帧
</NButton>
@@ -157,9 +157,11 @@ async function loadPreview() {
:bordered="false"
:type="preview.specConsistencySummary?.hasWarnings ? 'warning' : 'success'"
>
{{ preview.specConsistencySummary?.hasWarnings
? `发现 ${preview.specConsistencySummary.warningCount} 项预警`
: '检查通过' }}
{{
preview.specConsistencySummary?.hasWarnings
? `发现 ${preview.specConsistencySummary.warningCount} 项预警`
: '检查通过'
}}
</NTag>
<span class="text-muted">仅提示,不阻止生成</span>
</div>
@@ -18,11 +18,11 @@ const props = defineProps<{
keyframeId: string
/** 正在执行其他镜头操作时禁止提交审核。 */
disabled?: boolean
/** 在独立弹窗内直接展示内容,无需再次点击展开。 */
/** 在独立弹窗内直接展示内容,并隐藏内部标题、说明与操作栏。 */
initialOpen?: boolean
}>()
const emit = defineEmits<{ reviewed: [] }>()
/** 默认折叠,仅展开后查询。 */
/** 普通入口展开后查询,独立弹窗打开时直接查询。 */
const open = ref(props.initialOpen ?? false)
/** 查询键包含全部归属信息,旧请求会被取消。 */
const key = computed(() =>
@@ -44,13 +44,14 @@ const reviewQuery = useQuery(key, (value, signal) => {
return qualityApi.keyframeQualityReview(shotId, keyframeId, signal)
})
const review = computed(() => reviewQuery.data.value)
const decisionLabel = (value: string) => ({
passed: 'AI 校验通过',
failed: 'AI 校验未通过',
needs_review: '需要人工复核',
manual_accepted: '人工已接受',
unknown: '未校验'
})[value] ?? value
const decisionLabel = (value: string) =>
({
passed: 'AI 校验通过',
failed: 'AI 校验未通过',
needs_review: '需要人工复核',
manual_accepted: '人工已接受',
unknown: '未校验'
})[value] ?? value
const reviewAction = ref<'accepted' | 'rejected' | null>(null)
const reviewReason = ref('')
const reviewer = ref('user')
@@ -60,8 +61,15 @@ const submitSuccess = ref('')
/** 人工接受必须先执行最新安全预检查;任何写入都需要明确按钮操作。 */
async function submitReview() {
if (!reviewAction.value || !review.value?.validationTaskId || !reviewReason.value.trim() ||
!reviewer.value.trim() || submitting.value || props.disabled) return
if (
!reviewAction.value ||
!review.value?.validationTaskId ||
!reviewReason.value.trim() ||
!reviewer.value.trim() ||
submitting.value ||
props.disabled
)
return
submitting.value = true
submitError.value = ''
submitSuccess.value = ''
@@ -107,26 +115,37 @@ const records = computed(() =>
<!-- 以下是首帧已有校验记录的只读查询模块 -->
<ReadonlyInspection
v-model:open="open"
:collapsible="!initialOpen"
:show-header="!initialOpen"
title="首帧校验历史"
description="查看记录不收费;设置主首帧前仍需完成本次检查。"
:loading="query.loading.value"
:error="query.error.value"
@refresh="() => { query.refresh(); reviewQuery.refresh() }"
@refresh="
() => {
query.refresh()
reviewQuery.refresh()
}
"
>
<section v-if="review" class="panel p-3 text-xs leading-6">
<p class="font-semibold">当前质量复核</p>
<p>原始模型判定:{{ decisionLabel(review.qualityDecision) }}</p>
<p>当前有效状态:{{ decisionLabel(review.effectiveQualityStatus) }}</p>
<p v-if="review.manualReview">
人工审核:{{ review.manualReview.decision === 'accepted' ? '已接受' : '已拒绝' }}
· {{ review.manualReview.reason || '未填写理由' }}
人工审核:{{ review.manualReview.decision === 'accepted' ? '已接受' : '已拒绝' }} ·
{{ review.manualReview.reason || '未填写理由' }}
</p>
<p v-else-if="review.manualReviewAvailable" class="text-muted">
已发现可人工复核的证据分歧;当前仅展示信息,不会自动接受候选。
</p>
<div v-for="(item, index) in review.historicalGazePreview" :key="index" class="mt-2 bg-muted/10 p-2">
<p>{{ item.subjectRef }} → {{ item.targetDescription }}:{{ decisionLabel(item.decision) }}</p>
<p>结构判断:{{ item.physicalAlignment || '未知' }};独立观察:{{ item.observationCertainty || '未知' }}</p>
<p>
结构判断:{{ item.physicalAlignment || '未知' }};独立观察:{{
item.observationCertainty || '未知'
}}
</p>
<p class="text-muted">{{ item.reason }}</p>
</div>
</section>
@@ -134,17 +153,37 @@ const records = computed(() =>
<p class="font-semibold">人工复核</p>
<p class="mt-2 text-muted">请先预览候选图片并确认视觉效果。接受会替换当前主首帧,拒绝只保存审核记录。</p>
<div class="mt-3 flex flex-wrap gap-2">
<NButton size="small" :disabled="disabled || submitting" @click="reviewAction = 'accepted'">人工接受</NButton>
<NButton size="small" :disabled="disabled || submitting" @click="reviewAction = 'rejected'">人工拒绝</NButton>
<NButton size="small" :disabled="disabled || submitting" @click="reviewAction = 'accepted'"
>人工接受</NButton
>
<NButton size="small" :disabled="disabled || submitting" @click="reviewAction = 'rejected'"
>人工拒绝</NButton
>
</div>
<div v-if="reviewAction" class="mt-3 space-y-3">
<NInput v-model:value="reviewer" placeholder="审核人" :disabled="submitting" />
<NInput v-model:value="reviewReason" type="textarea" :rows="3" placeholder="填写审核理由(必填)" :disabled="submitting" />
<NInput
v-model:value="reviewReason"
type="textarea"
:rows="3"
placeholder="填写审核理由(必填)"
:disabled="submitting"
/>
<NAlert :type="reviewAction === 'accepted' ? 'warning' : 'info'" :show-icon="false">
{{ reviewAction === 'accepted' ? '确认接受后将替换当前主首帧;AI 原始失败记录仍会保留。' : '拒绝后保留图片及原始质量记录。' }}
{{
reviewAction === 'accepted'
? '确认接受后将替换当前主首帧;AI 原始失败记录仍会保留。'
: '拒绝后保留图片及原始质量记录。'
}}
</NAlert>
<div class="flex gap-3">
<NButton type="primary" :loading="submitting" :disabled="!reviewReason.trim() || !reviewer.trim()" @click="submitReview">确认{{ reviewAction === 'accepted' ? '接受' : '拒绝' }}</NButton>
<NButton
type="primary"
:loading="submitting"
:disabled="!reviewReason.trim() || !reviewer.trim()"
@click="submitReview"
>确认{{ reviewAction === 'accepted' ? '接受' : '拒绝' }}</NButton
>
<NButton :disabled="submitting" @click="reviewAction = null">取消</NButton>
</div>
</div>
@@ -0,0 +1,26 @@
<script setup lang="ts">
import { NTag } from 'naive-ui'
import StatusBadge from '../../../components/ui/StatusBadge.vue'
import IssueHint from '../../../components/ui/IssueHint.vue'
/** 三个生产阶段共用的状态与原因入口参数。 */
defineProps<{
/** 后端返回的当前阶段状态。 */
status?: string
/** 状态的中文显示名称。 */
label?: string
/** 需要优先展示的过期或更新警告。 */
warningLabel?: string
/** 当前状态对应的原因说明,没有原因时隐藏入口。 */
messages: string[]
}>()
</script>
<template>
<!-- 以下是同一行展示状态与查看原因入口的公共模块 -->
<div class="flex flex-wrap items-center justify-end gap-x-3 gap-y-2">
<NTag v-if="warningLabel" size="small" type="warning" :bordered="false">{{ warningLabel }}</NTag>
<StatusBadge v-else-if="status" :status="status" :label="label" />
<IssueHint :messages="messages" inline />
</div>
</template>
@@ -4,20 +4,18 @@ import { useActionMessage } from '../../../components/ui/useActionMessage'
import ProviderInputInspector from './ProviderInputInspector.vue'
import { NAlert, NButton, NCollapse, NCollapseItem, NSelect, NTag } from 'naive-ui'
import { computed, onScopeDispose, ref, watch } from 'vue'
import { ExternalLink, ImagePlus, RefreshCw } from '@lucide/vue'
import { AssetImage, StatusBadge } from '../../../components/ui'
import { ImagePlus, RefreshCw } from '@lucide/vue'
import { AssetImage } from '../../../components/ui'
import { usePolling } from '../../../composables/usePolling'
import { useQuery } from '../../../composables/useQuery'
import { mediaAssetUrl } from '../../../lib/assets'
import { errorMessage } from '../../../lib/http'
import { formatDate } from '../../../lib/format'
import type { DesignedShot } from '../../storyboard/types'
import { storyboardApi } from '../../storyboard/api'
import ConfirmAction from '../../workflows/ConfirmAction.vue'
import { runOperation } from '../../workflows/operations'
import { productionApi } from '../api'
import { qualityApi } from '../quality-api'
import { isActiveVideo, primaryKeyframe, primaryVideo, productionStatusLabel, videoQualityStatusLabel } from '../model'
import { isActiveVideo, primaryKeyframe, primaryVideo, productionStatusLabel, videoRecordedValidation } from '../model'
import { productionIssueText, productionMessage } from '../production-messages'
import type {
GenerateKeyframeInput,
@@ -29,10 +27,11 @@ import type {
} from '../types'
import KeyframeDialog from './KeyframeDialog.vue'
import KeyframeCard from './KeyframeCard.vue'
import VideoCard from './VideoCard.vue'
import ProductionStageStatus from './ProductionStageStatus.vue'
import QualityDialog from './QualityDialog.vue'
import VideoQualityDiagnostics from './VideoQualityDiagnostics.vue'
import KeyframeValidationHistory from './KeyframeValidationHistory.vue'
import ActionMenu from '../../../components/ui/ActionMenu.vue'
import { AppDialog } from '../../../components/ui'
import ModelCapabilities from './ModelCapabilities.vue'
import type { QualityTarget } from '../quality.types'
@@ -138,10 +137,19 @@ const currentVideoInput = computed(() =>
)
const keyframes = computed(() => query.data.value?.keyframes ?? [])
const videos = computed(() => query.data.value?.videos ?? [])
/** 当前镜头尚未结束的首帧任务数量,包含等待提交和生成中。 */
const activeKeyframeCount = computed(
() => keyframes.value.filter(item => ['pending', 'generating'].includes(item.status)).length
)
/** 当前镜头尚未结束的视频任务数量,包含等待提交、排队和生成中。 */
const activeVideoCount = computed(() => videos.value.filter(isActiveVideo).length)
const videoQualityStatus = computed(() => query.data.value?.qualityStatus ?? null)
const videoInputPlan = computed(() => query.data.value?.inputPlan ?? null)
const currentKeyframe = computed(() => primaryKeyframe(keyframes.value))
/** 主区只展示正式成功主视频,不用候选代替尚未确认的主视频。 */
const currentVideo = computed(() => primaryVideo(videos.value))
/** 其它视频记录统一放入候选弹窗,包含生成中和失败记录。 */
const videoCandidates = computed(() => videos.value.filter(item => item.id !== currentVideo.value?.id))
const activeVideo = computed(() => videos.value.find(isActiveVideo))
const assetBlocked = computed(() => props.disabled || !!query.error.value)
/**
@@ -158,6 +166,14 @@ watch(
)
const qualityOpen = ref(false)
const candidatesOpen = ref(false)
/** 视频候选仅在用户打开弹窗后展示。 */
const videoCandidatesOpen = ref(false)
/** 仅点击视频卡片入口后显示已有质量记录。 */
const videoHistoryOpen = ref(false)
/** 当前查看记录的视频 ID,按资产隔离主视频和候选。 */
const videoHistoryId = ref('')
/** 记录弹窗中的视频是否为需要更新的当前主视频。 */
const videoHistoryStale = computed(() => videoHistoryId.value === currentVideo.value?.id && videoStale.value)
const qualityTarget = ref<QualityTarget | null>(null)
const specsOpen = ref(false)
const generationCatalog = ref<GenerationModelCatalog | null>(null)
@@ -197,9 +213,14 @@ watch(
{ immediate: true }
)
/** 从实际候选打开质量面板,保留单镜头主操作。 */
/**
* 从实际候选打开质量面板,先关闭候选弹窗,避免遮挡费用与操作确认。
* @param kind 需要检查的资产种类
* @param assetId 当前选中的真实资产编号
*/
function openQuality(kind: 'keyframe' | 'video', assetId: string) {
candidatesOpen.value = false
videoCandidatesOpen.value = false
qualityTarget.value = {
kind,
shotId: props.shot.shotId,
@@ -208,6 +229,15 @@ function openQuality(kind: 'keyframe' | 'video', assetId: string) {
}
qualityOpen.value = true
}
/**
* 从主视频或候选卡片打开只读记录,关闭候选弹窗以避免弹窗叠加。
* @param videoId 当前选中视频 ID
*/
function openVideoHistory(videoId: string) {
videoCandidatesOpen.value = false
videoHistoryId.value = videoId
videoHistoryOpen.value = true
}
/** 只打开当前镜头的有限质量重跑表单,费用确认后才发送任务。 */
function openShotKeyframeQuality() {
if (!props.episodeNo || !canGenerateKeyframe.value) return
@@ -221,7 +251,12 @@ function openShotKeyframeQuality() {
}
/** 当前查看历史的候选 ID;历史记录在独立弹窗内按候选隔离。 */
const historyKeyframeId = ref('')
/** 首帧校验历史弹窗的显示状态。 */
const historyOpen = ref(false)
/**
* 打开指定首帧的校验历史,供主首帧与候选卡片共用。
* @param keyframeId 需要查看历史的首帧 ID
*/
function openKeyframeHistory(keyframeId: string) {
historyKeyframeId.value = keyframeId
historyOpen.value = true
@@ -254,9 +289,9 @@ const canGenerateVideo = computed(
)
const keyframeStale = computed(() => !!props.keyframeReadiness?.primaryKeyframeStale)
/** 当前主首帧的持久化质量状态,避免会话缓存与按钮状态冲突。 */
const primaryQualityKey = computed(() => currentKeyframe.value
? JSON.stringify([props.shot.shotId, currentKeyframe.value.id, reviewRevision.value])
: '')
const primaryQualityKey = computed(() =>
currentKeyframe.value ? JSON.stringify([props.shot.shotId, currentKeyframe.value.id, reviewRevision.value]) : ''
)
const primaryQualityQuery = useQuery(primaryQualityKey, (value, signal) => {
if (!value) return Promise.resolve(null)
const [shotId, keyframeId] = JSON.parse(value) as [string, string, number]
@@ -273,6 +308,19 @@ async function refreshAfterReview() {
await refreshAll()
}
const keyframeCandidates = computed(() => keyframes.value.filter(item => item.id !== currentKeyframe.value?.id))
/**
* 按候选数量计算弹窗宽度,每项 260px,每行最多五项,预留间距和左右内边距。
* @param count 当前候选数量
* @returns 弹窗的期望宽度,单位为像素
*/
function candidateDialogWidth(count: number): number {
const columns = Math.max(1, Math.min(5, count))
return columns * 260 + (columns - 1) * 12 + 48
}
/** 首帧弹窗按当前候选数适配一至五列,实际宽度由公共弹窗限制在视口内。 */
const keyframeCandidatesWidth = computed(() => candidateDialogWidth(keyframeCandidates.value.length))
/** 视频弹窗与首帧共用固定列宽,少量候选不留多余的整列空白。 */
const videoCandidatesWidth = computed(() => candidateDialogWidth(videoCandidates.value.length))
/** 仅用于本会话即时提示;最终质量判定以持久化审核结果为准。 */
function keyframePassed(assetId: string) {
return sessionKeyframePassed(props.projectId, props.shot.shotId, assetId)
@@ -287,16 +335,14 @@ watch(key, () => {
historyOpen.value = false
historyKeyframeId.value = ''
confirmingVideo.value = ''
videoCandidatesOpen.value = false
videoHistoryOpen.value = false
videoHistoryId.value = ''
keyframeSpec.value = null
videoSpec.value = null
specError.value = ''
})
/** 只返回通过协议和 /storage 限制的视频地址。 */
function safeVideoUrl(value: string | null): string | null {
return value ? mediaAssetUrl(value) : null
}
/** 重新读取单镜头资产,并通知父页刷新项目就绪状态。 */
async function refreshAll() {
await Promise.all([query.refresh(), promptQuery.refresh(), videoInputQuery.refresh()])
@@ -433,38 +479,28 @@ async function inspectSpecs() {
specError.value = [...new Set(errors)].join(' ')
inspecting.value = false
}
/** 将只读检查入口与读取状态交给镜头标题行,保留弹窗在资产组件内管理。 */
defineExpose({ inspectSpecs, inspecting })
</script>
<template>
<section class="production-assets">
<div class="flex flex-wrap items-center justify-between gap-3">
<div>
<h4 class="text-sm font-semibold">镜头生产资产</h4>
</div>
<div class="flex gap-3">
<ActionMenu
label="镜头资产更多操作"
:items="[{ key: 'specs', label: '检查生成规格与模型限制', disabled: inspecting }]"
@select="inspectSpecs"
/>
</div>
</div>
<NAlert v-if="query.error.value" role="alert" type="error" :show-icon="false" class="mt-4"
>{{ query.error.value }} 当前保留上次成功读取的资产,操作已暂停。
</NAlert>
<div class="production-stage mt-5">
<div class="production-stage">
<div class="production-stage-heading">
<div>
<h5 class="text-sm font-medium">01 · 视频提示词</h5>
</div>
<StatusBadge
v-if="promptReadiness"
:status="promptReadiness.status"
:label="productionStatusLabel(promptReadiness.status)"
<!-- 以下是视频提示词状态与对应原因入口模块 -->
<ProductionStageStatus
:status="promptReadiness?.status"
:label="promptReadiness ? productionStatusLabel(promptReadiness.status) : undefined"
:messages="(promptReadiness?.issues ?? []).map(productionIssueText)"
/>
</div>
<IssueHint :messages="(promptReadiness?.issues ?? []).map(productionIssueText)" />
<div v-if="savedPrompt?.videoPrompt" class="surface-inset mt-4 p-4" aria-label="本镜视频提示词">
<p class="text-xs font-medium">本镜视频提示词</p>
<p class="mt-3 whitespace-pre-wrap break-words text-sm leading-6">{{ savedPrompt.videoPrompt }}</p>
@@ -506,13 +542,15 @@ async function inspectSpecs() {
<div>
<h5 class="text-sm font-medium">02 · 首帧</h5>
</div>
<StatusBadge
v-if="keyframeReadiness"
:status="keyframeReadiness.status"
:label="keyframeStale ? '主首帧已过期' : productionStatusLabel(keyframeReadiness.status)"
<!-- 以下是首帧状态与对应原因入口模块,过期使用警告色 -->
<ProductionStageStatus
:status="keyframeReadiness?.status"
:label="keyframeReadiness ? productionStatusLabel(keyframeReadiness.status) : undefined"
:warning-label="keyframeStale ? '主首帧已过期' : undefined"
:messages="(keyframeReadiness?.issues ?? []).map(productionIssueText)"
/>
</div>
<IssueHint :messages="(keyframeReadiness?.issues ?? []).map(productionIssueText)" />
<!-- 以下是主首帧卡片模块,校验历史通过卡片入口在弹窗内查看 -->
<div v-if="currentKeyframe" class="keyframe-grid mt-4">
<KeyframeCard
:shot-id="shot.shotId"
@@ -524,18 +562,10 @@ async function inspectSpecs() {
:validation-passed="keyframePassed(currentKeyframe.id)"
:confirming="false"
@quality="openQuality('keyframe', currentKeyframe.id)"
@history="openKeyframeHistory(currentKeyframe.id)"
/>
</div>
<p v-else class="mt-4 text-xs text-muted">尚无已确认主首帧。请生成候选,完成质量检查后再设为主首帧。</p>
<!-- 以下是当前主首帧的只读视觉校验历史模块 -->
<KeyframeValidationHistory
v-if="currentKeyframe"
:key="currentKeyframe.id"
:project-id="projectId"
:shot-id="shot.shotId"
:keyframe-id="currentKeyframe.id"
class="mt-3"
/>
<NAlert
v-if="currentKeyframe && keyframePassed(currentKeyframe.id) === false"
type="error"
@@ -554,6 +584,10 @@ async function inspectSpecs() {
<NButton v-if="keyframeCandidates.length" @click="candidatesOpen = true">
管理候选({{ keyframeCandidates.length }})
</NButton>
<!-- 以下是首帧候选任务进行中的数量提示模块 -->
<NTag v-if="activeKeyframeCount" size="small" type="warning" :bordered="false" role="status">
首帧任务进行中({{ activeKeyframeCount }})
</NTag>
<NButton :disabled="!canGenerateKeyframe" @click="keyframeOpen = true"
><ImagePlus :size="14" />{{
keyframeStale ? '生成替代候选' : currentKeyframe ? '再生成一张候选' : '生成首帧候选'
@@ -567,10 +601,12 @@ async function inspectSpecs() {
<div>
<h5 class="text-sm font-medium">03 · 视频</h5>
</div>
<StatusBadge
v-if="videoReadiness"
:status="videoReadiness.status"
:label="videoStale ? '主视频已过期' : productionStatusLabel(videoReadiness.status)"
<!-- 以下是视频状态与对应原因入口模块,需更新使用警告色 -->
<ProductionStageStatus
:status="videoReadiness?.status"
:label="videoReadiness ? productionStatusLabel(videoReadiness.status) : undefined"
:warning-label="videoStale ? '主视频需更新' : undefined"
:messages="videoIssueMessages"
/>
</div>
<div v-if="videoInputPlan" class="mt-3 flex flex-wrap items-center gap-2 text-xs">
@@ -579,7 +615,8 @@ async function inspectSpecs() {
</NTag>
<span class="text-muted">{{ videoInputPlan.reasons.map(productionMessage).join(';') }}</span>
</div>
<IssueHint :messages="videoIssueMessages" />
<!-- 以下是主视频素材变化说明模块,与此前画面检查结论分别说明 -->
<p v-if="videoStale" class="mt-3 text-xs text-muted">首帧或参考图已变化,请重新生成视频。</p>
<section class="surface-inset mt-4 p-4" aria-label="当前视频生成素材引用">
<div class="flex flex-wrap items-center justify-between gap-2">
<h6 class="text-xs font-medium">视频使用的素材</h6>
@@ -645,107 +682,34 @@ async function inspectSpecs() {
</div>
</div>
</section>
<div
v-if="videoQualityStatus && videoQualityStatus.status !== 'not_started'"
class="mt-3 flex items-center gap-2"
>
<NTag
size="small"
:type="
videoQualityStatus.status === 'passed'
? 'success'
: videoQualityStatus.status === 'exhausted'
? 'error'
: 'info'
<!-- 以下是主视频展示模块,其它记录在候选弹窗中查看 -->
<div v-if="currentVideo" class="video-grid mt-4">
<VideoCard
:item="currentVideo"
:shot-no="shot.shotNo"
:duration-seconds="shot.durationSeconds"
:stale="videoStale"
:blocked="assetBlocked"
:validation-passed="sessionVideoValidation(projectId, shot.shotId, currentVideo.id)?.passed ?? null"
:recorded-validation-passed="
videoRecordedValidation(videoQualityStatus, shot.shotId, currentVideo.id)
"
:bordered="false"
>
{{
videoQualityStatus.status === 'passed'
? '视频检查通过'
: videoQualityStatusLabel(videoQualityStatus.status)
}}
:confirming="false"
@quality="openQuality('video', currentVideo.id)"
@history="openVideoHistory(currentVideo.id)"
/>
</div>
<p v-else class="mt-4 text-xs text-muted">
{{ videoCandidates.length ? '尚无已确认主视频,请在候选中检查并选择。' : '尚无视频任务记录。' }}
</p>
<!-- 以下是视频候选弹窗入口模块 -->
<div v-if="videoCandidates.length" class="mt-4 flex flex-wrap gap-3">
<NButton @click="videoCandidatesOpen = true">管理候选({{ videoCandidates.length }})</NButton>
<!-- 以下是视频候选任务进行中的数量提示模块 -->
<NTag v-if="activeVideoCount" size="small" type="warning" :bordered="false" role="status">
视频任务进行中({{ activeVideoCount }})
</NTag>
</div>
<!-- 以下是当前镜头只读视频质量详情与失败归因模块 -->
<VideoQualityDiagnostics :key="shot.shotId" :shot-id="shot.shotId" class="mt-3" />
<div v-if="videos.length" class="video-grid mt-4">
<article v-for="item in videos" :key="item.id" class="video-record">
<video
v-if="item.status === 'completed' && safeVideoUrl(item.videoUrl)"
:src="safeVideoUrl(item.videoUrl) || undefined"
controls
preload="metadata"
class="production-video"
></video>
<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 v-if="item.isPrimary" size="small" :bordered="false">主视频</NTag>
<NTag v-if="!item.isPrimary" size="small" :bordered="false">候选视频</NTag>
<NTag v-if="item.isPrimary && videoStale" size="small" :bordered="false">已过期</NTag>
<span class="text-[10px] text-muted"
>{{ item.durationSeconds || shot.durationSeconds || '—' }}s</span
>
</div>
<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' && item.videoUrl"
text
size="small"
@click="openQuality('video', item.id)"
>质量检查<template v-if="sessionVideoValidation(projectId, item.shotId, item.id)">
·
{{
sessionVideoValidation(projectId, item.shotId, item.id)?.passed
? '曾通过'
: '未通过'
}}</template
></NButton
>
<a
v-if="safeVideoUrl(item.videoUrl)"
:href="safeVideoUrl(item.videoUrl) || undefined"
target="_blank"
rel="noopener noreferrer"
class="text-button"
>打开视频<ExternalLink :size="12"
/></a>
<NButton
v-if="
item.status === 'completed' &&
item.videoUrl &&
!item.isPrimary &&
sessionVideoValidation(projectId, item.shotId, item.id)?.passed === true
"
:disabled="assetBlocked"
@click="confirmingVideo = item.id"
text
size="small"
>
设为主视频
</NButton>
</div>
<NAlert v-if="confirmingVideo === item.id" type="info" :show-icon="false" class="mt-3 text-xs"
><p>确认把此候选设为当前镜头主视频?旧成片仍会保留。</p>
<div class="mt-2 flex gap-3">
<NButton @click="setPrimaryVideo" type="primary">确认切换</NButton>
<NButton @click="confirmingVideo = ''" text size="small">取消</NButton>
</div></NAlert
>
</div>
</article>
</div>
<p v-else class="mt-4 text-xs text-muted">尚无视频任务记录。</p>
<p v-if="videos.some(item => !item.isPrimary)" class="mt-3 text-xs text-muted">
质量链状态来自后端持久化记录;手动晋升候选仍需在当前页面完成一次视觉校验。自动质量任务通过后会直接更新主视频。
</p>
<section
v-if="generationCatalog"
class="generation-settings-panel surface-inset mt-4"
@@ -861,13 +825,10 @@ async function inspectSpecs() {
v-model:open="candidatesOpen"
title="首帧候选管理"
description="先完成质量检查;只有本会话校验通过的候选才能设为主首帧。"
wide
:width="keyframeCandidatesWidth"
>
<!-- 候选图片和对应的人工复核入口按相同候选 ID 分组。 -->
<div
v-if="keyframeCandidates.length"
class="mt-4 grid grid-cols-[repeat(auto-fill,minmax(260px,1fr))] items-start gap-3 max-[760px]:grid-cols-1"
>
<div v-if="keyframeCandidates.length" class="asset-candidate-grid mt-4">
<div v-for="item in keyframeCandidates" :key="item.id" class="min-w-0">
<KeyframeCard
:shot-id="shot.shotId"
@@ -888,6 +849,49 @@ async function inspectSpecs() {
</div>
<p v-else class="text-xs text-muted">暂无其它首帧候选。</p>
</AppDialog>
<!-- 以下是视频候选管理弹窗模块,复用主视频卡片操作与公共弹窗滚动布局 -->
<AppDialog
v-model:open="videoCandidatesOpen"
title="视频候选管理"
description="完成质量检查后,可以将通过的候选设为主视频。"
:width="videoCandidatesWidth"
>
<div v-if="videoCandidatesOpen && videoCandidates.length" class="asset-candidate-grid mt-4">
<VideoCard
v-for="item in videoCandidates"
:key="item.id"
:item="item"
:shot-no="shot.shotNo"
:duration-seconds="shot.durationSeconds"
:stale="false"
:blocked="assetBlocked"
:validation-passed="sessionVideoValidation(projectId, item.shotId, item.id)?.passed ?? null"
:recorded-validation-passed="videoRecordedValidation(videoQualityStatus, item.shotId, item.id)"
:confirming="confirmingVideo === item.id"
@quality="openQuality('video', item.id)"
@history="openVideoHistory(item.id)"
@select="confirmingVideo = item.id"
@confirm="setPrimaryVideo"
@cancel="confirmingVideo = ''"
/>
</div>
<p v-else class="text-xs text-muted">暂无其它视频候选。</p>
</AppDialog>
<!-- 以下是指定视频质量记录弹窗模块,打开后直接展示结果与修改建议 -->
<AppDialog
v-model:open="videoHistoryOpen"
title="视频质量记录"
description="查看此视频已有的画面检查结果与本镜头的相关记录,不收费。"
wide
>
<VideoQualityDiagnostics
v-if="videoHistoryOpen && videoHistoryId"
:key="`${shot.shotId}:${videoHistoryId}`"
:shot-id="shot.shotId"
:video-id="videoHistoryId"
:stale="videoHistoryStale"
/>
</AppDialog>
<AppDialog
v-model:open="historyOpen"
title="首帧校验历史"
@@ -932,29 +936,24 @@ async function inspectSpecs() {
.production-stage-actions {
@apply mt-4 flex min-h-[34px] flex-wrap items-center gap-3;
}
.keyframe-grid {
@apply grid gap-3;
grid-template-columns: repeat(auto-fill, minmax(180px, 220px));
/* 主首帧与主视频共用 260px 宽度,画面保持正方形,小屏下不超过可用空间。 */
.keyframe-grid,
.video-grid {
@apply grid w-full max-w-[260px] grid-cols-1 gap-3;
}
/* 候选画面固定 260px,最多五列;列数减少时仍保持左右边缘对齐。 */
.asset-candidate-grid {
@apply grid w-full max-w-[1348px] items-start gap-3;
grid-template-columns: repeat(auto-fit, minmax(min(260px, 100%), 260px));
justify-content: space-between;
}
.keyframe-card {
@apply relative overflow-hidden rounded-none bg-(--app-subtle);
@apply min-w-0 overflow-hidden rounded-none bg-(--app-subtle);
}
.keyframe-card .asset-image {
@apply aspect-square rounded-none;
}
.keyframe-image {
@apply relative;
}
.primary-keyframe-mark {
@apply absolute top-2 left-2 z-1 flex size-7 items-center justify-center;
color: var(--app-on-accent);
background: var(--app-button-primary);
box-shadow:
0 0 0 1px rgb(0 0 0 / 55%),
0 2px 8px rgb(0 0 0 / 35%);
}
.video-input-grid,
.video-grid {
.video-input-grid {
@apply grid gap-3;
grid-template-columns: repeat(auto-fill, minmax(180px, 220px));
}
@@ -970,12 +969,6 @@ async function inspectSpecs() {
.video-input-image .asset-image {
@apply h-full w-full aspect-auto;
}
.video-record {
@apply min-w-0 overflow-hidden rounded-none bg-(--app-subtle);
}
.production-video {
@apply block w-full aspect-square bg-[#080808] object-contain;
}
.generation-settings-panel {
@apply p-5;
}
@@ -989,9 +982,16 @@ async function inspectSpecs() {
@apply mb-[7px] text-xs font-medium leading-5;
}
@media (max-width: 760px) {
/* 手机画面占满内容宽度,图片与视频的高度继续由正方形比例确定。 */
.keyframe-grid,
.video-input-grid,
.video-grid {
@apply max-w-none;
}
/* 手机候选按整行展示,避免固定 260px 造成侧边留白。 */
.asset-candidate-grid {
@apply max-w-none grid-cols-[minmax(0,_1fr)];
}
.video-input-grid {
@apply grid-cols-[repeat(2,_minmax(0,_1fr))];
}
.generation-settings-panel {
@@ -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>
@@ -1,22 +1,27 @@
<script setup lang="ts">
import { computed, ref } from 'vue'
import { computed } from 'vue'
import { NAlert, NTag } from 'naive-ui'
import ReadonlyInspection from '../../../components/ui/ReadonlyInspection.vue'
import { useQuery } from '../../../composables/useQuery'
import { formatDate } from '../../../lib/format'
import { videoDiagnosticsApi } from '../diagnostics-api'
import { videoQualityStatusLabel } from '../model'
import type { VideoQualityRollbackTarget } from '../diagnostics.types'
/** 视频诊断始终绑定当前正式镜头。 */
const props = defineProps<{ /** 正式镜头 ID。 */ shotId: string }>()
/** 仅用户展开后查询,关闭后取消旧请求。 */
const open = ref(false)
/** 镜头和展开状态共同决定查询目标。 */
const key = computed(() => (open.value ? props.shotId : ''))
/** 视频诊断绑定正式镜头与用户选中的视频,随弹窗挂载直接读取。 */
const props = defineProps<{
/** 正式镜头 ID。 */
shotId: string
/** 用户选中的视频 ID。 */
videoId: string
/** 当前视频是否因首帧或参考图变化而需要更新。 */
stale: boolean
}>()
/** 查询目标包含镜头和视频,切换目标后取消旧请求。 */
const key = computed(() => (props.shotId && props.videoId ? JSON.stringify([props.shotId, props.videoId]) : ''))
/** 切换镜头时取消查询,先读取链状态,耗尽时再查询独立归因。 */
const query = useQuery(key, async (shotId, signal) => {
if (!shotId) return null
const query = useQuery(key, async (value, signal) => {
if (!value) return null
const [shotId] = JSON.parse(value) as [string, string]
const detail = await videoDiagnosticsApi.qualityDetail(shotId, signal)
if (detail.shotId !== shotId || !Array.isArray(detail.chain)) throw new Error('质量记录与当前镜头不匹配,请刷新。')
const analysis =
@@ -28,6 +33,16 @@ const query = useQuery(key, async (shotId, signal) => {
})
/** 当前请求返回的权威质量链。 */
const detail = computed(() => query.data.value?.detail)
/** 当前视频的独立记录,不能使用其它候选或流程整体结果兜底。 */
const currentRecord = computed(() => detail.value?.chain.find(item => item.videoId === props.videoId))
/** 当前视频优先展示,其它候选明确标识为相关记录。 */
const orderedChain = computed(() => {
const chain = detail.value?.chain ?? []
return [
...chain.filter(item => item.videoId === props.videoId),
...chain.filter(item => item.videoId !== props.videoId)
]
})
/** 当前链对应的后端确定性归因。 */
const analysis = computed(() => query.data.value?.analysis)
@@ -50,23 +65,38 @@ function rollbackLabel(target: VideoQualityRollbackTarget) {
</script>
<template>
<!-- 以下是只读视频质量详情与自动修复失败归因模块 -->
<ReadonlyInspection
v-model:open="open"
title="视频质量详情"
description="查看检查结果和修改建议,不收费。"
:loading="query.loading.value"
:error="query.error.value"
@refresh="query.refresh"
>
<template v-if="detail">
<p>
<strong>{{ videoQualityStatusLabel(detail.status) }}</strong> · 修复 {{ detail.repairAttempt }} /
{{ detail.maxRepairAttempts ?? '未设置' }} · 候选 {{ detail.chain.length }}
<!-- 以下是弹窗中的视频已有检查记录模块,无需再次点击查看 -->
<section class="workspace-panel text-xs leading-6" aria-label="当前视频质量记录">
<NAlert v-if="stale" type="warning" :show-icon="false" class="mb-3">
此视频需要更新:首帧或参考图已变化。此前画面检查结果仅供参考,请重新生成视频。
</NAlert>
<NAlert v-if="query.error.value" type="error" :show-icon="false" role="alert">{{ query.error.value }}</NAlert>
<p v-if="query.loading.value" class="text-muted" role="status">正在读取质量记录…</p>
<template v-else-if="detail">
<p v-if="currentRecord" class="font-semibold">
{{
currentRecord.validationPassed === true
? '当前视频此前画面检查通过'
: currentRecord.validationPassed === false
? '当前视频此前画面检查未通过'
: '当前视频尚未完成画面检查'
}}
</p>
<p v-else class="text-muted">此视频暂无自动质量流程记录。</p>
<!-- 以下是镜头质量流程上下文模块,与当前视频的结论区分 -->
<p class="mt-3 text-muted">
本镜头共 {{ detail.chain.length }} 条视频记录;当前视频优先显示,其它候选单独标识。
</p>
<p v-if="currentRecord" class="text-muted">
当前视频修复 {{ currentRecord.repairAttempt }} / {{ currentRecord.maxRepairAttempts ?? '未设置' }}
</p>
<p v-if="['generating', 'validating', 'repairing'].includes(detail.status)" class="text-muted">
当前镜头正在执行:{{ videoQualityStatusLabel(detail.status) }}
</p>
<p v-if="!detail.chain.length" class="mt-2 text-muted">当前镜头尚无质量链记录。</p>
<article v-for="item in detail.chain" :key="item.videoId" class="surface-inset mt-3 p-3">
<article v-for="item in orderedChain" :key="item.videoId" class="surface-inset mt-3 p-3">
<div class="flex flex-wrap items-center gap-2">
<NTag size="small" :bordered="false">{{ item.videoId === videoId ? '当前视频' : '其它候选' }}</NTag>
<code>{{ item.videoId }}</code>
<NTag size="small" :bordered="false">第 {{ item.repairAttempt }} 代</NTag>
<span
@@ -97,6 +127,7 @@ function rollbackLabel(target: VideoQualityRollbackTarget) {
:type="analysis.requiresManualReview ? 'warning' : 'info'"
:show-icon="false"
>
<p class="font-semibold">镜头最近一次质量流程的修改建议</p>
{{ analysis.summary }}
<p v-if="analysis.recommendedRollback.length" class="mt-1">
建议检查:{{ analysis.recommendedRollback.map(rollbackLabel).join('、') }}
@@ -110,5 +141,5 @@ function rollbackLabel(target: VideoQualityRollbackTarget) {
</ul>
</article>
</template>
</ReadonlyInspection>
</section>
</template>
+23 -2
View File
@@ -1,5 +1,5 @@
import { reactive } from 'vue'
import type { ProductionIssueCode, ProductionSession, ShotKeyframe, ShotVideo } from './types'
import type { ProductionIssueCode, ProductionSession, ShotKeyframe, ShotVideo, ShotVideoQualityStatus } from './types'
/** 按项目隔离生产回执,切换页面后仍能查看上一次批量操作结果。 */
const sessions = reactive<Record<string, ProductionSession>>({})
@@ -34,6 +34,22 @@ export function primaryVideo(items: ShotVideo[]): ShotVideo | undefined {
return items.find(item => item.isPrimary && item.status === 'completed' && item.videoUrl)
}
/**
* 只读取指定镜头与视频的持久化检查结论,不用流程整体状态代替单个视频结果。
* @param qualityStatus 镜头质量流程记录,读取失败时为空
* @param shotId 当前镜头 ID
* @param videoId 当前视频 ID
* @returns 对应视频的检查结论,没有记录或尚未检查时返回 null
*/
export function videoRecordedValidation(
qualityStatus: ShotVideoQualityStatus | null,
shotId: string,
videoId: string
): boolean | null {
if (qualityStatus?.shotId !== shotId) return null
return qualityStatus.chain.find(item => item.videoId === videoId)?.validationPassed ?? null
}
/** 活动视频状态与后端重复任务保护保持一致。 */
export function isActiveVideo(item: ShotVideo): boolean {
return ['pending', 'queued', 'running'].includes(item.status)
@@ -63,7 +79,11 @@ export function issueLabel(code: ProductionIssueCode): string {
return labels[code] ?? '生成条件需要完善'
}
/** 生产状态中文标签,未知值由状态组件回退显示原文。 */
/**
* 将生产任务状态转换为中文标签,包含首帧与视频的生成中状态。
* @param status 后端返回的生产任务状态
* @returns 状态对应的中文名称,未知状态保留原值
*/
export function productionStatusLabel(status: string): string {
const labels: Record<string, string> = {
ready: '已就绪',
@@ -73,6 +93,7 @@ export function productionStatusLabel(status: string): string {
pending: '等待提交',
queued: '排队中',
running: '生成中',
generating: '生成中',
completed: '已完成',
failed: '失败',
cancelled: '已取消',
+19 -6
View File
@@ -94,17 +94,30 @@ export const qualityApi = {
{ method: 'POST', body: { validationTaskId } }
),
/** 人工接受会修改主首帧,必须由用户明确确认。 */
acceptKeyframeReview: (shotId: string, keyframeId: string, body: {
validationTaskId: string; expectedPrimaryId: string; reviewer: string; reason: string
}) =>
acceptKeyframeReview: (
shotId: string,
keyframeId: string,
body: {
validationTaskId: string
expectedPrimaryId: string
reviewer: string
reason: string
}
) =>
request<{ reviewId: string; decision: 'accepted'; primaryChanged: boolean }>(
`/storyboard-shots/${encodeURIComponent(shotId)}/keyframes/${encodeURIComponent(keyframeId)}/quality-review/accept`,
{ method: 'POST', body }
),
/** 人工拒绝只记录审核决定,不删除候选图片。 */
rejectKeyframeReview: (shotId: string, keyframeId: string, body: {
validationTaskId: string; reviewer: string; reason: string
}) =>
rejectKeyframeReview: (
shotId: string,
keyframeId: string,
body: {
validationTaskId: string
reviewer: string
reason: string
}
) =>
request<{ reviewId: string; decision: 'rejected'; primaryChanged: false }>(
`/storyboard-shots/${encodeURIComponent(shotId)}/keyframes/${encodeURIComponent(keyframeId)}/quality-review/reject`,
{ method: 'POST', body }
+6 -1
View File
@@ -319,8 +319,13 @@ onScopeDispose(() => {
.project-header .n-page-header__title {
@apply min-w-0 overflow-hidden;
}
/* 标题和配置入口使用同一垂直中心,消除省略文本的行内基线留白。 */
.project-header .n-page-header__title,
.project-header .n-page-header__extra {
@apply flex items-center;
}
.project-title {
@apply max-w-full text-base font-semibold;
@apply block max-w-full text-base font-semibold leading-normal;
}
.project-notices.n-scrollbar {
@apply shrink-0 h-auto max-h-[min(24dvh,160px)] overflow-hidden;
+4 -18
View File
@@ -140,7 +140,7 @@ const rules = { concurrency: integerRule('批量并发'), maxRepairAttempts: int
</script>
<template>
<WorkspacePage split compact class="storyboard-workspace-page">
<WorkspacePage split compact mobile-scroll class="storyboard-workspace-page compact-shot-workspace">
<template #notice>
<NAlert v-if="episodeSourceUnavailable" type="info" :show-icon="false">
本集镜头已重新生成。新标题和剧情详情尚未提供,当前只显示正式镜头编号;请按实际生成规格核对内容。
@@ -452,7 +452,7 @@ const rules = { concurrency: integerRule('批量并发'), maxRepairAttempts: int
</NScrollbar>
</nav>
<article class="storyboard-detail min-w-0">
<NScrollbar v-if="shot" class="panel-scroll" content-class="p-5 lg:p-7">
<NScrollbar v-if="shot" class="panel-scroll" content-class="shot-detail-content p-5 lg:p-7">
<header class="mb-6">
<p class="eyebrow">
段落 {{ shot.beatNo }} · 镜头 {{ shot.shotNo }}
@@ -562,23 +562,9 @@ const rules = { concurrency: integerRule('批量并发'), maxRepairAttempts: int
@apply p-0;
}
@media (max-width: 760px) {
/* 移动端按整行排列剧集、统计和操作,避免 flex 自动换行留下不规则空白。 */
.storyboard-workspace-page .workspace-toolbar {
@apply grid grid-cols-[minmax(0,_1fr)] gap-2;
}
.storyboard-workspace-page .toolbar-episode,
.storyboard-workspace-page .toolbar-metrics,
.storyboard-workspace-page .toolbar-actions {
@apply w-full min-w-0 m-0;
}
.storyboard-workspace-page .toolbar-metrics {
@apply justify-between;
}
.storyboard-workspace-page .toolbar-actions {
@apply justify-start;
}
/* 手机目录按实际内容占高,避免没有状态或短标题时保留整块空白。 */
.storyboard-workspace {
@apply grid-cols-[minmax(0,_1fr)] grid-rows-[184px_minmax(0,_1fr)] gap-3;
@apply grid-cols-[minmax(0,_1fr)] grid-rows-[auto_minmax(0,_1fr)] gap-2;
}
.storyboard-controls {
@apply grid-cols-[minmax(0,_1fr)_minmax(0,_1fr)];
@@ -1,12 +1,25 @@
<script setup lang="ts">
import { computed, useId } from 'vue'
import { computed, ref, useId } from 'vue'
import { useDirectorySelection } from '../../../composables/useDirectorySelection'
import { DirectoryItem } from '../../../components/ui'
import type { DesignedShot } from '../types'
/** 分镜设计与镜头生产共用的两级目录;选择始终使用正式 Shot ID。 */
const props = defineProps<{ shots: DesignedShot[]; activeId: string; itemClass: string }>()
const props = defineProps<{
/** 当前剧集的正式镜头列表。 */
shots: DesignedShot[]
/** 当前选中镜头的正式 ID。 */
activeId: string
/** 页面传入的目录条目样式。 */
itemClass: string
}>()
/** 用户选择目录镜头时通知页面更新当前镜头。 */
const emit = defineEmits<{ select: [shotId: string] }>()
/** 两个镜头页面共用的目录根节点,用于定位当前选中的正式镜头。 */
const directoryRoot = ref<HTMLDivElement | null>(null)
/** 当前目录实例的唯一标识,关联各段落标题和目录组。 */
const directoryId = useId()
/** 将镜头按段落和镜头编号排序,供桌面分组与手机横向目录共用。 */
const groups = computed(() => {
const entries = new Map<number, DesignedShot[]>()
for (const shot of props.shots) {
@@ -21,37 +34,47 @@ const groups = computed(() => {
shots: shots.toSorted((a, b) => a.shotNo - b.shotNo)
}))
})
/** 主体、分镜和生产共用目录定位,镜头分组标题保留桌面置顶避让。 */
useDirectorySelection(
directoryRoot,
() => props.activeId,
() => props.shots.map(shot => shot.shotId),
'.directory-group-heading'
)
</script>
<template>
<div
v-for="group in groups"
:key="group.beatNo"
class="beat-directory-group"
role="group"
:aria-labelledby="`${directoryId}-beat-${group.beatNo}`"
>
<h4 :id="`${directoryId}-beat-${group.beatNo}`" class="directory-group-heading">
<span>段落 {{ String(group.beatNo).padStart(2, '0') }}</span>
<span class="directory-group-count">{{ group.shots.length }} 镜</span>
</h4>
<div class="beat-directory-items">
<DirectoryItem
v-for="shot in group.shots"
:key="shot.shotId"
:active="activeId === shot.shotId"
:class="itemClass"
:aria-label="`段落 ${group.beatNo} · 镜头 ${shot.shotNo} · ${shot.title}`"
@click="emit('select', shot.shotId)"
>
{{ shot.title }}
<template #eyebrow>
<!-- 窄屏目录变为横向条目时补回归属,桌面不重复显示分组编号。 -->
<span class="directory-mobile-beat">段落 {{ String(group.beatNo).padStart(2, '0') }} / </span>
<span class="directory-shot-number">镜头 {{ String(shot.shotNo).padStart(2, '0') }}</span>
</template>
<template #meta><slot name="meta" :shot="shot" /></template>
</DirectoryItem>
<!-- 以下是选中镜头自动定位的目录根模块,不新增布局占位 -->
<div ref="directoryRoot" class="beat-shot-directory">
<div
v-for="group in groups"
:key="group.beatNo"
class="beat-directory-group"
role="group"
:aria-labelledby="`${directoryId}-beat-${group.beatNo}`"
>
<h4 :id="`${directoryId}-beat-${group.beatNo}`" class="directory-group-heading">
<span>段落 {{ String(group.beatNo).padStart(2, '0') }}</span>
<span class="directory-group-count">{{ group.shots.length }} 镜</span>
</h4>
<div class="beat-directory-items">
<DirectoryItem
v-for="shot in group.shots"
:key="shot.shotId"
:active="activeId === shot.shotId"
:class="itemClass"
:aria-label="`段落 ${group.beatNo} · 镜头 ${shot.shotNo} · ${shot.title}`"
@click="emit('select', shot.shotId)"
>
{{ shot.title }}
<template #eyebrow>
<!-- 窄屏目录变为横向条目时补回归属,桌面不重复显示分组编号。 -->
<span class="directory-mobile-beat">段落 {{ String(group.beatNo).padStart(2, '0') }} / </span>
<span class="directory-shot-number">镜头 {{ String(shot.shotNo).padStart(2, '0') }}</span>
</template>
<template #meta><slot name="meta" :shot="shot" /></template>
</DirectoryItem>
</div>
</div>
</div>
</template>
@@ -59,6 +82,9 @@ const groups = computed(() => {
<style>
/* 本组件专属布局与 Naive 内部结构覆盖。 */
@reference "../../../styles/styles.css";
.beat-shot-directory {
display: contents;
}
.directory-group-heading {
@apply sticky top-0 z-[1] flex items-center justify-between gap-3 shrink-0 py-2.5 px-3.5 bg-(--app-control) font-mono font-semibold text-[11px] leading-[1.6] text-ink;
}
@@ -2,6 +2,7 @@
import AppForm from '../../components/ui/AppForm.vue'
import { NFormItem } from 'naive-ui'
import { integerRule } from '../../lib/form-rules'
import { useDirectorySelection } from '../../composables/useDirectorySelection'
import WorkspacePage from '../../components/ui/WorkspacePage.vue'
import WorkspaceTools from '../../components/ui/WorkspaceTools.vue'
import {
@@ -17,7 +18,7 @@ import {
NTag
} from 'naive-ui'
import { computed, ref, watch } from 'vue'
import { useRoute, useRouter } from 'vue-router'
import { useRoute, useRouter, type LocationQueryRaw } from 'vue-router'
import { Check, Circle, UserCheck } from '@lucide/vue'
import { AssetImage, DirectoryItem, EmptyState, StatusBadge } from '../../components/ui'
import { downloadText } from '../../lib/format'
@@ -115,6 +116,13 @@ const filtered = computed(() =>
`${item.name} ${item.ref}`.toLowerCase().includes(search.value.trim().toLowerCase())
)
)
/** 主体目录根节点,复用分镜与生产目录的自动定位和平滑滚动。 */
const subjectDirectoryRoot = ref<HTMLElement | null>(null)
useDirectorySelection(
subjectDirectoryRoot,
() => selectedId.value,
() => filtered.value.map(item => item.id)
)
/** 深链接仅在目标 ID 变化时选择,不因目录轮询把用户切回原主体。 */
const linkedSubjectId = computed(
@@ -133,6 +141,17 @@ watch(selectedId, () => {
castingOpen.value = false
pendingSelection.value = ''
})
/** 当前主体写入地址,刷新和返回页面后恢复相同主体,再定位到对应目录项。 */
watch(
selectedId,
id => {
if (!id || !subjects.value.some(item => item.id === id) || route.query.subjectId === id) return
const query: LocationQueryRaw = { ...route.query, subjectId: id }
delete query.subjectRef
void router.replace({ query })
},
{ flush: 'post' }
)
/** 切换主体前确认放弃当前草稿,避免误丢尚未保存的文本。 */
function select(id: string) {
@@ -292,7 +311,7 @@ function runNextAction() {
</script>
<template>
<WorkspacePage split compact class="identity-workspace-page">
<WorkspacePage split compact mobile-scroll class="identity-workspace-page">
<template #notice>
<NAlert v-if="stageComplete" type="success" :show-icon="false">
所有需要确认的角色身份已经准备好,可以继续制作主体形态图片。
@@ -628,34 +647,37 @@ function runNextAction() {
content-class="directory-list-content identity-subject-list-content"
x-scrollable
>
<DirectoryItem
v-for="item in filtered"
:key="item.id"
:aria-pressed="selectedId === item.id"
:active="selectedId === item.id"
@click="select(item.id)"
class="identity-subject-item"
>{{ item.name }}
<template #leading>
<IdentityThumbnail
:project-id="projectId"
:subject-id="item.id"
:name="item.name"
:module="item.module"
:identity-id="item.identity === null ? null : item.identity?.id"
:source="thumbnailSource(item)"
:refresh-key="thumbnailRefreshKey"
/>
</template>
<template #eyebrow>{{ item.ref }}</template>
<template #meta>
<span>{{ item.forms.length }} 个形态</span
><span v-if="castingBySubject.has(item.id)" class="directory-status">
{{ castingStatusLabel(castingBySubject.get(item.id)!.status) }}</span
>
</template></DirectoryItem
>
<p v-if="!filtered.length" class="py-6 text-xs text-muted">没有匹配主体,请调整筛选。</p>
<!-- 以下是主体选中项自动定位模块,不增加目录布局占位 -->
<div ref="subjectDirectoryRoot" class="identity-directory-items">
<DirectoryItem
v-for="item in filtered"
:key="item.id"
:aria-pressed="selectedId === item.id"
:active="selectedId === item.id"
@click="select(item.id)"
class="identity-subject-item"
>{{ item.name }}
<template #leading>
<IdentityThumbnail
:project-id="projectId"
:subject-id="item.id"
:name="item.name"
:module="item.module"
:identity-id="item.identity === null ? null : item.identity?.id"
:source="thumbnailSource(item)"
:refresh-key="thumbnailRefreshKey"
/>
</template>
<template #eyebrow>{{ item.ref }}</template>
<template #meta>
<span>{{ item.forms.length }} 个形态</span
><span v-if="castingBySubject.has(item.id)" class="directory-status">
{{ castingStatusLabel(castingBySubject.get(item.id)!.status) }}</span
>
</template></DirectoryItem
>
<p v-if="!filtered.length" class="py-6 text-xs text-muted">没有匹配主体,请调整筛选。</p>
</div>
</NScrollbar>
</aside>
<NScrollbar class="identity-detail panel-scroll min-w-0">
@@ -869,6 +891,10 @@ function runNextAction() {
.identity-workspace {
@apply grid grid-cols-[240px_minmax(0,_1fr)] items-start gap-3;
}
/* 主体目录根节点只用于定位,保留桌面纵向和手机横向的自然布局。 */
.identity-directory-items {
display: contents;
}
.identity-subject-list {
@apply max-h-[560px] overflow-hidden;
}
@@ -1025,6 +1051,19 @@ function runNextAction() {
@apply shrink-0;
}
@media (max-width: 760px) {
/* 主体详情自然撑高,提示与主体导航随正文滚走;顶部两行保留固定。 */
.identity-workspace-page .identity-workspace {
height: auto;
flex: none;
overflow: visible;
grid-template-rows: auto auto;
}
.identity-workspace-page .identity-workspace > .identity-detail,
.identity-workspace-page .identity-detail > .n-scrollbar-container {
height: auto;
max-height: none;
overflow: visible;
}
.identity-next-action {
@apply items-start flex-col;
}
@@ -23,7 +23,7 @@ import FormPromptBatch from './components/FormPromptBatch.vue'
import { useKeyframeImpact } from './useKeyframeImpact'
import { useProjectContext } from '../projects/context'
import { queryText, referenceLocation, referenceTargets } from '../production/asset-links'
import { masonryRowSpan, type GalleryLayout } from './layout'
import { masonryColumnCount, masonryRowSpan, type GalleryLayout } from './layout'
/** 形态图库以正式数据库为准;首次读取、手动刷新和自身操作完成后更新,不定时刷新。 */
const route = useRoute()
@@ -150,7 +150,8 @@ function syncMasonryLayout(container: HTMLElement) {
const rowHeight = Number.parseFloat(styles.gridAutoRows)
const rowGap = Number.parseFloat(styles.rowGap)
const cardGap = Number.parseFloat(styles.columnGap)
const columnCount = Math.max(1, styles.gridTemplateColumns.split(/\s+/).filter(Boolean).length)
const minCardWidth = Number.parseFloat(styles.getPropertyValue('--gallery-card-min-width'))
const columnCount = masonryColumnCount(container.clientWidth, minCardWidth, cardGap)
const nextRows = Array<number>(columnCount).fill(1)
const cards = Array.from(container.children).filter(
(element): element is HTMLElement =>
@@ -293,7 +294,7 @@ const rules = { concurrency: integerRule('批量并发'), limit: integerRule('
</script>
<template>
<WorkspacePage compact class="gallery-workspace-page">
<WorkspacePage compact mobile-scroll class="gallery-workspace-page">
<template #notice>
<NAlert v-if="stageComplete" type="success" :show-icon="false">
当前制作需要的主体参考图已经准备好,可以继续进行分镜设计。
@@ -817,7 +818,10 @@ const rules = { concurrency: integerRule('批量并发'), limit: integerRule('
/* 本组件专属布局与 Naive 内部结构覆盖。 */
@reference "../../styles/styles.css";
.form-image-grid {
@apply grid grid-cols-[repeat(auto-fill,_minmax(min(260px,_100%),_1fr))];
@apply grid;
/* 排版和列数计算共用卡片最小宽度,手机缩窄后不保留桌面隐式列。 */
--gallery-card-min-width: 260px;
grid-template-columns: repeat(auto-fill, minmax(min(var(--gallery-card-min-width), 100%), 1fr));
--gallery-gap: 12px;
gap: var(--gallery-gap);
}
@@ -839,7 +843,7 @@ const rules = { concurrency: integerRule('批量并发'), limit: integerRule('
padding-top: var(--app-content-gap);
}
.gallery-workspace-page .form-image-masonry {
@apply grid grid-cols-[repeat(auto-fill,_minmax(min(260px,_100%),_1fr))] items-start;
@apply items-start;
/* 避免每个 1px 网格行都叠加间距,造成卡片下方出现额外空白。 */
column-gap: var(--gallery-gap);
row-gap: 0;
+12
View File
@@ -1,6 +1,18 @@
/** 图库展示方式;仅改变卡片排版,不影响素材顺序、筛选及后端查询。 */
export type GalleryLayout = 'grid' | 'masonry'
/**
* 按可用宽度计算瀑布流列数,忽略旧卡片位置生成的隐式网格列。
* @param width 容器可用宽度
* @param minCardWidth 卡片最小宽度
* @param gap 列间距
* @returns 当前宽度能够容纳的显式列数
*/
export function masonryColumnCount(width: number, minCardWidth: number, gap: number): number {
if (![width, minCardWidth, gap].every(Number.isFinite) || width <= 0 || minCardWidth <= 0 || gap < 0) return 1
return Math.max(1, Math.floor((width + gap) / (Math.min(width, minCardWidth) + gap)))
}
/**
* 计算瀑布流卡片需要跨越的网格行数。
* @param height 卡片实际高度
@@ -108,7 +108,8 @@ function removeImage(image: VisualStyleImage) {
</script>
<template>
<WorkspacePage compact class="visual-style-page"
<!-- 以下是手机提示、风格工具与正文共同滚动的视觉风格工作区 -->
<WorkspacePage compact mobile-scroll class="visual-style-page"
><template #header>
<!-- 以下是标题、锁定状态与生成操作 -->
<div class="workspace-toolbar visual-style-toolbar">
+120 -3
View File
@@ -289,9 +289,13 @@ body {
.workspace-tabs.n-tabs .n-tabs-nav .n-tabs-tab-pad {
width: 0;
}
/* 选中状态仅通过文字颜色表达,不显示底部指示线。 */
.workspace-tabs.n-tabs .n-tabs-nav .n-tabs-bar {
display: none;
/* 所有横向 Tab 的选中指示线由 2px 加粗到 3px,顶部导航内对齐底边。 */
.n-tabs.n-tabs--top .n-tabs-bar {
height: 3px;
bottom: 0;
}
.n-tabs.n-tabs--bottom .n-tabs-bar {
height: 3px;
}
/* 标签与两侧附加操作共用无底边框的导航行。 */
.workspace-tabs.n-tabs .n-tabs-nav.n-tabs-nav--line-type.n-tabs-nav--top .n-tabs-nav-scroll-content,
@@ -496,6 +500,10 @@ body {
grid-template-columns: minmax(0, 1fr) 180px;
}
}
/* 仅手机显示的操作图标,桌面保持原有文字按钮。 */
.mobile-action-icon {
display: none;
}
@media (max-width: 760px) {
:root {
--app-content-padding: 15px;
@@ -520,6 +528,115 @@ body {
align-items: stretch;
padding-bottom: 12px;
}
/* 分镜和生产共用紧凑手机工具栏,剧集选择与两个操作入口保持同行。 */
.compact-shot-workspace .workspace-toolbar {
display: grid;
grid-template-columns: minmax(0, 1fr) auto;
align-items: center;
gap: 6px 8px;
}
.compact-shot-workspace .toolbar-episode {
width: auto;
min-width: 0;
margin: 0;
}
.compact-shot-workspace .toolbar-episode .n-base-selection-label {
min-height: 44px;
}
.compact-shot-workspace .toolbar-actions {
grid-column: 2;
grid-row: 1;
flex-wrap: nowrap;
width: auto;
min-width: 0;
gap: 4px;
margin: 0;
}
.compact-shot-workspace .toolbar-actions .mobile-toolbar-icon,
.compact-shot-workspace .toolbar-actions .workspace-tools-trigger,
.compact-shot-workspace .toolbar-actions .n-button.icon-button {
width: 44px;
min-width: 44px;
height: 44px;
padding: 0;
flex-shrink: 0;
}
.compact-shot-workspace .mobile-action-icon {
display: inline;
}
.compact-shot-workspace .workspace-action-label,
.compact-shot-workspace .workspace-tools-label,
.compact-shot-workspace .workspace-tools-receipt,
.compact-shot-workspace .toolbar-summary,
.compact-shot-workspace .toolbar-metrics {
display: none;
}
/* 目录只占实际高度,不再为短标题或缺失状态保留空白。 */
.compact-shot-workspace .workspace-surface .directory-panel {
height: auto;
align-self: start;
}
.compact-shot-workspace .directory-scroll.panel-scroll {
height: auto;
flex: 0 0 auto;
}
.compact-shot-workspace .directory-heading {
padding: 8px 12px 4px;
}
.compact-shot-workspace .directory-heading > span {
display: none;
}
.compact-shot-workspace .directory-list-content {
gap: 8px;
padding: 0 0 6px;
}
.compact-shot-workspace .n-button.directory-item {
width: 180px;
min-height: 0;
padding: 8px 12px;
}
.compact-shot-workspace .directory-item-body {
gap: 4px;
}
.compact-shot-workspace .directory-item-meta:empty {
display: none;
}
.compact-shot-workspace .shot-detail-content {
padding: 12px;
}
.compact-shot-workspace .workspace-inline-status {
/* 手机保留逐镜状态和操作原因,隐藏重复的项目汇总以增加正文空间。 */
display: none;
}
/* 手机阅读页固定顶栏和项目标题;页面提示、工具与正文一起滚动。 */
.project-view:has(.mobile-reading-workspace) {
overflow-x: hidden;
overflow-y: auto;
overscroll-behavior: contain;
}
.workspace-page.mobile-reading-workspace,
.mobile-reading-workspace .workspace-split,
.mobile-reading-workspace .workspace-scroll {
height: auto;
overflow: visible;
flex: none;
}
.compact-shot-workspace .workspace-surface {
height: auto;
overflow: visible;
flex: none;
grid-template-rows: auto auto;
}
.compact-shot-workspace .workspace-surface > article,
.compact-shot-workspace .workspace-surface > article > .panel-scroll,
.compact-shot-workspace .workspace-surface > article > .panel-scroll > .n-scrollbar-container,
.mobile-reading-workspace .workspace-heading-scroll,
.mobile-reading-workspace .workspace-heading-scroll > .n-scrollbar-container,
.mobile-reading-workspace .workspace-scroll > .n-scrollbar-container {
height: auto;
max-height: none;
overflow: visible;
}
.content-with-history {
grid-template-columns: minmax(0, 1fr);
grid-template-rows: minmax(0, 1fr) 130px;
+4 -1
View File
@@ -189,7 +189,10 @@ describe('全站平面主题', () => {
/\.form-image-grid:not\(\.form-image-masonry\) \.asset-image\s*\{[^}]*aspect-ratio:\s*1 \/ 1;/
)
expect(css).toMatch(
/\.gallery-workspace-page \.form-image-masonry\s*\{[^}]*display:\s*grid;[^}]*grid-template-columns:\s*repeat\(auto-fill, minmax\(min\(260px, 100%\), 1fr\)\);[^}]*grid-auto-flow:\s*row dense;[^}]*grid-auto-rows:\s*1px;/
/\.form-image-grid\s*\{[^}]*display:\s*grid;[^}]*--gallery-card-min-width:\s*260px;[^}]*grid-template-columns:\s*repeat\(auto-fill, minmax\(min\(var\(--gallery-card-min-width\), 100%\), 1fr\)\);/
)
expect(css).toMatch(
/\.gallery-workspace-page \.form-image-masonry\s*\{[^}]*grid-auto-flow:\s*row dense;[^}]*grid-auto-rows:\s*1px;/
)
expect(css).toMatch(
/\.form-image-masonry > \.form-image-card\s*\{[^}]*grid-column-start:\s*var\(--form-image-column,\s*auto\);[^}]*grid-row-start:\s*var\(--form-image-row-start,\s*auto\);[^}]*grid-row-end:\s*span var\(--form-image-row-span,\s*1\);/
+4 -2
View File
@@ -44,9 +44,11 @@ describe('管理后台组件边界', () => {
expect(adminCss).toMatch(/html,\s*body,\s*#app,\s*\.app-provider\s*\{[^}]*overflow:\s*hidden/)
expect(adminCss).toMatch(/\.workspace-page\s*\{[^}]*min-height:\s*0;[^}]*overflow:\s*hidden/)
})
it('业务样式不再直接开启浏览器原生滚动条', () => {
it('仅手机阅读工作区允许项目内容整体滚动,其余面板保持独立滚动', () => {
const css = readAllStyles()
expect(css).not.toMatch(/overflow(?:-[xy])?\s*:\s*(?:auto|scroll)\b/)
const mobileReading = /\.project-view:has\(\.mobile-reading-workspace\)\s*\{[^}]*\}/
expect(css.match(mobileReading)?.[0]).toContain('overflow-y: auto;')
expect(css.replace(mobileReading, '')).not.toMatch(/overflow(?:-[xy])?\s*:\s*(?:auto|scroll)\b/)
})
it('历史缩略图尺寸在非分层样式中覆盖 Naive 按钮,原图不能撑大预览或横向条目', () => {
// happy-dom 不计算几何;专门保护此前失效的层叠和固定尺寸约束。
@@ -262,7 +262,7 @@ describe('拆解页内容滚动', () => {
['人物', 'character'],
['场景', 'scene'],
['道具', 'prop']
] as const)('%s 的奇偶主体默认展示独立形态块,搜索重排不影响形态归属', async (label, module) => {
] as const)('%s 的奇偶主体默认收起形态块,展开和搜索不影响形态归属', async (label, module) => {
const record = checkpoint()
// 前两个主体各准备两种形态,覆盖奇偶条纹和默认标签,不调用模型接口。
record.state.breakdownResult!.subjectForms = [0, 1].flatMap(subjectIndex =>
@@ -281,6 +281,9 @@ describe('拆解页内容滚动', () => {
const articles = wrapper!.findAll('.subject-record-list > article')
for (const index of [0, 1]) {
const article = articles[index]!
expect(article.findAll('.subject-form-card')).toHaveLength(0)
await article.get('.n-collapse-item__header-main').trigger('click')
await flushPromises()
const cards = article.findAll('.subject-form-card')
expect(cards).toHaveLength(2)
expect(cards[0]!.get('.n-tag').text()).toBe('默认')
@@ -376,7 +379,7 @@ describe('拆解页内容滚动', () => {
it('分镜顶部无叠加操作行,选择标签保持单行且统计操作垂直居中', () => {
// 仅保护样式契约,DOM 环境不提供真实布局坐标。
const css = readAllStyles()
expect(css).toMatch(/\.breakdown-result-pad\s*\{[^}]*padding:\s*16px/)
expect(css).toMatch(/\.breakdown-result-pad\s*\{[^}]*padding:\s*0(?:px)?/)
expect(css).toMatch(/\.breakdown-episode-picker > span\s*\{[^}]*flex-shrink:\s*0;[^}]*white-space:\s*nowrap;/)
expect(css).toMatch(/\.breakdown-storyboard-summary\s*\{[^}]*align-items:\s*center;/)
})
+7 -15
View File
@@ -46,31 +46,23 @@ describe('镜头生产数据契约', () => {
expect(source).toMatch(/\.generation-input-mode-label\s*\{[^}]*mb-\[7px\][^}]*text-xs/)
})
it('主首帧、素材引用和视频使用固定上限的正方形网格,不随少量记录撑满整行', () => {
it('主首帧与主视频共用固定宽度,素材引用保留正方形网格', () => {
const source = readFileSync('src/features/production/components/ShotProductionAssets.vue', 'utf8')
expect(source).toContain('v-if="videos.length" class="video-grid mt-4"')
expect(source).toContain('v-if="currentVideo" class="video-grid mt-4"')
expect(source).toMatch(/\.keyframe-grid,\s*\.video-grid\s*\{[^}]*max-w-\[260px\][^}]*grid-cols-1/)
expect(source).toMatch(
/\.keyframe-grid\s*\{[^}]*grid-template-columns:\s*repeat\(auto-fill, minmax\(180px, 220px\)\)/
)
expect(source).toMatch(
/\.video-input-grid,[\s\S]*?\.video-grid\s*\{[^}]*grid-template-columns:\s*repeat\(auto-fill, minmax\(180px, 220px\)\)/
/\.video-input-grid\s*\{[^}]*grid-template-columns:\s*repeat\(auto-fill, minmax\(180px, 220px\)\)/
)
expect(source).toMatch(/\.keyframe-card \.asset-image\s*\{[^}]*aspect-square/)
expect(source).toMatch(/\.production-video\s*\{[^}]*aspect-square/)
const videoCard = readFileSync('src/features/production/components/VideoCard.vue', 'utf8')
expect(videoCard).toContain('class="block aspect-square w-full bg-[#080808] object-contain"')
expect(source).toMatch(/\.video-input-card\s*\{[^}]*bg-\(--app-control\)/)
expect(source).toMatch(/\.video-input-image\s*\{[^}]*aspect-square/)
expect(source).toContain('object-fit="cover"')
expect(source).not.toContain('class="video-input-ref"')
expect(source).not.toContain('{{ reference.subjectFormName }} · {{ reference.subjectRef }}')
expect(source).toMatch(
/@media \(max-width: 760px\)[\s\S]*?\.video-grid\s*\{[^}]*grid-cols-\[repeat\(2,_minmax\(0,_1fr\)\)\]/
)
})
it('主首帧角标使用深色强调背景并在图片上保持清晰边界', () => {
const source = readFileSync('src/features/production/components/ShotProductionAssets.vue', 'utf8')
expect(source).toMatch(
/\.primary-keyframe-mark\s*\{[^}]*color:\s*var\(--app-on-accent\)[^}]*background:\s*var\(--app-button-primary\)[^}]*box-shadow:/
/@media \(max-width: 760px\)[\s\S]*?\.video-input-grid\s*\{[^}]*grid-cols-\[repeat\(2,_minmax\(0,_1fr\)\)\]/
)
})
@@ -84,19 +84,33 @@ describe('精简公开资产回归', () => {
const wrapper = mount(ShotProductionAssets, { props: { projectId, shot, disabled: false } })
try {
await flushPromises()
expect(wrapper.find('video').exists()).toBe(true)
/** 未确认的候选不出现在主区,只在管理弹窗中播放和检查。 */
expect(wrapper.find('video').exists()).toBe(false)
expect(wrapper.text()).toContain('尚无已确认主视频')
await wrapper
.findAll('button')
.find(button => button.text() === '管理候选(1)')!
.trigger('click')
await flushPromises()
expect(document.querySelector('video')).not.toBeNull()
expect(wrapper.text()).not.toContain('自动校验中')
expect(wrapper.findAll('button').some(button => button.text() === '设为主视频')).toBe(false)
expect(
[...document.querySelectorAll('button')].some(button => button.textContent?.trim() === '设为主视频')
).toBe(false)
const session = qualitySession(
qualityKey(projectId, { kind: 'video', shotId: shot.shotId, assetId: video.id, title: '' })
)
session.videoValidation = validation
await flushPromises()
expect(wrapper.findAll('button').some(button => button.text() === '设为主视频')).toBe(true)
expect(
[...document.querySelectorAll('button')].some(button => button.textContent?.trim() === '设为主视频')
).toBe(true)
expect(sessionVideoValidation('other-project', shot.shotId, video.id)).toBeNull()
session.videoValidation = { ...validation, passed: false }
await flushPromises()
expect(wrapper.findAll('button').some(button => button.text() === '设为主视频')).toBe(false)
expect(
[...document.querySelectorAll('button')].some(button => button.textContent?.trim() === '设为主视频')
).toBe(false)
expect(fetcher.mock.calls.every(([, options]) => options?.method === 'GET')).toBe(true)
} finally {
wrapper.unmount()
@@ -170,7 +184,7 @@ describe('精简公开资产回归', () => {
try {
await flushPromises()
expect(wrapper.findAll('.keyframe-card')).toHaveLength(1)
expect(wrapper.find('.primary-keyframe-mark').attributes('aria-label')).toBe('当前主首帧')
expect(wrapper.find('.keyframe-card').text()).toContain('主首帧')
expect(wrapper.findAll('button').some(item => item.text().includes('设为主首帧'))).toBe(false)
await wrapper
@@ -0,0 +1,61 @@
import { describe, expect, it } from 'vitest'
import { videoRecordedValidation } from '@/features/production/model'
import type { ShotVideoQualityStatus } from '@/features/production/types'
/** 两条候选拥有不同检查结果,用于验证结果不能跨视频归属。 */
const qualityStatus: ShotVideoQualityStatus = {
shotId: 'shot-1',
status: 'passed',
primaryVideoId: 'video-passed',
latestVideoId: 'video-passed',
repairAttempt: 1,
maxRepairAttempts: 2,
validationPassed: true,
issues: [],
chain: [
{
videoId: 'video-failed',
providerStatus: 'completed',
isPrimary: false,
repairAttempt: 0,
maxRepairAttempts: 2,
validationPassed: false,
createdAt: '2026-10-10T00:00:00Z',
updatedAt: '2026-10-10T00:01:00Z'
},
{
videoId: 'video-passed',
providerStatus: 'completed',
isPrimary: true,
repairAttempt: 1,
maxRepairAttempts: 2,
validationPassed: true,
createdAt: '2026-10-10T00:02:00Z',
updatedAt: '2026-10-10T00:03:00Z'
}
]
}
describe('视频检查记录归属', () => {
it('流程通过时仍保留另一个候选未通过的结果', () => {
expect(videoRecordedValidation(qualityStatus, 'shot-1', 'video-failed')).toBe(false)
expect(videoRecordedValidation(qualityStatus, 'shot-1', 'video-passed')).toBe(true)
})
it('其它镜头的同名视频不能提供当前检查结论', () => {
expect(videoRecordedValidation(qualityStatus, 'shot-2', 'video-passed')).toBeNull()
})
it('没有匹配记录时不能用流程级通过结果兜底', () => {
expect(videoRecordedValidation(qualityStatus, 'shot-1', 'video-missing')).toBeNull()
expect(videoRecordedValidation(null, 'shot-1', 'video-passed')).toBeNull()
})
it('尚未检查的候选保持未知状态', () => {
const unchecked: ShotVideoQualityStatus = {
...qualityStatus,
chain: [{ ...qualityStatus.chain[0]!, validationPassed: null }]
}
expect(videoRecordedValidation(unchecked, 'shot-1', 'video-failed')).toBeNull()
})
})
+14 -1
View File
@@ -1,7 +1,20 @@
import { describe, expect, it } from 'vitest'
import { masonryRowSpan } from '@/features/subject-images/layout'
import { masonryColumnCount, masonryRowSpan } from '@/features/subject-images/layout'
describe('图库瀑布流卡片布局', () => {
it('从桌面缩窄到手机时重新按可用宽度计算列数', () => {
expect(masonryColumnCount(2164, 260, 12)).toBe(8)
expect(masonryColumnCount(363, 260, 12)).toBe(1)
expect(masonryColumnCount(240, 260, 12)).toBe(1)
expect(masonryColumnCount(531, 260, 12)).toBe(1)
expect(masonryColumnCount(532, 260, 12)).toBe(2)
})
it('容器尚未布局或尺寸无效时保留单列', () => {
expect(masonryColumnCount(0, 260, 12)).toBe(1)
expect(masonryColumnCount(363, Number.NaN, 12)).toBe(1)
expect(masonryColumnCount(363, 260, -1)).toBe(1)
})
it('按卡片实际高度计算网格跨度', () => {
expect(masonryRowSpan(420, 1, 20)).toBe(21)
expect(masonryRowSpan(421, 1, 20)).toBe(21)
+2 -2
View File
@@ -925,8 +925,8 @@ describe('工作台页面交互', () => {
const toolbar = wrapper.get('.result-toolbar')
expect(toolbar.find('[aria-label="拆解结果"]').exists()).toBe(true)
expect(toolbar.find(':scope > button').exists()).toBe(false)
expect(toolbar.get('.n-tabs-nav__suffix button').attributes('aria-label')).toBe('拆解更多操作')
await toolbar.get('.n-tabs-nav__suffix button').trigger('click')
expect(toolbar.find('.n-tabs-nav__suffix [aria-label="拆解更多操作"]').exists()).toBe(true)
await toolbar.get('.n-tabs-nav__suffix [aria-label="拆解更多操作"]').trigger('click')
await flushPromises()
const exportItem = [...document.querySelectorAll('.n-dropdown-option-body')].find(
item => item.textContent?.trim() === '导出 JSON'