|
@@ -0,0 +1,575 @@
|
|
|
+
|
|
|
+ * 注意:
|
|
|
+ * 1. 所有的JS接口只能在公众号绑定的域名下调用,公众号开发者需要先登录微信公众平台进入“公众号设置”的“功能设置”里填写“JS接口安全域名”。
|
|
|
+ * 2. 如果发现在 Android 不能分享自定义内容,请到官网下载最新的包覆盖安装,Android 自定义分享接口需升级至 6.0.2.58 版本及以上。
|
|
|
+ * 3. 完整 JS-SDK 文档地址:http:
|
|
|
+ *
|
|
|
+ * 如有问题请通过以下渠道反馈:
|
|
|
+ * 邮箱地址:weixin-open@qq.com
|
|
|
+ * 邮件主题:【微信JS-SDK反馈】具体问题
|
|
|
+ * 邮件内容说明:用简明的语言描述问题所在,并交代清楚遇到该问题的场景,可附上截屏图片,微信团队会尽快处理你的反馈。
|
|
|
+ */
|
|
|
+wx.ready(function () {
|
|
|
+
|
|
|
+ document.querySelector('#checkJsApi').onclick = function () {
|
|
|
+ wx.checkJsApi({
|
|
|
+ jsApiList: [
|
|
|
+ 'getNetworkType',
|
|
|
+ 'previewImage'
|
|
|
+ ],
|
|
|
+ success: function (res) {
|
|
|
+ alert(JSON.stringify(res));
|
|
|
+ }
|
|
|
+ });
|
|
|
+ };
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ document.querySelector('#onMenuShareAppMessage').onclick = function () {
|
|
|
+ wx.onMenuShareAppMessage({
|
|
|
+ title: '互联网之子',
|
|
|
+ desc: '在长大的过程中,我才慢慢发现,我身边的所有事,别人跟我说的所有事,那些所谓本来如此,注定如此的事,它们其实没有非得如此,事情是可以改变的。更重要的是,有些事既然错了,那就该做出改变。',
|
|
|
+ link: 'http://movie.douban.com/subject/25785114/',
|
|
|
+ imgUrl: 'http://demo.open.weixin.qq.com/jssdk/images/p2166127561.jpg',
|
|
|
+ trigger: function (res) {
|
|
|
+
|
|
|
+ alert('用户点击发送给朋友');
|
|
|
+ },
|
|
|
+ success: function (res) {
|
|
|
+ alert('已分享');
|
|
|
+ },
|
|
|
+ cancel: function (res) {
|
|
|
+ alert('已取消');
|
|
|
+ },
|
|
|
+ fail: function (res) {
|
|
|
+ alert(JSON.stringify(res));
|
|
|
+ }
|
|
|
+ });
|
|
|
+ alert('已注册获取“发送给朋友”状态事件');
|
|
|
+ };
|
|
|
+
|
|
|
+
|
|
|
+ document.querySelector('#onMenuShareTimeline').onclick = function () {
|
|
|
+ wx.onMenuShareTimeline({
|
|
|
+ title: '互联网之子',
|
|
|
+ link: 'http://movie.douban.com/subject/25785114/',
|
|
|
+ imgUrl: 'http://demo.open.weixin.qq.com/jssdk/images/p2166127561.jpg',
|
|
|
+ trigger: function (res) {
|
|
|
+
|
|
|
+ alert('用户点击分享到朋友圈');
|
|
|
+ },
|
|
|
+ success: function (res) {
|
|
|
+ alert('已分享');
|
|
|
+ },
|
|
|
+ cancel: function (res) {
|
|
|
+ alert('已取消');
|
|
|
+ },
|
|
|
+ fail: function (res) {
|
|
|
+ alert(JSON.stringify(res));
|
|
|
+ }
|
|
|
+ });
|
|
|
+ alert('已注册获取“分享到朋友圈”状态事件');
|
|
|
+ };
|
|
|
+
|
|
|
+
|
|
|
+ document.querySelector('#onMenuShareQQ').onclick = function () {
|
|
|
+ wx.onMenuShareQQ({
|
|
|
+ title: '互联网之子',
|
|
|
+ desc: '在长大的过程中,我才慢慢发现,我身边的所有事,别人跟我说的所有事,那些所谓本来如此,注定如此的事,它们其实没有非得如此,事情是可以改变的。更重要的是,有些事既然错了,那就该做出改变。',
|
|
|
+ link: 'http://movie.douban.com/subject/25785114/',
|
|
|
+ imgUrl: 'http://img3.douban.com/view/movie_poster_cover/spst/public/p2166127561.jpg',
|
|
|
+ trigger: function (res) {
|
|
|
+ alert('用户点击分享到QQ');
|
|
|
+ },
|
|
|
+ complete: function (res) {
|
|
|
+ alert(JSON.stringify(res));
|
|
|
+ },
|
|
|
+ success: function (res) {
|
|
|
+ alert('已分享');
|
|
|
+ },
|
|
|
+ cancel: function (res) {
|
|
|
+ alert('已取消');
|
|
|
+ },
|
|
|
+ fail: function (res) {
|
|
|
+ alert(JSON.stringify(res));
|
|
|
+ }
|
|
|
+ });
|
|
|
+ alert('已注册获取“分享到 QQ”状态事件');
|
|
|
+ };
|
|
|
+
|
|
|
+
|
|
|
+ document.querySelector('#onMenuShareWeibo').onclick = function () {
|
|
|
+ wx.onMenuShareWeibo({
|
|
|
+ title: '互联网之子',
|
|
|
+ desc: '在长大的过程中,我才慢慢发现,我身边的所有事,别人跟我说的所有事,那些所谓本来如此,注定如此的事,它们其实没有非得如此,事情是可以改变的。更重要的是,有些事既然错了,那就该做出改变。',
|
|
|
+ link: 'http://movie.douban.com/subject/25785114/',
|
|
|
+ imgUrl: 'http://img3.douban.com/view/movie_poster_cover/spst/public/p2166127561.jpg',
|
|
|
+ trigger: function (res) {
|
|
|
+ alert('用户点击分享到微博');
|
|
|
+ },
|
|
|
+ complete: function (res) {
|
|
|
+ alert(JSON.stringify(res));
|
|
|
+ },
|
|
|
+ success: function (res) {
|
|
|
+ alert('已分享');
|
|
|
+ },
|
|
|
+ cancel: function (res) {
|
|
|
+ alert('已取消');
|
|
|
+ },
|
|
|
+ fail: function (res) {
|
|
|
+ alert(JSON.stringify(res));
|
|
|
+ }
|
|
|
+ });
|
|
|
+ alert('已注册获取“分享到微博”状态事件');
|
|
|
+ };
|
|
|
+
|
|
|
+
|
|
|
+ document.querySelector('#onMenuShareQZone').onclick = function () {
|
|
|
+ wx.onMenuShareQZone({
|
|
|
+ title: '互联网之子',
|
|
|
+ desc: '在长大的过程中,我才慢慢发现,我身边的所有事,别人跟我说的所有事,那些所谓本来如此,注定如此的事,它们其实没有非得如此,事情是可以改变的。更重要的是,有些事既然错了,那就该做出改变。',
|
|
|
+ link: 'http://movie.douban.com/subject/25785114/',
|
|
|
+ imgUrl: 'http://img3.douban.com/view/movie_poster_cover/spst/public/p2166127561.jpg',
|
|
|
+ trigger: function (res) {
|
|
|
+ alert('用户点击分享到QZone');
|
|
|
+ },
|
|
|
+ complete: function (res) {
|
|
|
+ alert(JSON.stringify(res));
|
|
|
+ },
|
|
|
+ success: function (res) {
|
|
|
+ alert('已分享');
|
|
|
+ },
|
|
|
+ cancel: function (res) {
|
|
|
+ alert('已取消');
|
|
|
+ },
|
|
|
+ fail: function (res) {
|
|
|
+ alert(JSON.stringify(res));
|
|
|
+ }
|
|
|
+ });
|
|
|
+ alert('已注册获取“分享到QZone”状态事件');
|
|
|
+ };
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ var voice = {
|
|
|
+ localId: '',
|
|
|
+ serverId: ''
|
|
|
+ };
|
|
|
+
|
|
|
+ document.querySelector('#translateVoice').onclick = function () {
|
|
|
+ if (voice.localId == '') {
|
|
|
+ alert('请先使用 startRecord 接口录制一段声音');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ wx.translateVoice({
|
|
|
+ localId: voice.localId,
|
|
|
+ complete: function (res) {
|
|
|
+ if (res.hasOwnProperty('translateResult')) {
|
|
|
+ alert('识别结果:' + res.translateResult);
|
|
|
+ } else {
|
|
|
+ alert('无法识别');
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ };
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ document.querySelector('#startRecord').onclick = function () {
|
|
|
+ wx.startRecord({
|
|
|
+ cancel: function () {
|
|
|
+ alert('用户拒绝授权录音');
|
|
|
+ }
|
|
|
+ });
|
|
|
+ };
|
|
|
+
|
|
|
+
|
|
|
+ document.querySelector('#stopRecord').onclick = function () {
|
|
|
+ wx.stopRecord({
|
|
|
+ success: function (res) {
|
|
|
+ voice.localId = res.localId;
|
|
|
+ },
|
|
|
+ fail: function (res) {
|
|
|
+ alert(JSON.stringify(res));
|
|
|
+ }
|
|
|
+ });
|
|
|
+ };
|
|
|
+
|
|
|
+
|
|
|
+ wx.onVoiceRecordEnd({
|
|
|
+ complete: function (res) {
|
|
|
+ voice.localId = res.localId;
|
|
|
+ alert('录音时间已超过一分钟');
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+
|
|
|
+ document.querySelector('#playVoice').onclick = function () {
|
|
|
+ if (voice.localId == '') {
|
|
|
+ alert('请先使用 startRecord 接口录制一段声音');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ wx.playVoice({
|
|
|
+ localId: voice.localId
|
|
|
+ });
|
|
|
+ };
|
|
|
+
|
|
|
+
|
|
|
+ document.querySelector('#pauseVoice').onclick = function () {
|
|
|
+ wx.pauseVoice({
|
|
|
+ localId: voice.localId
|
|
|
+ });
|
|
|
+ };
|
|
|
+
|
|
|
+
|
|
|
+ document.querySelector('#stopVoice').onclick = function () {
|
|
|
+ wx.stopVoice({
|
|
|
+ localId: voice.localId
|
|
|
+ });
|
|
|
+ };
|
|
|
+
|
|
|
+
|
|
|
+ wx.onVoicePlayEnd({
|
|
|
+ complete: function (res) {
|
|
|
+ alert('录音(' + res.localId + ')播放结束');
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+
|
|
|
+ document.querySelector('#uploadVoice').onclick = function () {
|
|
|
+ if (voice.localId == '') {
|
|
|
+ alert('请先使用 startRecord 接口录制一段声音');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ wx.uploadVoice({
|
|
|
+ localId: voice.localId,
|
|
|
+ success: function (res) {
|
|
|
+ alert('上传语音成功,serverId 为' + res.serverId);
|
|
|
+ voice.serverId = res.serverId;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ };
|
|
|
+
|
|
|
+
|
|
|
+ document.querySelector('#downloadVoice').onclick = function () {
|
|
|
+ if (voice.serverId == '') {
|
|
|
+ alert('请先使用 uploadVoice 上传声音');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ wx.downloadVoice({
|
|
|
+ serverId: voice.serverId,
|
|
|
+ success: function (res) {
|
|
|
+ alert('下载语音成功,localId 为' + res.localId);
|
|
|
+ voice.localId = res.localId;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ };
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ var images = {
|
|
|
+ localId: [],
|
|
|
+ serverId: []
|
|
|
+ };
|
|
|
+ document.querySelector('#chooseImage').onclick = function () {
|
|
|
+ wx.chooseImage({
|
|
|
+ success: function (res) {
|
|
|
+ images.localId = res.localIds;
|
|
|
+ alert('已选择 ' + res.localIds.length + ' 张图片');
|
|
|
+ }
|
|
|
+ });
|
|
|
+ };
|
|
|
+
|
|
|
+
|
|
|
+ document.querySelector('#previewImage').onclick = function () {
|
|
|
+ wx.previewImage({
|
|
|
+ current: 'http://img5.douban.com/view/photo/photo/public/p1353993776.jpg',
|
|
|
+ urls: [
|
|
|
+ 'http://img3.douban.com/view/photo/photo/public/p2152117150.jpg',
|
|
|
+ 'http://img5.douban.com/view/photo/photo/public/p1353993776.jpg',
|
|
|
+ 'http://img3.douban.com/view/photo/photo/public/p2152134700.jpg'
|
|
|
+ ]
|
|
|
+ });
|
|
|
+ };
|
|
|
+
|
|
|
+
|
|
|
+ document.querySelector('#uploadImage').onclick = function () {
|
|
|
+ if (images.localId.length == 0) {
|
|
|
+ alert('请先使用 chooseImage 接口选择图片');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ var i = 0, length = images.localId.length;
|
|
|
+ images.serverId = [];
|
|
|
+ function upload() {
|
|
|
+ wx.uploadImage({
|
|
|
+ localId: images.localId[i],
|
|
|
+ isShowProgressTips: 1,
|
|
|
+ success: function (res) {
|
|
|
+ i++;
|
|
|
+
|
|
|
+ images.serverId.push(res.serverId);
|
|
|
+ if (i < length) {
|
|
|
+ upload();
|
|
|
+ }
|
|
|
+ },
|
|
|
+ fail: function (res) {
|
|
|
+ alert(JSON.stringify(res));
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ upload();
|
|
|
+ };
|
|
|
+
|
|
|
+
|
|
|
+ document.querySelector('#downloadImage').onclick = function () {
|
|
|
+ if (images.serverId.length === 0) {
|
|
|
+ alert('请先使用 uploadImage 上传图片');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ var i = 0, length = images.serverId.length;
|
|
|
+ images.localId = [];
|
|
|
+ function download() {
|
|
|
+ wx.downloadImage({
|
|
|
+ serverId: images.serverId[i],
|
|
|
+ success: function (res) {
|
|
|
+ i++;
|
|
|
+ alert('已下载:' + i + '/' + length);
|
|
|
+ images.localId.push(res.localId);
|
|
|
+ if (i < length) {
|
|
|
+ download();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ download();
|
|
|
+ };
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ document.querySelector('#getNetworkType').onclick = function () {
|
|
|
+ wx.getNetworkType({
|
|
|
+ success: function (res) {
|
|
|
+ alert(res.networkType);
|
|
|
+ },
|
|
|
+ fail: function (res) {
|
|
|
+ alert(JSON.stringify(res));
|
|
|
+ }
|
|
|
+ });
|
|
|
+ };
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ document.querySelector('#openLocation').onclick = function () {
|
|
|
+ wx.openLocation({
|
|
|
+ latitude: 23.099994,
|
|
|
+ longitude: 113.324520,
|
|
|
+ name: 'TIT 创意园',
|
|
|
+ address: '广州市海珠区新港中路 397 号',
|
|
|
+ scale: 14,
|
|
|
+ infoUrl: 'http://weixin.qq.com'
|
|
|
+ });
|
|
|
+ };
|
|
|
+
|
|
|
+
|
|
|
+ document.querySelector('#getLocation').onclick = function () {
|
|
|
+ wx.getLocation({
|
|
|
+ success: function (res) {
|
|
|
+ alert(JSON.stringify(res));
|
|
|
+ },
|
|
|
+ cancel: function (res) {
|
|
|
+ alert('用户拒绝授权获取地理位置');
|
|
|
+ }
|
|
|
+ });
|
|
|
+ };
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ document.querySelector('#hideOptionMenu').onclick = function () {
|
|
|
+ wx.hideOptionMenu();
|
|
|
+ };
|
|
|
+
|
|
|
+
|
|
|
+ document.querySelector('#showOptionMenu').onclick = function () {
|
|
|
+ wx.showOptionMenu();
|
|
|
+ };
|
|
|
+
|
|
|
+
|
|
|
+ document.querySelector('#hideMenuItems').onclick = function () {
|
|
|
+ wx.hideMenuItems({
|
|
|
+ menuList: [
|
|
|
+ 'menuItem:readMode',
|
|
|
+ 'menuItem:share:timeline',
|
|
|
+ 'menuItem:copyUrl'
|
|
|
+ ],
|
|
|
+ success: function (res) {
|
|
|
+ alert('已隐藏“阅读模式”,“分享到朋友圈”,“复制链接”等按钮');
|
|
|
+ },
|
|
|
+ fail: function (res) {
|
|
|
+ alert(JSON.stringify(res));
|
|
|
+ }
|
|
|
+ });
|
|
|
+ };
|
|
|
+
|
|
|
+
|
|
|
+ document.querySelector('#showMenuItems').onclick = function () {
|
|
|
+ wx.showMenuItems({
|
|
|
+ menuList: [
|
|
|
+ 'menuItem:readMode',
|
|
|
+ 'menuItem:share:timeline',
|
|
|
+ 'menuItem:copyUrl'
|
|
|
+ ],
|
|
|
+ success: function (res) {
|
|
|
+ alert('已显示“阅读模式”,“分享到朋友圈”,“复制链接”等按钮');
|
|
|
+ },
|
|
|
+ fail: function (res) {
|
|
|
+ alert(JSON.stringify(res));
|
|
|
+ }
|
|
|
+ });
|
|
|
+ };
|
|
|
+
|
|
|
+
|
|
|
+ document.querySelector('#hideAllNonBaseMenuItem').onclick = function () {
|
|
|
+ wx.hideAllNonBaseMenuItem({
|
|
|
+ success: function () {
|
|
|
+ alert('已隐藏所有非基本菜单项');
|
|
|
+ }
|
|
|
+ });
|
|
|
+ };
|
|
|
+
|
|
|
+
|
|
|
+ document.querySelector('#showAllNonBaseMenuItem').onclick = function () {
|
|
|
+ wx.showAllNonBaseMenuItem({
|
|
|
+ success: function () {
|
|
|
+ alert('已显示所有非基本菜单项');
|
|
|
+ }
|
|
|
+ });
|
|
|
+ };
|
|
|
+
|
|
|
+
|
|
|
+ document.querySelector('#closeWindow').onclick = function () {
|
|
|
+ wx.closeWindow();
|
|
|
+ };
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ document.querySelector('#scanQRCode0').onclick = function () {
|
|
|
+ wx.scanQRCode();
|
|
|
+ };
|
|
|
+
|
|
|
+ document.querySelector('#scanQRCode1').onclick = function () {
|
|
|
+ wx.scanQRCode({
|
|
|
+ needResult: 1,
|
|
|
+ desc: 'scanQRCode desc',
|
|
|
+ success: function (res) {
|
|
|
+ alert(JSON.stringify(res));
|
|
|
+ }
|
|
|
+ });
|
|
|
+ };
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ document.querySelector('#chooseWXPay').onclick = function () {
|
|
|
+
|
|
|
+ wx.chooseWXPay({
|
|
|
+ timestamp: 1414723227,
|
|
|
+ nonceStr: 'noncestr',
|
|
|
+ package: 'addition=action_id%3dgaby1234%26limit_pay%3d&bank_type=WX&body=innertest&fee_type=1&input_charset=GBK¬ify_url=http%3A%2F%2F120.204.206.246%2Fcgi-bin%2Fmmsupport-bin%2Fnotifypay&out_trade_no=1414723227818375338&partner=1900000109&spbill_create_ip=127.0.0.1&total_fee=1&sign=432B647FE95C7BF73BCD177CEECBEF8D',
|
|
|
+ signType: 'SHA1',
|
|
|
+ paySign: 'bd5b1933cda6e9548862944836a9b52e8c9a2b69'
|
|
|
+ });
|
|
|
+ };
|
|
|
+
|
|
|
+
|
|
|
+ document.querySelector('#openProductSpecificView').onclick = function () {
|
|
|
+ wx.openProductSpecificView({
|
|
|
+ productId: 'pDF3iY_m2M7EQ5EKKKWd95kAxfNw',
|
|
|
+ extInfo: '123'
|
|
|
+ });
|
|
|
+ };
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ document.querySelector('#addCard').onclick = function () {
|
|
|
+ wx.addCard({
|
|
|
+ cardList: [
|
|
|
+ {
|
|
|
+ cardId: 'pDF3iY9tv9zCGCj4jTXFOo1DxHdo',
|
|
|
+ cardExt: '{"code": "", "openid": "", "timestamp": "1418301401", "signature":"f6628bf94d8e56d56bfa6598e798d5bad54892e5"}'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ cardId: 'pDF3iY9tv9zCGCj4jTXFOo1DxHdo',
|
|
|
+ cardExt: '{"code": "", "openid": "", "timestamp": "1418301401", "signature":"f6628bf94d8e56d56bfa6598e798d5bad54892e5"}'
|
|
|
+ }
|
|
|
+ ],
|
|
|
+ success: function (res) {
|
|
|
+ alert('已添加卡券:' + JSON.stringify(res.cardList));
|
|
|
+ },
|
|
|
+ cancel: function (res) {
|
|
|
+ alert(JSON.stringify(res))
|
|
|
+ }
|
|
|
+ });
|
|
|
+ };
|
|
|
+
|
|
|
+ var codes = [];
|
|
|
+
|
|
|
+ document.querySelector('#chooseCard').onclick = function () {
|
|
|
+ wx.chooseCard({
|
|
|
+ cardSign: '1fdb2640c60e41f8823e9f762e70c531d161ae76',
|
|
|
+ timestamp: 1437997723,
|
|
|
+ nonceStr: 'k0hGdSXKZEj3Min5',
|
|
|
+ success: function (res) {
|
|
|
+ res.cardList = JSON.parse(res.cardList);
|
|
|
+ encrypt_code = res.cardList[0]['encrypt_code'];
|
|
|
+ alert('已选择卡券:' + JSON.stringify(res.cardList));
|
|
|
+ decryptCode(encrypt_code, function (code) {
|
|
|
+ codes.push(code);
|
|
|
+ });
|
|
|
+ },
|
|
|
+ cancel: function (res) {
|
|
|
+ alert(JSON.stringify(res))
|
|
|
+ }
|
|
|
+ });
|
|
|
+ };
|
|
|
+
|
|
|
+
|
|
|
+ document.querySelector('#openCard').onclick = function () {
|
|
|
+ if (codes.length < 1) {
|
|
|
+ alert('请先使用 chooseCard 接口选择卡券。');
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ var cardList = [];
|
|
|
+ for (var i = 0; i < codes.length; i++) {
|
|
|
+ cardList.push({
|
|
|
+ cardId: 'pDF3iY9tv9zCGCj4jTXFOo1DxHdo',
|
|
|
+ code: codes[i]
|
|
|
+ });
|
|
|
+ }
|
|
|
+ wx.openCard({
|
|
|
+ cardList: cardList,
|
|
|
+ cancel: function (res) {
|
|
|
+ alert(JSON.stringify(res))
|
|
|
+ }
|
|
|
+ });
|
|
|
+ };
|
|
|
+
|
|
|
+ var shareData = {
|
|
|
+ title: '微信JS-SDK Demo',
|
|
|
+ desc: '微信JS-SDK,帮助第三方为用户提供更优质的移动web服务',
|
|
|
+ link: 'http://demo.open.weixin.qq.com/jssdk/',
|
|
|
+ imgUrl: 'http://mmbiz.qpic.cn/mmbiz/icTdbqWNOwNRt8Qia4lv7k3M9J1SKqKCImxJCt7j9rHYicKDI45jRPBxdzdyREWnk0ia0N5TMnMfth7SdxtzMvVgXg/0'
|
|
|
+ };
|
|
|
+ wx.onMenuShareAppMessage(shareData);
|
|
|
+ wx.onMenuShareTimeline(shareData);
|
|
|
+
|
|
|
+ function decryptCode(code, callback) {
|
|
|
+ $.getJSON('/jssdk/decrypt_code.php?code=' + encodeURI(code), function (res) {
|
|
|
+ if (res.errcode == 0) {
|
|
|
+ codes.push(res.code);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+});
|
|
|
+
|
|
|
+wx.error(function (res) {
|
|
|
+ alert(res.errMsg);
|
|
|
+});
|