import { BgPaddingMultiSelect, type BgPaddingMultiValue } from '@/components/block/BgPaddingMultiSelect'; import CascaderMultiSelect from '@/components/block/CascaderMultiSelect'; import { Button } from '@/components/ui/button'; import { Card, CardAction, CardContent, CardHeader } from '@/components/ui/card'; import { Label } from '@/components/ui/label'; import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '@/components/ui/select'; import { Switch } from '@/components/ui/switch'; import { X } from 'lucide-react'; import React from 'react'; interface Tag { sex: string; category: string; size: string; material: string; color: string; } interface TagOptions { sexOptions: any[]; categoryOptions: any[]; sizeOptions: any[]; materialOptions: any[]; colorOptions: any[]; } interface ClothingCardProps { imageUrl: string; tag: Tag; options: TagOptions; idx: number; onTagChange: (level: keyof Tag, value: string) => void; onRemove: () => void; errors?: Partial>; scenesOptions?: any[]; scenes?: string[][]; onScenesChange?: (scenes: string[][]) => void; fileName?: string; bgMode: 'custom' | 'scene'; onChangeBgMode: (bgMode: 'custom' | 'scene') => void; paddingList?: BgPaddingMultiValue; onPaddingListChange?: (paddingList: BgPaddingMultiValue) => void; } const LABELS = ['性别', '类别', '尺寸', '材质', '颜色']; const LEVELS: (keyof Tag)[] = ['sex', 'category', 'size', 'material', 'color']; const ClothingCard: React.FC = ({ imageUrl, tag, options, onTagChange, onRemove, errors = {}, scenesOptions = [], scenes = [], onScenesChange, fileName, bgMode, onChangeBgMode, paddingList, onPaddingListChange, }) => { return (
预览 {fileName &&
{fileName}
}
{LEVELS.map((level, lidx) => { let selectOptions: any[] = []; if (level === 'sex') selectOptions = options.sexOptions; else if (level === 'category') selectOptions = options.categoryOptions; else if (level === 'size') selectOptions = options.sizeOptions; else if (level === 'material') selectOptions = options.materialOptions; else if (level === 'color') selectOptions = options.colorOptions; return (
{errors[level] &&
{errors[level]}
}
); })}
{/* 场景级联多选/自定义上传切换 */}
onChangeBgMode(bgMode === 'custom' ? 'scene' : 'custom')} />
{bgMode === 'scene' ? ( {})} /> ) : ( {})} /> )}
); }; export default ClothingCard;