消息页面

This commit is contained in:
zhaofang
2022-11-10 16:28:15 +08:00
parent b4493ca981
commit 65657fe239
3 changed files with 246 additions and 22 deletions

View File

@@ -16,7 +16,7 @@
></u-tabs>
</view>
<view class="" v-show="tab == 0">
<system-news></system-news>
<system-news :items="message.list" @loadMessage="loadMessage"></system-news>
</view>
<view class="" v-show="tab == 1">
<at-my :items="data"></at-my>
@@ -32,6 +32,7 @@
import apiQa from '@/api/modules/qa.js'
import apiComments from '../../api/modules/comments.js';
import apiUser from '@/api/system/user.js'
import apiMessage from '@/api/system/message.js';
export default {
data() {
return {
@@ -48,26 +49,86 @@
type:null,//当前只限于文章
pageSize:10,//条数
},//查询条件
message:{
list:[],
total:0
},
queryData: {
pageIndex: 1,
pageSize: 10
},
}
},
onLoad() {
this.findData(true);
this.queryMessage(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'
if(this.tab == 0) {
if(this.message.list.length<this.message.total){
this.queryData.pageIndex++;
this.queryMessage(false);
this.loadStatus='more'
}else{
this.loadStatus='noMore'
}
} else {
if(this.data.length<this.total){
this.query.pageIndex++;
this.findData(false);
this.loadStatus='more'
}else{
this.loadStatus='noMore'
}
}
},
methods: {
loadMessage() {
console.log('1111')
this.queryMessage(true);
},
queryMessage(flag) {
if (flag) {
this.message.list = [];
this.queryData.pageIndex = 1;
}
uni.showLoading({ title: '加载中...' });
apiMessage.list(this.queryData).then(res => {
if (res.status == 200) {
let ids = [];
this.emptyControl=true
this.message.total = res.result.count;
if(res.result.list.length!=0){
res.result.list.forEach(item => {
// ids.push()
item.checked = false;
this.message.list.push(item);
});
// this.loadAuthorInfo(res.result.list,ids);
//设置已读
// let ids=[];
// for(let i=0;i<res.result.list.length;i++){
// if(!res.result.list[i].isRead){
// ids.push(res.result.list[i].id)
// }
// }
// apiMessage.updateIsRead(ids).then(res=>{
// if(res.status==200){
// }
// })
}
} else {
this.$refs.toast.show({ message: '获取数据失败', type: 'error' })
}
uni.hideLoading();
});
},
click(item) {
this.tab = item.index;
},