mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/vue/learning-system-portal.git
synced 2025-12-15 05:46:43 +08:00
个人主页,关注我的,和我关注的人
This commit is contained in:
@@ -5,7 +5,7 @@
|
|||||||
<li class="follow-home-title tabs-index" @click="tagTab(2)">{{userInfo.aid == pageId ?'关注我的人':'关注他的人'}}<span v-if="active == 2" class="line"></span></li>
|
<li class="follow-home-title tabs-index" @click="tagTab(2)">{{userInfo.aid == pageId ?'关注我的人':'关注他的人'}}<span v-if="active == 2" class="line"></span></li>
|
||||||
</ul>
|
</ul>
|
||||||
<div v-show="active ==1">
|
<div v-show="active ==1">
|
||||||
<div class="follow-list" v-for="item in followList" :key="item.id">
|
<div class="follow-list" v-for="item in follow.list" :key="item.id">
|
||||||
<div style="width:60px;height:60">
|
<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.authorInfo.avatar" v-if="item.authorInfo.avatar"></el-avatar>
|
||||||
<div v-else class="uavatar">
|
<div v-else class="uavatar">
|
||||||
@@ -30,16 +30,16 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<!--分页没有加-->
|
<!--分页没有加-->
|
||||||
<div style="text-align: center; margin-top:57px;" v-show="page.count > 0">
|
<div style="text-align: center; margin-top:57px;" v-show="follow.count > 0">
|
||||||
<el-pagination
|
<el-pagination
|
||||||
background
|
background
|
||||||
@size-change="handleSizeChange"
|
@size-change="handleSizeChange"
|
||||||
@current-change="handleCurrentChange"
|
@current-change="handleCurrentChange"
|
||||||
:current-page="page.pageIndex"
|
:current-page="follow.pageIndex"
|
||||||
:page-sizes="[10, 20, 30, 40]"
|
:page-sizes="[10, 20, 30, 40]"
|
||||||
:page-size="page.pageSize"
|
:page-size="follow.pageSize"
|
||||||
layout="total, sizes, prev, pager, next, jumper"
|
layout="total, sizes, prev, pager, next, jumper"
|
||||||
:total="page.count">
|
:total="follow.count">
|
||||||
</el-pagination>
|
</el-pagination>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -48,7 +48,7 @@
|
|||||||
<p class="text">还没有关注的人</p>
|
<p class="text">还没有关注的人</p>
|
||||||
</div>
|
</div>
|
||||||
<div v-show="active == 2">
|
<div v-show="active == 2">
|
||||||
<div class="follow-list" v-for="(maPage,index) in mypageList" :key="index">
|
<div class="follow-list" v-for="(maPage,index) in followMe.list" :key="index">
|
||||||
<div style="width:60px;height:60">
|
<div style="width:60px;height:60">
|
||||||
<el-avatar shape="circle" style="width:60px;height:60px" size="small" :src="baseUrl+maPage.userFollow.authorInfo.avatar" v-if="maPage.userFollow.authorInfo.avatar"></el-avatar>
|
<el-avatar shape="circle" style="width:60px;height:60px" size="small" :src="baseUrl+maPage.userFollow.authorInfo.avatar" v-if="maPage.userFollow.authorInfo.avatar"></el-avatar>
|
||||||
<div v-else class="uavatar">
|
<div v-else class="uavatar">
|
||||||
@@ -77,11 +77,11 @@
|
|||||||
background
|
background
|
||||||
@size-change="handleSizeChange"
|
@size-change="handleSizeChange"
|
||||||
@current-change="handleCurrentChange"
|
@current-change="handleCurrentChange"
|
||||||
:current-page="page.pageIndex"
|
:current-page="followMe.pageIndex"
|
||||||
:page-sizes="[10, 20, 30, 40]"
|
:page-sizes="[10, 20, 30, 40]"
|
||||||
:page-size="page.pageSize"
|
:page-size="followMe.pageSize"
|
||||||
layout="total, sizes, prev, pager, next, jumper"
|
layout="total, sizes, prev, pager, next, jumper"
|
||||||
:total="page.count">
|
:total="followMe.count">
|
||||||
</el-pagination>
|
</el-pagination>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -95,7 +95,7 @@ import apiFollow from "@/api/phase2/userfollow.js"
|
|||||||
import { mapGetters,mapActions } from 'vuex';
|
import { mapGetters,mapActions } from 'vuex';
|
||||||
import apiUser from "@/api/system/user.js";
|
import apiUser from "@/api/system/user.js";
|
||||||
export default{
|
export default{
|
||||||
name:"articleList",
|
name:"followList",
|
||||||
components: {
|
components: {
|
||||||
interactBar,
|
interactBar,
|
||||||
// timeShow,
|
// timeShow,
|
||||||
@@ -107,9 +107,9 @@ import apiUser from "@/api/system/user.js";
|
|||||||
return userAvatarText(this.userInfo.name);
|
return userAvatarText(this.userInfo.name);
|
||||||
},
|
},
|
||||||
showEmpty(){ //是否显示空信息内容
|
showEmpty(){ //是否显示空信息内容
|
||||||
if(this.active==1 && this.followList.length==0){
|
if(this.active==1 && this.follow.list.length==0){
|
||||||
return true;
|
return true;
|
||||||
}else if(this.active==2 && this.mypageList.length==0){
|
}else if(this.active==2 && this.followMe.list.length==0){
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
@@ -118,11 +118,20 @@ import apiUser from "@/api/system/user.js";
|
|||||||
data(){
|
data(){
|
||||||
return{
|
return{
|
||||||
baseUrl:process.env.VUE_APP_FILE_BASE_URL,
|
baseUrl:process.env.VUE_APP_FILE_BASE_URL,
|
||||||
followList:[],
|
|
||||||
active:1,
|
active:1,
|
||||||
pageId:'',
|
pageId:'',
|
||||||
// pageList:[],
|
follow:{
|
||||||
mypageList:[],
|
list:[],
|
||||||
|
count:0,
|
||||||
|
pageIndex:1,
|
||||||
|
pageSize:10
|
||||||
|
},
|
||||||
|
followMe:{
|
||||||
|
list:[],
|
||||||
|
count:0,
|
||||||
|
pageIndex:1,
|
||||||
|
pageSize:10
|
||||||
|
},
|
||||||
page:{
|
page:{
|
||||||
pageIndex:1,
|
pageIndex:1,
|
||||||
pageSize:10,
|
pageSize:10,
|
||||||
@@ -135,70 +144,84 @@ import apiUser from "@/api/system/user.js";
|
|||||||
this.pageId = this.$xpage.getHomeId(this.$route);
|
this.pageId = this.$xpage.getHomeId(this.$route);
|
||||||
},
|
},
|
||||||
methods:{
|
methods:{
|
||||||
|
resetActive(){
|
||||||
cancel(item) {
|
this.active=1;
|
||||||
|
this.follow={list:[],count:0,pageIndex:1,pageSize:10},
|
||||||
|
this.followMe={list:[],count:0,pageIndex:1,pageSize:10},
|
||||||
|
this.tagTab(1);
|
||||||
|
},
|
||||||
|
cancel(item,idx) {
|
||||||
|
let $this=this;
|
||||||
apiFollow.remove(item.followId).then(res=>{
|
apiFollow.remove(item.followId).then(res=>{
|
||||||
if(res.status == 200) {
|
if(res.status == 200) {
|
||||||
this.getPage()
|
$this.follow.list.splice(idx,1);
|
||||||
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},//展示全部
|
||||||
//展示全部
|
tagTab(num) {
|
||||||
tagTab(num) {
|
|
||||||
this.active = num;
|
this.active = num;
|
||||||
if(num == 1) {
|
if(num == 1) {
|
||||||
|
if(this.follow.list.length==0){
|
||||||
this.getPage()
|
this.getPage()
|
||||||
|
}
|
||||||
// if(this.followList.length==0){
|
|
||||||
// this.getPage()
|
|
||||||
// }
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
this.getMyPage()
|
if(this.followMe.list.length==0){
|
||||||
|
this.getMyPage()
|
||||||
// if(this.mypageList.length==0){
|
}
|
||||||
// this.getMyPage()
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
handleSizeChange(val) {
|
handleSizeChange(val) {
|
||||||
this.page.pageSize = val;
|
if(this.active==1){
|
||||||
this.page.pageIndex = 1;
|
this.follow={list:[],count:0,pageIndex:1,pageSize:val};
|
||||||
this.getPage()
|
this.getPage()
|
||||||
this.getMyPage()
|
}else{
|
||||||
},
|
this.followMe={list:[],count:0,pageIndex:1,pageSize:val};
|
||||||
handleCurrentChange(val) {
|
this.getMyPage()
|
||||||
this.page.pageIndex = val;
|
}
|
||||||
this.getPage()
|
|
||||||
this.getMyPage()
|
|
||||||
},
|
|
||||||
getMyPage() {//关注我的,关注他的
|
|
||||||
this.page.aid = this.pageId;
|
|
||||||
apiFollow.mypage(this.page).then(res=>{
|
|
||||||
this.page.count = res.result.count;
|
|
||||||
|
|
||||||
if(res.status== 200) {
|
},
|
||||||
this.page.count = res.result.count;
|
handleCurrentChange(val) {
|
||||||
res.result.list.forEach(item=>{
|
if(this.active==1){
|
||||||
item.userFollow.authorInfo = { aid: "",name: "",orgInfo: "",avatar: "",sex: null ,sign:''}
|
this.follow.pageIndex=val;
|
||||||
})
|
this.getPage()
|
||||||
this.mypageList = res.result.list;
|
}else{
|
||||||
console.log(this.mypageList,'this.mypageList');
|
this.followMe.pageIndex=val;
|
||||||
this.getUserData(res.result.list);
|
this.getMyPage()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
},
|
||||||
|
getMyPage() {//关注我的,关注他的
|
||||||
|
this.page.aid = this.pageId;
|
||||||
|
this.page.pageIndex=this.followMe.pageIndex;
|
||||||
|
this.page.pageSize=this.followMe.pageSize;
|
||||||
|
let $this=this;
|
||||||
|
apiFollow.mypage(this.page).then(res=>{
|
||||||
|
if(res.status== 200) {
|
||||||
|
$this.followMe.count = res.result.count;
|
||||||
|
res.result.list.forEach(item=>{
|
||||||
|
item.userFollow.authorInfo = { aid: "",name: "",orgInfo: "",avatar: "",sex: null ,sign:''}
|
||||||
|
})
|
||||||
|
this.followMe.list = res.result.list;
|
||||||
|
//console.log(this.mypageList,'this.mypageList');
|
||||||
|
this.getUserData(res.result.list);
|
||||||
|
}else{
|
||||||
|
console.log('加载关注我数据错误:'+res.message);
|
||||||
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
getPage() { //我关注的,他关注的
|
getPage() { //我关注的,他关注的
|
||||||
this.page.aid = this.pageId;
|
this.page.aid = this.pageId;
|
||||||
|
this.page.pageIndex=this.follow.pageIndex;
|
||||||
|
this.page.pageSize=this.follow.pageSize;
|
||||||
|
let $this=this;
|
||||||
apiFollow.page(this.page).then(res=>{
|
apiFollow.page(this.page).then(res=>{
|
||||||
this.page.count = res.result.count;
|
|
||||||
if(res.status== 200) {
|
if(res.status== 200) {
|
||||||
this.page.count = res.result.count;
|
$this.follow.count = res.result.count;
|
||||||
res.result.list.forEach(item=>{
|
res.result.list.forEach(item=>{
|
||||||
item.authorInfo = { aid: "",name: "",orgInfo: "",avatar: "",sex: null ,sign:''}
|
item.authorInfo = { aid: "",name: "",orgInfo: "",avatar: "",sex: null ,sign:''}
|
||||||
})
|
})
|
||||||
this.followList = res.result.list;
|
this.follow.list = res.result.list;
|
||||||
this.getUserData(res.result.list);
|
this.getUserData(res.result.list);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -50,7 +50,7 @@
|
|||||||
<span slot="label"><svg-icon icon-class="home-book" style="font-size: 30px;"></svg-icon><span class="tabs-info">书籍</span></span>
|
<span slot="label"><svg-icon icon-class="home-book" style="font-size: 30px;"></svg-icon><span class="tabs-info">书籍</span></span>
|
||||||
<book-list></book-list>
|
<book-list></book-list>
|
||||||
</el-tab-pane> -->
|
</el-tab-pane> -->
|
||||||
</el-tabs>
|
</el-tabs>
|
||||||
<div style="text-align: center; margin-top:57px;" v-show="page.count > 0">
|
<div style="text-align: center; margin-top:57px;" v-show="page.count > 0">
|
||||||
<el-pagination
|
<el-pagination
|
||||||
background
|
background
|
||||||
@@ -469,8 +469,10 @@
|
|||||||
},
|
},
|
||||||
handleClick() {
|
handleClick() {
|
||||||
if(this.activeName == '7') {
|
if(this.activeName == '7') {
|
||||||
|
this.$refs.followList.resetActive();
|
||||||
|
//this.page.count =0;
|
||||||
this.$refs.followList.getPage();
|
this.$refs.followList.getPage();
|
||||||
console.log(this.$refs.followList,'llllmj')
|
//console.log(this.$refs.followList,'llllmj')
|
||||||
this.page.count = this.$refs.followList.count;
|
this.page.count = this.$refs.followList.count;
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user