feat: 帖子详情页 - 当前登录用户不显示关注按钮
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -101,6 +101,7 @@
|
|||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view
|
<view
|
||||||
|
v-if="currentUserId !== postData.author.id"
|
||||||
class="follow-btn"
|
class="follow-btn"
|
||||||
:class="{ followed: isFollowed }"
|
:class="{ followed: isFollowed }"
|
||||||
@click="toggleFollow"
|
@click="toggleFollow"
|
||||||
@@ -256,11 +257,14 @@ import {
|
|||||||
getCommunityList
|
getCommunityList
|
||||||
} from '@/api/tool.js'
|
} from '@/api/tool.js'
|
||||||
import { checkLogin, toLogin } from '@/libs/login.js'
|
import { checkLogin, toLogin } from '@/libs/login.js'
|
||||||
|
import Cache from '@/utils/cache'
|
||||||
|
import { USER_INFO } from '@/config/cache'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
postId: null,
|
postId: null,
|
||||||
|
currentUserId: null,
|
||||||
currentImageIndex: 0,
|
currentImageIndex: 0,
|
||||||
isLoading: true,
|
isLoading: true,
|
||||||
isFollowed: false,
|
isFollowed: false,
|
||||||
@@ -312,6 +316,10 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
onLoad(options) {
|
onLoad(options) {
|
||||||
|
const userInfo = Cache.get(USER_INFO, true)
|
||||||
|
if (userInfo) {
|
||||||
|
this.currentUserId = userInfo.uid || userInfo.id || null
|
||||||
|
}
|
||||||
if (options.id) {
|
if (options.id) {
|
||||||
// Ensure postId is number for API calls (URL params are strings)
|
// Ensure postId is number for API calls (URL params are strings)
|
||||||
this.postId = parseInt(options.id, 10) || options.id
|
this.postId = parseInt(options.id, 10) || options.id
|
||||||
|
|||||||
Reference in New Issue
Block a user