import { getZhongTaiProductNewsPage, getCatalogList } from '../../api/index' Page({ /** * 页面的初始数据 */ data: { category: [], secondCategory: ['级分类','级分类','级分类','级分类','级分类','级分类'], activeCate: '', seActiveCate: '', dataList: [], total: 0, pageNum: 1, pageSize: 10, }, onLoad(options) { this.getCate() this.getList() }, getCate() { getCatalogList({catalogCode: 'product_info'}).then(res => { this.setData({ category: res.data }) }) }, itemClick(e) { const { id } = e.currentTarget.dataset wx.navigateTo({ url: '/pages/consult/detail?id='+id, }) }, getList() { const { pageNum, pageSize, activeCate } = this.data getZhongTaiProductNewsPage({ pageNum, pageSize, catalogCode: activeCate }).then(res => { if(res.data){ this.setData({ dataList: res.data.records,total: res.data.records.total }) } }) }, cateClick(e) { const { code } = e.currentTarget.dataset this.setData({ activeCate: code }) this.getList() }, seCateClick(e) { const { index } = e.currentTarget.dataset console.log(index); }, onReady() { }, /** * 生命周期函数--监听页面显示 */ onShow() { }, /** * 生命周期函数--监听页面隐藏 */ onHide() { }, /** * 生命周期函数--监听页面卸载 */ onUnload() { }, /** * 页面相关事件处理函数--监听用户下拉动作 */ onPullDownRefresh() { }, /** * 页面上拉触底事件的处理函数 */ onReachBottom() { }, /** * 用户点击右上角分享 */ onShareAppMessage() { } })