jiangping
2024-07-29 d9a89d83c2048a964f16ca179feb2b7f21b9d33a
wechat_staff/pages/detailDis/product.js
@@ -1,7 +1,8 @@
import {
  shareContent,
  getProductInfo,
  actionDo
  actionDo,
  refreshEnjoy
} from '../../api/index'
import moment from "moment";
Page({
@@ -10,10 +11,19 @@
   */
  data: {
    bottomLift: 0,
    current: 0,
    id: '',
    info: {},
    member: {},
    showShare: false
    showShare: false,
    enjoyList: []
  },
  onShow(){
    console.log('onShow')
    refreshEnjoy(this)
  },
  onHide() {
    console.log('onHide')
  },
  /**
   * 生命周期函数--监听页面加载
@@ -34,13 +44,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 +72,7 @@
        enjoyList.splice(index, 1)
      }
      wx.setStorageSync('enjoyList', enjoyList)
      refreshEnjoy(this)
    }else{
      actionDo({
        id: info.id,
@@ -70,6 +85,29 @@
        })
      })
    }
  },
  priviewBanner(e) {
    const url = e.currentTarget.dataset.url
    const {
      info
    } = this.data
    wx.previewImage({
      urls: info.bannerImgList,
      current: url
    })
  },
  bindchange(e) {
    this.setData({ current: e.detail.current })
  },
  priviewSpace(e) {
    const url = e.currentTarget.dataset.url
    const {
      info
    } = this.data
    wx.previewImage({
      urls: info.spaceList.map(i => i.spaceImg),
      current: url
    })
  },
  onShareAppMessage() {
    console.log('用户点击了分享');
@@ -183,6 +221,15 @@
  onHide() {
  },
  goTestPage(){
    wx.navigateTo({
      url: '/pages/webView/index',
      success: function(res) {
        // 通过eventChannel向被打开页面传送数据
        res.eventChannel.emit('data',{link:'http://crmtest.zhibang.com:8000/core/oauth/authorize/jump?timestamp=-465385833&agent_phone_number=18055151023&bindKey=mpAddIntention&sign=cdfe13abfe2727b40eee160085c80d11'} );
      }
    })
  },
  onUnload() {
  },