Page({ /** * 页面的初始数据 */ data: { userInfo: getApp().globalData.userInfo }, /** * 生命周期函数--监听页面加载 */ onLoad: function (options) { console.log(this.data.userInfo) }, closeShare(){ let userInfo = getApp().globalData.userInfo console.log(userInfo) wx.navigateTo({ url: `/pages/out/index?index=1&userid=${userInfo.openid}&gameid=1&type=2&url=`+ getApp().globalData.gameurl }) }, /** * 生命周期函数--监听页面初次渲染完成 */ onReady: function () { }, /** * 生命周期函数--监听页面显示 */ onShow: function () { }, /** * 生命周期函数--监听页面隐藏 */ onHide: function () { }, /** * 生命周期函数--监听页面卸载 */ onUnload: function () { }, /** * 页面相关事件处理函数--监听用户下拉动作 */ onPullDownRefresh: function () { }, /** * 页面上拉触底事件的处理函数 */ onReachBottom: function () { }, /** * 用户点击右上角分享 */ onShareAppMessage: function (e) { // console.log(getApp().globalData.userInfo.id) this.shareFun() return { title: '万套房源5折起,iPhone13 Pro Max免费赢!速来!', imageUrl: 'https://static.quhouse.com/468340e3a1374decb4fa51a172aa4f52.png', path: '/pages/index/index?id=' + getApp().globalData.userInfo.id } }, shareFun(){ let token = getApp().globalData.token wx.request({ url: getApp().globalData.httpurl +'ar/user/share', method: "POST", data: {}, header: { Authorization: 'bearer '+ token }, success(res) { console.log(res) if (res.data.code == 0) { }else{ wx.showToast({ icon: 'none', title: res.data.msg }) return ; } } }) } })