// pages/fzpx/fzpx.js var app = getApp() Page({ /** * 页面的初始数据 */ data: { items: [] }, /** * 生命周期函数--监听页面加载 */ onLoad: function (options) { this.showList(); }, link: function (e) { var id = e.currentTarget.dataset['id']; var str = e.currentTarget.dataset['str']; var flag = e.currentTarget.dataset['flag']; wx.navigateTo({ url: '../' + str + '/' + str + '?id=' + id + '&flag=' + flag }) }, showList: function () { var that = this; wx.showLoading(); wx.request({ url: app.globalData.url + '/api/activity/preview', data: { page: 1, size: 1000, userId: wx.getStorageSync("user").id, type: 'act_3' }, success: function (res) { wx.hideLoading(); console.log('res', res); if (res.data.code == 0) { let content = res.data.data.content.map(({ startTime, ...i }) => ({ ...i, startTime: app.formatDate(startTime), })); that.setData({ items: content }) } else { wx.showToast({ title: res.data.msg, }) } } }) } })