From 931dfcc7fb40be18a450a7714f89283c58e736c1 Mon Sep 17 00:00:00 2001 From: zhaofang <752743406@qq.com> Date: Fri, 28 Oct 2022 15:00:12 +0800 Subject: [PATCH] =?UTF-8?q?=E6=88=91=E7=9A=84=E5=85=B3=E6=B3=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/HomePage/followList.vue | 57 ++++++++++++++------------ 1 file changed, 30 insertions(+), 27 deletions(-) diff --git a/src/components/HomePage/followList.vue b/src/components/HomePage/followList.vue index 8861e0f1..17f1c56e 100644 --- a/src/components/HomePage/followList.vue +++ b/src/components/HomePage/followList.vue @@ -7,26 +7,28 @@
- +
-
+
-
+
-
- 取消关注 - 关注他 - 已关注 +
+ 取消关注 +
+
+ 已关注 + 关注他
@@ -66,8 +68,8 @@

{{maPage.userFollow.authorInfo.sign}}

-
- 已关注 +
+ 已关注 关注他
@@ -233,7 +235,7 @@ import apiUser from "@/api/system/user.js"; if(res.status== 200) { $this.follow.count = res.result.count; res.result.list.forEach(item=>{ - item.authorInfo = { aid: "",name: "",orgInfo: "",avatar: "",sex: null ,sign:''} + item.userFollow.authorInfo = { aid: "",name: "",orgInfo: "",avatar: "",sex: null ,sign:''} }) this.follow.list = res.result.list; this.getUserData(res.result.list); @@ -241,25 +243,26 @@ import apiUser from "@/api/system/user.js"; }) }, getUserData(list) { - let ids = []; - if(this.active == 1) { - ids = list.map(item=> item.followId); - } else { - ids = list.map(item=> item.userFollow.aid); - } + let ids = []; + if(this.active == 2) { + ids = list.map(item=> item.userFollow.aid); + } else { + ids = list.map(item=> item.userFollow.followId); + } + apiUser.getByIds(ids).then(res => { if (res.status == 200) { list.forEach((item, index) => { res.result.some(author => { - if (this.active == 1 && author.aid == item.followId) { - item.authorInfo = author; - return true; - } else if ( this.active == 2 && author.aid == item.userFollow.aid) { - item.userFollow.authorInfo = author; - return true; - } else { - return false; - } + if (this.active == 1 && author.aid == item.userFollow.followId) { + item.userFollow.authorInfo = author; + return true; + } else if(this.active == 2 && author.aid == item.userFollow.aid){ + item.userFollow.authorInfo = author; + return true; + } else { + return false; + } }); }); } else {