liukangdong
2024-07-18 5b219a9694c8d69db42e746a654c779cc6a61bf6
wechat_jiaxuan/pages/homeId/index.js
@@ -1,17 +1,27 @@
// pages/consult/consult.js
import { getCataLogTagList, pageZSZXContentList } from '../../api/index'
Page({
  /**
   * 页面的初始数据
   */
  data: {
    category: ['新品上市', '专利证书', '大牌授权','新品上市', '专利证书', '大牌授权'],
    secondCategory: ['级分类','级分类','级分类','级分类','级分类','级分类'],
    tagList: [],
    activeCate: '',
    seActiveCate: '',
    dataList: []
  },
    dataList: [],
    pageNum: 1,
    pageSize: 10,
    code: '',
    tagCodes: ''
  },
  onLoad(options) {
    wx.setNavigationBarTitle({
      title: options.name
   })
    this.setData({ code: options.code})
    this.getTabList()
    this.getList()
  },
  itemClick(e) {
    const { id } = e.target.dataset
    console.log(e.target.dataset);
@@ -20,20 +30,42 @@
    })
  },
  cateClick(e) {
    const { index } = e.target.dataset
    console.log(index);
    const { code } = e.target.dataset
    this.setData({
      tagCodes: code,
      pageNum: 1,
      dataList: []
    })
    this.getList()
  },
  seCateClick(e) {
    const { index } = e.target.dataset
    console.log(index);
  getTabList() {
    getCataLogTagList({
      catalogCode: this.data.code
    }).then(res => {
      if(res && res.data && res.data.length > 0){
        this.setData({
          tagList: res.data[0].valueVos
        })
      }
    })
  },
  onLoad(options) {
  getList(){
    const { code, tagCodes, pageSize, pageNum } = this.data
    pageZSZXContentList({
      catalogCode: code,
      tagCodes,
      pageSize,
      pageNum
    }).then(res => {
      this.setData({
        dataList: [ ...this.data.dataList, ...res.data.records ]
      })
    })
  },
  onReachBottom() {
  },
  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady() {
  },