feat: 帖子详情页 - 当前登录用户不显示关注按钮

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
panchengyong
2026-03-09 15:39:09 +08:00
parent 4ace4452a0
commit c69ce2891f

View File

@@ -100,8 +100,9 @@
<view class="post-time">{{ postData.author.time }}</view>
</view>
</view>
<view
class="follow-btn"
<view
v-if="currentUserId !== postData.author.id"
class="follow-btn"
:class="{ followed: isFollowed }"
@click="toggleFollow"
>
@@ -256,11 +257,14 @@ import {
getCommunityList
} from '@/api/tool.js'
import { checkLogin, toLogin } from '@/libs/login.js'
import Cache from '@/utils/cache'
import { USER_INFO } from '@/config/cache'
export default {
data() {
return {
postId: null,
currentUserId: null,
currentImageIndex: 0,
isLoading: true,
isFollowed: false,
@@ -312,6 +316,10 @@ export default {
}
},
onLoad(options) {
const userInfo = Cache.get(USER_INFO, true)
if (userInfo) {
this.currentUserId = userInfo.uid || userInfo.id || null
}
if (options.id) {
// Ensure postId is number for API calls (URL params are strings)
this.postId = parseInt(options.id, 10) || options.id