<div class="new_sharebtnbox" data-tag="share">
<a class="new_box new_wechat" data-cmd="wechat"></a>
<a class="new_box new_weibo " data-cmd="weibo"></a>
<a class="new_box new_qq" data-cmd="qzone"></a>
</div>
<script src="https://cdn.bootcss.com/jquery.qrcode/1.0/jquery.qrcode.min.js"></script>
<script>
var fg = true; //防止微信二维码重复生成的bug
var path = window.document.location.href;
var tle = $('.new_title').text();
//var path = "https://lenzetech.com";
var ShareTip = function() {};
//1、微信
$('.new_wechat').click(function () {
$('.new_qrcode').fadeIn(500);
if(fg){
$("#qrcode").qrcode({
text: path, //设置二维码内容
pic: "https://lenzetech.com/public/static/upload/image/aboutUs/news-01.png",
render: "table", //设置渲染方式
width: 200, //设置宽度,默认生成的二维码大小是 256×256
height: 200, //设置高度
margin: "auto",
typeNumber: -1, //计算模式
background: "#fff", //背景颜色
foreground: "#000" //前景颜色
});
}
fg = false;
});
$('.new_close').click(function () {
$('.new_qrcode').fadeOut(500);
});
//2、新浪微博
ShareTip.prototype.sina = function(title, url, picurl) {
var sharesinastring = 'http://v.t.sina.com.cn/share/share.php?title=' + title + '&url=' + url + '&content=utf-8&sourceUrl=' + url + '&pic=' + picurl;
window.open(sharesinastring, 'newwindow', 'height=300,width=300,top=100,left=100');
};
$('.new_weibo').click(function () {
let sh1 = new ShareTip();
sh1.sina(tle, window.location.href, "https://lenzetech.com/public/static/upload/image/aboutUs/news-01.png");
});
//3、QQZone
ShareTip.prototype.qqzone = function(title, url, picurl) {
var shareqqzonestring = 'http://sns.qzone.qq.com/cgi-bin/qzshare/cgi_qzshare_onekey?title=' + title + '&url=' + url + '&pics=' + picurl;
window.open(shareqqzonestring, 'newwindow', 'height=300,width=300,top=100,left=100');
};
$('.new_qq').click(function () {
let sh2 = new ShareTip();
sh2.qqzone(tle, window.location.href, "https://lenzetech.com/public/static/upload/image/aboutUs/news-01.png");
});
</script>
参考:https://www.cnblogs.com/shuangjiang/p/9524588.html