diff --git a/src/api/user/index.ts b/src/api/user/index.ts index 78cf7001..962dd024 100644 --- a/src/api/user/index.ts +++ b/src/api/user/index.ts @@ -78,9 +78,21 @@ export async function getUserTopicApi( request: User.UserGetUserTopicRequestData ): Promise { const queryParams = objectToQueryParams(request, 'uid') - const url = `/user/${request.uid}/published-topic?${queryParams}` + const url = `/user/${request.uid}/topics?${queryParams}` const response = fetchGet(url) return response } + +// 获取用户回复 +export async function getUserReplyApi( + request: User.UserGetUserReplyRequestData +): Promise { + const queryParams = objectToQueryParams(request, 'uid') + const url = `/user/${request.uid}/replies?${queryParams}` + + const response = fetchGet(url) + + return response +} diff --git a/src/api/user/types/user.ts b/src/api/user/types/user.ts index d22e745c..35923f05 100644 --- a/src/api/user/types/user.ts +++ b/src/api/user/types/user.ts @@ -52,6 +52,19 @@ export interface UserGetUserTopicRequestData { tidArray: number[] } +// 发布评论返回数据 +export interface UserReply { + tid: number + content: string + time: number +} + +// 获取用户发布的回复 +export interface UserGetUserReplyRequestData { + uid: number + ridArray: number[] +} + export type UserInfoResponseData = KUNGalgameResponseData export type UserUpdateBioResponseData = KUNGalgameResponseData<{}> @@ -67,3 +80,5 @@ export type UserUpdateEmailResponseData = KUNGalgameResponseData<{}> export type UserUpdatePasswordResponseData = KUNGalgameResponseData<{}> export type UserGetUserTopicResponseData = KUNGalgameResponseData + +export type UserGetUserReplyResponseData = KUNGalgameResponseData diff --git a/src/store/modules/kungalgamer.ts b/src/store/modules/kungalgamer.ts index bcedcf17..2ba4fd3a 100644 --- a/src/store/modules/kungalgamer.ts +++ b/src/store/modules/kungalgamer.ts @@ -28,6 +28,8 @@ import type { UserUpdatePasswordResponseData, UserGetUserTopicRequestData, UserGetUserTopicResponseData, + UserGetUserReplyRequestData, + UserGetUserReplyResponseData, } from '@/api' import { @@ -38,6 +40,7 @@ import { updateUserEmailApi, updateUserPasswordApi, getUserTopicApi, + getUserReplyApi, } from '@/api' // kungalgame store 类型 @@ -181,13 +184,24 @@ export const useKUNGalgameUserStore = defineStore({ return updateUserPasswordApi(requestData) }, - // 获取用户发布的话题 - async getTopic(tidArray: number[]): Promise { + // 获取用户的话题 + async getTopics(tidArray: number[]): Promise { const requestData: UserGetUserTopicRequestData = { uid: this.uid, tidArray: tidArray, } return getUserTopicApi(requestData) }, + + // 获取用户回复 + async getReplies( + ridArray: number[] + ): Promise { + const requestData: UserGetUserReplyRequestData = { + uid: this.uid, + ridArray: ridArray, + } + return getUserReplyApi(requestData) + }, }, }) diff --git a/src/views/kungalgamer/content/Topic.vue b/src/views/kungalgamer/content/Topic.vue index 78975846..b91c666c 100644 --- a/src/views/kungalgamer/content/Topic.vue +++ b/src/views/kungalgamer/content/Topic.vue @@ -1,9 +1,10 @@ @@ -47,8 +80,7 @@ onMounted(async () => {