feat(short-drama-agent-front): 完善镜头定位与项目配置

This commit is contained in:
GJ committed 2026-10-08 19:45:26 +08:00
1 parent 470b52e26d
commit 5b134207b8
66 files changed
+2042 -984

No files matched your search

+50 -8
View File
@@ -1,5 +1,5 @@
<script setup lang="ts">
import { computed, inject, onScopeDispose, provide, watchEffect } from 'vue'
import { computed, inject, onScopeDispose, provide, ref, watch, watchEffect } from 'vue'
import { useRoute, useRouter } from 'vue-router'
import { NScrollbar, NAlert, NButton, NPageHeader, NSpin, NEllipsis } from 'naive-ui'
import { EmptyState } from '../../components/ui'
@@ -9,6 +9,8 @@ import { projectAccessKey, projectSectionFromPath, type ProjectAccess } from './
import { useProjectStageAccess } from './useProjectStageAccess'
import { useWorkflowExecution } from '../workflows/execution'
import { clearEpisodeSourceInvalidations, invalidateEpisodeSource } from '../storyboard/model'
import ProjectSettingsDialog from '../generation-config/components/ProjectSettingsDialog.vue'
import { projectGenerationRevisionKey } from '../generation-config/context'
import WorkflowExecutionPanel from '../workflows/WorkflowExecutionPanel.vue'
/** 项目标题只保留名称;下游工作区在剧本完成前不挂载,直接链接也无法越过限制。 */
@@ -22,6 +24,32 @@ const isGallery = computed(() => {
})
const context = useProjectData(id)
provide(projectContextKey, context)
/** 项目全局配置保存后更新已挂载生成表单。 */
const generationRevision = ref(0)
provide(projectGenerationRevisionKey, generationRevision)
/** 项目标题栏共用配置弹窗开关。 */
const settingsOpen = ref(false)
/** 既有配置恢复链接打开同一个全局弹窗,不切换工作区。 */
watch(
() => route.query.configure,
value => {
if (value === 'profile') settingsOpen.value = true
},
{ immediate: true }
)
/** 关闭弹窗清除仅用于打开配置的参数,保留镜头与其它地址信息。 */
watch(settingsOpen, shown => {
if (!shown && route.query.configure === 'profile') {
const query = { ...route.query }
delete query.configure
void router.replace({ path: route.path, query, hash: route.hash })
}
})
/** 切项目时关闭旧配置,禁止把草稿带入其它项目。 */
watch(id, () => {
settingsOpen.value = false
generationRevision.value = 0
})
const operation = computed(() => getOperation(id.value))
const createDramaExecution = useWorkflowExecution(id, 'create-drama')
/** 项目内跨页面继续观察首帧后台任务,维持活动锁并在真实终态后释放。 */
@@ -128,13 +156,12 @@ function resolveOperationError() {
void router.push({ path: `/projects/${id.value}/production`, query })
} else if (target === 'style') void router.push(`/projects/${id.value}/visual-style`)
else if (target === 'identity') void router.push(`/projects/${id.value}/subject-identity`)
else if (target === 'profile') {
const onIdentityPage = route.path.replace(/\/+$/, '').endsWith('/subject-identity')
void router.push({
path: onIdentityPage ? route.path : `/projects/${id.value}/production`,
query: { ...route.query, configure: 'profile' }
})
}
else if (target === 'profile') settingsOpen.value = true
}
/** 配置真实保存后更新当前项目的就绪门禁并解除配置缺失提示。 */
function projectSettingsSaved() {
if (operationGuide.value?.target === 'profile') operation.value.error = ''
void context.refreshStageReadiness()
}
const access = inject(projectAccessKey, undefined)
let published: ProjectAccess | null = null
@@ -149,12 +176,18 @@ onScopeDispose(() => {
<template>
<section class="project-frame">
<header class="project-header">
<!-- 以下是项目标题与全局配置入口模块 -->
<NPageHeader @back="router.push('/projects')">
<template #title
><NEllipsis class="project-title" :tooltip="false">{{
context.project.value?.title || context.project.value?.topic || '读取项目'
}}</NEllipsis></template
>
<template #extra>
<NButton size="small" :disabled="!context.project.value" @click="settingsOpen = true"
>项目配置</NButton
>
</template>
</NPageHeader>
</header>
<NScrollbar
@@ -194,6 +227,15 @@ onScopeDispose(() => {
@refresh="createDramaExecution.query.refresh"
@dismiss="createDramaExecution.dismiss"
/>
<!-- 以下是当前项目图片与视频配置弹窗模块 -->
<ProjectSettingsDialog
:key="id"
v-if="context.project.value?.id === id"
v-model:open="settingsOpen"
:project-id="id"
:disabled="operation.pending"
@saved="projectSettingsSaved"
/>
<div class="project-view">
<RouterView v-if="context.project.value?.id === id && currentAccess?.enabled" :key="id" />
<EmptyState