function wxSetup(wxConfig, shareConfig) { if (wx) { wx.config(wxConfig); wx.ready(function(){ appendLog('ready'); wx.checkJsApi({ jsApiList: ['onMenuShareAppMessage'], success: function (res) { appendLog(res); } }) var shareTitle = shareConfig.shareTile, shareDesc = shareConfig.shareDesc, imgUrl = shareConfig.imgUrl ; wx.onMenuShareTimeline({ title: shareTitle, // link: '', imgUrl: imgUrl, success: function (res) { appendLog(res); }, cancel: function (res) { appendLog(res); }, fail: function (res) { appendLog(res); } }); wx.onMenuShareAppMessage({ title: shareTitle, desc: shareDesc, link: '', imgUrl: imgUrl, type: '', dataUrl: '', success: function (res) { appendLog(res); }, cancel: function (res) { appendLog(res); }, fail: function (res) { appendLog(res); }, trigger: function (res) { appendLog(res); } }); }); wx.error(function(res) { appendLog(res); }); } } function appendLog(log) { if (window.debug) { console.log(log); }; } function str(obj) { return JSON.stringify(obj, '', '\t'); } //解析url,获得传递的参数 function getUrlParam(name){ var reg=new RegExp("(^|&)"+name+"=([^&]*)(&|$)"); var r=window.location.search.substr(1).match(reg); if (r!=null) return decodeURI(r[2]); return null; } function linkJoin(){ var url = targetUrl + '?param=' + param; window.location.href = url; }