// 创建全局mixin
export default {
  onLoad() {
    // 开启分享功能
    uni.showShareMenu({
      withShareTicket: true,
      menus: ['shareAppMessage', 'shareTimeline']
    })
  },
  
  onShareAppMessage() {
    return {
      title: this.shareTitle || 'AI 诊病虫，智控赋新农~',
      path: this.sharePath || '/pages/index/index',
      imageUrl: this.shareImage || ''
    }
  },
  
  // 朋友圈
  onShareTimeline() {
    return {
      title: this.timelineTitle || 'AI 诊病虫，智控赋新农~',
      query: this.timelineQuery || '',
      imageUrl: this.timelineImage || ''
    }
  },
  
  data() {
    return {
      shareTitle: '',
      sharePath: '',
      shareImage: '',
      timelineTitle: '',
      timelineQuery: '',
      timelineImage: ''
    }
  }
}