mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/vue/learning-system-portal.git
synced 2025-12-10 03:16:42 +08:00
我的关注
This commit is contained in:
@@ -7,26 +7,28 @@
|
||||
<div v-show="active ==1">
|
||||
<div class="follow-list" v-for="(item,index) in follow.list" :key="index">
|
||||
<div style="width:60px;height:60">
|
||||
<el-avatar shape="circle" style="width:60px;height:60px" size="small" :src="baseUrl+item.authorInfo.avatar" v-if="item.authorInfo.avatar"></el-avatar>
|
||||
<el-avatar shape="circle" style="width:60px;height:60px" size="small" :src="baseUrl+item.userFollow.authorInfo.avatar" v-if="item.userFollow.authorInfo.avatar"></el-avatar>
|
||||
<div v-else class="uavatar">
|
||||
<div v-if="item.authorInfo.sex == null" style="border-radius: 50%;width: 60px;height: 60px;"></div>
|
||||
<div v-if="item.userFollow.authorInfo.sex == null" style="border-radius: 50%;width: 60px;height: 60px;"></div>
|
||||
<div v-else>
|
||||
<div v-if="item.authorInfo.sex === 1 "><img style="width:60px;height:60" :src="`${webBaseUrl}/images/Avatarman.png`" alt=""></div>
|
||||
<div v-if="item.userFollow.authorInfo.sex === 1 "><img style="width:60px;height:60" :src="`${webBaseUrl}/images/Avatarman.png`" alt=""></div>
|
||||
<div v-else><img style="width:60px;height:60" :src="`${webBaseUrl}/images/Avatarwoman.png`" alt=""></div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- <img style="width:60px;height:60" :src="item.authorInfo.avatar"/> -->
|
||||
</div>
|
||||
<div class="follow-center">
|
||||
<p class="follow-home-title" style="font-size: 20px;margin-bottom: 12px;">{{item.authorInfo.name}}
|
||||
<p class="follow-home-title" style="font-size: 20px;margin-bottom: 12px;">{{item.userFollow.authorInfo.name}}
|
||||
<!-- <img style="width:22px;height:22;vertical-align:middle" src="/images/homeWu/man.png" /> -->
|
||||
</p>
|
||||
<p class="portal-summary-text">{{item.authorInfo.sign}}</p>
|
||||
<p class="portal-summary-text">{{item.userFollow.authorInfo.sign}}</p>
|
||||
</div>
|
||||
<div>
|
||||
<el-button plain class="btn" icon="el-icon-check" v-if="pageId == userInfo.aid && active == 1" @click="cancel(item)">取消关注</el-button>
|
||||
<el-button type="primary" class="btn" v-if="active == 2" icon="el-icon-plus">关注他</el-button>
|
||||
<el-button class="btn" icon="el-icon-plus" v-if="active == 2">已关注</el-button>
|
||||
<div v-if="pageId == userInfo.aid">
|
||||
<el-button plain class="btn" icon="el-icon-check" @click="cancel(item)">取消关注</el-button>
|
||||
</div>
|
||||
<div v-else>
|
||||
<el-button class="btn" icon="el-icon-check" v-if="item.has">已关注</el-button>
|
||||
<el-button type="primary" class="btn" v-else icon="el-icon-plus" @click="toFollow(item)">关注他</el-button>
|
||||
</div>
|
||||
</div>
|
||||
<!--分页没有加-->
|
||||
@@ -66,8 +68,8 @@
|
||||
</p>
|
||||
<p class="portal-summary-text">{{maPage.userFollow.authorInfo.sign}}</p>
|
||||
</div>
|
||||
<div v-if="pageId == userInfo.aid">
|
||||
<el-button class="btn" icon="el-icon-plus" v-if="maPage.has">已关注</el-button>
|
||||
<div>
|
||||
<el-button class="btn" icon="el-icon-check" v-if="maPage.has">已关注</el-button>
|
||||
<el-button type="primary" class="btn" v-else icon="el-icon-plus" @click="toFollow(maPage)">关注他</el-button>
|
||||
</div>
|
||||
</div>
|
||||
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user