feat: 帖子详情页 - 当前登录用户不显示关注按钮
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -101,6 +101,7 @@
|
||||
</view>
|
||||
</view>
|
||||
<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
|
||||
|
||||
Reference in New Issue
Block a user