...
|
...
|
@@ -2,40 +2,20 @@ |
|
|
<script src="http://res.wx.qq.com/open/js/jweixin-1.4.0.js"></script>
|
|
|
<script>
|
|
|
$(function () {
|
|
|
$('#wx_share').click(function(){
|
|
|
$.ajax({
|
|
|
type: 'POST',
|
|
|
url: '/portal/login/wx_share_mobile',
|
|
|
data: {
|
|
|
},
|
|
|
dataType: 'json',
|
|
|
async: false,
|
|
|
success: function(data) {
|
|
|
if (data.code == 1) {
|
|
|
var url = window.location.href;
|
|
|
var title_title = $(document).attr('title');
|
|
|
// wx.config({
|
|
|
// debug: false,
|
|
|
// appId: '{$data.appId}',
|
|
|
// timestamp: '{$data.timestamp}',
|
|
|
// nonceStr: '{$data.nonceStr}',
|
|
|
// signature: '{$data.signature}',
|
|
|
// jsApiList: [
|
|
|
// 'updateAppMessageShareData',
|
|
|
// 'updateTimelineShareData',
|
|
|
// ]
|
|
|
// });
|
|
|
wx.config({
|
|
|
debug: true,
|
|
|
appId: data.appId,
|
|
|
timestamp: data.timestamp,
|
|
|
nonceStr: data.nonceStr,
|
|
|
signature: data.signature,
|
|
|
debug: false,
|
|
|
appId: '{$data.appId}',
|
|
|
timestamp: '{$data.timestamp}',
|
|
|
nonceStr: '{$data.nonceStr}',
|
|
|
signature: '{$data.signature}',
|
|
|
jsApiList: [
|
|
|
'updateAppMessageShareData',
|
|
|
'updateTimelineShareData',
|
|
|
]
|
|
|
});
|
|
|
$('#wx_share').click(function(){
|
|
|
wx.ready(function () { //需在用户可能点击分享按钮前就先调用
|
|
|
wx.updateAppMessageShareData({
|
|
|
title: title_title, // 分享标题
|
...
|
...
|
@@ -61,12 +41,8 @@ |
|
|
wx.error(function (res) {
|
|
|
// config信息验证失败会执行error函数,如签名过期导致验证失败,具体错误信息可以打开config的debug模式查看,也可以在返回的res参数中查看,对于SPA可以在这里更新签名。
|
|
|
});
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
});
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
function wx_Share(){
|
...
|
...
|
|