|
|
@@ -56,6 +56,7 @@
|
|
|
<text class="dynamic-time">{{ formatTime(item.createdAt) }}</text>
|
|
|
<view class="dynamic-stats">
|
|
|
<text class="stat-item">❤️ {{ item.likeCount || 0 }}</text>
|
|
|
+ <text class="stat-item comment-stat" @click.stop="viewDynamicComments(item, index)">💬 {{ item.commentCount || 0 }}</text>
|
|
|
<text class="stat-item">💬 {{ item.commentCount || 0 }}</text>
|
|
|
<text class="stat-item">⭐ {{ item.favoriteCount || 0 }}</text>
|
|
|
</view>
|
|
|
@@ -197,11 +198,42 @@ export default {
|
|
|
|
|
|
// 查看动态详情
|
|
|
viewDynamicDetail(item) {
|
|
|
+ if (!item || !item.dynamicId) {
|
|
|
+ console.error('动态项无效:', item)
|
|
|
+ uni.showToast({
|
|
|
+ title: '动态信息无效',
|
|
|
+ icon: 'none'
|
|
|
+ })
|
|
|
+ return
|
|
|
+ }
|
|
|
uni.navigateTo({
|
|
|
url: `/pages/plaza/detail?dynamicId=${item.dynamicId}`
|
|
|
})
|
|
|
},
|
|
|
|
|
|
+ // 查看动态评论
|
|
|
+ viewDynamicComments(item, index) {
|
|
|
+ // 如果 item 无效,尝试从 dynamicList 中根据索引获取
|
|
|
+ if (!item || !item.dynamicId) {
|
|
|
+ if (typeof index === 'number' && this.dynamicList && this.dynamicList[index]) {
|
|
|
+ item = this.dynamicList[index]
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (!item || !item.dynamicId) {
|
|
|
+ console.error('动态项无效:', item, 'index:', index, 'dynamicList:', this.dynamicList)
|
|
|
+ uni.showToast({
|
|
|
+ title: '动态信息无效',
|
|
|
+ icon: 'none'
|
|
|
+ })
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ uni.navigateTo({
|
|
|
+ url: `/pages/plaza/detail?dynamicId=${item.dynamicId}&scrollToComment=true`
|
|
|
+ })
|
|
|
+ },
|
|
|
+
|
|
|
// 预览媒体
|
|
|
previewMedia(urls, index) {
|
|
|
if (!urls || urls.length === 0) return
|
|
|
@@ -366,6 +398,15 @@ export default {
|
|
|
color: #666;
|
|
|
}
|
|
|
|
|
|
+.comment-stat {
|
|
|
+ cursor: pointer;
|
|
|
+ transition: opacity 0.2s;
|
|
|
+}
|
|
|
+
|
|
|
+.comment-stat:active {
|
|
|
+ opacity: 0.6;
|
|
|
+}
|
|
|
+
|
|
|
.empty-container {
|
|
|
display: flex;
|
|
|
flex-direction: column;
|