From fbb14eafe469e96d35a8f91930844c24bb36b45d Mon Sep 17 00:00:00 2001 From: Linzm <1015157648@qq.com> Date: Mon, 19 Jan 2026 16:48:31 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=EF=BC=9A=E5=9C=BA=E6=99=AF?= =?UTF-8?q?=E6=89=8B=E5=8A=9E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components.d.ts | 5 ++ src/views/cartoon/index.vue | 141 ++++++++++++++++++++++++++++++------ 2 files changed, 125 insertions(+), 21 deletions(-) diff --git a/components.d.ts b/components.d.ts index 02da195..b4f54b9 100644 --- a/components.d.ts +++ b/components.d.ts @@ -13,6 +13,11 @@ declare module '@vue/runtime-core' { Backup: typeof import('./src/components/arFrame/backup.vue')['default'] Backup2: typeof import('./src/components/arFrame/backup2.vue')['default'] Brand: typeof import('./src/components/brand/index.vue')['default'] + ElButton: typeof import('element-plus/es')['ElButton'] + ElIcon: typeof import('element-plus/es')['ElIcon'] + ElInput: typeof import('element-plus/es')['ElInput'] + ElRadioButton: typeof import('element-plus/es')['ElRadioButton'] + ElRadioGroup: typeof import('element-plus/es')['ElRadioGroup'] Gsplat: typeof import('./src/components/arFrame/gsplat.vue')['default'] Hint: typeof import('./src/components/hint/hint.vue')['default'] Loading: typeof import('./src/components/loading/index.vue')['default'] diff --git a/src/views/cartoon/index.vue b/src/views/cartoon/index.vue index 0524dd9..e245b17 100644 --- a/src/views/cartoon/index.vue +++ b/src/views/cartoon/index.vue @@ -159,30 +159,80 @@ upload-icon="plus" /> -
-
- {{ toValueWithout("坐骑类型") }} +
+
+ {{ toValueWithout("坐骑类型") }} +
+
+
+
+ + +
+
{{ toValueWithout(item.name) }}
-
-
-
- - -
-
{{ toValueWithout(item.name) }}
+
+
+
+
+ {{ toValueWithout("场景道具") }} +
+
+ + + {{ toValueWithout(item.name) }} + + +
+
+ + + + + + + +
+
@@ -214,6 +264,7 @@ import example1 from '@/assets/badge/1.png' import example2 from '@/assets/badge/2.png' import example3 from '@/assets/badge/3.png' import example4 from '@/assets/badge/4.png' +// Element Plus 图标通过组件自动导入,这里使用文本符号作为替代 // 初始化翻译功能 const { t } = useTranslation(); @@ -377,6 +428,53 @@ const rideChange = (item: any) => { mountsId.value = item.id } +// 场景道具相关 +const method = ref(1) // 1: 智能生成, 2: 自定义 +const scenePropsList = ref([ + { id: 1, name: '智能生成' }, + { id: 2, name: '自定义' } +]) +const scenePropsInputs = ref(['']) // 初始显示一个输入框 +const scene_prop = ref('') // 最终存储的字符串,用逗号连接 + +// 处理场景道具选择变化 +const handleScenePropsChange = (val: number) => { + method.value = val + if (val === 1) { + // 选择不使用场景道具时,清空输入和结果 + scenePropsInputs.value = [''] + scene_prop.value = '' + } else if (val === 2) { + // 选择自定义场景道具时,确保至少有一个输入框 + if (scenePropsInputs.value.length === 0) { + scenePropsInputs.value = [''] + } + updateSceneProp() + } +} + +// 添加输入框 +const addScenePropsInput = () => { + if (scenePropsInputs.value.length < 4) { + scenePropsInputs.value.push('') + } +} + +// 删除输入框 +const removeScenePropsInput = (index: number) => { + if (scenePropsInputs.value.length > 1) { + scenePropsInputs.value.splice(index, 1) + updateSceneProp() + } +} + +// 更新场景道具字符串 +const updateSceneProp = () => { + // 过滤空值,然后用逗号连接 + const validInputs = scenePropsInputs.value.filter(input => input && input.trim() !== '') + scene_prop.value = validInputs.join(',') +} + const isLoading = ref(false) // 生成图片 @@ -661,7 +759,8 @@ const createLog = () => { type_id: typeId.value, kind_id: kindId.value, mounts_id: mountsId.value || undefined, - subject_id: subjectId.value + subject_id: subjectId.value, + scene_prop: typeId.value === 9 && method.value === 2 && scene_prop.value ? scene_prop.value : undefined }, }) }, 1000);