var phpdata; var url = window.location.href; $(function() { $.ajax({ url: "/cms/index/gettokens", type : "POST", data:{key:'tokens',url:url}, success: function(res){ if (res.code == 1){ phpdata = res.data wx.config({ debug: false, ticket: phpdata.ticket, appId: phpdata.appId, timestamp: phpdata.timestamp, nonceStr: phpdata.nonceStr, signature: phpdata.signature, jsApiList: [ 'updateAppMessageShareData', 'updateTimelineShareData' ] }); } } }); // alert("http://"+document.domain+"/static/modules/cms/wap/images/banner/banner2.jpg") var default_wximg = (typeof (wxthumb) != 'undefined' && wxthumb ) ? wxthumb:"/static/modules/cms/wap/images/logohanshang.jpg"; default_wximg = "http://"+document.domain+default_wximg; wx.ready(function () { // 鍦ㄨ繖閲岃皟鐢 API wx.updateAppMessageShareData({ title: wechartshar_title, // 鍒嗕韩鏍囬 desc: wechartshar_desc, // 鍒嗕韩鎻忚堪 link: window.location.href, // 鍒嗕韩閾炬帴 imgUrl: default_wximg, // 鍒嗕韩鍥炬爣 success: function () { // 鐢ㄦ埛纭鍒嗕韩鍚庢墽琛岀殑鍥炶皟鍑芥暟 }, cancel: function () { // 鐢ㄦ埛鍙栨秷鍒嗕韩鍚庢墽琛岀殑鍥炶皟鍑芥暟 } }); wx.updateTimelineShareData({ title: wechartshar_title, // 鍒嗕韩鏍囬 link: window.location.href, // 鍒嗕韩閾炬帴 imgUrl: default_wximg, // 鍒嗕韩鍥炬爣 success: function () { // 鐢ㄦ埛纭鍒嗕韩鍚庢墽琛岀殑鍥炶皟鍑芥暟 }, cancel: function () { // 鐢ㄦ埛鍙栨秷鍒嗕韩鍚庢墽琛岀殑鍥炶皟鍑芥暟 } }); }); });