问题描述
微信小程序如何请求接口成功后再去调用微信转发的接口
问题出现的环境背景及自己尝试过哪些方法
相关代码
// 请把代码文本粘贴到下方(请勿用图片代替代码)
<button formType="submit" wx:if="{{executorDtata.length==1}}" open-type="share">创建并邀请好友</button>
create:function(e){
console.log('2222222')
var that = this;
if (this.data.taskContent.replace(/\s+/g, '')){
wx.request({
url: getApp().globalData.url + '/createTack',
data: {
groupId: getApp().globalData.groupId,
isRepeat: this.data.listNoId ? 1 : 0,
taskContent: this.data.taskContent,
executeUserId: this.data.executorZid,
remindUserIds: this.data.remindNoZid,
remindTime: this.data.time,
remindWeek: this.data.listNoId,
flag: this.data.executorDtata.length > 1 ? 0 : 1
},
header: {
Authorization: getApp().globalData.token,
// formId: e.detail.formId
formId: 1
},
success: function (res) {
if (res.data.code == 100) {
that.onShareAppMessage()
}
}
})
}else{
wx.showToast({
title: '请您输入创建任务',
duration: 1000,
icon: 'none'
})
}
},
onShareAppMessage: function(ops) {
if (ops.from === 'button') {
console.log('1111111111')
return {
title: '小哥哥图片',
desc: '小哥哥图片',
path: '/pages/join/join?inviteUserId=' + this.data.shareZid + "&groupId=" + this.data.shareGroupId,
imageUrl: "../../images/userimg.jpg",
success: (res) => {
wx.reLaunch({
url: '../task/task',
})
},
fail: (res) => {
console.log("转发失败", JSON.stringify(res));
}
}
}
},
没太看懂
另外onShareAppMessage接口已经改了