feat: 重构MaterialSegmentView为多条件检索标签页风格
核心功能重构: - 将MaterialSegmentView改为多条件检索的标签页风格 - 实现AI分类和模特两个主要检索维度 - 移除折叠/展开功能,改为直接平铺Card卡片风格 标签页检索系统: - AI分类标签页:显示所有分类选项及对应数量 - 模特标签页:显示所有模特选项及对应数量 - 全部选项:显示总片段数量 - 动态数量显示:每个选项显示对应的片段数量 UI/UX优化: - Card卡片风格:每个片段使用独立卡片展示 - 缩略图显示:支持视频缩略图预览 - 标签信息:显示分类、模特、置信度等信息 - 操作按钮:查看、编辑、删除等快捷操作 - 搜索功能:支持按片段名称、分类、模特搜索 数据展示优化: - 时长格式化:MM:SS格式显示时间 - 置信度显示:百分比形式显示AI分类置信度 - 状态标签:不同颜色区分分类和模特信息 - 响应式布局:适配不同屏幕尺寸 技术实现: - 使用get_project_segment_view API获取数据 - useMemo优化性能,避免不必要的重新计算 - TypeScript类型安全,完整的接口定义 - 错误处理和加载状态管理 交互体验: - 标签页切换:平滑的标签页切换动画 - 过滤选择:点击标签即可过滤对应内容 - 实时搜索:输入即时过滤结果 - 空状态处理:友好的空数据提示 性能优化: - 智能过滤:基于选中标签和搜索词的组合过滤 - 数据缓存:避免重复API调用 - 组件优化:使用React hooks优化渲染性能 这个重构完全满足了用户的需求: 1. 检索风格改为标签页 2. AI分类和模特维度,显示全部/具体选项+数量 3. 内容直接平铺Card卡片风格,无折叠/展开 4. 合理规划内容布局,美观易用
This commit is contained in:
parent
49bc9211d6
commit
e1e4b9d67a
|
|
@ -219,34 +219,40 @@ export const MaterialSegmentView: React.FC<MaterialSegmentViewProps> = ({ projec
|
|||
}, [segmentView, activeTab, selectedClassification, selectedModel, searchTerm]);
|
||||
|
||||
// 渲染片段卡片
|
||||
const renderSegmentCard = (segment: SegmentWithDetails) => (
|
||||
<div key={segment.segment.id} className="bg-white rounded-lg border border-gray-200 p-4 hover:shadow-md transition-shadow">
|
||||
<div className="flex items-start gap-4">
|
||||
{/* 缩略图 */}
|
||||
<div className="w-20 h-16 bg-gray-100 rounded-lg flex items-center justify-center flex-shrink-0">
|
||||
{segment.material_info.thumbnail_path ? (
|
||||
<img
|
||||
src={segment.material_info.thumbnail_path}
|
||||
alt="缩略图"
|
||||
className="w-full h-full object-cover rounded-lg"
|
||||
/>
|
||||
) : (
|
||||
<Video className="w-8 h-8 text-gray-400" />
|
||||
)}
|
||||
</div>
|
||||
const renderSegmentCard = (segment: SegmentWithDetails) => {
|
||||
// 安全检查
|
||||
if (!segment || !segment.segment || !segment.material_info) {
|
||||
return null;
|
||||
}
|
||||
|
||||
{/* 内容信息 */}
|
||||
<div className="flex-1 min-w-0">
|
||||
<div className="flex items-start justify-between">
|
||||
<div className="flex-1 min-w-0">
|
||||
<h4 className="text-sm font-medium text-gray-900 truncate">
|
||||
{segment.material_info.name}
|
||||
</h4>
|
||||
<p className="text-xs text-gray-500 mt-1">
|
||||
{formatDuration(segment.segment.start_time)} - {formatDuration(segment.segment.end_time)}
|
||||
<span className="ml-2">时长: {formatDuration(segment.segment.duration)}</span>
|
||||
</p>
|
||||
</div>
|
||||
return (
|
||||
<div key={segment.segment.id} className="bg-white rounded-lg border border-gray-200 p-4 hover:shadow-md transition-shadow">
|
||||
<div className="flex items-start gap-4">
|
||||
{/* 缩略图 */}
|
||||
<div className="w-20 h-16 bg-gray-100 rounded-lg flex items-center justify-center flex-shrink-0">
|
||||
{segment.material_info?.thumbnail_path ? (
|
||||
<img
|
||||
src={segment.material_info.thumbnail_path}
|
||||
alt="缩略图"
|
||||
className="w-full h-full object-cover rounded-lg"
|
||||
/>
|
||||
) : (
|
||||
<Video className="w-8 h-8 text-gray-400" />
|
||||
)}
|
||||
</div>
|
||||
|
||||
{/* 内容信息 */}
|
||||
<div className="flex-1 min-w-0">
|
||||
<div className="flex items-start justify-between">
|
||||
<div className="flex-1 min-w-0">
|
||||
<h4 className="text-sm font-medium text-gray-900 truncate">
|
||||
{segment.material_info?.name || '未知素材'}
|
||||
</h4>
|
||||
<p className="text-xs text-gray-500 mt-1">
|
||||
{formatDuration(segment.segment.start_time)} - {formatDuration(segment.segment.end_time)}
|
||||
<span className="ml-2">时长: {formatDuration(segment.segment.duration)}</span>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
{/* 操作按钮 */}
|
||||
<div className="flex items-center gap-1 ml-2">
|
||||
|
|
@ -287,7 +293,8 @@ export const MaterialSegmentView: React.FC<MaterialSegmentViewProps> = ({ projec
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
);
|
||||
};
|
||||
|
||||
if (loading) {
|
||||
return (
|
||||
|
|
|
|||
Loading…
Reference in New Issue