diff --git a/珞珈岛-项目相关文件/luojia-island/vue-frontend/src/components/PostPage.vue b/珞珈岛-项目相关文件/luojia-island/vue-frontend/src/components/PostPage.vue index cb9168b..ef90945 100644 --- a/珞珈岛-项目相关文件/luojia-island/vue-frontend/src/components/PostPage.vue +++ b/珞珈岛-项目相关文件/luojia-island/vue-frontend/src/components/PostPage.vue @@ -27,9 +27,9 @@

{{ post.summary }}

- 热度 {{ post.likes }} + 浏览量 {{ post.viewCount }} 评论 {{ post.comments }} - 赞 {{ post.favorites }} + 赞 {{ post.likes }}
diff --git a/珞珈岛-项目相关文件/luojia-island/vue-frontend/src/stores/postdetail.js b/珞珈岛-项目相关文件/luojia-island/vue-frontend/src/stores/postdetail.js index 70b91e6..7f7e9cd 100644 --- a/珞珈岛-项目相关文件/luojia-island/vue-frontend/src/stores/postdetail.js +++ b/珞珈岛-项目相关文件/luojia-island/vue-frontend/src/stores/postdetail.js @@ -106,6 +106,12 @@ export const usePostDetailStore = defineStore("postDetail", { async fetchPostDetail(postId) { this.detailLoading = true; + // 先重置评论相关状态,防止串数据 + this.comments = []; + this.lastVal = Date.now(); + this.offset = 0; + this.commentsFinished = false; + this.commentsLoading = false; try { // 获取帖子详情 const postRes = await request.get('/post/detail', { params: { id: postId } }); diff --git a/珞珈岛-项目相关文件/luojia-island/vue-frontend/src/stores/postlist.js b/珞珈岛-项目相关文件/luojia-island/vue-frontend/src/stores/postlist.js index fe3835c..1c42d64 100644 --- a/珞珈岛-项目相关文件/luojia-island/vue-frontend/src/stores/postlist.js +++ b/珞珈岛-项目相关文件/luojia-island/vue-frontend/src/stores/postlist.js @@ -52,9 +52,9 @@ export const usePostListStore = defineStore('postList', { avatar: post.userAvatar || require('@/assets/default-avatar/boy_1.png'), title: post.title, summary: post.content ? post.content.slice(0, 40) + (post.content.length > 40 ? '...' : '') : '', + viewCount: post.viewCount || 0, likes: post.likeCount || 0, comments: post.commentCount || 0, - favorites: post.favoriteCount || 0, category: post.category || '全部', createTime: post.createTime, userName: post.userName, @@ -70,6 +70,7 @@ export const usePostListStore = defineStore('postList', { } } else { // 处理错误情况 + } } catch (error) { // 处理异常情况 diff --git a/珞珈岛-项目相关文件/luojia-island/vue-frontend/src/views/PostDetail.vue b/珞珈岛-项目相关文件/luojia-island/vue-frontend/src/views/PostDetail.vue index adfba83..299f1e1 100644 --- a/珞珈岛-项目相关文件/luojia-island/vue-frontend/src/views/PostDetail.vue +++ b/珞珈岛-项目相关文件/luojia-island/vue-frontend/src/views/PostDetail.vue @@ -24,8 +24,8 @@

{{ postDetailStore.post?.title || '' }}

{{ postDetailStore.post?.content || '' }}

- 浏览量 {{ postDetailStore.post?.likeCount ?? 0 }} - 点赞 {{ postDetailStore.post?.favoriteCount ?? 0 }} + 浏览量 {{ postDetailStore.post?.viewCount ?? 0 }} + 点赞 {{ postDetailStore.post?.likeCount ?? 0 }} 评论 {{ postDetailStore.post?.commentCount ?? 0 }}