
const util = require("../../../utils/util");
const api = require('../../../api/api.js');
Page({
  data: {
    rid:'',
  },
  onLoad(options) {
		if(options.rid){
			this.setData({
				 rid:options.rid
			});
		}
    wx.showShareMenu({
			withShareTicket: true,
			menus: ['shareAppMessage', 'shareTimeline']
		})
	},
	onShareAppMessage: function () {
		let rid=this.data.rid;
	
		const promise =new Promise( resolve=> util.request(api.recordZzyShare, {
				userId: rid
			}, 'GET').then(res=>{
				console.log(res);
				if (res.errno === 0) {
					resolve({
						title: '鲸致生活，欢迎您的加入！',
						path: '/pages/upgrade/joinMaster/joinMaster?scene=rid%2C'+rid,
						imageUrl:'https://jzmall.lifejingzhi.com/file/wx-servant/share-card.jpg'
					})
				}
			})
		);

    return {
      // title: '立即加入',
			// path: '/pages/upgrade/joinMaster/joinMaster?scene=rid%2C'+rid,
      promise 
		}
	
	
  },

})
