// 微信分享
var wx = require('wechat-sdk');
rewardsResultService.getWechatInfo().then(function(data) {
var conf = data;
wx.config({
debug: false,
appId: 'wx34e783920b37ee91',
timestamp: conf.timestamp,
nonceStr: conf.noncestr,
signature: conf.signature,
jsApiList: ['onMenuShareAppMessage', 'onMenuShareTimeline','onMenuShareQQ']
});
configWeChatInterface();
});
var iconUrl = 'http://'+location.host+'/images/icon-200yuan.png';
function configWeChatInterface() {
//分享给朋友
wx.onMenuShareAppMessage({
title: '一言不合就发红包,金蛛送您200元红包!',
desc: '一言不合就发红包,金蛛送您200元红包!',
link: location.href,
imgUrl: iconUrl,
type: 'link',
success: function() {
// alert('share success');
},
cancel: function() {
}
});
//分享到朋友圈
wx.onMenuShareTimeline({
title: '一言不合就发红包,金蛛送您200元红包!',
link: location.href, // 分享链接
imgUrl: iconUrl
});
//分享到QQ
wx.onMenuShareQQ({
title: '一言不合就发红包,金蛛送您200元红包!', // 分享标题
desc: '一言不合就发红包,金蛛送您200元红包!', // 分享描述
link: location.href, // 分享链接
imgUrl: iconUrl, // 分享图标
success: function () {
// 用户确认分享后执行的回调函数
},
cancel: function () {
// 用户取消分享后执行的回调函数
}
});
}
如果觉得《前端做微信好友分享_Javascript 实现微信分享(QQ 朋友圈 分享给朋友)》对你有帮助,请点赞、收藏,并留下你的观点哦!