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>
|
||||
@@ -1,9 +1,8 @@
|
||||
<script setup lang="ts">
|
||||
import { computed, inject, ref, watch } from 'vue'
|
||||
import { NButton, NCheckbox, NFormItem, NInput, NTag } from 'naive-ui'
|
||||
import { ArrowLeft, ArrowRight, CheckCheck, RefreshCw, Save, ShieldCheck, Wrench } from '@lucide/vue'
|
||||
import { ArrowLeft, ArrowRight, CheckCheck, RefreshCw, Save, Wrench } from '@lucide/vue'
|
||||
import AppDrawer from '../../components/ui/AppDrawer.vue'
|
||||
import WorkspaceActionTooltip from '../../components/ui/WorkspaceActionTooltip.vue'
|
||||
import WorkspaceSectionHeading from '../../components/ui/WorkspaceSectionHeading.vue'
|
||||
import QualityPolicySummary from '../generation-config/components/QualityPolicySummary.vue'
|
||||
import { projectSettingsOpenKey } from '../generation-config/context'
|
||||
@@ -26,7 +25,7 @@ import {
|
||||
} from '../projects/quality-policy-confirmation'
|
||||
import { userFacingText } from '../../lib/user-facing-text'
|
||||
|
||||
/** 制作前检查统一入口,即使后续页面尚未开放也可以补齐审核。 */
|
||||
/** 制作前检查抽屉,即使后续页面尚未开放也可以补齐审核。 */
|
||||
const props = withDefaults(
|
||||
defineProps<{
|
||||
/** 当前正式项目。 */ projectId: string
|
||||
@@ -38,7 +37,7 @@ const props = withDefaults(
|
||||
/** 所有写入或后台终态后让调用方刷新实际导航状态。 */
|
||||
const emit = defineEmits<{ changed: []; openStoryboard: [] }>()
|
||||
/** 全屏入口,未打开不读取完整复检。 */
|
||||
const open = ref(false)
|
||||
const open = defineModel<boolean>('open', { default: false })
|
||||
/** 复用标题栏的唯一配置入口,跳转时指定质量规则分类。 */
|
||||
const openProjectSettings = inject(projectSettingsOpenKey, undefined)
|
||||
/** 只记录用户主动的抽屉交接,等待当前抽屉离场后再打开配置。 */
|
||||
@@ -267,18 +266,7 @@ async function repaired() {
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<!-- 以下是项目顶部始终可到达的制作前检查入口及统一悬浮说明 -->
|
||||
<WorkspaceActionTooltip label="制作前检查" mobile-only>
|
||||
<NButton
|
||||
size="small"
|
||||
class="preparation-trigger workspace-action-button"
|
||||
:disabled="disabled || !projectId"
|
||||
aria-label="制作前检查"
|
||||
@click="open = true"
|
||||
><template #icon><ShieldCheck :size="15" aria-hidden="true" /></template
|
||||
><span class="preparation-trigger-label">制作前检查</span></NButton
|
||||
>
|
||||
</WorkspaceActionTooltip>
|
||||
<!-- 以下是制作前检查抽屉。 -->
|
||||
<AppDrawer
|
||||
v-model:open="open"
|
||||
:title="repairIssue ? '修订正式分镜问题' : '制作前检查'"
|
||||
@@ -577,9 +565,4 @@ async function repaired() {
|
||||
grid-template-columns: minmax(0, 1fr);
|
||||
}
|
||||
}
|
||||
@media (max-width: 639px) {
|
||||
.preparation-trigger-label {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -12,7 +12,7 @@ import ActionMenu from '../../components/ui/ActionMenu.vue'
|
||||
import DetailDisclosure from '../../components/ui/DetailDisclosure.vue'
|
||||
import WorkspaceTools from '../../components/ui/WorkspaceTools.vue'
|
||||
import { NButton, NCheckbox, NInput, NInputNumber, NPopover, NScrollbar, NSelect, NTag } from 'naive-ui'
|
||||
import { computed, onScopeDispose, ref, watch, type Directive } from 'vue'
|
||||
import { computed, onScopeDispose, ref, useTemplateRef, watch, type Directive } from 'vue'
|
||||
import { useRoute, useRouter } from 'vue-router'
|
||||
import {
|
||||
Search,
|
||||
@@ -138,6 +138,8 @@ const statusFilterOptions: Array<{ label: string; value: ImageStatusFilter }> =
|
||||
{ label: '全部状态', value: 'all' },
|
||||
{ label: '缺少主图', value: 'missing' }
|
||||
]
|
||||
/** 当前卡片容器,用于在筛选移除卡片后重新计算位置。 */
|
||||
const galleryGrid = useTemplateRef<HTMLElement>('galleryGrid')
|
||||
/** 保存每张卡片的尺寸观察器,切换回网格时及时释放。 */
|
||||
const masonryCardObservers = new WeakMap<HTMLElement, ResizeObserver>()
|
||||
|
||||
@@ -243,6 +245,14 @@ const filtered = computed(() =>
|
||||
.includes(search.value.trim().toLowerCase())
|
||||
)
|
||||
)
|
||||
/** 筛选或数据更新可能只移除卡片,保留的卡片尺寸不变也需要重新排位。 */
|
||||
watch(
|
||||
[filtered, layout],
|
||||
() => {
|
||||
if (galleryGrid.value) syncMasonryLayout(galleryGrid.value)
|
||||
},
|
||||
{ flush: 'post' }
|
||||
)
|
||||
watch(
|
||||
() => [route.query.subjectRef, route.query.subjectFormId, route.query.sourceShotId],
|
||||
() => {
|
||||
@@ -626,7 +636,13 @@ const rules = { concurrency: integerRule('批量并发'), limit: integerRule('
|
||||
><ContextNotice v-if="running" role="status" type="info" :show-icon="false" class="mt-4">
|
||||
部分形态正在生成。任务完成后可再次批量生图。
|
||||
</ContextNotice>
|
||||
<div v-if="filtered.length" class="form-image-grid" :class="{ 'form-image-masonry': layout === 'masonry' }">
|
||||
<!-- 以下是筛选结果,网格与瀑布流共用同一组卡片。 -->
|
||||
<div
|
||||
v-if="filtered.length"
|
||||
ref="galleryGrid"
|
||||
class="form-image-grid"
|
||||
:class="{ 'form-image-masonry': layout === 'masonry' }"
|
||||
>
|
||||
<article
|
||||
v-for="form in filtered"
|
||||
v-masonry-card="layout === 'masonry'"
|
||||
|
||||
@@ -47,6 +47,13 @@ const query = useQuery(key, async (value, signal) => {
|
||||
})
|
||||
/** 道具当前有效规格或独立的缺失、过期状态。 */
|
||||
const prop = computed(() => query.data.value?.prop)
|
||||
/** 基础形态需有已完成的旧规格,状态形态可从有效的基础规格派生。 */
|
||||
const canReuseStructure = computed(() => {
|
||||
const current = prop.value
|
||||
if (!current || current.status === 'ready' || current.reason) return false
|
||||
if (!props.form.isDefault) return true
|
||||
return current.status === 'stale' && current.lastGenerationAttempt?.status === 'completed'
|
||||
})
|
||||
/** 复用中的局部按钮状态。 */
|
||||
const reusing = ref(false)
|
||||
/** 复用反馈只在消息层展示。 */
|
||||
@@ -54,7 +61,7 @@ const message = useActionMessage()
|
||||
|
||||
/** 仅复用已有结构;冲突保留当前数据,不调用生成入口。 */
|
||||
async function reuseStructure() {
|
||||
if (!prop.value || reusing.value || getOperation(props.projectId).pending) return
|
||||
if (!canReuseStructure.value || reusing.value || getOperation(props.projectId).pending) return
|
||||
const target = key.value
|
||||
const formId = props.form.id
|
||||
reusing.value = true
|
||||
@@ -129,7 +136,7 @@ function episodeLabel(id: string) {
|
||||
{{ userFacingText(prop.reason, '请重新核对当前形态与剧本来源。') }}
|
||||
</p>
|
||||
<!-- 以下是免费复用操作,文字生成仍使用图片准备检查 -->
|
||||
<div class="flex flex-wrap items-center gap-3">
|
||||
<div v-if="canReuseStructure" class="flex flex-wrap items-center gap-3">
|
||||
<NButton
|
||||
size="small"
|
||||
:loading="reusing"
|
||||
@@ -140,6 +147,9 @@ function episodeLabel(id: string) {
|
||||
</NButton>
|
||||
<span class="text-xs text-muted">需要新规格时,可在图片准备检查中另行确认文字模型费用。</span>
|
||||
</div>
|
||||
<p v-else-if="prop.status === 'missing'" class="text-xs text-muted">
|
||||
可在图片准备检查中核对缺少的资料和准备费用。
|
||||
</p>
|
||||
<p v-if="prop.spec" class="font-medium">{{ prop.spec.semanticClass }}</p>
|
||||
<ul v-if="parts.length" class="space-y-3">
|
||||
<li v-for="part in parts" :key="part.id">
|
||||
|
||||
Reference in new issue
Block a user