xianzou / blog

弦奏的博客 一个混迹多年的前端开发人员,正在努力的学习中
17 stars 2 forks source link

网页分享到QQ,QQ空间,微博,微信 #20

Open xianzou opened 5 years ago

xianzou commented 5 years ago

分享到QQ

 const shareTitle = `${title}-厦门市大数据安全开放平台`; // 标题
 const imgUrl = 'https://www.baidu.com/img/baidu_jgylogo3.gif';
# shareTitle 标题
# imgUrl 图片
# summary 详细内容
window.open(`http://connect.qq.com/widget/shareqq/index.html?url=${encodeURIComponent(document.location.href)}?sharesource=qzone&title=${shareTitle}&pics=${imgUrl}&summary=${summary}`);

分享到微博

 const shareTitle = `${title}-厦门市大数据安全开放平台`; // 标题
 const imgUrl = 'https://www.baidu.com/img/baidu_jgylogo3.gif';

# shareTitle 标题
# imgUrl 图片
window.open(`http://v.t.sina.com.cn/share/share.php?title=${shareTitle}&url=${encodeURIComponent(document.location.href)}&content=utf-8&sourceUrl=&pic=`);

分享到QQ空间

 const shareTitle = `${title}-厦门市大数据安全开放平台`; // 标题
 const imgUrl = 'https://www.baidu.com/img/baidu_jgylogo3.gif';

# shareTitle 标题
# imgUrl 图片
# summary 详细内容
window.open(`https://sns.qzone.qq.com/cgi-bin/qzshare/cgi_qzshare_onekey?url=${encodeURIComponent(window.location.href)}&sharesource=qzone&title=${shareTitle}&pics=${imgUrl}&summary=${summary}&desc=`);

分享到微信

# 生成二维码给微信扫描分享,php生成,也可以用jquery.qrcode.js插件实现二维码生成
window.open(`http://zixuephp.net/inc/qrcode_img.php?url=${encodeURIComponent(window.location.href)}`);

# 推荐使用qrcode.react实现
// https://www.npmjs.com/package/qrcode.react

import QRCode from 'qrcode.react';

 <QRCode value={document.location.href} size={240} />