aa
jiangping
2024-08-01 3134c86bd9e7596db5ecb6aa2ca996483c3de6f0
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 })
@@ -25,6 +30,28 @@
      actionType: 'view',
      id: options.id
    })
    const member = wx.getStorageSync('member') || {}
    if(!member.id){
      getMemberInfo().then(res => {
        this.setData({
          member: res.data
        })
      })
    }
  },
  onShow() {
    const member = wx.getStorageSync('member') || {}
    if(member && member.id){
      this.setData({
        member
      })
    }
  },
  onUnload() {
    console.log('详情进行了销毁');
    setTimeout(() => {
      eventBus.emit('productDeBack', this.data.info)
    }, 500)
  },
  onLoad(options) {
    var app = getApp().globalData
@@ -34,10 +61,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 +91,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 +108,7 @@
      })
      wx.showToast({
        title: actionType == 'collect' ? '收藏成功' : '取消收藏',
        icon: "none"
      })
    })
  },
@@ -189,9 +214,6 @@
    })
  },
  onHide() {
  },
  onUnload() {
  },
  onPullDownRefresh() {