[更新]
This commit is contained in:
@@ -8,30 +8,37 @@
|
||||
* 页面的初始数据
|
||||
*/
|
||||
data: {
|
||||
qrcode : '', //二维码
|
||||
userInfo : '', //我的信息
|
||||
isImgLay : false,//是否显示图片弹出层
|
||||
parentId : '', //是否分享进入
|
||||
shareState : false //显示分享朋友圈弹出层
|
||||
qrcode : '', //二维码
|
||||
userInfo : '', //我的信息
|
||||
isImgLay : false, //是否显示图片弹出层
|
||||
shareState : false, //显示分享朋友圈弹出层
|
||||
sharesData : '' //分享携带参数
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
onLoad (options) {
|
||||
// 判断是否由分享进入
|
||||
if(options.type == "share"){
|
||||
// 写入缓存
|
||||
this.setData({
|
||||
parentId: options.parent_id
|
||||
if(getApp().globalData.scene === 1155 && options.type === "shareLogin"){
|
||||
wx.switchTab({
|
||||
url: '/pages/index/index',
|
||||
})
|
||||
}
|
||||
wx.$api.user.myshare(this.data.parentId).then(res=>{
|
||||
|
||||
// 获取用户信息和二维码
|
||||
wx.$api.user.myshare('mini','','pages/index/index?type=shareLogin').then(res=>{
|
||||
this.setData({
|
||||
qrcode : res.data.qrcode,
|
||||
userInfo : res.data.user
|
||||
})
|
||||
}).catch(err=>{})
|
||||
|
||||
// 获取分享好友标题
|
||||
wx.$api.user.wechatShares().then(res=>{
|
||||
this.setData({
|
||||
sharesData: res.data
|
||||
})
|
||||
}).catch(err=>{})
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -176,20 +183,20 @@
|
||||
*/
|
||||
onShareAppMessage(){
|
||||
return {
|
||||
title : this.data.userInfo.nickname + "邀请您进入本时生活",
|
||||
imageUrl: "",
|
||||
path : "/pages/index/index?parent_id=" + this.data.userInfo.user_id + "&type=share"
|
||||
title : this.data.userInfo.nickname + this.data.sharesData.title,
|
||||
path : "/pages/index/index?parent_id=" + this.data.userInfo.user_id + "&type=shareLogin",
|
||||
imageUrl: this.data.sharesData.image
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* 用户点击右上角分享朋友圈
|
||||
*/
|
||||
onShareTimeline () {
|
||||
return {
|
||||
title : this.data.userInfo.nickname + "邀请您进入本时生活",
|
||||
path : "/pages/index/index?parent_id=" + this.data.userInfo.user_id + "&type=share",
|
||||
imageUrl: ''
|
||||
}
|
||||
}
|
||||
// onShareTimeline () {
|
||||
// return {
|
||||
// title : this.data.userInfo.nickname + this.data.sharesData.title,
|
||||
// query : "type=shareLogin",
|
||||
// imageUrl: this.data.sharesData.image
|
||||
// }
|
||||
// }
|
||||
})
|
||||
Reference in New Issue
Block a user