liukangdong
2024-07-26 c7d7aff39b6566d05d3c0a080839c46bb2b6a8aa
wechat_staff/pages/detailDis/product.js
@@ -1,7 +1,8 @@
import {
  shareContent,
  getProductInfo,
  actionDo
  actionDo,
  refreshEnjoy
} from '../../api/index'
import moment from "moment";
Page({
@@ -13,7 +14,15 @@
    id: '',
    info: {},
    member: {},
    showShare: false
    showShare: false,
    enjoyList: []
  },
  onShow(){
    console.log('onShow')
    refreshEnjoy(this)
  },
  onHide() {
    console.log('onHide')
  },
  /**
   * 生命周期函数--监听页面加载
@@ -34,13 +43,17 @@
      member
    })
  },
  //  组件事件
  handleEnjoy(e) {
    const info = this.data.info
    if(info.id == null ){
      return
    }
    const enjoyList = wx.getStorageSync('enjoyList') || []
    const { type, flag } = e.detail
    console.log('type', type);
    console.log('flag', flag);
    const info = this.data.info
    console.log('flag', flag);
    if(type == 'enjoy'){
      // 点击了喜欢
      const index = enjoyList.findIndex( i => i.id === info.id )
@@ -58,6 +71,7 @@
        enjoyList.splice(index, 1)
      }
      wx.setStorageSync('enjoyList', enjoyList)
      refreshEnjoy(this)
    }else{
      actionDo({
        id: info.id,