一、分享QQ
二、分享微信
1.引入JS文件
2.配置
wx = { isWX: (/micromessenger/gi).test(navigator.userAgent), icon: '//live.51vv.com/wx/m/article/dist/images/logo.png', // 微信二次分享 share: function(res) { var _this = this, shareData = { title: res.title || 'VV直播', desc: res.desc || '', link: res.link || location.href, imgUrl: res.imgUrl || _this.icon, type: res.type || 'link', dataUrl: res.dataUrl || '' }; if(_this.isWX) { $.ajax({ url : '//live.51vv.com/wx/s/getWxMpSign.htm?url=' + encodeURIComponent(location.href), success : function(data) { wx.config({ debug: false, appId: data.wx_appid, timestamp: parseInt(data.wx_timestamp), nonceStr: data.wx_nonceStr, signature: data.wx_signature, jsApiList: [ 'onMenuShareTimeline', 'onMenuShareAppMessage', 'onMenuShareQQ', 'onMenuShareWeibo', 'onMenuShareQZone' ] }); wx.ready(function(){ wx.onMenuShareAppMessage(shareData); wx.onMenuShareTimeline(shareData); wx.onMenuShareQQ(shareData); wx.onMenuShareWeibo(shareData); wx.onMenuShareQZone(shareData); }); } }); } }};
3.调用
vv.wx.share({ title: 'VV音乐再相聚', // 分享标题,默认为“VV直播” desc: '即刻下载VV音乐,唱享现在!', // 分享描述,默认为空 imgUrl: 'http://upcdn.mpres.51vv.com/v_block/02496797c18f5846082ec6c6d8024d6d.jpg' // 分享图标,默认VV直播的icon0});