fix(short-drama-agent-front): 统一全屏布局与问题处理交互
This commit is contained in:
1 parent
db91a4b871
commit
cc27d463e0
25 files changed
+838
-316
No files matched your search
@@ -1,5 +1,6 @@
|
||||
<script setup lang="ts">
|
||||
import ContextNotice from '../../../components/ui/ContextNotice.vue'
|
||||
import WorkspaceSectionHeading from '../../../components/ui/WorkspaceSectionHeading.vue'
|
||||
|
||||
import { computed, onScopeDispose, ref, watch } from 'vue'
|
||||
import { NButton, NFormItem, NSelect, NSpin } from 'naive-ui'
|
||||
@@ -249,8 +250,8 @@ onScopeDispose(() => {
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<!-- 以下是项目画布与图片、视频模型配置模块 -->
|
||||
<section class="production-tool-section creative-profile-settings workspace-panel">
|
||||
<!-- 以下是平铺的项目画布与模型配置模块,使用留白分组而不叠加背景面板 -->
|
||||
<section class="production-tool-section creative-profile-settings">
|
||||
<h3 v-if="!hideActions" class="text-sm font-semibold">项目画布与生成模型</h3>
|
||||
<NSpin :show="loading">
|
||||
<ContextNotice v-if="disabled" type="info" :show-icon="false" class="mb-3"
|
||||
@@ -269,18 +270,28 @@ onScopeDispose(() => {
|
||||
当前没有可用的完整图片和视频模型,暂时无法保存项目生成配置。
|
||||
</ContextNotice>
|
||||
<div v-if="profile" class="creative-profile-grid">
|
||||
<NFormItem label="作品宽高比">
|
||||
<NSelect
|
||||
:value="profile.aspectRatio"
|
||||
:options="aspectRatios"
|
||||
:disabled="saving || disabled"
|
||||
@update:value="profile.aspectRatio = $event as CreativeProfileAspectRatio"
|
||||
<!-- 以下是独占一行的画布设置,与下方两个模型分组共用边界 -->
|
||||
<section class="creative-profile-canvas space-y-4">
|
||||
<WorkspaceSectionHeading
|
||||
title="画布设置"
|
||||
description="设置作品画面比例,后续制作使用已保存的项目画布。"
|
||||
/>
|
||||
</NFormItem>
|
||||
<div></div>
|
||||
<NFormItem label="作品宽高比">
|
||||
<NSelect
|
||||
:value="profile.aspectRatio"
|
||||
:options="aspectRatios"
|
||||
:disabled="saving || disabled"
|
||||
@update:value="profile.aspectRatio = $event as CreativeProfileAspectRatio"
|
||||
/>
|
||||
</NFormItem>
|
||||
</section>
|
||||
<!-- 以下是项目图片生成配置模块 -->
|
||||
<section class="model-section min-w-0 pt-5">
|
||||
<h3 class="mb-4 text-sm font-semibold">图片配置</h3>
|
||||
<section class="model-section min-w-0">
|
||||
<WorkspaceSectionHeading
|
||||
class="mb-4"
|
||||
title="图片配置"
|
||||
description="选择图片模型和默认生成参数,后续图片制作将继承此配置。"
|
||||
/>
|
||||
<NFormItem label="图片模型">
|
||||
<NSelect
|
||||
:value="imageSelection"
|
||||
@@ -296,8 +307,12 @@ onScopeDispose(() => {
|
||||
/>
|
||||
</section>
|
||||
<!-- 以下是项目视频生成配置模块 -->
|
||||
<section class="model-section min-w-0 pt-5">
|
||||
<h3 class="mb-4 text-sm font-semibold">视频配置</h3>
|
||||
<section class="model-section min-w-0">
|
||||
<WorkspaceSectionHeading
|
||||
class="mb-4"
|
||||
title="视频配置"
|
||||
description="选择视频模型和默认生成参数,后续视频制作将继承此配置。"
|
||||
/>
|
||||
<NFormItem label="视频模型">
|
||||
<NSelect
|
||||
:value="videoSelection"
|
||||
@@ -324,27 +339,30 @@ onScopeDispose(() => {
|
||||
<style scoped>
|
||||
@reference "../../../styles/styles.css";
|
||||
.creative-profile-grid {
|
||||
@apply grid grid-cols-[repeat(2,_minmax(0,_1fr))] items-start gap-x-5 gap-y-6;
|
||||
@apply grid grid-cols-[repeat(2,_minmax(0,_1fr))] items-start gap-x-10 gap-y-6;
|
||||
}
|
||||
/* 画布设置铺满一行,图片与视频在宽屏并排、窄屏依次显示。 */
|
||||
.creative-profile-canvas {
|
||||
grid-column: 1 / -1;
|
||||
}
|
||||
.model-section > :deep(.n-form-item) {
|
||||
@apply mb-6;
|
||||
}
|
||||
.creative-profile-grid > :deep(.n-form-item--top-labelled),
|
||||
.model-section > :deep(.n-form-item--top-labelled) {
|
||||
/* 模块首字段与动态参数字段使用相同的标签和控件行高。 */
|
||||
.creative-profile-grid :deep(.n-form-item--top-labelled) {
|
||||
grid-template-rows: minmax(var(--n-label-height), auto) auto auto;
|
||||
}
|
||||
.creative-profile-grid > :deep(.n-form-item-label),
|
||||
.model-section > :deep(.n-form-item-label) {
|
||||
.creative-profile-grid :deep(.n-form-item-label) {
|
||||
min-height: 30px;
|
||||
padding: 0 0 8px;
|
||||
}
|
||||
.creative-profile-grid > :deep(.n-form-item-blank),
|
||||
.model-section > :deep(.n-form-item-blank) {
|
||||
.creative-profile-grid :deep(.n-form-item-blank) {
|
||||
min-height: 34px;
|
||||
align-items: center;
|
||||
}
|
||||
.creative-profile-settings {
|
||||
@apply m-0;
|
||||
/* 与质量规则页的首模块保持相同的顶部留白。 */
|
||||
@apply m-0 pt-5;
|
||||
}
|
||||
.creative-profile-settings > h3 {
|
||||
@apply mb-4;
|
||||
@@ -356,8 +374,5 @@ onScopeDispose(() => {
|
||||
.creative-profile-grid {
|
||||
@apply grid-cols-[minmax(0,_1fr)];
|
||||
}
|
||||
.creative-profile-grid > div:empty {
|
||||
@apply hidden;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -135,6 +135,10 @@ function constrainedOptions(schema: GenerationOptionSchema, current: string | nu
|
||||
.generation-option-grid :deep(.n-form-item) {
|
||||
@apply min-w-0 mb-0 self-start;
|
||||
}
|
||||
/* 数值字段与同列的下拉字段使用相同宽度,避免留下不齐的空白。 */
|
||||
.generation-option-grid :deep(.n-input-number) {
|
||||
width: 100%;
|
||||
}
|
||||
/* Naive 默认使用 1fr 扩展控件行;同排说明文字不等高时会把较短字段的控件推到底部。 */
|
||||
.generation-option-grid :deep(.n-form-item--top-labelled) {
|
||||
grid-template-rows: minmax(var(--n-label-height), auto) auto auto;
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
<script setup lang="ts">
|
||||
import { computed, ref } from 'vue'
|
||||
import { NButton, NTabs, NTabPane } from 'naive-ui'
|
||||
import { AppDialog } from '../../../components/ui'
|
||||
import { AppDrawer } from '../../../components/ui'
|
||||
import type { CreativeProfileInput } from '../types'
|
||||
import CreativeProfileSettings from './CreativeProfileSettings.vue'
|
||||
import QualityPolicySettings from './QualityPolicySettings.vue'
|
||||
|
||||
/** 项目全局配置弹窗参数。 */
|
||||
/** 项目全局配置全屏抽屉参数。 */
|
||||
const props = defineProps<{
|
||||
/** 当前正式项目 ID。 */
|
||||
projectId: string
|
||||
@@ -15,13 +15,13 @@ const props = defineProps<{
|
||||
}>()
|
||||
/** 真实保存成功后通知项目布局更新就绪信息。 */
|
||||
const emit = defineEmits<{ saved: [profile: CreativeProfileInput] }>()
|
||||
/** 弹窗显隐状态。 */
|
||||
/** 项目配置全屏抽屉显隐状态。 */
|
||||
const open = defineModel<boolean>('open', { default: false })
|
||||
/** 保存进行中时禁止关闭弹窗,避免重复写入。 */
|
||||
/** 保存进行中时禁止关闭抽屉,避免重复写入。 */
|
||||
const saving = ref(false)
|
||||
/** 配置表单实例,footer 调用表单自身的校验与保存入口。 */
|
||||
const form = ref<InstanceType<typeof CreativeProfileSettings> | null>(null)
|
||||
/** 项目级配置分类保持同一个弹窗与底栏。 */
|
||||
/** 项目级配置分类保持同一个全屏抽屉与底栏。 */
|
||||
const tab = ref('generation')
|
||||
/** 质量策略表单实例。 */
|
||||
const qualityForm = ref<InstanceType<typeof QualityPolicySettings> | null>(null)
|
||||
@@ -30,8 +30,8 @@ const activeForm = computed(() => (tab.value === 'quality' ? qualityForm.value :
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<!-- 以下是项目图片与视频全局配置弹窗模块 -->
|
||||
<AppDialog v-model:open="open" title="项目全局配置" :busy="saving" wide>
|
||||
<!-- 以下是内容铺满视口的项目全局配置抽屉模块 -->
|
||||
<AppDrawer v-model:open="open" title="项目全局配置" :busy="saving">
|
||||
<template #description>设置生成模型、画布与质量规则,后续制作使用已保存的项目配置。</template>
|
||||
<!-- 以下是生成配置与质量规则分类导航,保存期间禁止切换 -->
|
||||
<NTabs v-if="open" v-model:value="tab" type="line" size="small">
|
||||
@@ -64,5 +64,5 @@ const activeForm = computed(() => (tab.value === 'quality' ? qualityForm.value :
|
||||
tab === 'quality' ? '保存质量规则' : '保存配置'
|
||||
}}</NButton>
|
||||
</template>
|
||||
</AppDialog>
|
||||
</AppDrawer>
|
||||
</template>
|
||||
@@ -1,10 +1,12 @@
|
||||
<script setup lang="ts">
|
||||
import { computed, onScopeDispose, ref, watch } from 'vue'
|
||||
import { NButton, NCheckbox, NFormItem, NInput, NSelect } from 'naive-ui'
|
||||
import { Trash2 } from '@lucide/vue'
|
||||
import { projectsApi } from '../../projects/api'
|
||||
import { actionResourceOptions, policyDraft, policyIssue } from '../../projects/quality-policy'
|
||||
import type { ProjectQualityPolicy } from '../../projects/types'
|
||||
import { errorMessage } from '../../../lib/http'
|
||||
import WorkspaceSectionHeading from '../../../components/ui/WorkspaceSectionHeading.vue'
|
||||
|
||||
/** 项目质量策略独立编辑表单。 */
|
||||
const props = defineProps<{
|
||||
@@ -31,10 +33,18 @@ const physicsOptions = [
|
||||
{ value: 'stylized', label: '风格化表现' },
|
||||
{ value: 'fantasy', label: '幻想表现' }
|
||||
]
|
||||
/** 草稿校验错误。 */
|
||||
const issue = computed(() => (policy.value ? policyIssue(policy.value) : ''))
|
||||
/** 只有已读取真实策略且没有活动操作才允许提交。 */
|
||||
const canSave = computed(() => !!policy.value && !issue.value && !props.disabled && !loading.value && !saving.value)
|
||||
/** 仅在用户点击保存时产生校验反馈,不在读取或新增空白例外时提前报错。 */
|
||||
const issue = ref('')
|
||||
/** 已读取策略且没有活动操作时允许点击保存,由保存入口校验完整性。 */
|
||||
const canSave = computed(() => !!policy.value && !props.disabled && !loading.value && !saving.value)
|
||||
/** 修改草稿后清除上一次校验反馈,下一次保存再检查完整策略。 */
|
||||
watch(
|
||||
policy,
|
||||
() => {
|
||||
issue.value = ''
|
||||
},
|
||||
{ deep: true, flush: 'sync' }
|
||||
)
|
||||
/** 规则文本仅做逐行编辑,空行不作为规则提交。 */
|
||||
const rulesText = ref('')
|
||||
/** 保留输入中的换行,仅在策略草稿中去除空白规则。 */
|
||||
@@ -60,6 +70,7 @@ async function load() {
|
||||
loading.value = true
|
||||
error.value = ''
|
||||
notice.value = ''
|
||||
issue.value = ''
|
||||
try {
|
||||
const result = await projectsApi.qualityPolicy(id, controller.signal)
|
||||
if (current !== version) return
|
||||
@@ -89,9 +100,11 @@ function removeException(index: number) {
|
||||
policy.value?.actionExceptions?.splice(index, 1)
|
||||
}
|
||||
|
||||
/** 保存完整策略,保留项目和请求归属检查。 */
|
||||
/** 点击保存时校验完整策略,通过后再提交并核对项目归属。 */
|
||||
async function save() {
|
||||
if (!canSave.value || !policy.value) return
|
||||
issue.value = policyIssue(policy.value)
|
||||
if (issue.value) return
|
||||
const id = props.projectId
|
||||
const current = version
|
||||
const input = policyDraft(policy.value)
|
||||
@@ -134,12 +147,10 @@ defineExpose({ save, canSave })
|
||||
<template v-if="policy">
|
||||
<!-- 以下是物理表现与明确动作许可模块 -->
|
||||
<section class="space-y-4" aria-label="动作与物理规则">
|
||||
<div>
|
||||
<h3 class="text-sm font-medium">动作与物理规则</h3>
|
||||
<p class="mt-2 text-xs leading-6 text-muted">
|
||||
选择表现方式后,仍需明确勾选允许的动作范围。保存不会重新生成已有资产。
|
||||
</p>
|
||||
</div>
|
||||
<WorkspaceSectionHeading
|
||||
title="动作与物理规则"
|
||||
description="选择表现方式后,仍需明确勾选允许的动作范围。保存不会重新生成已有资产。"
|
||||
/>
|
||||
<NFormItem label="物理表现方式" :label-props="{ id: 'quality-physics-mode-label' }">
|
||||
<NSelect
|
||||
v-model:value="policy.physicsMode"
|
||||
@@ -173,16 +184,20 @@ defineExpose({ save, canSave })
|
||||
</NFormItem>
|
||||
<!-- 以下是主体和具体动作资源的精确例外模块 -->
|
||||
<section class="space-y-4" aria-label="精确动作例外">
|
||||
<div class="flex flex-wrap items-center justify-between gap-3">
|
||||
<h3 class="text-sm font-medium">精确动作例外</h3>
|
||||
<NButton
|
||||
size="small"
|
||||
:disabled="disabled || saving || (policy.actionExceptions?.length ?? 0) >= 30"
|
||||
@click="addException"
|
||||
>添加例外</NButton
|
||||
>
|
||||
</div>
|
||||
<p class="text-xs leading-6 text-muted">仅对填写的主体与资源放宽动作资源冲突,需记录明确依据。</p>
|
||||
<!-- 以下是与生成配置统一间距的模块标题、说明和操作模块 -->
|
||||
<WorkspaceSectionHeading
|
||||
title="精确动作例外"
|
||||
description="仅对填写的主体与资源放宽动作资源冲突,需记录明确依据。"
|
||||
>
|
||||
<template #actions>
|
||||
<NButton
|
||||
size="small"
|
||||
:disabled="disabled || saving || (policy.actionExceptions?.length ?? 0) >= 30"
|
||||
@click="addException"
|
||||
>添加例外</NButton
|
||||
>
|
||||
</template>
|
||||
</WorkspaceSectionHeading>
|
||||
<div v-for="(item, index) in policy.actionExceptions" :key="index" class="quality-exception-row">
|
||||
<NFormItem label="主体引用"
|
||||
><NInput
|
||||
@@ -204,7 +219,15 @@ defineExpose({ save, canSave })
|
||||
:aria-label="`例外 ${index + 1} 确认依据`"
|
||||
:disabled="disabled || saving"
|
||||
/></NFormItem>
|
||||
<NButton :disabled="disabled || saving" @click="removeException(index)">移除</NButton>
|
||||
<!-- 以下是与输入框底部对齐的图标移除操作,保留明确的可访问名称 -->
|
||||
<NButton
|
||||
class="icon-button quality-exception-remove"
|
||||
:aria-label="`移除例外 ${index + 1}`"
|
||||
title="移除例外"
|
||||
:disabled="disabled || saving"
|
||||
@click="removeException(index)"
|
||||
><Trash2 :size="16" aria-hidden="true"
|
||||
/></NButton>
|
||||
</div>
|
||||
</section>
|
||||
<p v-if="issue" role="status" class="text-xs leading-6 text-danger">{{ issue }}</p>
|
||||
@@ -222,9 +245,12 @@ defineExpose({ save, canSave })
|
||||
.quality-exception-row {
|
||||
display: grid;
|
||||
grid-template-columns: minmax(120px, 1fr) minmax(100px, 0.7fr) minmax(160px, 1.5fr) auto;
|
||||
align-items: center;
|
||||
align-items: end;
|
||||
gap: 16px;
|
||||
}
|
||||
.quality-exception-remove {
|
||||
justify-self: end;
|
||||
}
|
||||
@media (max-width: 640px) {
|
||||
.quality-exception-row {
|
||||
grid-template-columns: minmax(0, 1fr);
|
||||
|
||||
Reference in new issue
Block a user