From e053af9a1edfed5d89b11e07c15a62dce38fc81f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=BE=90=E9=A3=9E=E6=B4=8B?=
<15778543+xufeiyang6017@user.noreply.gitee.com>
Date: Thu, 29 Jan 2026 11:35:37 +0800
Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BE=9B=E5=AE=8C=E6=95=B4=E7=9A=84?=
=?UTF-8?q?=E5=8A=A8=E6=80=81=E5=B1=95=E7=A4=BA?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
pages/eggbar/eggbar.js | 49 ++++++++++++++++++++++++++++++++++++++++
pages/eggbar/eggbar.wxml | 5 +++-
pages/eggbar/eggbar.wxss | 14 ++++++++++++
3 files changed, 67 insertions(+), 1 deletion(-)
diff --git a/pages/eggbar/eggbar.js b/pages/eggbar/eggbar.js
index 68f4f8a..93e737a 100644
--- a/pages/eggbar/eggbar.js
+++ b/pages/eggbar/eggbar.js
@@ -157,6 +157,32 @@ Page({
});
}
+ // 确保topic字段存在
+ if (post.topic) {
+ console.log('动态话题:', post.topic);
+ }
+
+ // 为了兼容前端模板,添加user对象
+ if (!post.user) {
+ post.user = {
+ avatar: post.avatar_url || '',
+ nickname: post.username
+ };
+ }
+
+ // 为了兼容前端模板,添加image字段(使用images数组的第一个元素)
+ if (!post.image && post.images && post.images.length > 0) {
+ post.image = post.images[0];
+ }
+
+ // 为了兼容前端模板,添加like_count和comment_count字段
+ if (post.likes !== undefined && post.like_count === undefined) {
+ post.like_count = post.likes;
+ }
+ if (post.comments !== undefined && post.comment_count === undefined) {
+ post.comment_count = post.comments;
+ }
+
return post;
});
@@ -361,6 +387,29 @@ Page({
}
});
},
+
+ // 预览图片
+ previewImage(e) {
+ const images = e.currentTarget.dataset.images;
+ const currentIndex = parseInt(e.currentTarget.dataset.current);
+
+ console.log('预览图片:', {
+ images,
+ currentIndex,
+ current: images[currentIndex]
+ });
+
+ wx.previewImage({
+ current: images[currentIndex],
+ urls: images,
+ success: function(res) {
+ console.log('预览图片成功:', res);
+ },
+ fail: function(err) {
+ console.error('预览图片失败:', err);
+ }
+ });
+ },
createPost() {
wx.navigateTo({
diff --git a/pages/eggbar/eggbar.wxml b/pages/eggbar/eggbar.wxml
index 595444b..fae68d3 100644
--- a/pages/eggbar/eggbar.wxml
+++ b/pages/eggbar/eggbar.wxml
@@ -38,7 +38,10 @@
{{item.content}}
-
+
+
+
+ #{{item.topic}}