fix(short-drama-agent-front): 优化项目操作与形态图库
This commit is contained in:
1 parent
27ee9fd4ff
commit
dbf97e6f98
11 files changed
+175
-109
No files matched your search
@@ -1,11 +1,10 @@
|
||||
<script setup lang="ts">
|
||||
import ContextNotice from '../../components/ui/ContextNotice.vue'
|
||||
import WorkspaceActionTooltip from '../../components/ui/WorkspaceActionTooltip.vue'
|
||||
|
||||
import { computed, h, inject, onScopeDispose, provide, ref, watch, watchEffect } from 'vue'
|
||||
import { useRoute, useRouter } from 'vue-router'
|
||||
import { Settings2 } from '@lucide/vue'
|
||||
import { NScrollbar, NButton, NPageHeader, NSpin, NEllipsis, NSkeleton } from 'naive-ui'
|
||||
import { Menu, Settings2, ShieldCheck } from '@lucide/vue'
|
||||
import { NScrollbar, NButton, NPageHeader, NSpin, NEllipsis, NSkeleton, NDropdown, NPopover } from 'naive-ui'
|
||||
import { EmptyState, WorkspaceRefreshButton } from '../../components/ui'
|
||||
import { projectContextKey, useProjectData, type CheckpointWorkflow } from './context'
|
||||
import { getOperation, operationErrorText } from '../workflows/operations'
|
||||
@@ -36,6 +35,33 @@ const generationRevision = ref(0)
|
||||
provide(projectGenerationRevisionKey, generationRevision)
|
||||
/** 项目标题栏共用配置弹窗开关。 */
|
||||
const settingsOpen = ref(false)
|
||||
/** 项目操作菜单的展开状态。 */
|
||||
const projectActionsOpen = ref(false)
|
||||
/** 制作前检查抽屉的打开状态。 */
|
||||
const preparationOpen = ref(false)
|
||||
/** 标题栏操作只使用当前项目的数据。 */
|
||||
const hasCurrentProject = computed(() => context.project.value?.id === id.value)
|
||||
/** 检查入口沿用读取错误限制,已有项目仍可打开配置。 */
|
||||
const projectActionOptions = computed(() => [
|
||||
{
|
||||
key: 'preparation',
|
||||
label: '制作前检查',
|
||||
icon: () => h(ShieldCheck, { size: 16 }),
|
||||
disabled: !!context.error.value
|
||||
},
|
||||
{ key: 'settings', label: '项目配置', icon: () => h(Settings2, { size: 16 }) }
|
||||
])
|
||||
|
||||
/**
|
||||
* 打开所选的项目抽屉。
|
||||
* @param key 项目操作选项
|
||||
*/
|
||||
function selectProjectAction(key: string | number) {
|
||||
if (!hasCurrentProject.value) return
|
||||
if (key === 'preparation' && !context.error.value) preparationOpen.value = true
|
||||
if (key === 'settings') openProjectSettings()
|
||||
}
|
||||
|
||||
/** 本次项目配置打开的指定分类,不改变当前工作区路由。 */
|
||||
const settingsTab = ref<ProjectSettingsTab>('generation')
|
||||
/**
|
||||
@@ -66,6 +92,8 @@ watch(settingsOpen, shown => {
|
||||
/** 切项目时关闭旧配置,禁止把草稿带入其它项目。 */
|
||||
watch(id, () => {
|
||||
settingsOpen.value = false
|
||||
preparationOpen.value = false
|
||||
projectActionsOpen.value = false
|
||||
generationRevision.value = 0
|
||||
})
|
||||
const operation = computed(() => getOperation(id.value))
|
||||
@@ -308,7 +336,7 @@ onScopeDispose(() => {
|
||||
<template>
|
||||
<section class="project-frame">
|
||||
<header class="project-header">
|
||||
<!-- 以下是项目标题与全局配置入口模块,首次读取保留标题及两个操作的真实占位 -->
|
||||
<!-- 以下是项目标题与全局配置入口模块,首次读取保留标题和菜单按钮的占位 -->
|
||||
<NPageHeader @back="router.push('/projects')">
|
||||
<template #title>
|
||||
<div v-if="isProjectInitialLoading" class="project-title project-title-loading" aria-hidden="true">
|
||||
@@ -319,38 +347,36 @@ onScopeDispose(() => {
|
||||
}}</NEllipsis>
|
||||
</template>
|
||||
<template #extra>
|
||||
<!-- 以下是制作前检查入口,后续页面受限时仍可完成正式分镜审核 -->
|
||||
<div class="project-header-actions flex items-center gap-2">
|
||||
<template v-if="isProjectInitialLoading">
|
||||
<NSkeleton class="project-header-action-placeholder" aria-hidden="true" />
|
||||
<NSkeleton
|
||||
class="project-header-action-placeholder project-header-config-placeholder"
|
||||
aria-hidden="true"
|
||||
/>
|
||||
</template>
|
||||
<template v-else>
|
||||
<StoryboardPreparation
|
||||
v-if="context.project.value?.id === id"
|
||||
:key="id"
|
||||
:project-id="id"
|
||||
:disabled="!!context.error.value"
|
||||
:can-open-storyboard="stageAccess.sections.value.storyboard.enabled"
|
||||
@changed="context.refresh()"
|
||||
@open-storyboard="router.push(`/projects/${id}/storyboard`)"
|
||||
/>
|
||||
<WorkspaceActionTooltip label="项目配置" mobile-only>
|
||||
<!-- 以下是制作前检查与项目配置共用的菜单入口。 -->
|
||||
<NSkeleton
|
||||
v-if="isProjectInitialLoading"
|
||||
class="project-header-action-placeholder"
|
||||
aria-hidden="true"
|
||||
/>
|
||||
<NDropdown
|
||||
v-else
|
||||
v-model:show="projectActionsOpen"
|
||||
trigger="click"
|
||||
placement="bottom-end"
|
||||
:options="projectActionOptions"
|
||||
@select="selectProjectAction"
|
||||
>
|
||||
<NPopover trigger="hover" placement="left" :disabled="projectActionsOpen || !hasCurrentProject">
|
||||
<template #trigger>
|
||||
<NButton
|
||||
class="workspace-action-button"
|
||||
class="project-header-menu icon-button workspace-action-button"
|
||||
size="small"
|
||||
aria-label="项目配置"
|
||||
:disabled="!context.project.value"
|
||||
@click="openProjectSettings()"
|
||||
><template #icon><Settings2 :size="15" aria-hidden="true" /></template
|
||||
><span class="project-config-label">项目配置</span></NButton
|
||||
:disabled="!hasCurrentProject"
|
||||
aria-label="项目操作"
|
||||
aria-haspopup="menu"
|
||||
:aria-expanded="projectActionsOpen"
|
||||
>
|
||||
</WorkspaceActionTooltip>
|
||||
</template>
|
||||
</div>
|
||||
<template #icon><Menu :size="18" aria-hidden="true" /></template>
|
||||
</NButton>
|
||||
</template>
|
||||
项目操作
|
||||
</NPopover>
|
||||
</NDropdown>
|
||||
</template>
|
||||
</NPageHeader>
|
||||
</header>
|
||||
@@ -362,6 +388,17 @@ onScopeDispose(() => {
|
||||
></ContextNotice
|
||||
>
|
||||
</NScrollbar>
|
||||
<!-- 以下是制作前检查抽屉,跨工作区保留真实任务状态。 -->
|
||||
<StoryboardPreparation
|
||||
v-if="hasCurrentProject"
|
||||
:key="id"
|
||||
v-model:open="preparationOpen"
|
||||
:project-id="id"
|
||||
:disabled="!!context.error.value"
|
||||
:can-open-storyboard="stageAccess.sections.value.storyboard.enabled"
|
||||
@changed="context.refresh()"
|
||||
@open-storyboard="router.push(`/projects/${id}/storyboard`)"
|
||||
/>
|
||||
<!-- 以下是当前项目图片与视频配置弹窗模块 -->
|
||||
<ProjectSettingsDialog
|
||||
:key="id"
|
||||
@@ -461,12 +498,14 @@ onScopeDispose(() => {
|
||||
min-height: 1.5em;
|
||||
}
|
||||
.project-header-action-placeholder {
|
||||
width: 120px;
|
||||
height: 34px;
|
||||
width: var(--app-toolbar-icon-size, 34px);
|
||||
height: var(--app-toolbar-icon-size, 34px);
|
||||
flex-shrink: 0;
|
||||
}
|
||||
.project-header-config-placeholder {
|
||||
width: 104px;
|
||||
.project-header .n-button.project-header-menu {
|
||||
--n-height: var(--app-toolbar-icon-size, 34px);
|
||||
min-height: var(--n-height);
|
||||
padding-inline: 0;
|
||||
}
|
||||
.project-notices.n-scrollbar {
|
||||
@apply shrink-0 h-auto max-h-[min(24dvh,160px)] overflow-hidden;
|
||||
@@ -502,27 +541,11 @@ onScopeDispose(() => {
|
||||
@apply items-start flex-col gap-2;
|
||||
}
|
||||
}
|
||||
/* 手机端隐藏文字后,两个项目入口共用方形点击区域并将图标居中。 */
|
||||
/* 手机端的项目菜单和标签栏图标共用紧凑尺寸。 */
|
||||
@media (max-width: 639px) {
|
||||
.project-frame {
|
||||
/* 顶部入口与标签栏图标共用紧凑尺寸。 */
|
||||
--app-toolbar-icon-size: 32px;
|
||||
}
|
||||
.project-header-actions > .n-button.workspace-action-button {
|
||||
width: var(--app-toolbar-icon-size);
|
||||
min-width: var(--app-toolbar-icon-size);
|
||||
height: var(--app-toolbar-icon-size);
|
||||
min-height: var(--app-toolbar-icon-size);
|
||||
padding: 0;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
.project-header-action-placeholder {
|
||||
width: var(--app-toolbar-icon-size);
|
||||
height: var(--app-toolbar-icon-size);
|
||||
}
|
||||
.project-header-actions > .n-button .n-button__icon {
|
||||
margin: 0;
|
||||
}
|
||||
}
|
||||
@media (prefers-reduced-motion: reduce) {
|
||||
.project-header .n-skeleton {
|
||||
@@ -530,12 +553,3 @@ onScopeDispose(() => {
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
<style scoped>
|
||||
/* 窄屏的两个项目操作统一显示图标,保留按钮的完整可访问名称。 */
|
||||
@media (max-width: 639px) {
|
||||
.project-config-label {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
Reference in new issue
Block a user