feat: 项目页面统一使用制作阶段准入

This commit is contained in:
GouJ committed 2026-09-26 21:02:52 +08:00
1 parent 5c8107ecf9
commit f0cbacb888
1 file changed
+21 -9
+21 -9
View File
@@ -5,7 +5,8 @@ import { NScrollbar, NAlert, NButton, NPageHeader, NSpin, NEllipsis } from 'naiv
import { EmptyState } from '../../components/ui'
import { projectContextKey, useProjectData } from './context'
import { getOperation } from '../workflows/operations'
import { isProjectComplete, projectAccessKey, type ProjectAccess } from './access'
import { projectAccessKey, projectSectionFromPath, type ProjectAccess } from './access'
import { useProjectStageAccess } from './useProjectStageAccess'
import { useWorkflowExecution } from '../workflows/execution'
import WorkflowExecutionPanel from '../workflows/WorkflowExecutionPanel.vue'
@@ -28,8 +29,14 @@ watchEffect(() => {
void context.refresh()
}
})
const complete = computed(() => isProjectComplete(context.project.value, id.value))
const isCreation = computed(() => route.path.replace(/\/+$/, '').endsWith('/create-drama'))
const stageAccess = useProjectStageAccess(id, context.project, context.checkpoints)
const complete = stageAccess.scriptReady
const currentSection = computed(() => projectSectionFromPath(route.path))
const currentAccess = computed(() => {
const section = currentSection.value
return section ? stageAccess.sections.value[section] : null
})
const isCreation = computed(() => currentSection.value === 'create-drama')
type OperationGuide = {
title: string
description: string
@@ -98,7 +105,7 @@ function resolveOperationError() {
const access = inject(projectAccessKey, undefined)
let published: ProjectAccess | null = null
watchEffect(() => {
published = { projectId: id.value, completed: complete.value }
published = { projectId: id.value, completed: complete.value, sections: stageAccess.sections.value }
if (access) access.value = published
})
onScopeDispose(() => {
@@ -154,14 +161,19 @@ onScopeDispose(() => {
@dismiss="createDramaExecution.dismiss"
/>
<div class="project-view">
<RouterView v-if="context.project.value?.id === id && (isCreation || complete)" :key="id" />
<RouterView v-if="context.project.value?.id === id && currentAccess?.enabled" :key="id" />
<EmptyState
v-else-if="context.project.value?.id === id"
class="project-access-gate"
title="请先完成剧本创作"
:description="`剧本完成后,才能使用拆解、视觉风格、主体身份、形态图片、资产库、分镜设计与镜头生产。${isGallery ? '请手动刷新项目状态。' : '状态会自动更新。'}`"
:title="currentAccess?.reason || '当前步骤还不能开始'"
:description="`完成前面的制作步骤后,这里会自动开放。${isGallery ? '如刚完成操作,请刷新项目状态。' : ''}`"
>
<NButton type="primary" @click="router.push(`/projects/${id}/create-drama`)">返回剧本创作</NButton>
<NButton
v-if="currentAccess?.nextPath"
type="primary"
@click="router.push(`/projects/${id}/${currentAccess.nextPath}`)"
>{{ currentAccess.nextLabel || '前往上一步' }}</NButton
>
<NButton v-if="isGallery" class="ml-3" :loading="context.loading.value" @click="context.refresh"
>刷新项目状态</NButton
>
@@ -169,7 +181,7 @@ onScopeDispose(() => {
<NSpin
v-else-if="context.loading.value"
class="workspace-loading"
description="正在读取项目和工作流记录…"
description="正在读取项目内容…"
/>
</div>
</section>