|
|
@@ -67,6 +67,7 @@
|
|
|
</uni-list>
|
|
|
|
|
|
</view>
|
|
|
+ <u-toast ref="uToast"></u-toast>
|
|
|
</view>
|
|
|
</template>
|
|
|
|
|
|
@@ -76,7 +77,7 @@
|
|
|
updateNotifyMessageReadByIdAPI
|
|
|
} from '@/api/wt/index.js'
|
|
|
|
|
|
- let [page, isEnd] = [1, false]
|
|
|
+ // let [page, isEnd] = [1, false]
|
|
|
export default {
|
|
|
|
|
|
data() {
|
|
|
@@ -92,23 +93,38 @@
|
|
|
messageStatus: {
|
|
|
0: '已读',
|
|
|
1: '未读'
|
|
|
- }
|
|
|
+ },
|
|
|
+ page: 1,
|
|
|
+ size: 10,
|
|
|
+ isEnd: false,
|
|
|
+ userInfo: ''
|
|
|
}
|
|
|
},
|
|
|
onReachBottom() {
|
|
|
- if (isEnd) return
|
|
|
- page++
|
|
|
+ console.log(this.isEnd, this.page);
|
|
|
this.getList()
|
|
|
},
|
|
|
onShow() {
|
|
|
- page = 1
|
|
|
- this.getList()
|
|
|
+ this.doSearch();
|
|
|
+ },
|
|
|
+ onLoad() {
|
|
|
+ this.userInfo = uni.getStorageSync("userInfo")
|
|
|
+ console.log(this.userInfo);
|
|
|
},
|
|
|
methods: {
|
|
|
+ doSearch() {
|
|
|
+ this.isEnd = false;
|
|
|
+ this.page = 1;
|
|
|
+ this.list = []
|
|
|
+ this.getList();
|
|
|
+ },
|
|
|
//已读操作
|
|
|
async handleRead(item) {
|
|
|
- await updateNotifyMessageReadByIdAPI([item.id]);
|
|
|
- this.getList()
|
|
|
+ const res = await updateNotifyMessageReadByIdAPI([item.id]);
|
|
|
+ if (res.code == 0) {
|
|
|
+ this.list.find(data => item.id === data.id).readStatus = 1
|
|
|
+ }
|
|
|
+ // this.getList()
|
|
|
},
|
|
|
toggleChecked() {
|
|
|
this.checkShow = !this.checkShow
|
|
|
@@ -124,23 +140,39 @@
|
|
|
this.list.filter(i => i.messageStatus == 1).map(i => i.id),
|
|
|
0
|
|
|
)
|
|
|
- page = 1
|
|
|
+ this.page = 1
|
|
|
this.getList()
|
|
|
},
|
|
|
//获取我的消息列表数据
|
|
|
async getList() {
|
|
|
- let userInfo = wx.getStorageSync("userInfo");
|
|
|
- const params = {
|
|
|
- pageNum: page,
|
|
|
- size: 8,
|
|
|
- userId: userInfo.userId
|
|
|
+
|
|
|
+ if (this.isEnd) {
|
|
|
+ this.$refs.uToast.show({
|
|
|
+ message: "暂无更多数据",
|
|
|
+ duration: 1000
|
|
|
+ })
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ uni.showLoading({
|
|
|
+ title: '加载中'
|
|
|
+ })
|
|
|
+
|
|
|
+ let params = {
|
|
|
+ pageNum: this.page,
|
|
|
+ size: this.size,
|
|
|
+ userId: this.userInfo.userId
|
|
|
}
|
|
|
+ console.log(params);
|
|
|
let res = await notifyMessagePageAPI(params)
|
|
|
- if (params.page === 1) {
|
|
|
- this.list = []
|
|
|
+ if (params.pageNum === 1) {
|
|
|
+ this.list = res.list
|
|
|
+ } else {
|
|
|
+ this.list.push(...res.list)
|
|
|
}
|
|
|
- this.list.push(...res.list)
|
|
|
- isEnd = this.list.length >= res.count
|
|
|
+ this.page += 1
|
|
|
+ this.isEnd = this.list.length >= res.count;
|
|
|
+
|
|
|
},
|
|
|
handleTo(e) {
|
|
|
console.log(e)
|