优化模板生成故事

This commit is contained in:
海龙 2025-08-26 02:56:10 +08:00
parent 61b7003622
commit 5fe8c76efa
3 changed files with 27 additions and 16 deletions

View File

@ -192,7 +192,7 @@ export const useTemplateStoryServiceHook = (): UseTemplateStoryService => {
...selectedTemplate, ...selectedTemplate,
fillable_content: selectedTemplate.fillable_content.map((field) => fillable_content: selectedTemplate.fillable_content.map((field) =>
field.field_name === fieldName field.field_name === fieldName
? { ...field, field_value: fieldValue } ? { ...field, value: fieldValue }
: field : field
), ),
}; };

View File

@ -168,6 +168,8 @@ export interface StoryTemplateEntity {
field_type: string; field_type: string;
/** 字段值 */ /** 字段值 */
field_value?: string; field_value?: string;
/** 前端展示,无关后端的字段值 */
value?: string;
/** 字段描述 */ /** 字段描述 */
field_description?: string; field_description?: string;
/** 字段元数据 */ /** 字段元数据 */

View File

@ -18,7 +18,15 @@ import {
Sparkles, Sparkles,
Settings, Settings,
} from "lucide-react"; } from "lucide-react";
import { Dropdown, Modal, Tooltip, Upload, Popconfirm, Image } from "antd"; import {
Dropdown,
Modal,
Tooltip,
Upload,
Popconfirm,
Image,
Popover,
} from "antd";
import { UploadOutlined } from "@ant-design/icons"; import { UploadOutlined } from "@ant-design/icons";
import { StoryTemplateEntity } from "@/app/service/domain/Entities"; import { StoryTemplateEntity } from "@/app/service/domain/Entities";
import { useImageStoryServiceHook } from "@/app/service/Interaction/ImageStoryService"; import { useImageStoryServiceHook } from "@/app/service/Interaction/ImageStoryService";
@ -229,14 +237,14 @@ const RenderTemplateStoryMode = ({
<div className="relative"> <div className="relative">
<input <input
type="text" type="text"
value={field.field_value || ""} value={field.value || ""}
onChange={(e) => onChange={(e) =>
updateFillableContentField( updateFillableContentField(
field.field_name, field.field_name,
e.target.value e.target.value
) )
} }
placeholder={`${field.field_description}`} placeholder={`${field.field_value}`}
className="w-[30rem] px-3 py-2 pr-16 bg-white/0 border border-white/10 rounded-lg text-white placeholder-gray-400 focus:outline-none focus:border-blue-500 focus:ring-1 focus:ring-blue-500/30 transition-all duration-200 text-sm" className="w-[30rem] px-3 py-2 pr-16 bg-white/0 border border-white/10 rounded-lg text-white placeholder-gray-400 focus:outline-none focus:border-blue-500 focus:ring-1 focus:ring-blue-500/30 transition-all duration-200 text-sm"
/> />
<div className="absolute right-2 top-1/2 -translate-y-1/2"> <div className="absolute right-2 top-1/2 -translate-y-1/2">
@ -246,9 +254,10 @@ const RenderTemplateStoryMode = ({
handleCreateVideo={() => handleCreateVideo={() =>
handleFieldBlur( handleFieldBlur(
field.field_name, field.field_name,
field.field_value || "" field.value || ""
) )
} }
icon={<Sparkles className="w-4 h-4" />} icon={<Sparkles className="w-4 h-4" />}
width="w-8" width="w-8"
height="h-8" height="h-8"
@ -260,7 +269,7 @@ const RenderTemplateStoryMode = ({
classNames={{ classNames={{
root: "max-w-none", root: "max-w-none",
}} }}
trigger="hover" trigger="focus"
styles={{ root: { zIndex: 1000 } }} styles={{ root: { zIndex: 1000 } }}
> >
{/* 图片 */} {/* 图片 */}