// pages/message-list/index.js Page({ data: { messageList: [] }, onLoad: function (options) { this.loadMessageList(); }, loadMessageList: function () { // 模拟加载消息列表 const messageList = [ { id: 1, type: 'system', name: '系统通知', avatar: 'https://mmbiz.qpic.cn/mmbiz/icTdbqWNOwNRna42FI242Lcia07jQodd2FJGIYQfG0LAJGFxM4FbnQP6yfMxBgJ0F3YRqJCJ1aPAK2dQagdusBZg/0', content: '您有一条新的系统通知', time: '刚刚', unread: 1 }, { id: 2, type: 'service', name: '客服中心', avatar: 'https://mmbiz.qpic.cn/mmbiz/icTdbqWNOwNRna42FI242Lcia07jQodd2FJGIYQfG0LAJGFxM4FbnQP6yfMxBgJ0F3YRqJCJ1aPAK2dQagdusBZg/0', content: '您好,请问有什么可以帮助您的?', time: '5分钟前', unread: 0 }, { id: 3, type: 'order', name: '订单通知', avatar: 'https://mmbiz.qpic.cn/mmbiz/icTdbqWNOwNRna42FI242Lcia07jQodd2FJGIYQfG0LAJGFxM4FbnQP6yfMxBgJ0F3YRqJCJ1aPAK2dQagdusBZg/0', content: '您的订单已发货', time: '1小时前', unread: 0 } ]; this.setData({ messageList: messageList }); }, onMessageTap: function (e) { // 跳转到消息详情页 wx.navigateTo({ url: '/pages/chat-detail/index?id=' + e.currentTarget.dataset.id }); }, onPullDownRefresh: function () { this.loadMessageList(); wx.stopPullDownRefresh(); } });