// pages/lianxi/index.js const api = require("../../utils/request.js"); Page({ /** * 页面的初始数据 */ data: { results: [ // {id:1,title:"开发需求",is_top:true,ifrom:"第一条咨询",update_time:"2022-10-01"} ], count:0, query: { page: 1, limit: 10, search:"" }, type_: {1:"技能大赛",2:"铺装工匠",3:"培训信息",4:"大赛信息"}, }, /** * 生命周期函数--监听页面加载 */ onLoad: function (options) { this.data.query.type = options.type //type {1:"技能大赛",2:"铺装工匠",3:"培训信息",4:"大赛信息"} this.getList(this.data.query) wx.stopPullDownRefresh(); }, /** * 生命周期函数--监听页面初次渲染完成 */ onReady: function () { }, /** * 生命周期函数--监听页面显示 */ onShow: function () { }, getList: function () { var that = this api.request('/cms/article/', 'GET', that.data.query).then(res => { if (that.data.query.page == 1) { that.data.results = res.data.results } else { that.data.results = that.data.results.concat(res.data.results) } for(var i = 0;i