mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/vue/learning-system-portal.git
synced 2025-12-11 20:06:44 +08:00
提交
This commit is contained in:
@@ -9,6 +9,7 @@
|
|||||||
<script>
|
<script>
|
||||||
import { mapGetters} from 'vuex';
|
import { mapGetters} from 'vuex';
|
||||||
import apiFollow from "@/api/phase2/userfollow.js"
|
import apiFollow from "@/api/phase2/userfollow.js"
|
||||||
|
import apiUser from "@/api/system/user.js";
|
||||||
export default{
|
export default{
|
||||||
name:"followButton",
|
name:"followButton",
|
||||||
props:{
|
props:{
|
||||||
@@ -105,7 +106,29 @@
|
|||||||
if(res.status == 200) {
|
if(res.status == 200) {
|
||||||
$this.hasFollow=true;
|
$this.hasFollow=true;
|
||||||
$this.$message.success("关注成功");
|
$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 {
|
} else {
|
||||||
$this.$message.error("关注失败:"+res.message);
|
$this.$message.error("关注失败:"+res.message);
|
||||||
$this.$emit('error',$this.aid);
|
$this.$emit('error',$this.aid);
|
||||||
|
|||||||
@@ -74,7 +74,7 @@
|
|||||||
<p class="portal-summary-text">{{maPage.userFollow.authorInfo.sign}}</p>
|
<p class="portal-summary-text">{{maPage.userFollow.authorInfo.sign}}</p>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<followButton :has="maPage.has" :aid="maPage.userFollow.aid"></followButton>
|
<followButton :has="maPage.has" :aid="maPage.userFollow.aid" @add="myFollowAdd"></followButton>
|
||||||
</div>
|
</div>
|
||||||
<!--
|
<!--
|
||||||
<div v-if="pageId == userInfo.aid">
|
<div v-if="pageId == userInfo.aid">
|
||||||
@@ -171,6 +171,9 @@ import apiUser from "@/api/system/user.js";
|
|||||||
myCancelFollow(dataIndex){ //我关注的,我取消关注
|
myCancelFollow(dataIndex){ //我关注的,我取消关注
|
||||||
//this.follow.list.splice(dataIndex,1);
|
//this.follow.list.splice(dataIndex,1);
|
||||||
},
|
},
|
||||||
|
myFollowAdd(data) {
|
||||||
|
this.follow.list.push(data);
|
||||||
|
},
|
||||||
myAddFollow(dataIndex){ //我关注的,我取消关注
|
myAddFollow(dataIndex){ //我关注的,我取消关注
|
||||||
//this.follow.list.splice(dataIndex,1);
|
//this.follow.list.splice(dataIndex,1);
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user