refactor(web): 竞品分析复用 WorksGallery,与监控账号作品列表同一套展现
- WorksGallery 支持 sourceId 可选与 extraFilters 透传 - 竞品页删除自建作品卡片/详情抽屉/分页,仅保留筛选卡 - 修复日期筛选序列化(dayjs 模板串产生非法 RFC3339)
This commit is contained in:
@@ -105,12 +105,15 @@ function GrowthChart({ metrics }: { metrics: any[] }) {
|
||||
}
|
||||
|
||||
interface WorksGalleryProps {
|
||||
sourceId: string;
|
||||
/** 不传则不过滤来源(如竞品分析页跨全部竞品);监控/自有账号详情传具体账号 ID。 */
|
||||
sourceId?: string;
|
||||
sourceType?: 'owned' | 'competitor';
|
||||
emptyHint?: string;
|
||||
/** 页面自有筛选(如竞品分析页的互动量/发布时间条件)透传到作品列表查询。 */
|
||||
extraFilters?: Record<string, string | number | undefined>;
|
||||
}
|
||||
|
||||
export default function WorksGallery({ sourceId, sourceType, emptyHint }: WorksGalleryProps) {
|
||||
export default function WorksGallery({ sourceId, sourceType, emptyHint, extraFilters }: WorksGalleryProps) {
|
||||
const [works, setWorks] = useState<any[]>([]);
|
||||
const [workPage, setWorkPage] = useState(1);
|
||||
const [workPageInfo, setWorkPageInfo] = useState({ total: 0, hasNext: false });
|
||||
@@ -131,7 +134,8 @@ export default function WorksGallery({ sourceId, sourceType, emptyHint }: WorksG
|
||||
setWorksPending(true);
|
||||
setWorksError(null);
|
||||
try {
|
||||
const filters: Record<string, string | number> = { source_id: sourceId };
|
||||
const filters: Record<string, string | number | undefined> = { ...extraFilters };
|
||||
if (sourceId) filters.source_id = sourceId;
|
||||
if (sourceType) filters.source_type = sourceType;
|
||||
if (minGrowth !== null) {
|
||||
// 爆品筛选:growth_hours 开启后端 24h 点赞增量计算,min_likes_growth 设下限。
|
||||
@@ -146,7 +150,7 @@ export default function WorksGallery({ sourceId, sourceType, emptyHint }: WorksG
|
||||
} finally {
|
||||
setWorksPending(false);
|
||||
}
|
||||
}, [sourceId, sourceType, workPage, minGrowth]);
|
||||
}, [sourceId, sourceType, workPage, minGrowth, extraFilters]);
|
||||
|
||||
useEffect(() => {
|
||||
loadWorks();
|
||||
|
||||
Reference in New Issue
Block a user