// 小程序分享
onShareAppMessage: function( options ){
var that = this;
// 设置菜单中的转发按钮触发转发事件时的转发内容
var shareObj = {
title: "", // 默认是小程序的名称
path:"", // 默认是当前页面,必须是以‘/’开头的完整路径
imageUrl: '', //自定义图片路径,可以是本地文件路径、代码包文件路径或者网络图片路径,支持PNG及JPG
success: function(res){
// 转发成功之后的回调
if(res.errMsg == 'shareAppMessage:ok'){
}
},
fail: function(){
// 转发失败之后的回调
if(res.errMsg == 'shareAppMessage:fail cancel'){
wx.showToast({
icon:"none",
title:"转发取消",
})
// 用户取消转发
}else if(res.errMsg == 'shareAppMessage:fail'){
// 转发失败,其中 detail message 为详细失败信息
wx.showToast({
icon:"none",
title:"转发失败",
})
}
},
complete: function(){
// 转发结束之后的回调(转发成不成功都会执行)
}
};
// 返回shareObj
return shareObj;
},
// 小程序支付
wx.requestPayment({
timeStamp: res.data.timeStamp,
nonceStr: res.data.nonceStr,
package: res.data.package,
signType: res.data.signType,
paySign: res.data.paySign,
// 支付成功的回调
success(res){
console.log(res)
if(res.errMsg=="requestPayment:ok"){
wx.showToast({
icon:"success",
title:"缴费成功"
})
}
},
// 支付失败回调
fail(res) {
wx.showToast({
icon:"none",
title:"支付失败"
})
}
})