fix: main data
This commit is contained in:
@@ -40,8 +40,8 @@
|
||||
</view>
|
||||
<view class="stat-divider"></view>
|
||||
<view class="stat-item">
|
||||
<text class="stat-num">{{ isLoggedIn ? userStats.comment : '-' }}</text>
|
||||
<text class="stat-label">评论数</text>
|
||||
<text class="stat-num">{{ isLoggedIn ? userStats.pkCount : '-' }}</text>
|
||||
<text class="stat-label">参与PK</text>
|
||||
</view>
|
||||
<view class="stat-divider"></view>
|
||||
<view class="stat-item">
|
||||
@@ -71,13 +71,13 @@
|
||||
<view class="menu-item" @tap="navTo('/pages/mine/pk')">
|
||||
<view class="icon-left"><text class="icon-bookmark"></text></view>
|
||||
<text class="menu-text">我参与的PK</text>
|
||||
<text class="menu-value" v-if="isLoggedIn">{{ userStats.participant }}</text>
|
||||
<text class="menu-value" v-if="isLoggedIn">{{ userStats.pkCount }}</text>
|
||||
</view>
|
||||
<view class="menu-item" @tap="navTo('comments')">
|
||||
<!-- <view class="menu-item" @tap="navTo('comments')">
|
||||
<view class="icon-left"><text class="icon-document"></text></view>
|
||||
<text class="menu-text">我的评论</text>
|
||||
<text class="menu-value" v-if="isLoggedIn">{{ userStats.comment }}</text>
|
||||
</view>
|
||||
</view> -->
|
||||
</view>
|
||||
|
||||
<!-- Menu Group 2 -->
|
||||
@@ -130,6 +130,7 @@ const userStats = ref({
|
||||
participant: 0,
|
||||
comment: 0,
|
||||
liked: 0,
|
||||
pkCount: 0,
|
||||
label: []
|
||||
});
|
||||
|
||||
@@ -139,6 +140,7 @@ const loadUserStats = async () => {
|
||||
participant: 0,
|
||||
comment: 0,
|
||||
liked: 0,
|
||||
pkCount: 0,
|
||||
label: []
|
||||
};
|
||||
return;
|
||||
@@ -150,6 +152,7 @@ const loadUserStats = async () => {
|
||||
participant: data.participant || 0,
|
||||
comment: data.comment || 0,
|
||||
liked: data.liked || 0,
|
||||
pkCount: data.pkCount || 0,
|
||||
label: data.label || []
|
||||
};
|
||||
} catch (error) {
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
v-for="(item, index) in topics"
|
||||
:key="item.id || index"
|
||||
:topic="item"
|
||||
@card-click="goToTopicDetail(item.id)"
|
||||
@item-click="goToTopicDetail(item.id)"
|
||||
/>
|
||||
</view>
|
||||
|
||||
@@ -83,15 +83,15 @@ const loadData = async (page = 1) => {
|
||||
}
|
||||
|
||||
// 构造适合 TopicCard 渲染的数据格式
|
||||
const formattedList = list.map(item => ({
|
||||
id: item.topicId || item.id,
|
||||
title: item.topicName || item.title || '未知话题',
|
||||
image: item.image || item.coverUrl || 'https://api.dicebear.com/7.x/shapes/svg?seed=' + (item.topicId || item.id), // 给个默认图防止报错
|
||||
views: item.participantCount || item.views || 0,
|
||||
items: item.items || item.ratingItems || []
|
||||
}));
|
||||
// const formattedList = list.map(item => ({
|
||||
// id: item.topicId || item.id,
|
||||
// title: item.topicName || item.title || '未知话题',
|
||||
// image: item.image || item.coverUrl || 'https://api.dicebear.com/7.x/shapes/svg?seed=' + (item.topicId || item.id), // 给个默认图防止报错
|
||||
// views: item.participantCount || item.views || 0,
|
||||
// items: item.items || item.ratingItems || []
|
||||
// }));
|
||||
|
||||
topics.value = [...topics.value, ...formattedList];
|
||||
topics.value = [...topics.value, ...list];
|
||||
|
||||
// 判断是否有下一页
|
||||
hasMore.value = list.length >= pageSize;
|
||||
|
||||
Reference in New Issue
Block a user