微信的分享功能(針對web手機站頁面進行的分享功能)


把這段js粘貼進,設置可以分享的頁面,當微信打開,即可微信進行分享各個圈

 

$(function(){

    var lujing=$("#logimg").attr("src");  //分享中帶有的圖片
    var url=window.location.href;         //分享頁的地址
    var title=document.title;             //分享內容的標題
    weixin("http://m.e-iot.com/images/bg.jpg",url,title);
 });


             function weixin(a,b,c){ 
document.addEventListener('WeixinJSBridgeReady', function onBridgeReady() {


window.shareData = {
"imgUrl": a,
"timeLineLink": b,
"sendFriendLink": b,
"weiboLink": b,
"tTitle": c,
"tContent": "8+1互助平台---營銷型網站互助分享會",
"fTitle": c,
"fContent": "8+1互助平台---營銷型網站互助分享會",
"wContent": "8+1互助平台---營銷型網站互助分享會"
};


// 發送給好友
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) {
_report('send_msg', '111111');
})
});


// 分享到朋友圈
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) {
_report('timeline', res.err_msg);
});
});


// 分享到微博
WeixinJSBridge.on('menu:share:weibo', function (argv) {
WeixinJSBridge.invoke('shareWeibo', {
"content": window.shareData.wContent,
"url": window.shareData.weiboLink
}, function (res) {
_report('weibo', res.err_msg);
});
});
}, false)
                  }


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM