From ab5dfa9b57e4d99e29036bf82a6ad00d5fd1b13a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=9B=AE=E6=A3=83?= Date: Wed, 25 Dec 2024 14:28:47 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20=E4=BF=AE=E5=A4=8Dlink=5Fcard=5F?= =?UTF-8?q?ids=E5=AD=97=E6=AE=B5=E4=B8=8D=E8=AF=86=E5=88=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/viewPost/tp-linkCard.vue | 7 ++- src/plugins/Mys/types/Post.d.ts | 53 ++++++++++++++++++---- src/plugins/Mys/types/SctPost.d.ts | 29 +++--------- src/views/t-post.vue | 59 ++++++++++++++++--------- 4 files changed, 96 insertions(+), 52 deletions(-) diff --git a/src/components/viewPost/tp-linkCard.vue b/src/components/viewPost/tp-linkCard.vue index d37cfc57..820e6078 100644 --- a/src/components/viewPost/tp-linkCard.vue +++ b/src/components/viewPost/tp-linkCard.vue @@ -7,7 +7,12 @@ {{ props.data.insert.link_card.price }} diff --git a/src/plugins/Mys/types/Post.d.ts b/src/plugins/Mys/types/Post.d.ts index 4a1ae32b..e0809f4d 100644 --- a/src/plugins/Mys/types/Post.d.ts +++ b/src/plugins/Mys/types/Post.d.ts @@ -1,7 +1,7 @@ /** * @file plugins/Mys/types/post.d.ts * @description Mys 插件帖子类型定义文件 - * @since Beta v0.6.3 + * @since Beta v0.6.7 */ declare namespace TGApp.Plugins.Mys.Post { @@ -13,15 +13,11 @@ declare namespace TGApp.Plugins.Mys.Post { * @property {FullData} data.post 帖子数据 * @return Response */ - interface Response extends TGApp.BBS.Response.BaseWithData { - data: { - post: FullData; - }; - } + type Response = TGApp.BBS.Response.BaseWithData & { data: { post: FullData } }; /** * @description 帖子数据 - * @since Beta v0.5.0 + * @since Beta v0.6.7 * @interface FullData * @property {Post} post 帖子信息 * @property {Forum|null} forum 所属版块,可能为 null @@ -42,7 +38,7 @@ declare namespace TGApp.Plugins.Mys.Post { * @property {unknown[]} vod_list 视频列表,可能为空 * @property {boolean} is_block_on 是否被屏蔽 * @property {unknown} forum_rank_info 版块排行信息,可能为 null - * @property {unknown[]} link_card_list 链接卡片列表,可能为空 + * @property {LinkCard[]} link_card_list 链接卡片列表,可能为空 * @property {TGApp.Plugins.Mys.News.Meta} news_meta 咨讯元数据,可能为 null * @return FullData */ @@ -66,7 +62,7 @@ declare namespace TGApp.Plugins.Mys.Post { vod_list: Vod[]; is_block_on: boolean; forum_rank_info: unknown | null; - link_card_list: unknown[]; + link_card_list: LinkCard[]; news_meta: TGApp.Plugins.Mys.News.Meta | null | undefined; recommend_reason: unknown | null; villa_card: unknown | null; @@ -302,6 +298,45 @@ declare namespace TGApp.Plugins.Mys.Post { next_post_view_type: number; } + /** + * @description 链接卡片信息 + * @since Beta v0.6.7 + * @interface LinkCard + * @property {string} button_text 按钮文本 + * @property {string} card_id 卡片 ID + * @property {unknown} card_meta 卡片元数据 + * @property {number} card_status 卡片状态 + * @property {string} cover 封面图 URL + * @property {string} landing_url 落地页 URL + * @property {number} landing_url_type 落地页类型 + * @property {number} link_type 链接类型 + * @property {string} market_price 市场价 + * @property {string} origin_url 原始 URL + * @property {string} origin_user_avatar 原始用户头像 URL + * @property {string} origin_user_avatar_url 原始用户头像 URL + * @property {string} origin_user_nickname 原始用户名 + * @property {string} price 价格 + * @property {string} title 标题 + * @returns LinkCard + */ + type LinkCard = { + button_text: string; + card_id: string; + card_meta: unknown; + card_status: number; + cover: string; + landing_url: string; + landing_url_type: number; + link_type: number; + market_price: string; + origin_url: string; + origin_user_avatar: string; + origin_user_avatar_url: string; + origin_user_nickname: string; + price: string; + title: string; + }; + /** * @description 视频信息 * @since Beta v0.3.7 diff --git a/src/plugins/Mys/types/SctPost.d.ts b/src/plugins/Mys/types/SctPost.d.ts index 4cf47eaa..b4511482 100644 --- a/src/plugins/Mys/types/SctPost.d.ts +++ b/src/plugins/Mys/types/SctPost.d.ts @@ -1,15 +1,9 @@ /** * @file plugins/Mys/types/SctPost.d.ts * @description Mys 插件 结构化帖子类型声明文件 - * @since Beta v0.4.5 + * @since Beta v0.6.7 */ -/** - * @description 结构化帖子类型命名空间 - * @since Beta v0.4.5 - * @namespace TGApp.Plugins.Mys.SctPost - * @memberof TGApp.Plugins.Mys - */ declare namespace TGApp.Plugins.Mys.SctPost { /** * @description 帖子结构化数据-基础类型 @@ -20,11 +14,7 @@ declare namespace TGApp.Plugins.Mys.SctPost { * @property {Base[]} children - 子帖子 * @return Base */ - interface Base { - insert: any; - attributes?: any; - children?: Base[]; - } + type Base = { insert: any; attributes?: any; children?: Base[] }; /** * @description 帖子结构化数据-空类型 @@ -34,22 +24,17 @@ declare namespace TGApp.Plugins.Mys.SctPost { * @property {never} attributes - 帖子属性 * @return Empty */ - interface Empty { - insert: never; - attributes?: never; - } + type Empty = { insert: never; attributes?: never }; /** * @description 帖子结构化数据-其他类型 - * @since Beta v0.3.4 + * @since Beta v0.6.7 * @property {string} describe - 描述 * @property {string[]} imgs - 图片链接 + * @property {string[]} link_card_ids - 关联卡片ID * @return Other */ - interface Other { - describe: string; - imgs: string[]; - + type Other = { describe: string; imgs: string[]; link_card_ids?: string[] } & { [key: string]: unknown; - } + }; } diff --git a/src/views/t-post.vue b/src/views/t-post.vue index ff2fa6be..3664cb3e 100644 --- a/src/views/t-post.vue +++ b/src/views/t-post.vue @@ -6,7 +6,7 @@