广告修改
This commit is contained in:
@@ -24,32 +24,23 @@ export type Genre = (typeof genres)[number];
|
||||
export type Sort = (typeof sorts)[number];
|
||||
export type Region = (typeof regions)[number];
|
||||
|
||||
export type ShortDramaItem =
|
||||
| {
|
||||
kind: "drama";
|
||||
id: string;
|
||||
slug?: string;
|
||||
title: string;
|
||||
subtitle: string;
|
||||
/** 左下角标签,最多 3 个(优先带 id 以便跳转) */
|
||||
tags: CardTagItem[];
|
||||
heat: string;
|
||||
episodes: string;
|
||||
badge?: BadgeTone;
|
||||
cover: string;
|
||||
/** 发布时间(接口原值,视频卡展示日期用) */
|
||||
date?: string;
|
||||
/** 覆盖默认详情/播放链接(如历史继续看到某集) */
|
||||
href?: string;
|
||||
}
|
||||
| {
|
||||
kind: "ad";
|
||||
id: string;
|
||||
title: string;
|
||||
subtitle: string;
|
||||
cover: string;
|
||||
href?: string;
|
||||
};
|
||||
export type ShortDramaItem = {
|
||||
kind: "drama";
|
||||
id: string;
|
||||
slug?: string;
|
||||
title: string;
|
||||
subtitle: string;
|
||||
/** 左下角标签,最多 3 个(优先带 id 以便跳转) */
|
||||
tags: CardTagItem[];
|
||||
heat: string;
|
||||
episodes: string;
|
||||
badge?: BadgeTone;
|
||||
cover: string;
|
||||
/** 发布时间(接口原值,视频卡展示日期用) */
|
||||
date?: string;
|
||||
/** 覆盖默认详情/播放链接(如历史继续看到某集) */
|
||||
href?: string;
|
||||
};
|
||||
|
||||
export const PAGE_SIZE = 24;
|
||||
export const TOTAL_PAGES = 11;
|
||||
@@ -59,16 +50,8 @@ export function shortDramaSortType(sort: Sort): 1 | 2 {
|
||||
}
|
||||
|
||||
export function mapPlayletListItem(item: PlayletListItem): ShortDramaItem | null {
|
||||
if (item.type === 2) {
|
||||
return {
|
||||
kind: "ad",
|
||||
id: `ad-${item.advertiseId || item.id || item.link || "unknown"}`,
|
||||
title: (item.title || "").trim() || "广告",
|
||||
subtitle: "",
|
||||
cover: (item.cover || "").trim(),
|
||||
href: (item.link || "").trim() || undefined,
|
||||
};
|
||||
}
|
||||
// 信息流广告(type=2)不展示:网页只保留后台 5 个站点广告位
|
||||
if (item.type === 2) return null;
|
||||
|
||||
if (!item.id) return null;
|
||||
const tags = pickPlayletCardTags(item);
|
||||
@@ -124,34 +107,6 @@ export function buildShortDramaList(
|
||||
};
|
||||
}
|
||||
|
||||
/** @deprecated 本地 mock,供「更多」等未接接口页面临时使用 */
|
||||
const adSlots = new Set([4, 9, 14, 18, 23]);
|
||||
const freshSlots = new Set([3, 11, 21]);
|
||||
|
||||
export function getShortDramas(genre: Genre, sort: Sort, page: number, region: Region = "全部"): ShortDramaItem[] {
|
||||
const seed = `${genres.indexOf(genre)}-${sorts.indexOf(sort)}-${regions.indexOf(region)}-${page}`;
|
||||
|
||||
return Array.from({ length: PAGE_SIZE }, (_, index): ShortDramaItem => {
|
||||
const id = `short-${seed}-${index}`;
|
||||
const cover = "";
|
||||
|
||||
if (adSlots.has(index)) {
|
||||
return { kind: "ad", id, title: "广告文案", subtitle: "我是副标题", cover };
|
||||
}
|
||||
|
||||
return {
|
||||
kind: "drama",
|
||||
id,
|
||||
title: "有恩必报",
|
||||
subtitle: "权谋交锋爱意藏在局中",
|
||||
tags: [{ name: genre === "全部" ? "标签" : genre }],
|
||||
heat: "25.8万 热度",
|
||||
episodes: "30集",
|
||||
badge: freshSlots.has(index) ? "fresh" : "original",
|
||||
cover,
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
/** 有 slug 时路径用 slug,否则回退 id */
|
||||
export function dramaPathKey(id: string | number, slug?: string | null) {
|
||||
|
||||
Reference in New Issue
Block a user