// pages/matchList/matchList.js const app = getApp() Page({ /** * 页面的初始数据 */ data: { token: '', requestIp: '', pageList: [], type: '', hideSelect: false }, doSelect: function (e) { var self = this if(e.currentTarget.dataset.id == 1){ console.log('1') } else if (e.currentTarget.dataset.id == 2){ console.log('2') } else { console.log('3') } self.setData({ hideSelect: true }) }, checkall: function () { }, getMatchList: function () { var self = this wx.request({ url: self.data.requestIp + 'wxminiapp/article/listpagearticlebycategoryrelease', header: { 'token': self.data.token }, data: { articleCategoryId: '674b6d2a-637b-4f65-950e-1343b602574a' }, success: function (res) { if (res.statusCode == 200) { for (var i = 0; i < res.data.rows.length; i++) { res.data.rows[i].images = res.data.rows[i].images.split(',')[0] } self.setData({ pageList: res.data.rows }) } } }) }, getActivityList: function () { var self = this wx.request({ url: self.data.requestIp + 'wxminiapp/article/listpagearticlebycategoryrelease', header: { 'token': self.data.token }, data: { articleCategoryId: '48f0147d-5e12-493a-9d24-eb2d4f74064c' }, success: function (res) { for (var i = 0; i < res.data.rows.length; i++) { res.data.rows[i].images = res.data.rows[i].images.split(',')[0] } self.setData({ pageList: res.data.rows }) } }) }, goDetail: function (e) { wx.navigateTo({ url: '../newsDetail/newsDetail?articleContentId=' + e.currentTarget.dataset.id, }) }, hideSelect: function () { this.setData({ hideSelect: false }) }, getToken: function () { var self = this wx.getStorage({ key: 'token', success: function (res) { self.setData({ token: res.data }) if(self.data.type == 'match'){ console.log('match') self.getMatchList() }else{ console.log('activity') self.getActivityList() } }, }) }, /** * 生命周期函数--监听页面加载 */ onLoad: function (options) { this.setData({ requestIp: app.globalData.requestIp, type: options.type }) this.getToken() }, /** * 生命周期函数--监听页面初次渲染完成 */ onReady: function () { }, /** * 生命周期函数--监听页面显示 */ onShow: function () { }, /** * 生命周期函数--监听页面隐藏 */ onHide: function () { }, /** * 生命周期函数--监听页面卸载 */ onUnload: function () { }, /** * 页面相关事件处理函数--监听用户下拉动作 */ onPullDownRefresh: function () { }, /** * 页面上拉触底事件的处理函数 */ onReachBottom: function () { }, /** * 用户点击右上角分享 */ onShareAppMessage: function () { } })