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
| InitJsSdk: function (callback) { if (_wxInited) { callback && callback(); return; } var url = "/weixin/jssdksign"; $.ajax( url , { data: { "url": window.location.href.split('#')[0] }, type: "GET", success: function (data) { if (data) { data.jsApiList = [ "previewImage", "getLocation", "openLocation", "chooseImage", "uploadImage", "onMenuShareTimeline", "onMenuShareAppMessage", "hideMenuItems", "showMenuItems" ]; wx.config(data);
wx.ready(function () { wx.hideMenuItems({ menuList: ['menuItem:share:appMessage','menuItem:share:timeline',"menuItem:share:qq","menuItem:share:QZone","menuItem:copyUrl"] }); _wxInited = true; callback && callback(); }); } }, error:function(e){ } }); },
uploadImage: function (callback,safe,count) { _utils.InitJsSdk(function () { wx.chooseImage({ count: count || 1, success: function (res) { var localIds = res.localIds; try { _utils.pushAllImg(localIds, safe, callback) } catch (error) { console.log(JSON.stringify(error)) } }, error:function(error){ $.message.show('图片选取失败!') } }) }) },
|