qrcode.html 1.38 KB
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>活动分享</title>
<script type="text/javascript" th:src="@{/static/js/common/jquery.min.js}"></script>
<script type="text/javascript" th:src="@{/static/js/qrcode.js}"></script>
<script type="text/javascript" th:src="@{/static/js/jquery.qrcode.js}"></script>
<script th:inline="javascript">
	// 活动ID
	var activityId = [[${activityId}]];
	$(function () {
		jQuery('#qrcode').qrcode({
		render: "canvas",
		width: 150,
		height: 150,
		correctLevel: 0,
		text: location.origin + "/web-dj-mobile/groupbuy/to/activity/" + activityId,
        })
        
        $.ajax({
	        type: 'GET',
	        url: '/web-dj-mobile/groupbuy/activity/'+ activityId,
	        dataType: 'json',
	        success: function(res) {
	        	console.log(res);
	        	$('#activityName').html(res.data.activityName);
	        }
        });
        
	})
</script>
<style>
	.qrcodeBox{
		width: 100%;
		height: 300px;
		margin-top: 50%;
	}
	.qrcodeBox div{
		width: 200px;
		margin: 0 auto;
		text-align: center;
	}
	
	#activityName {
		width: auto;
		margin-top: 20px;
	}
</style>
</head>
<body>
	<div class="qrcodeBox">
		<div id="qrcode"></div>
		<div>请截图保存二维码</div>
		<div id="activityName"></div>
	</div>
    
</body>
</html>