123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384 |
- 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;
- }
|