liukangdong
2024-08-05 00bf17838b496e6fcfed2e521f9c27f8f0e3e3c7
wechat_jiaxuan/pages/detailDis/product.js
@@ -1,7 +1,9 @@
import {
  getProductInfo,
  actionDo
  actionDo,
  getMemberInfo
} from '../../api/index'
import { eventBus } from '../../utils/eventBus'
Page({
  /**
   * 页面的初始数据
@@ -14,7 +16,10 @@
    isFold: false,
    info: {},
    member: {},
    showShare: false
    showShare: false,
    options: {
      empty: '无参数'
    }
  },
  changeFold() {
    this.setData({ isFold: !this.data.isFold })
@@ -26,6 +31,12 @@
      id: options.id
    })
  },
  onUnload() {
    console.log('详情进行了销毁');
    setTimeout(() => {
      eventBus.emit('productDeBack', this.data.info)
    }, 500)
  },
  onLoad(options) {
    var app = getApp().globalData
    this.setData({
@@ -34,10 +45,8 @@
    if (options.origin && options.origin == 'b') {
      this.setData({ origin: 'b' })
    }
    const member = wx.getStorageSync('member')
    this.setData({
      id: options.id,
      member
      id: options.id
    })
  },
  bindchange(e) {
@@ -66,9 +75,8 @@
  handleAction(e) {
    const actionType = e.currentTarget.dataset.code
    const {
      info
      info, member
    } = this.data
    const member = wx.getStorageSync('member')
    if (member.authStatus == '0') {
      return wx.navigateTo({
        url: '/pages/auth/auth',
@@ -84,6 +92,7 @@
      })
      wx.showToast({
        title: actionType == 'collect' ? '收藏成功' : '取消收藏',
        icon: "none"
      })
    })
  },
@@ -98,6 +107,14 @@
      wx.setNavigationBarTitle({
        title: res.data.title
      })
      if(userId){
        getMemberInfo().then(res => {
          this.setData({ member: res.data })
          wx.setStorageSync('member', res.data)
        })
      }else{
        this.setData({ member: wx.getStorageSync('member') })
      }
    })
  },
  playVideo() {
@@ -189,9 +206,6 @@
    })
  },
  onHide() {
  },
  onUnload() {
  },
  onPullDownRefresh() {