weixin 分享

微信JS-SDK说明文档

http://mp.weixin.qq.com/wiki/7/aaa137b55fb2e0456bf8dd9148dd613f.html#.E6.AD.A5.E9.AA.A4.E4.B8.80.EF.BC.9A.E7.BB.91.E5.AE.9A.E5.9F.9F.E5.90.8D

< script type = "text/javascript" > 
//微信分享 beg
var _title = '分享标题';
var _desc = '分享简介';
var _imgUrl = '';
weixinJS.jsApiListData = ['onMenuShareTimeline', 'onMenuShareAppMessage'];
weixinJS.cbWeiXinRun = function() {
    //朋友圈
    wx.onMenuShareTimeline({
        title: _title,
        imgUrl: _imgUrl,
        success: function() {
            alert('333');
            $('.p5').show().siblings('.p').hide();

        },
        cancel: function() {
            // 用户取消分享后执行的回调函数
            }

    });
    //朋友
    wx.onMenuShareAppMessage({
        title: _title,
        desc: _desc,
        imgUrl: _imgUrl,
        success: function() {
            alert('333');
            $('.p5').show().siblings('.p').hide();

        },
        cancel: function() {
            alert('333');
            // 用户取消分享后执行的回调函数

        }

    });

}
//微信分享 end
 < /script>/

 

wx.onMenuShareTimeline({
    title: '互联网之子',
    link: 'http://wx.vland.cc/mobile.php?act=module&rid=406&fromuser=oktsYuHivHXuzdsMeCbWyF7b14UU&name=hllihe&do=sharelihe&weid=7',
    imgUrl: 'http://wx.vland.cc/resource/attachment/images/7/2015/01/fl2Lk2p5o3iOJP3jdp9iPXI9i93iPm.jpg',
    trigger: function(res) {
        alert('用户点击分享到朋友圈');
    },
    success: function(res) {
        alert('已分享');
    },
    cancel: function(res) {
        alert('已取消');
    },
    fail: function(res) {
        alert('wx.onMenuShareTimeline:fail: ' + JSON.stringify(res));
    }
});

 

posted on 2015-08-26 11:59  bandbandme  阅读(263)  评论(0编辑  收藏  举报