diff --git a/src/components/viewPost/vp-overlay-collection.vue b/src/components/viewPost/vp-overlay-collection.vue index 8c914bdf..25d9510a 100644 --- a/src/components/viewPost/vp-overlay-collection.vue +++ b/src/components/viewPost/vp-overlay-collection.vue @@ -52,9 +52,10 @@ import { nextTick, onMounted, shallowRef, useTemplateRef, watch } from "vue"; import { useRouter } from "vue-router"; import { timestampToDate } from "@/utils/toolFunc.js"; +// import bbsReq from "@/web/request/bbsReq.js"; import postReq from "@/web/request/postReq.js"; -type TpoCollectionProps = { collection: TGApp.BBS.Post.Collection }; +type TpoCollectionProps = { collection: TGApp.BBS.Post.Collection; gid: number }; type TpoCollectionItem = { postId: string; title: string; @@ -86,9 +87,11 @@ watch( ); onMounted(async () => { - const collectionPosts = await postReq.collection(props.collection.collection_id); + const resp = await postReq.collection(props.collection.collection_id); + // const resp2 = await bbsReq.collection(props.collection.collection_id, props.gid); + // console.log(resp2); const tempArr: Array = []; - for (const postItem of collectionPosts) { + for (const postItem of resp) { const post: TpoCollectionItem = { postId: postItem.post.post_id, title: postItem.post.subject, diff --git a/src/types/BBS/Collection.d.ts b/src/types/BBS/Collection.d.ts index a45d51c8..f2fc8e9c 100644 --- a/src/types/BBS/Collection.d.ts +++ b/src/types/BBS/Collection.d.ts @@ -1,7 +1,7 @@ /** * @file types/BBS/Collection.d.ts * @description BBS 收藏相关类型定义文件 - * @since Beta v0.7.1 + * @since Beta v0.7.2 */ declare namespace TGApp.BBS.Collection { @@ -15,6 +15,21 @@ declare namespace TGApp.BBS.Collection { */ type UserPostResp = TGApp.BBS.Response.BaseWithData; + /** + * @description 用户收藏帖子响应数据 + * @since Beta v0.7.1 + * @interface UserPostRes + * @property {boolean} is_last - 是否最后一页 + * @property {string} next_offset - 下一页偏移量 + * @property {Array} list - 帖子列表 + * @return UserPostRes + */ + type UserPostRes = { + is_last: boolean; + next_offset: string; + list: Array; + }; + /** * @description 合集帖子返回 * @since Beta v0.7.1 @@ -35,17 +50,82 @@ declare namespace TGApp.BBS.Collection { type PostsRes = { posts: Array }; /** - * @description 用户收藏帖子响应数据 - * @since Beta v0.7.1 - * @interface UserPostRes - * @property {boolean} is_last - 是否最后一页 - * @property {string} next_offset - 下一页偏移量 - * @property {Array} list - 帖子列表 - * @return UserPostRes + * @description 合集信息返回 + * @since Beta v0.7.2 + * @interface InfoResp + * @extends TGApp.BBS.Response.BaseWithData + * @property {InfoRes} data - 返回数据 + * @return InfoResp */ - type UserPostRes = { - is_last: boolean; - next_offset: string; - list: Array; + type InfoResp = TGApp.BBS.Response.BaseWithData; + + /** + * @description 合集信息数据 + * @since Beta v0.7.2 + * @interface InfoRes + * @property {Collection} collection_info - 合集信息 + * @property {User} author_info - 用户信息 + * @return InfoRes + */ + type InfoRes = { collection_info: Collection; author_info: User }; + + /** + * @description 合集信息 + * @since Beta v0.7.2 + * @interface Collection + * @property {number} id - 合集 ID + * @property {string} title - 合集标题 + * @property {string} cover - 合集封面 + * @property {number} post_num - 帖子数量 + * @property {number} view_num - 浏览数量 + * @property {number} post_updated_at - 最后更新时间(秒级时间戳) + * @property {string} desc - 合集描述 + * @property {boolean} is_delete - 是否删除 + * @property {boolean} is_following - 是否关注 + * @property {number} uid - 用户 ID + * @property {number} status - 状态 + * @return Collection + */ + type Collection = { + id: number; + title: string; + cover: string; + post_num: number; + view_num: number; + post_updated_at: number; + desc: string; + is_delete: boolean; + is_following: boolean; + uid: number; + status: number; + }; + + /** + * @description 用户信息 + * @since Beta v0.7.2 + * @interface User + * @property {string} uid - 用户 ID + * @property {string} nickname - 用户昵称 + * @property {string} introduce - 用户介绍 + * @property {string} avatar - 用户头像 + * @property {number} gender - 用户性别 + * @property {TGApp.BBS.User.Certification} certification - 用户认证信息 + * @property {boolean} is_following - 是否关注 + * @property {boolean} is_followed - 是否被关注 + * @property {string} avatar_url - 用户头像 URL + * @property {string} pendant - 用户挂件 + * @return User + */ + type User = { + uid: string; + nickname: string; + introduce: string; + avatar: string; + gender: number; + certification: TGApp.BBS.User.Certification; + is_following: boolean; + is_followed: boolean; + avatar_url: string; + pendant: string; }; } diff --git a/src/views/t-post.vue b/src/views/t-post.vue index c7c55adb..0420a582 100644 --- a/src/views/t-post.vue +++ b/src/views/t-post.vue @@ -93,7 +93,8 @@