web网页社会化分享

<div class="share" id="share">
	<div class="share-box" id="share-box">
		<a class="share-btn gwds_weixin" data-w="gwds_weixin" title="微信">&nbsp;</a>
		<a class="share-btn gwds_tsina" data-w="gwds_tsina" title="新浪微博">&nbsp;</a>
		<a data-w="gwds_qzone" class="share-btn gwds_qzone" title="QQ空间">&nbsp;</a>
		<a data-w="gwds_douban" class="share-btn gwds_douban" title="豆瓣网">&nbsp;</a>
	</div>
</div>
<script>
	var title = "${data.title!''}";
	var url = encodeURIComponent(window.location.href); 
	var list = {
		'gwds_weixin': '/f/front/qrcode?url=' + url, 
		'gwds_tsina': 'http://service.weibo.com/share/share.php?url=' + url + "&title=" + title,
		'gwds_qzone': 'https://sns.qzone.qq.com/cgi-bin/qzshare/cgi_qzshare_onekey?url=' + url + "&title=" + title,
		'gwds_douban': 'https://www.douban.com/share/service?appkey=3&sharesource=weibo&title=' + title + '&url=' + url
	}
	$('.share-btn').on('click', function(){
		var key = $(this).data('w');
		window.open(list[key]);
		return false
	});
</script>

微信分享 需要生成二维码 使用微信打开分享

<%@ page language="java" contentType="text/html; charset=UTF-8"	pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ page  session="false"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()	+ path + "/";
%>
<!DOCTYPE html>
<html>

<head>
	<base href="<%=basePath%>">
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
	<meta name="viewport" content="width=device-width, initial-scale=1.0, shrink-to-fit=no">
	<link rel="icon" href="assets/img/v2/favicon.ico">
	<title>xxx</title>

	<style>
		.code-box{
			width: 262px; margin: 50px auto; border: 1px solid #ddd; padding: 10px
		}
		.code-box h5{margin: 0;}
		.code-box p{font-size: 13px; line-height: 22px; margin: 0; color: #555;}
		#div_div{width: 200px; height: 200px; margin: 20px auto}
	</style>

</head>
<body>
<div class="code-box">
	<h5>分享到微信</h5>
	<div id="div_div">
		<div id="qrcode"></div>
	</div>
	<p>用微信“扫一扫”,点击右上角分享按钮,<br>即可将网页分享给您的微信好友或朋友圈。</p>
</div>

<script src="/assets/js/jquery.min.js"></script>
<script src="/assets/js/qrcode.js" type="text/javascript"></script>
<script type="text/javascript">
	var url='${pd.url}';
	var qrcode = new QRCode("qrcode", {
		text: url,
		width: 200,
		height: 200,
		colorDark : "#000000",
		colorLight : "#ffffff"
	});
</script>
</body>

</html>

在这里插入图片描述

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值