Skip to content

Commit

Permalink
fix: 修复部分显示错误
Browse files Browse the repository at this point in the history
  • Loading branch information
JYcx9248 authored and fuqihao.foliet committed Aug 9, 2023
1 parent e9d4795 commit d92ca04
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 9 deletions.
4 changes: 2 additions & 2 deletions src/pages/moment/moment.vue
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
<view v-if="moment.data.text" class="post-content font-md">
{{ moment.data.text }}
</view>
<view class="like-info">
<view v-if="moment.likeData.count" class="like-info">
{{ moment.likeData.count }} 位喵友觉得很赞
</view>
</view>
Expand Down Expand Up @@ -304,7 +304,7 @@ const localGetCommentsData = async () => {
for (let i = 0; i < res.data.length; i++) {
comments.data.push(res.data[i]);
comments.likeData.push(res.likeData[i]);
comments.replyNumber += res.data[i].comments;
comments.replyNumber += res.data[i].comments ? res.data[i].comments : 0;
}
isCommentsLoaded = true;
page += 1;
Expand Down
2 changes: 1 addition & 1 deletion src/pages/post/post.vue
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ const localGetCommentsData = async () => {
for (let i = 0; i < res.data.length; i++) {
comments.data.push(res.data[i]);
comments.likeData.push(res.likeData[i]);
comments.replyNumber += res.data[i].comments;
comments.replyNumber += res.data[i].comments ? res.data[i].comments : 0;
}
isCommentsLoaded = true;
page += 1;
Expand Down
8 changes: 6 additions & 2 deletions src/pages/profile/my-publish/my-posts.vue
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,12 @@
<view class="time font-sm">
{{ displayTime(post.createAt) }}
</view>
<view class="comment font-sm">{{ post.comments }}条回复</view>
<view class="font-sm">{{ post.likes }}位喵友觉得很赞</view>
<view v-if="post.comments" class="comment font-sm"
>{{ post.comments }}条回复</view
>
<view v-if="post.likes" class="font-sm"
>{{ post.likes }}位喵友觉得很赞</view
>
<view v-if="post.user.id === myUserId && myUserId">
<view class="delete" @click.stop="onClickDelete(post.id)">
<image :src="Icons.Delete" class="deletepic" />
Expand Down
8 changes: 4 additions & 4 deletions src/pages/profile/personal-info/personal-info.vue
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ import { onLoad, onPullDownRefresh, onReady, onShow } from "@dcloudio/uni-app";
import UserPublished from "@/pages/profile/profile-components/userPublished.vue";
import { Pictures } from "@/utils/url";
import TopBar from "@/components/TopBar.vue";
import UserInfo from "@/pages/profile/profile-components/userInfo.vue";
const props = defineProps<{
userId?: string;
}>();
Expand Down Expand Up @@ -77,15 +77,15 @@ const refresh = async () => {
userInfo.id = res.user.id;
userInfo.nickname = res.user.nickname;
userInfo.avatarUrl = res.user.avatarUrl;
userInfo.follower = res.user.follower;
userInfo.following = res.user.following;
userInfo.follower = res.user.follower ? res.user.follower : 0;
userInfo.following = res.user.following ? res.user.following : 0;
userInfo.article = res.user.article;
let commentLikeReq = {
targetId: userInfo.id,
targetType: 6
};
const userLiked = await getUserLiked(commentLikeReq);
console.log(userLiked);
followInfo.followed = userLiked.liked;
followInfo.originFollow = userLiked.liked;
};
Expand Down

0 comments on commit d92ca04

Please sign in to comment.