调用微信分享

/* 调用微信分享 */
if(WeiXinSDK.isWeiXin() && share)
{
// 朋友圈
var WeiXin_data_Timeline =
{
title: share.title, // 分享标题
link: share.url, // 分享链接
imgUrl: share.img, // 分享图标
success: function ()
{
// 用户确认分享后执行的回调函数
new Image().src = ‘http://yp.yueus.com/action/wx_share_callback.php?platform=timeline&url=‘+encodeURIComponent(window.location.href);
},
cancel: function ()
{
// 用户取消分享后执行的回调函数
}
};

        // 好友、QQ
        var WeiXin_data =
        {
            title: share.title, // 分享标题
            desc: share.content, // 分享描述
            link: share.url, // 分享链接
            imgUrl: share.img, // 分享图标
            type: '', // 分享类型,music、video或link,不填默认为link
            dataUrl: '', // 如果type是music或video,则要提供数据链接,默认为空
            success: function ()
            {
                // 用户确认分享后执行的回调函数
                new Image().src = 'http://yp.yueus.com/action/wx_share_callback.php?platform=friends&url='+encodeURIComponent(window.location.href);
            },
            cancel: function ()
            {
                // 用户取消分享后执行的回调函数
            }
        };

        WeiXinSDK.ready(function()
        {
            WeiXinSDK.ready(function()
            {
                WeiXinSDK.ShareToFriend(WeiXin_data);

                WeiXinSDK.ShareTimeLine(WeiXin_data_Timeline);

                WeiXinSDK.ShareQQ(WeiXin_data);
            });

        });
    }
    /**** 调用微信分享 ****/

猜你喜欢

转载自blog.csdn.net/Seety_ST/article/details/51701021
今日推荐