From 5c8107ecf91eb459160693e31cf105fa521861ce Mon Sep 17 00:00:00 2001 From: GouJ Date: Sat, 26 Sep 2026 21:02:40 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E9=9B=86=E4=B8=AD=E7=AE=A1=E7=90=86?= =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E5=88=B6=E4=BD=9C=E9=98=B6=E6=AE=B5=E5=87=86?= =?UTF-8?q?=E5=85=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../projects/useProjectStageAccess.ts | 71 +++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100644 src/features/projects/useProjectStageAccess.ts diff --git a/src/features/projects/useProjectStageAccess.ts b/src/features/projects/useProjectStageAccess.ts new file mode 100644 index 0000000..36d0e33 --- /dev/null +++ b/src/features/projects/useProjectStageAccess.ts @@ -0,0 +1,71 @@ +import { computed, type Ref } from 'vue' +import { breakdownSnapshot } from '../workflows/selectors' +import type { ProjectSection, ProjectAccess } from './access' +import type { ProjectDetail } from './types' +import type { Checkpoint } from '../workflows/types' + +/** + * 主流程准入只使用已经持久化且当前项目可读取的数据。 + * 更细的身份、图片和分镜 readiness 由对应页面与 Production Plan 继续校验, + * 避免前端复制服务端业务规则。 + */ +export function useProjectStageAccess( + projectId: Ref, + project: Ref, + checkpoints: Ref +) { + const scriptReady = computed(() => project.value?.id === projectId.value && project.value.status === 'completed') + const breakdownReady = computed(() => { + if (!scriptReady.value) return false + const snapshot = breakdownSnapshot(checkpoints.value) + const result = snapshot?.breakdownResult ?? snapshot + return Boolean( + result?.subjectCandidates?.length && + result?.subjectForms?.length && + result?.storyboardEpisodeShots?.length && + result?.storyboardShotValidation?.valid + ) + }) + + const sections = computed>(() => ({ + 'create-drama': { enabled: true, reason: '' }, + breakdown: { + enabled: scriptReady.value, + reason: '请先完成剧本创作', + nextPath: 'create-drama', + nextLabel: '前往剧本创作' + }, + 'visual-style': { + enabled: breakdownReady.value, + reason: '请先完成剧本拆解,准备好人物、场景、道具和镜头', + nextPath: 'breakdown', + nextLabel: '前往剧本拆解' + }, + 'subject-identity': { + enabled: breakdownReady.value, + reason: '请先完成剧本拆解,准备好需要制作的主体', + nextPath: 'breakdown', + nextLabel: '前往剧本拆解' + }, + 'subject-images': { + enabled: breakdownReady.value, + reason: '请先完成剧本拆解和主体准备', + nextPath: 'subject-identity', + nextLabel: '前往主体身份' + }, + storyboard: { + enabled: breakdownReady.value, + reason: '请先完成剧本拆解,生成正式镜头后再进行分镜设计', + nextPath: 'breakdown', + nextLabel: '前往剧本拆解' + }, + production: { + enabled: breakdownReady.value, + reason: '请先完成剧本拆解。进入镜头生产后还会检查主体素材和分镜设计是否齐全', + nextPath: 'breakdown', + nextLabel: '前往剧本拆解' + } + })) + + return { scriptReady, breakdownReady, sections } +}