// pages/reportList/reportList.js const app = getApp() Page({ /** * 页面的初始数据 */ data: { reportList: [], page: { page: 1, rows: 10, visitsType: '', isHandle: 1 }, baseUrl: app.baseUrls.appealReportUrl, imgUrl: app.baseUrls.baseImgUrl, }, getList: function () { var self = this app.restAjax.get(app.restAjax.path(app.apis.reportList, [app.baseUrls.appealReportUrl]), self.data.page, { headers: { token: app.globalData.token } }, function (code, data) { if (data.rows.length > 0) { for (let i = 0; i < data.rows.length; i++) { data.rows[i].visitsPhoto = data.rows[i].visitsPhoto.split(',')[0] } self.setData({ reportList: data.rows }) } else { self.setData({ ['page.page']: self.data.page.page - 1 }) } }, function (code, data) { console.log(data) }) }, checkDetail: function (e) { wx.navigateTo({ url: '../reportDetail/reportDetail?visitsId=' + e.currentTarget.dataset.visit, }) }, checkHandle: function (e) { wx.navigateTo({ url: '../reportHandle/reportHandle?visitsId=' + e.currentTarget.dataset.visit, }) }, /** * 生命周期函数--监听页面加载 */ onLoad: function (options) { this.setData({ ['page.visitsType']: options.visitsType }) var title = '' if (options.visitsType == '355507a7-9d5a-4bad-9059-90975efbe754') { title = '我的诉求上报' } else if (options.visitsType == 'e4b1db45-4e15-46b5-8d46-c9f70b30a1c0') { title = '我的公众咨询' } else { title = '我的社情民意' } wx.setNavigationBarTitle({ title: title, }) this.getList() }, /** * 生命周期函数--监听页面初次渲染完成 */ onReady: function () { }, /** * 生命周期函数--监听页面显示 */ onShow: function () { }, /** * 生命周期函数--监听页面隐藏 */ onHide: function () { }, /** * 生命周期函数--监听页面卸载 */ onUnload: function () { }, /** * 页面相关事件处理函数--监听用户下拉动作 */ onPullDownRefresh: function () { }, /** * 页面上拉触底事件的处理函数 */ onReachBottom: function () { var self = this this.setData({ ['page.page']: self.data.page.page + 1 }) this.getList() }, /** * 用户点击右上角分享 */ onShareAppMessage: function () { } })