import httpRequestApi from '../../../utils/APIClient'; import { formatDate } from '../../../utils/util'; Page({ data: { messageList: [], totalNo: 1, totalSize: 0, index: 1, statusbarobj: { isshowbtn: false, //是否显示按钮 title: "朗读小咖秀", //标题 }, }, onLoad: function(options) { wx.setNavigationBarTitle({ title: '消息列表' }) this.getMessage(); }, getMessage: function() { console.log(this.data.totalNo) console.log(this.data.index) if (this.data.totalNo < this.data.index) { return; } httpRequestApi.getMessageList(this.data.index, 10).success((res) => { res.data.data.list.forEach(item => { item.gmtCreated = formatDate(item.gmtCreated, 1) this.data.messageList.push(item); }) this.setData({ messageList: this.data.messageList, totalNo: res.data.data.totalNo, index: this.data.index + 1 }) httpRequestApi.refreshMessageStatus().success((res) => { console.log(res) }) }); }, onReachBottom: function() { this.getMessage(); }, onShareAppMessage() { return { title: '课文朗读,从未如此有趣。', path: `/pages/index/index?uid=${wx.getStorageSync('uid')}`, imageUrl: 'http://reader-wx.ai160.com/images/reader/v3/shareContent.png' } } })