k94314517
2024-08-07 a1664efbefb313784e1920ffc8cfceda2a2ea1c8
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,15 @@
      id: options.id
    })
  },
  onShow(){
    this.setData({ member: wx.getStorageSync('member') })
  },
  onUnload() {
    console.log('详情进行了销毁');
    setTimeout(() => {
      eventBus.emit('productDeBack', this.data.info)
    }, 500)
  },
  onLoad(options) {
    var app = getApp().globalData
    this.setData({
@@ -34,10 +48,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,10 +78,9 @@
  handleAction(e) {
    const actionType = e.currentTarget.dataset.code
    const {
      info
      info, member
    } = this.data
    const member = wx.getStorageSync('member')
    if (member.authStatus == '0') {
    if (!member.phone) {
      return wx.navigateTo({
        url: '/pages/auth/auth',
      })
@@ -84,6 +95,7 @@
      })
      wx.showToast({
        title: actionType == 'collect' ? '收藏成功' : '取消收藏',
        icon: "none"
      })
    })
  },
@@ -98,6 +110,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() {
@@ -119,6 +139,13 @@
    })
  },
  handleDesign() {
    const { member } = this.data
    if (!member.phone) {
      wx.setStorageSync('tempPath', '/pages/design/design')
      return wx.navigateTo({
        url: '/pages/auth/auth',
      })
    }
    wx.navigateTo({
      url: '/pages/design/design',
    })
@@ -189,9 +216,6 @@
    })
  },
  onHide() {
  },
  onUnload() {
  },
  onPullDownRefresh() {