This commit is contained in:
zhaofang
2022-11-04 11:19:55 +08:00
parent 5cf98ed2e1
commit 14a8947cdf

View File

@@ -262,7 +262,7 @@ import apiUser from "@/api/system/user.js";
}) })
this.followMe.list = res.result.list; this.followMe.list = res.result.list;
//console.log(this.mypageList,'this.mypageList'); //console.log(this.mypageList,'this.mypageList');
this.getUserData(res.result.list); this.getUserData(res.result.list,2);
}else{ }else{
console.log('加载关注我数据错误:'+res.message); 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:''} item.userFollow.authorInfo = { aid: "",name: "",orgInfo: "",avatar: "",sex: null ,sign:''}
}) })
this.follow.list = res.result.list; 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 = []; let ids = [];
if(this.active == 2) { if(num == 2) {
ids = list.map(item=> item.userFollow.aid); ids = list.map(item=> item.userFollow.aid);
} else { } else {
ids = list.map(item=> item.userFollow.followId); ids = list.map(item=> item.userFollow.followId);
} }
apiUser.getByIds(ids).then(res => { apiUser.getByIds(ids).then(res => {
if (res.status == 200) { if (res.status == 200) {
list.forEach((item, index) => { list.forEach((item, index) => {
res.result.some(author => { 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; item.userFollow.authorInfo = author;
return true; 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; item.userFollow.authorInfo = author;
return true; return true;
} else { } else {