qrcode.html
1.38 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
<!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>