This commit is contained in:
zhaofang
2022-11-18 16:49:58 +08:00
parent e1460dd992
commit 698c510bea
2 changed files with 28 additions and 2 deletions

View File

@@ -9,6 +9,7 @@
<script>
import { mapGetters} from 'vuex';
import apiFollow from "@/api/phase2/userfollow.js"
import apiUser from "@/api/system/user.js";
export default{
name:"followButton",
props:{
@@ -105,7 +106,29 @@
if(res.status == 200) {
$this.hasFollow=true;
$this.$message.success("关注成功");
$this.$emit('add',$this.aid,$this.data);
// $this.$emit('add',$this.aid,$this.data);
let pageId = this.$xpage.getHomeId(this.$route);
if(pageId == this.userInfo.aid) {
apiUser.getByIds([this.aid]).then(rs => {
if (res.status == 200) {
let data = {
has:true,
userFollow:{
aid:res.result.aid,
followId:res.result.followId,
followTime:res.result.followTime,
id:res.result.id,
authorInfo:rs.result[0],
}
}
$this.$emit('add',data);
} else {
this.$message.error(res.message);
}
});
}
} else {
$this.$message.error("关注失败:"+res.message);
$this.$emit('error',$this.aid);

View File

@@ -74,7 +74,7 @@
<p class="portal-summary-text">{{maPage.userFollow.authorInfo.sign}}</p>
</div>
<div>
<followButton :has="maPage.has" :aid="maPage.userFollow.aid"></followButton>
<followButton :has="maPage.has" :aid="maPage.userFollow.aid" @add="myFollowAdd"></followButton>
</div>
<!--
<div v-if="pageId == userInfo.aid">
@@ -171,6 +171,9 @@ import apiUser from "@/api/system/user.js";
myCancelFollow(dataIndex){ //我关注的,我取消关注
//this.follow.list.splice(dataIndex,1);
},
myFollowAdd(data) {
this.follow.list.push(data);
},
myAddFollow(dataIndex){ //我关注的,我取消关注
//this.follow.list.splice(dataIndex,1);
},