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 中 // 返回包含用户名的评论对象