liukangdong
2024-07-18 5b219a9694c8d69db42e746a654c779cc6a61bf6
wechat_jiaxuan/pages/consult/detail.js
@@ -1,12 +1,14 @@
// pages/consult/detail.js
import { shareContent, getProductNewsInfo } from '../../api/index'
Page({
  /**
   * 页面的初始数据
   */
  data: {
    navTitle: '详情',
    bottomLift: 0
    bottomLift: 0,
    info: {},
    showShare: false
  },
  /**
@@ -17,25 +19,30 @@
    this.setData({
      bottomLift: app.bottomLift
    })
    this.getDetail(options.id)
  },
  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady() {
  getDetail(id) {
    getProductNewsInfo({ id }).then(res => {
      this.setData({ detail: res.data })
    })
  },
  /**
   * 生命周期函数--监听页面显示
   */
  onShow() {
  openShare() {
    this.setData({showShare: true})
  },
  /**
   * 生命周期函数--监听页面隐藏
   */
  handleShare() {
    console.log('点击了分享');
    shareContent(this.data.info.id)
  },
  // onShareAppMessage: function () {
  //   // let { productDetail, userInfo } = this.data
  //   return {
  //     title: productDetail.title,
  //     path: '/pages/index/index?id=' + productDetail.id + '&shareuserid=' + userInfo.id + '&type=0'
  //   }
  // },
  onClose() {
    this.setData({showShare: false})
  },
  onHide() {
  },