👽️ 适应米社返回数据变更

This commit is contained in:
目棃
2024-07-08 14:47:59 +08:00
parent d9ab24cb14
commit 5816f5c825
4 changed files with 23 additions and 15 deletions

View File

@@ -15,7 +15,7 @@
<div class="tpc-content">
<div class="tpc-title" :title="card.title">{{ card.title }}</div>
<TpAvatar v-if="card.user" :data="card.user" position="left" />
<div class="tpc-data">
<div class="tpc-data" v-if="card.data">
<div class="tpc-info-item" :title="`浏览数:${card.data.view}`">
<v-icon>mdi-eye</v-icon>
<span>{{ card.data.view }}</span>
@@ -158,12 +158,22 @@ function getPostCover(item: TGApp.Plugins.Mys.Post.FullData): string {
*/
function getCommonCard(item: TGApp.Plugins.Mys.Post.FullData): TGApp.Plugins.Mys.News.RenderCard {
let forum = null;
let data = null;
if (item.forum !== null) {
forum = {
name: item.forum.name,
icon: item.forum.icon,
};
}
if (item.stat !== null) {
data = {
mark: item.stat.bookmark_num,
forward: item.stat.forward_num,
like: item.stat.like_num,
reply: item.stat.reply_num,
view: item.stat.view_num,
};
}
return {
title: item.post.subject,
cover: getPostCover(item),
@@ -171,13 +181,7 @@ function getCommonCard(item: TGApp.Plugins.Mys.Post.FullData): TGApp.Plugins.Mys
subtitle: item.post.post_id,
user: item.user,
forum: forum,
data: {
mark: item.stat.bookmark_num,
forward: item.stat.forward_num,
like: item.stat.like_num,
reply: item.stat.reply_num,
view: item.stat.view_num,
},
data: data,
};
}

View File

@@ -61,12 +61,12 @@ declare namespace TGApp.Plugins.Mys.News {
* @property {string} cover 封面图片 URL
* @property {number} postId 帖子 ID
* @property {string} subtitle 副标题
* @property {TGApp.Plugins.Mys.User.Post|null} user 发帖用户
* @property {TGApp.Plugins.Mys.User.Post|null} user 发帖用户,可能为 null
* @property forum 版块,可能为 null
* @property {string} forum.name 版块名称
* @property {string} forum.icon 版块图标
* @property {RenderStatus} status 活动状态,仅活动咨讯有
* @property data 帖子统计
* @property data 帖子统计,可能为 null
* @property {number} data.mark 帖子收藏数
* @property {number} data.forward 帖子转发数
* @property {number} data.like 帖子点赞数
@@ -90,7 +90,7 @@ declare namespace TGApp.Plugins.Mys.News {
like: number;
reply: number;
view: number;
};
} | null;
status?: RenderStatus;
}

View File

@@ -30,11 +30,11 @@ declare namespace TGApp.Plugins.Mys.Post {
* @since Beta v0.5.0
* @interface FullData
* @property {Post} post 帖子信息
* @property {Forum} forum 所属版块
* @property {Forum|null} forum 所属版块,可能为 null
* @property {Topic[]} topics 所属话题
* @property {TGApp.Plugins.Mys.User.Post|null} user 发帖人
* @property {TGApp.Plugins.Mys.User.Post|null} user 发帖人,可能为 null
* @property {TGApp.Plugins.Mys.User.SelfOperation} self_operation 当前用户操作
* @property {Stat} stat 帖子统计
* @property {Stat|null} stat 帖子统计,可能为 null
* @property {HelpSys} help_sys 帮助系统,可能为 null
* @property {Image} cover 封面图,可能为 null
* @property {Image[]} image_list 图片列表
@@ -58,7 +58,7 @@ declare namespace TGApp.Plugins.Mys.Post {
topics: Topic[];
user: TGApp.Plugins.Mys.User.Post | null;
self_operation: TGApp.Plugins.Mys.User.SelfOperation;
stat: Stat;
stat: Stat | null;
help_sys: HelpSys | null;
cover: Image | null;
image_list: Image[];

View File

@@ -90,6 +90,10 @@ export async function parseLink(
await emit("active_deep_link", "router?path=/news/2/news");
return true;
}
if (link === "mihoyobbs://homeForum?game_id=8&tab_type=2") {
await emit("active_deep_link", "router?path=/news/8/news");
return true;
}
}
return false;
}