fix: 完善剧本完成状态限制并优化表单对齐与配色
This commit is contained in:
1 parent
a24326b85d
commit
370e7bb4a6
19 files changed
+340
-67
No files matched your search
@@ -1,19 +1,30 @@
|
||||
<script setup lang="ts">
|
||||
import { computed, provide } from 'vue'
|
||||
import { computed, inject, onScopeDispose, provide, watchEffect } from 'vue'
|
||||
import { useRoute, useRouter } from 'vue-router'
|
||||
import { NScrollbar, NAlert, NButton, NPageHeader, NSpin, NEllipsis } from 'naive-ui'
|
||||
import { RefreshCw } from '@lucide/vue'
|
||||
import { StatusBadge } from '../../components/ui'
|
||||
import { EmptyState } from '../../components/ui'
|
||||
import { projectContextKey, useProjectData } from './context'
|
||||
import { getOperation } from '../workflows/operations'
|
||||
import { isProjectComplete, projectAccessKey, type ProjectAccess } from './access'
|
||||
|
||||
/** 项目仅保留紧凑标题与刷新;工作流统一由左侧导航切换,子工作区负责内容滚动。 */
|
||||
/** 项目标题只保留名称;下游工作区在剧本完成前不挂载,直接链接也无法越过限制。 */
|
||||
const route = useRoute()
|
||||
const router = useRouter()
|
||||
const id = computed(() => String(route.params.projectId))
|
||||
const context = useProjectData(id)
|
||||
provide(projectContextKey, context)
|
||||
const operation = computed(() => getOperation(id.value))
|
||||
const complete = computed(() => isProjectComplete(context.project.value, id.value))
|
||||
const isCreation = computed(() => route.path.replace(/\/+$/, '').endsWith('/create-drama'))
|
||||
const access = inject(projectAccessKey, undefined)
|
||||
let published: ProjectAccess | null = null
|
||||
watchEffect(() => {
|
||||
published = { projectId: id.value, completed: complete.value }
|
||||
if (access) access.value = published
|
||||
})
|
||||
onScopeDispose(() => {
|
||||
if (access?.value === published) access.value = null
|
||||
})
|
||||
</script>
|
||||
<template>
|
||||
<section class="project-frame">
|
||||
@@ -24,16 +35,6 @@ const operation = computed(() => getOperation(id.value))
|
||||
context.project.value?.title || context.project.value?.topic || '读取项目'
|
||||
}}</NEllipsis></template
|
||||
>
|
||||
<template #extra
|
||||
><div class="flex items-center gap-3">
|
||||
<StatusBadge v-if="context.project.value" :status="context.project.value.status" /><NButton
|
||||
size="small"
|
||||
:loading="context.loading.value"
|
||||
@click="context.refresh"
|
||||
><template #icon><RefreshCw :size="14" /></template>刷新</NButton
|
||||
>
|
||||
</div></template
|
||||
>
|
||||
</NPageHeader>
|
||||
</header>
|
||||
<NScrollbar
|
||||
@@ -42,8 +43,10 @@ const operation = computed(() => getOperation(id.value))
|
||||
content-class="project-notices-content"
|
||||
>
|
||||
<NAlert v-if="context.error.value" type="error" :show-icon="false"
|
||||
>{{ context.error.value
|
||||
}}<span v-if="context.project.value"> 当前保留上次成功读取的数据。</span></NAlert
|
||||
>{{ context.error.value }}<span v-if="context.project.value"> 当前保留上次成功读取的数据。</span>
|
||||
<NButton text class="ml-3" :loading="context.loading.value" @click="context.refresh"
|
||||
>重试读取</NButton
|
||||
></NAlert
|
||||
>
|
||||
<NAlert v-if="operation.pending" :show-icon="false" role="status"
|
||||
>{{ operation.label }}。可切换页面查看结果,请勿重复提交;关闭页面不会取消后端任务。</NAlert
|
||||
@@ -52,7 +55,15 @@ const operation = computed(() => getOperation(id.value))
|
||||
<NAlert v-if="operation.notice" :show-icon="false" role="status">{{ operation.notice }}</NAlert>
|
||||
</NScrollbar>
|
||||
<div class="project-view">
|
||||
<RouterView v-if="context.project.value" :key="id" />
|
||||
<RouterView v-if="context.project.value?.id === id && (isCreation || complete)" :key="id" />
|
||||
<EmptyState
|
||||
v-else-if="context.project.value?.id === id"
|
||||
class="project-access-gate"
|
||||
title="请先完成剧本创作"
|
||||
description="剧本完成后,才能使用拆解、视觉风格、主体身份、形态图片、分镜设计与镜头生产。状态会自动更新。"
|
||||
>
|
||||
<NButton type="primary" @click="router.push(`/projects/${id}/create-drama`)">返回剧本创作</NButton>
|
||||
</EmptyState>
|
||||
<NSpin
|
||||
v-else-if="context.loading.value"
|
||||
class="workspace-loading"
|
||||
|
||||
Reference in new issue
Block a user