消息@我的

This commit is contained in:
zhaofang
2022-11-09 19:16:20 +08:00
parent 1bbd397ba4
commit 6f961650d2
6 changed files with 343 additions and 77 deletions

View File

@@ -15,35 +15,23 @@
}"
></u-tabs>
</view>
<view class="news-page-btn">
<view class="btn-index">多选</view>
<view class="btn-index">清空</view>
<view class="btn-index">一键已读</view>
<view class="" v-show="tab == 0">
<system-news></system-news>
</view>
<view class="news-page-list">
<view class="list-index" v-for="item in 5">
<view class="list-index-img">
<image style="width:80upx;height:80upx" src="../../static/images/woman.png" mode=""></image>
</view>
<view class="list-index-cen">
<view class="cen-name">
李沐沐
</view>
<view class="cen-text">
收藏了你发布的课程···
</view>
</view>
<view class="list-index-time">
2022/9/20
</view>
</view>
<view class="" v-show="tab == 1">
<at-my :items="data"></at-my>
</view>
<view v-if="total>query.pageSize">
<uni-load-more :status="loadStatus"></uni-load-more>
</view>
</view>
</template>
<script>
import apiQa from '@/api/modules/qa.js'
import apiComments from '../../api/modules/comments.js';
import apiUser from '@/api/system/user.js'
export default {
data() {
return {
@@ -51,7 +39,32 @@
{name:'系统'},
{name:'@我的'}
],
tab:1,
tab:0,
data:[],//拿到的数据
total:0,//总条数
loadStatus:'more',//more,loading,noMore
query:{
pageIndex:1,//当前页
type:null,//当前只限于文章
pageSize:10,//条数
},//查询条件
}
},
onLoad() {
this.findData(true);
},
onPullDownRefresh() {
this.onReachBottom();
},
onReachBottom() {
console.log('111111')
this.loadStatus='loading';//more,loading,noMore
if(this.data.length<this.total){
this.query.pageIndex++;
this.findData(false);
this.loadStatus='more'
}else{
this.loadStatus='noMore'
}
},
methods: {
@@ -60,7 +73,54 @@
},
ubtab(num){
this.tab = num
}
},
findData(flag) {
uni.showLoading({ title: '加载中...' });
if(flag){
this.data=[]
this.pageIndex=1
}
apiComments.pagelist(this.query).then(res=>{
if (res.status == 200) {
this.total=res.result.count;
let ids = [];
if (res.result.list.length != 0) {
res.result.list.forEach(item=>{
ids.push(item.sysCreateAid);
item.authorInfo={avatar:'',name:'',code:'',sex:null};
this.data.push(item)
})
this.loadAuthorInfo(res.result.list,ids);
}
}else{
this.$refs.interactToast.show({message:'加载@我的评论失败',type:'error'});
}
uni.hideLoading();
})
},
loadAuthorInfo(list, ids) {
//加载作者信息,头像,机构信息
if (ids.length == 0) {
return;
}
const noReapetIds = [...new Set(ids)];
apiUser.getByIds(ids).then(res => {
if (res.status == 200) {
list.forEach((item, index) => {
res.result.some(author => {
if (author.aid == item.sysCreateAid) {
item.authorInfo = author;
return true;
} else {
return false;
}
});
});
} else {
console.log('加载用户信息失败:' + res.error);
}
});
},
}
}
</script>
@@ -72,57 +132,7 @@
.tabs-info{
padding: 0 254upx;
}
.news-page-btn{
height: 80upx;
padding: 30upx 32upx 0 36upx;
.btn-index{
font-size: 28upx;
color: #666666;
float: right;
margin-left: 20upx;
padding: 6upx 32upx 6upx 28upx;
border: 2upx solid rgba(153,153,153,0.2);
border-radius: 26upx;
}
.btn-index:first-child{
margin-left: 0;
float: left;
}
}
.news-page-list{
padding: 0 32upx 0 36upx;
box-sizing: border-box;
.list-index{
display: flex;
padding: 40upx 0;
border-bottom: 2upx solid rgba(153,153,153,0.1);;
.list-index-img{
width: 80upx;
}
.list-index-cen{
margin-left: 30upx;
width: 100%;
.cen-name{
font-size: 28upx;
font-weight: 500;
color: #333333;
margin-top: 4upx;
}
.cen-text{
font-size: 24upx;
color: #999999;
margin-top: 4upx;
}
}
.list-index-time{
margin-top: 4upx;
width: 130upx;
font-size: 24upx;
color: #999999;
}
}
}
}
</style>