diff --git a/src/components/HomePage/followList.vue b/src/components/HomePage/followList.vue index 27325b3c..0bfd1151 100644 --- a/src/components/HomePage/followList.vue +++ b/src/components/HomePage/followList.vue @@ -262,7 +262,7 @@ import apiUser from "@/api/system/user.js"; }) this.followMe.list = res.result.list; //console.log(this.mypageList,'this.mypageList'); - this.getUserData(res.result.list); + this.getUserData(res.result.list,2); }else{ console.log('加载关注我数据错误:'+res.message); } @@ -280,26 +280,26 @@ import apiUser from "@/api/system/user.js"; item.userFollow.authorInfo = { aid: "",name: "",orgInfo: "",avatar: "",sex: null ,sign:''} }) this.follow.list = res.result.list; - this.getUserData(res.result.list); + this.getUserData(res.result.list, 1); } }) }, - getUserData(list) { + // num 判断是哪个接口 + getUserData(list,num) { let ids = []; - if(this.active == 2) { + if(num == 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.userFollow.followId) { + if (num == 1 && author.aid == item.userFollow.followId) { item.userFollow.authorInfo = author; return true; - } else if(this.active == 2 && author.aid == item.userFollow.aid){ + } else if(num == 2 && author.aid == item.userFollow.aid){ item.userFollow.authorInfo = author; return true; } else {