分享至微信、QQ、微博、复制链接

var share = {
"tit": '您的朋友分享了文章',
"desc": '分享来自百度文库,包含。。。',
"pic": 'https://' + window.location.host + '/web/images/shareLogo.png',
"localhostAdd": 'https://' + window.location.host,
//"pic":'http://www.elitez.cn/c/images/head.jpg',
"url": ''
}

//分享至微信
$('body').on('mouseover', '.wchat', function (event) {
var urlText = $(this).siblings('.urlText').text();
var code = $('.share').text();
//var name = $('#hidden').val();
var questionId = $(this).siblings('.questionId').text();
if ($(this).find(".myQuCode canvas").length == 0) {
$(this).find(".myQuCode").qrcode({
//render: "table", //table方式
width: 110, //宽度
height: 110, //高度
//text: //任意内容
text: window.location.protocol + '//' + window.location.host + "/public/mobile/xinzhiMobile.jsp?questionId=" + questionId
});
}
console.log(window.location.protocol + '//' + window.location.host + "/public/mobile/xinzhiMobile.jsp?questionId=" + questionId)
})

//分享至微博
$('body').on('click', '.share_sina', function (event) {
var urlText = $(this).parent().siblings('.lastLi').find('.urlText').text();
var targetUrl = window.location.protocol + '//' + window.location.host + '/' + urlText;
var code = $('.share').text();
//var name = $('#hidden').val();
var url = "http://v.t.sina.com.cn/share/share.php",
_url = targetUrl,
_title = share.desc,
_appkey = '',
_ralateUid = '',
c = '', pic = share.pic;
c = url + "?url=" + encodeURIComponent(_url) + "&appkey=" + _appkey + "&title=" + _title + "&pic=" + pic + "&ralateUid=" + _ralateUid + "&language=";
window.open(c, "shareQQ", "height=480,width=608,top=100,left=200,toolbar=no,menubar=no,resizable=yes,location=yes,status=no");
});

//分享至QQ
$('body').on('click', '.share_qq', function (event) {
var urlText = $(this).parent().siblings('.lastLi').find('.urlText').text();
var targetUrl = window.location.protocol + '//' + window.location.host + '/' + urlText;
//var name = $('#hidden').val();
var a = "http://connect.qq.com/widget/shareqq/index.html",//"http://connect.qq.com/widget/shareqq/index.html",
d = targetUrl,
m = share.tit,
pic = share.pic,
pl = '加点评论吧...',
titsummary = share.desc,
b = "",
x = window.screen.width,
y = window.screen.height;
h = "", k = ""; //g = l.join("||")||"";
k = a + "?url=" + encodeURIComponent(d) + "&showcount=0&desc=" + encodeURIComponent(pl) + "&summary=" + encodeURIComponent(titsummary) + "&title=" + encodeURIComponent(m) + "&pics=" + pic + "&style=203&width=19&height=22";
window.open(k, "", "height = 680, width = 960, top = " + (y - 680) / 2 + ", left = " + (x - 960) / 2 + ", toolbar = no, menubar = no, resizable = yes, location = yes,status = no");
});

//复制
var clipboard = new Clipboard('.btnShareCopy');
clipboard.on('success', function(e) {
alerter("复制成功")
//console.log(e);
});

posted on 2017-05-08 15:26  王子乔  阅读(966)  评论(0编辑  收藏  举报

导航