aa
jiangping
2024-08-02 7dc29ed74ebaa8a0e66f68264d9a13f95dc3af21
wechat_staff/pages/discover/discover.js
@@ -1,4 +1,6 @@
import { getCataLogTagList, getCatalogList } from '../../api/index'
import { getCataLogTagList, getCatalogList,refreshEnjoy } from '../../api/index'
const { HYEventBus } = require('hy-event-store')
const eventBus = new HYEventBus()
Page({
  /**
@@ -15,7 +17,34 @@
  onLoad(options) {
    let menuButtonInfo = wx.getMenuButtonBoundingClientRect();
    this.setData({menuButtonInfo})
  },
  },
  onShow(){
    refreshEnjoy(this)
    this.refreshDatacount()
    let discoverKey = wx.getStorageSync('discoverKey') || ''
    if(discoverKey){
      this.setData({ catalogCode: discoverKey })
      setTimeout(() => {
        wx.setStorageSync('discoverKey', '')
      }, 500)
    }
  },
  refreshDatacount(){
    var child =null;
    if(this.data.catalogCode == 'product_intro'){
      child = this.selectComponent(".disProduct")
    }else if(this.data.catalogCode == 'whole_case'){
      child = this.selectComponent(".disCase")
    }else if(this.data.catalogCode == 'real_case'){
      child = this.selectComponent(".disRealpic")
    }
    // 调用子组件中定义的方法
    if(child){
      child.refreshCount();
    }
  },
  tabsClick(e) {
    const catalogCode = e.currentTarget.dataset.code
    this.setData({catalogCode})
@@ -24,13 +53,6 @@
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady() {
  },
  /**
   * 生命周期函数--监听页面显示
   */
  onShow() {
  },