feat(short-drama-agent-front): 新增视觉风格骨架屏并优化参考图添加
This commit is contained in:
1 parent
3cc65aa056
commit
519b956808
11 files changed
+621
-242
No files matched your search
@@ -2,14 +2,15 @@
|
||||
import AppForm from '../../../components/ui/AppForm.vue'
|
||||
import { NFormItem } from 'naive-ui'
|
||||
import { stringArrayJsonRule } from '../../../lib/form-rules'
|
||||
import DetailDisclosure from '../../../components/ui/DetailDisclosure.vue'
|
||||
import { NButton, NCheckbox, NInput, NTag } from 'naive-ui'
|
||||
import { computed, reactive, ref, watch } from 'vue'
|
||||
import type { SaveVisualStyleInput, VisualStyle } from '../types'
|
||||
|
||||
/** 编辑草稿独立于轮询结果,刷新不会覆盖尚未保存的输入。 */
|
||||
const props = defineProps<{ visualStyle: VisualStyle | null; disabled: boolean }>()
|
||||
/** 保存校验后的风格配置,并向父页面同步草稿状态。 */
|
||||
const emit = defineEmits<{ save: [input: SaveVisualStyleInput]; dirty: [value: boolean] }>()
|
||||
/** 整体风格、分类补充和硬约束保持在同一份编辑草稿中。 */
|
||||
const form = reactive({
|
||||
name: '',
|
||||
prompt: '',
|
||||
@@ -19,7 +20,9 @@ const form = reactive({
|
||||
constraints: '[]',
|
||||
isLocked: false
|
||||
})
|
||||
/** 上次成功读取的表单快照,用于识别未保存修改。 */
|
||||
const baseline = ref('')
|
||||
/** 草稿变更时禁止 AI 覆盖现有输入。 */
|
||||
const dirty = computed(() => JSON.stringify(form) !== baseline.value)
|
||||
watch(
|
||||
() => props.visualStyle,
|
||||
@@ -54,18 +57,10 @@ function save() {
|
||||
})
|
||||
}
|
||||
const rules = { constraints: stringArrayJsonRule }
|
||||
const constraintsDetails = ref<InstanceType<typeof DetailDisclosure> | null>(null)
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<AppForm
|
||||
:model="form"
|
||||
:rules="rules"
|
||||
:disabled="disabled"
|
||||
class="panel workspace-panel"
|
||||
@invalid="constraintsDetails?.expand()"
|
||||
@submit="save"
|
||||
>
|
||||
<AppForm :model="form" :rules="rules" :disabled="disabled" class="panel workspace-panel" @submit="save">
|
||||
<fieldset :disabled="disabled" class="space-y-5">
|
||||
<div class="flex flex-wrap items-center justify-between gap-3">
|
||||
<h3 class="font-medium">风格说明</h3>
|
||||
@@ -85,8 +80,10 @@ const constraintsDetails = ref<InstanceType<typeof DetailDisclosure> | null>(nul
|
||||
:autosize="{ minRows: 3, maxRows: 12 }"
|
||||
></NInput>
|
||||
</NFormItem>
|
||||
<DetailDisclosure ref="constraintsDetails" display-directive="show" title="分类风格与硬约束"
|
||||
><div class="grid gap-5 lg:grid-cols-3">
|
||||
<!-- 以下是始终展开的分类风格模块,人物、场景、道具各占一行 -->
|
||||
<section class="style-category-section" aria-labelledby="style-category-heading">
|
||||
<h3 id="style-category-heading" class="font-medium mb-5">分类风格与硬约束</h3>
|
||||
<div class="style-category-fields grid grid-cols-1 gap-5">
|
||||
<NFormItem path="characterPrompt" label="人物风格与选角背景"
|
||||
><NInput
|
||||
:input-props="{ 'aria-label': '人物风格与选角背景' }"
|
||||
@@ -134,7 +131,7 @@ const constraintsDetails = ref<InstanceType<typeof DetailDisclosure> | null>(nul
|
||||
:autosize="{ minRows: 3, maxRows: 12 }"
|
||||
></NInput>
|
||||
</NFormItem>
|
||||
</DetailDisclosure>
|
||||
</section>
|
||||
<NCheckbox
|
||||
:disabled="disabled"
|
||||
id="style-lock"
|
||||
|
||||
Reference in new issue
Block a user