标签:
//发送给好友成功
res.err_msg=="send_app_msg:ok"
//分享到朋友圈成功
res.err_msg=="share_timeline:ok"
//分享到微博成功
res.err_msg=="share_weibo:ok"
document.addEventListener(‘WeixinJSBridgeReady‘, function onBridgeReady() {
// 发送给好友
WeixinJSBridge.on(‘menu:share:appmessage‘, function (argv) {
WeixinJSBridge.invoke(‘sendAppMessage‘, {
"img_url": window.shareData.imgUrl,
"img_width": "640",
"img_height": "640",
"link": window.shareData.sendFriendLink,
"desc": window.shareData.fContent,
"title": window.shareData.fTitle
}, function (res) {
//分享给好友成功
if(res.err_msg=="send_app_msg:ok"){
$.get("处理积分地址",function(data){
var sjon_data = $.parseJSON(data);
if(sjon_data.message){
alert(sjon_data.message);
}
//alert( res.err_msg);
});
}
_report(‘send_msg‘, res.err_msg);
})
});
}, false);
完整实例
document.addEventListener(‘WeixinJSBridgeReady‘, function onBridgeReady() {
// 发送给好友
WeixinJSBridge.on(‘menu:share:appmessage‘, function (argv) {
WeixinJSBridge.invoke(‘sendAppMessage‘, {
"img_url": window.shareData.imgUrl,
"img_width": "640",
"img_height": "640",
"link": window.shareData.sendFriendLink,
"desc": window.shareData.fContent,
"title": window.shareData.fTitle
}, function (res) {
//分享给好友成功
if(res.err_msg=="send_app_msg:ok"){
$.get("<?php echo $this->createAbsoluteUrl(‘Weiwxmember/SharePoint‘,array(‘url‘=>Yii::app()->request->hostInfo.Yii::app()->request->getUrl(),‘uid‘=>Yii::app()->request->getParam(‘uid‘) )) ; ?>",function(data){
var sjon_data = $.parseJSON(data);
if(sjon_data.message){
alert(sjon_data.message);
}
//alert( res.err_msg);
});
}
_report(‘send_msg‘, res.err_msg);
})
});
// 分享到朋友圈
WeixinJSBridge.on(‘menu:share:timeline‘, function (argv) {
WeixinJSBridge.invoke(‘shareTimeline‘, {
"img_url": window.shareData.imgUrl,
"img_width": "640",
"img_height": "640",
"link": window.shareData.timeLineLink,
"desc": window.shareData.tContent,
"title": window.shareData.tTitle
}, function (res) {
alert(res.err_msg);
_report(‘timeline‘, res.err_msg);
//分享到朋友圈成功
if(res.err_msg=="share_timeline:ok"){
$.get("<?php echo $this->createAbsoluteUrl(‘Weiwxmember/SharePoint‘,array(‘url‘=>Yii::app()->request->hostInfo.Yii::app()->request->getUrl(),‘uid‘=>Yii::app()->request->getParam(‘uid‘) )) ; ?>",function(data){
var sjon_data = $.parseJSON(data);
if(sjon_data.message){
alert(sjon_data.message);
}
});
}
});
});
// 分享到微博
WeixinJSBridge.on(‘menu:share:weibo‘, function (argv) {
WeixinJSBridge.invoke(‘shareWeibo‘, {
"content": window.shareData.wContent,
"url": window.shareData.weiboLink
}, function (res) {
// alert(res.err_msg);
//分享到微博成功
if(res.err_msg=="share_weibo:ok"){
$.get("<?php echo $this->createAbsoluteUrl(‘Weiwxmember/SharePoint‘,array(‘url‘=>Yii::app()->request->hostInfo.Yii::app()->request->getUrl(),‘uid‘=>Yii::app()->request->getParam(‘uid‘) )) ; ?>",function(data){
var sjon_data = $.parseJSON(data);
if(sjon_data.message){
alert(sjon_data.message);
}
});
}
_report(‘weibo‘, res.err_msg);
});
});
}, false);
【转】http://jingyan.baidu.com/article/1974b289a3a5d1f4b1f774a7.html
标签:
原文地址:http://www.cnblogs.com/veimr/p/4240252.html