关注和我分享的

This commit is contained in:
zhaofang
2022-11-23 18:39:09 +08:00
parent 3464c29e02
commit 2b0aab2ca1
2 changed files with 31 additions and 21 deletions

View File

@@ -110,18 +110,18 @@
onReachBottom() { onReachBottom() {
if(this.tab == 1 && this.followMe.list.length<this.followMe.count) {//关注我的 if(this.tab == 1 && this.followMe.list.length<this.followMe.count) {//关注我的
this.followMe.pageIndex ++; this.followMe.pageIndex ++;
this.getMyPage(); this.getMyPage(false);
} else if(this.tab == 2 && this.follow.list.length<this.follow.count){//我关注的 } else if(this.tab == 2 && this.follow.list.length<this.follow.count){//我关注的
this.follow.pageIndex ++; this.follow.pageIndex ++;
this.getPage(); this.getPage(false);
} }
}, },
onLoad(options) { onLoad(options) {
this.tab = options.type; this.tab = options.type;
this.$store.dispatch('GetUserInfo').then(rs => { this.$store.dispatch('GetUserInfo').then(rs => {
this.userInfo = rs; this.userInfo = rs;
this.getMyPage(); this.getMyPage(true);
this.getPage(); this.getPage(true);
}); });
}, },
@@ -147,7 +147,9 @@
this.show = false; this.show = false;
if(this.cancelIdx == 1) { if(this.cancelIdx == 1) {
$this.followMe.list[this.cancelIndex].has = false; $this.followMe.list[this.cancelIndex].has = false;
this.getPage(true);
} else { } else {
this.getMyPage(true)
$this.follow.list.splice(this.cancelIndex,1); $this.follow.list.splice(this.cancelIndex,1);
} }
uni.showToast({ uni.showToast({
@@ -158,24 +160,24 @@
}) })
}, },
toFollow(item,index) { toFollow(item,index) {
console.log(item,'item')
let $this=this; let $this=this;
apiFollow.save(item.userFollow.aid).then(res=>{ apiFollow.save(item.userFollow.aid).then(res=>{
if(res.status == 200) { if(res.status == 200) {
$this.followMe.list[index].has = true; $this.followMe.list[index].has = true;
// 手动把关注成功的数据push进我关注的列表 // 手动把关注成功的数据push进我关注的列表
let data = { this.getPage(true);
has:true, // let data = {
userFollow:{ // has:true,
aid:res.result.aid, // userFollow:{
followId:res.result.followId, // aid:res.result.aid,
followTime:res.result.followTime, // followId:res.result.followId,
id:res.result.id, // followTime:res.result.followTime,
authorInfo:item.userFollow.authorInfo, // id:res.result.id,
} // authorInfo:item.userFollow.authorInfo,
// }
} // }
$this.follow.list.push(data); // // $this.follow.list.push(data);
} else { } else {
// this.$message.error(res.message); // this.$message.error(res.message);
} }
@@ -184,7 +186,11 @@
ubtab(num){ ubtab(num){
this.tab = num; this.tab = num;
}, },
getMyPage() {//关注我的,关注他的 getMyPage(flag) {//关注我的,关注他的
if(flag) {
this.followMe.pageIndex =1;
this.followMe.list = [];
}
this.followMe.aid = this.userInfo.aid; this.followMe.aid = this.userInfo.aid;
let $this=this; let $this=this;
uni.showLoading({title:'加载中...'}); uni.showLoading({title:'加载中...'});
@@ -202,7 +208,11 @@
} }
}) })
}, },
getPage() { //我关注的,他关注的 getPage(falg) { //我关注的,他关注的
if(falg) {
this.follow.pageIndex = 1;
this.follow.list = [];
}
this.follow.aid = this.userInfo.aid; this.follow.aid = this.userInfo.aid;
let $this=this; let $this=this;
uni.showLoading({title:'加载中...'}); uni.showLoading({title:'加载中...'});

View File

@@ -1,6 +1,6 @@
<template> <template>
<view> <view>
<page-title :showBack="true">分享</page-title> <page-title :showBack="true">我分享</page-title>
<view v-for="(item,index) in dataList.list" :key="index"> <view v-for="(item,index) in dataList.list" :key="index">
<view v-if="item.type == 1"> <view v-if="item.type == 1">
<view class="course_box"> <view class="course_box">
@@ -42,7 +42,7 @@
<text style="font-size: 24upx;color: #999;margin-right: 35upx;">分享给{{item.toAname}}</text> <text style="font-size: 24upx;color: #999;margin-right: 35upx;">分享给{{item.toAname}}</text>
</view> </view>
<view class="rowbtn-right"> <view class="rowbtn-right">
<view class="withdraw" v-if="item.isRead" @click.stop="withdraw(item)"> <view class="withdraw" v-if="!item.isRead" @click.stop="withdraw(item)">
<image src="../../static/images/icon/withdrawnew.png" mode=""></image>撤回 <image src="../../static/images/icon/withdrawnew.png" mode=""></image>撤回
</view> </view>
<view v-if="item.isRead" class="Viewed"> <view v-if="item.isRead" class="Viewed">
@@ -298,7 +298,7 @@ export default {
}, },
toArticleDetail(item) { toArticleDetail(item) {
uni.navigateTo({ uni.navigateTo({
url: '/pages/resource/articeDetail?id=' + item.objId url: '/pages/resource/articeDetail?id=' + item.id
}); });
}, },
toQaDetail(item) { toQaDetail(item) {