码迷,mamicode.com
首页 > 微信 > 详细

[转]微信转载朋友圈时的窗口自定义及回调

时间:2014-08-26 21:06:56      阅读:404      评论:0      收藏:0      [点我收藏+]

标签:des   blog   http   java   io   for   ar   art   div   

From : http://blog.csdn.net/liangpei2008/article/details/19980093

var dataForWeixin={
   appId:"xxxxxxxxx",
   MsgImg:"转发时的图片",
   TLImg:"图片",
   url:"自定义链接",
   title:"自定义标题",
   desc:"自定义描述",
   fakeid:"",
   callback:function(
    //这里是分享成功后的回调功能
   ){}
};
(function(){
   var onBridgeReady=function(){
   //发送给朋友
   WeixinJSBridge.on(‘menu:share:appmessage‘, function(argv){
      WeixinJSBridge.invoke(‘sendAppMessage‘,{
         "appid":dataForWeixin.appId,
         "img_url":dataForWeixin.MsgImg,
         "img_width":"120",
         "img_height":"120",
         "link":dataForWeixin.url,
         "desc":dataForWeixin.desc,
         "title":dataForWeixin.title
      }, function(res){(dataForWeixin.callback)();});
   });
   //发送到朋友圈
   WeixinJSBridge.on(‘menu:share:timeline‘, function(argv){
      
      WeixinJSBridge.invoke(‘shareTimeline‘,{
         "img_url":dataForWeixin.TLImg,
         "img_width":"120",
         "img_height":"120",
         "link":dataForWeixin.url,
         "desc":dataForWeixin.desc,
         "title":dataForWeixin.title
      }, function(res){(dataForWeixin.callback)();});});
   //分享到微博
   WeixinJSBridge.on(‘menu:share:weibo‘, function(argv){
      WeixinJSBridge.invoke(‘shareWeibo‘,{
         "content":dataForWeixin.title,
         "url":dataForWeixin.url
      }, function(res){(dataForWeixin.callback)();});
   });
   //分享到facebook
   WeixinJSBridge.on(‘menu:share:facebook‘, function(argv){
      (dataForWeixin.callback)();
      WeixinJSBridge.invoke(‘shareFB‘,{
         "img_url":dataForWeixin.TLImg,
         "img_width":"120",
         "img_height":"120",
         "link":dataForWeixin.url,
         "desc":dataForWeixin.desc,
         "title":dataForWeixin.title
      }, function(res){});
   });
};
if(document.addEventListener){
   document.addEventListener(‘WeixinJSBridgeReady‘, onBridgeReady, false);
}else if(document.attachEvent){
   document.attachEvent(‘WeixinJSBridgeReady‘   , onBridgeReady);
   document.attachEvent(‘onWeixinJSBridgeReady‘ , onBridgeReady);
}
})();

http://bbs.blueidea.com/thread-3103040-1-1.html

http://www.baidu.com/s?ie=utf-8&f=3&rsv_bp=1&tn=baidu&wd=weixinjsbridge.invoke%20sendappmessage&rsv_enter=1&rsv_sug3=1&rsv_sug4=45&rsv_sug1=1&oq=sendAppMessage&rsv_sug2=1&rsp=0&inputT=4729

[转]微信转载朋友圈时的窗口自定义及回调

标签:des   blog   http   java   io   for   ar   art   div   

原文地址:http://www.cnblogs.com/Athrun/p/3938080.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!