From 1db22929d46b872b2ec1afa14bb79fa32c26b20e Mon Sep 17 00:00:00 2001 From: QMZ <1164250597@qq.com> Date: Sat, 21 Dec 2024 18:03:55 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8F=A4=E8=8C=97=E7=9A=84=E8=8E=93=E8=8E=93?= =?UTF-8?q?=E5=A5=B6=E9=BA=BB=E8=96=AF=E6=8C=BA=E5=A5=BD=E5=96=9D=20?= =?UTF-8?q?=E6=8E=A8=E8=8D=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/community/Postform.vue | 1 + src/views/community/trends.vue | 8 ++++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/views/community/Postform.vue b/src/views/community/Postform.vue index 57ee1edd..5613265d 100644 --- a/src/views/community/Postform.vue +++ b/src/views/community/Postform.vue @@ -89,6 +89,7 @@ // 当文件被选中时触发 if (file.raw) { // 创建预览图片的URL + this.imageUrl = URL.createObjectURL(file.raw); } }, diff --git a/src/views/community/trends.vue b/src/views/community/trends.vue index 32cfa798..d975fa19 100644 --- a/src/views/community/trends.vue +++ b/src/views/community/trends.vue @@ -220,10 +220,10 @@ // 并发请求每个 follow 的用户信息(用户名和头像) const followsWithUserInfo = await Promise.all( response.map(async (follow) => { - const { userid: followUserid } = follow; + const { myfollowid } = follow; try { // 获取每个 follow 的用户信息(包括用户名和头像) - const userResponse = await axios.get(`/user/info/${id}`); + const userResponse = await axios.get(`/user/info/${myfollowid}`); const { username, photo } = userResponse; // 返回包含用户名和头像的 follow 对象 @@ -233,7 +233,7 @@ photo }; } catch (userError) { - console.error(`Error fetching user info for follow with userid ${followUserid}:`, userError); + console.error(`Error fetching user info for follow with userid ${myfollowid}:`, userError); return { ...follow, username: 'Unknown', // 如果失败,设置默认的用户名 @@ -385,7 +385,7 @@ const { userid } = comment; try { // 获取用户信息 - const userResponse = await axios.get(`/user/info/${id}`); + const userResponse = await axios.get(`/user/info/${userid}`); const username = userResponse.username; // 假设用户名在 response.data.username 中 // 返回包含用户名的评论对象