slide.html
3.3 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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
<div class="share">
<ul>
<li class="share1">
<div class="share1_Img weixin" id="wx_share">
<img src="__TMPL__/public/assets/images/bicon_04.png" alt="" />
</div>
<p class="share1_Txt">{$share.post_share_wx}</p>
</li>
<li class="share1">
<div class="share1_Img wb_share">
<img src="__TMPL__/public/assets/images/bicon_05.png" alt="" />
</div>
<p class="share1_Txt">{$share.post_share_wb}</p>
</li>
<!--收藏-->
<li class="share2">
<div class="share2_Img collections">
<notempty name="is_collection">
<img src="__TMPL__/public/assets/images/bicon_15.png" alt="">
<else/>
<img src="__TMPL__/public/assets/images/bicon_02.png" alt="">
</notempty>
</div>
</li>
<!--点赞-->
<li class="share2">
<div class="share2_Img likes">
<notempty name="is_like">
<img src="__TMPL__/public/assets/images/bicon_16.png" alt="">
<else/>
<img src="__TMPL__/public/assets/images/bicon_03.png" alt="">
</notempty>
</div>
</li>
</ul>
</div>
<script src="__TMPL__/public/assets/js/jquery-2.1.0.js"></script>
<script src="http://res2.wx.qq.com/open/js/jweixin-1.4.0.js"></script>
<script>
$(function () {
$('#wx_share').click(function(){
var appid = '';
var timestamp = '';
var nonceStr = '';
var signature = '';
$.ajax({
type: 'POST',
url: '/portal/login/configShareWx',
data: {
},
dataType: 'json',
async: false,
success: function(data) {
console.log(data);
if (data.code == 1) {
appid = data.appid;
timestamp = data.timestamp;
nonceStr = data.nonceStr;
signature = data.signature;
} else {
console.log(data);
}
}
});
wx.config({
debug: false,
appId: appid,
timestamp: timestamp,
nonceStr: nonceStr,
signature: signature,
jsApiList: [
'checkJsApi',
'updateAppMessageShareData',
]
});
wx.ready(function () { //需在用户可能点击分享按钮前就先调用
wx.updateAppMessageShareData({
title: '分享标题', // 分享标题
desc: '分享描述', // 分享描述
link: 'http://www.starplanet.cn/portal/enjoy/getEnjoyDetail?id=81', // 分享链接,该链接域名或路径必须与当前页面对应的公众号JS安全域名一致
imgUrl: '', // 分享图标
success: function (e) {
// 设置成功
console.log(e);
}
})
});
});
});
</script>