// pages/certificate/certificate.js var urlPath = require('../../config.js'); Page({ /** * 组件的属性列表 */ properties: { }, /** * 组件的初始数据 */ data: { host: urlPath.host, list: [], page: 1, size: 10, }, // 获取证书列表信息 getList: function() { var that = this that.getNewsData(); }, getNewsData: function() { var that = this wx.request({ url: urlPath.getCertificate, header: { 'content-type': 'application/x-www-form-urlencoded' }, dataType: 'json', // 添加这个配置 method: 'post', data: { openid: wx.getStorageSync('openid'), page: that.data.page, size: that.data.size }, success(res) { var list = that.data.list; var this_data = JSON.parse(res.data.data); if (res.data.result == 'success' && this_data.length > 0) { console.log(list.concat(this_data)); that.setData({ list: list.concat(this_data), page: that.data.page + 1 }) } } }); }, /** * 页面上拉触底事件的处理函数 */ onReachBottom: function() { this.getNewsData() }, /** * 生命周期函数--监听页面加载 */ onLoad: function(options) { this.getList() }, /** * 组件的方法列表 */ methods: { }, img_url: function(e) { var imgurl = e.currentTarget.dataset.imgurl; // console.log('/pages/certificate_detail/certificate_detail?imgurl='+imgurl) wx.navigateTo({ url: '/pages/certificate_detail/certificate_detail?imgurl='+imgurl, }) } })