fix(short-drama-agent-front): 完善素材准入与选角审核读取

This commit is contained in:
GJ committed 2026-11-04 19:09:46 +08:00
1 parent 75e86f7486
commit 3503926d62
13 files changed
+355 -42

No files matched your search

+2 -7
View File
@@ -28,11 +28,6 @@ import SubjectIdentitySkeleton from '../subject-identity/SubjectIdentitySkeleton
const route = useRoute()
const router = useRouter()
const id = computed(() => String(route.params.projectId))
// 图库使用手动刷新,父布局也停止轮询,避免浏览素材时被周期性更新打断。
const isGallery = computed(() => {
const path = route.path.replace(/\/+$/, '')
return path.endsWith('/subject-images') || path.endsWith('/assets')
})
const context = useProjectData(id)
provide(projectContextKey, context)
/** 项目全局配置保存后更新已挂载生成表单。 */
@@ -343,7 +338,7 @@ onScopeDispose(() => {
v-else-if="context.project.value?.id === id"
class="project-access-gate"
:title="currentAccess?.reason || '当前步骤还不能开始'"
:description="`完成前面的制作步骤后,这里会自动开放。${isGallery ? '如刚完成操作,请刷新项目状态。' : ''}`"
description="如刚完成前置步骤,请刷新项目状态。正式分镜的复检详情可在「制作前检查」查看。"
>
<NButton
v-if="currentAccess?.nextPath"
@@ -353,7 +348,7 @@ onScopeDispose(() => {
>
<!-- 以下是手动刷新项目状态模块,图标位常驻以保持加载前后的按钮尺寸 -->
<WorkspaceRefreshButton
v-if="isGallery"
v-if="currentAccess"
label="刷新项目状态"
:loading="context.loading.value"
@refresh="context.refresh"
+17 -4
View File
@@ -17,14 +17,27 @@ export function useProjectData(id: Ref<string>) {
})
const project = computed<ProjectDetail | null>(() => query.data.value?.project ?? null)
const checkpoints = computed<Checkpoint[]>(() => query.data.value?.checkpoints ?? [])
const stageReadiness = computed(() => query.data.value?.stageReadiness ?? null)
/** 导航只消费当前项目的准入响应。 */
const stageReadiness = computed(() => {
const readiness = query.data.value?.stageReadiness
return readiness?.projectId === id.value ? readiness : null
})
/** 同项目并发轻量刷新只采用最后一次请求。 */
let readinessRefresh = 0
/** 子页面完成当前步骤后调用,只刷新轻量项目状态与导航门禁。 */
async function refreshStageReadiness() {
const projectId = id.value
if (!projectId || !query.data.value) return
const snapshot = query.data.value
if (!projectId || snapshot?.project.id !== projectId) return
const request = ++readinessRefresh
const nextReadiness = await projectsApi.stageReadiness(projectId)
if (id.value === projectId && query.data.value)
query.data.value = { ...query.data.value, stageReadiness: nextReadiness }
if (
request === readinessRefresh &&
id.value === projectId &&
query.data.value === snapshot &&
nextReadiness.projectId === projectId
)
query.data.value = { ...snapshot, stageReadiness: nextReadiness }
}
return { ...query, project, checkpoints, stageReadiness, refreshStageReadiness }
}
+29 -21
View File
@@ -4,7 +4,7 @@ import type { ProjectAccess, ProjectSection } from './access'
import type { ProjectStageReadiness } from './types'
function accessState(ready: boolean | undefined, reason: string | null | undefined, fallback: string) {
return { enabled: Boolean(ready), reason: reason || fallback }
return { enabled: ready === true, reason: reason || fallback }
}
/**
@@ -16,7 +16,12 @@ function accessState(ready: boolean | undefined, reason: string | null | undefin
export function useProjectStageAccess(projectId: Ref<string>, readiness: Ref<ProjectStageReadiness | null>) {
/** 当前步骤能否进入及对应中文说明,不改变原始准备状态。 */
const sections = computed<Record<ProjectSection, ProjectAccess['sections'][ProjectSection]>>(() => {
const state = readiness.value
const state = readiness.value?.projectId === projectId.value ? readiness.value : null
const preparationReady = state?.preparation?.ready === true
const preparationReason = state?.preparation?.reason
const materialReason = preparationReady
? state?.visualStyle.reason || '请先准备视觉风格'
: preparationReason || '请先核对正式分镜的素材准备条件'
const result: Record<ProjectSection, ProjectAccess['sections'][ProjectSection]> = {
'create-drama': { enabled: true, reason: '' },
breakdown: {
@@ -30,18 +35,18 @@ export function useProjectStageAccess(projectId: Ref<string>, readiness: Ref<Pro
nextLabel: '前往剧本拆解'
},
'subject-identity': {
enabled: Boolean(state?.preparation?.ready && state?.visualStyle.ready),
reason: state?.preparation?.reason || state?.visualStyle.reason || '请先准备视觉风格',
nextPath: state?.preparation?.ready ? 'visual-style' : 'breakdown',
nextLabel: state?.preparation?.ready ? '前往视觉风格' : '前往剧本拆解'
enabled: preparationReady && state?.visualStyle.ready === true,
reason: materialReason,
nextPath: preparationReady ? 'visual-style' : 'breakdown',
nextLabel: preparationReady ? '前往视觉风格' : '前往剧本拆解'
},
'subject-images': {
// 此页同时准备单个素材的Prompt与规格;全项目身份未齐备不阻断只读检查和逐项准备。
// 付费生成仍由本素材的实际预览、身份/规格与版本门禁决定。
enabled: Boolean(state?.preparation?.ready && state?.visualStyle.ready),
reason: state?.preparation?.reason || state?.visualStyle.reason || '请先准备视觉风格',
nextPath: state?.preparation?.ready ? 'visual-style' : 'breakdown',
nextLabel: state?.preparation?.ready ? '前往视觉风格' : '前往剧本拆解'
enabled: preparationReady && state?.visualStyle.ready === true,
reason: materialReason,
nextPath: preparationReady ? 'visual-style' : 'breakdown',
nextLabel: preparationReady ? '前往视觉风格' : '前往剧本拆解'
},
storyboard: {
enabled: Boolean(state?.breakdown.ready && state?.subjectAssets.ready),
@@ -56,21 +61,24 @@ export function useProjectStageAccess(projectId: Ref<string>, readiness: Ref<Pro
state?.subjectAssets.reason ||
state?.storyboard.reason ||
'请先完成镜头制作准备',
nextPath: state?.subjectAssets.ready
? 'storyboard'
: state?.breakdown.ready
? 'subject-images'
: 'breakdown',
nextLabel: state?.subjectAssets.ready
? '前往分镜设计'
: state?.breakdown.ready
? '前往形态图片'
: '前往剧本拆解'
nextPath: !state?.breakdown.ready
? 'breakdown'
: state.subjectAssets.ready
? 'storyboard'
: 'subject-images',
nextLabel: !state?.breakdown.ready
? '前往剧本拆解'
: state.subjectAssets.ready
? '前往分镜设计'
: '前往形态图片'
}
}
for (const section of Object.values(result)) section.reason = userFacingText(section.reason)
return result
})
const scriptReady = computed(() => readiness.value?.script.ready === true)
/** 只认当前项目的剧本就绪状态。 */
const scriptReady = computed(
() => readiness.value?.projectId === projectId.value && readiness.value.script.ready === true
)
return { projectId, scriptReady, sections }
}