Authored by xuqi

wx-share

@@ -27,6 +27,8 @@ var winW = $(window).width(); @@ -27,6 +27,8 @@ var winW = $(window).width();
27 27
28 var myScroll; 28 var myScroll;
29 29
  30 +require('../plugin/wxshare')();
  31 +
30 /** 32 /**
31 * 计算搭配的箭头的位置 33 * 计算搭配的箭头的位置
32 * @param $curPos 当前focus的搭配项 34 * @param $curPos 当前focus的搭配项
  1 +/**
  2 + * 微信分享
  3 + * @author: xuqi<qi.xu@yoho.cn>
  4 + * @date: 2015/10/30
  5 + */
  6 +
  7 +var $ = require('jquery');
  8 +
  9 +module.exports = function() {
  10 + var _weChatInterface = 'http://www.yohoshow.com/api/wechat/getSignPackage';
  11 +
  12 + $.getJSON(_weChatInterface + '?pageurl=' +
  13 + encodeURIComponent(location.href.split('#')[0]) + '&callback=?', function (json) {
  14 + var _appId, _timestamp, _nonceStr, _signature;
  15 +
  16 + if (json !== undefined && json !== '') {
  17 + _appId = json.appId.toString();
  18 + _timestamp = json.timestamp;
  19 + _nonceStr = json.nonceStr.toString();
  20 + _signature = json.signature.toString();
  21 +
  22 + wx.config({
  23 + debug: false,
  24 + appId: _appId,
  25 + timestamp: _timestamp,
  26 + nonceStr: _nonceStr,
  27 + signature: _signature,
  28 + jsApiList: [
  29 + 'checkJsApi',
  30 + 'onMenuShareTimeline',
  31 + 'onMenuShareAppMessage',
  32 + 'onMenuShareQQ',
  33 + 'onMenuShareWeibo',
  34 + 'hideMenuItems',
  35 + 'showMenuItems',
  36 + 'hideAllNonBaseMenuItem',
  37 + 'showAllNonBaseMenuItem',
  38 + 'translateVoice',
  39 + 'startRecord',
  40 + 'stopRecord',
  41 + 'onRecordEnd',
  42 + 'playVoice',
  43 + 'pauseVoice',
  44 + 'stopVoice',
  45 + 'uploadVoice',
  46 + 'downloadVoice',
  47 + 'chooseImage',
  48 + 'previewImage',
  49 + 'uploadImage',
  50 + 'downloadImage',
  51 + 'getNetworkType',
  52 + 'openLocation',
  53 + 'getLocation',
  54 + 'hideOptionMenu',
  55 + 'showOptionMenu',
  56 + 'closeWindow',
  57 + 'scanQRCode',
  58 + 'chooseWXPay',
  59 + 'openProductSpecificView',
  60 + 'addCard',
  61 + 'chooseCard',
  62 + 'openCard'
  63 + ]
  64 + });
  65 + }
  66 + });
  67 +
  68 + wx.ready(function () {
  69 + var shareTitle = $('#shareTitle').val();
  70 + var shareImg = $('#shareImg').val();
  71 + var shareDesc = $('#shareDesc').val();
  72 + var shareLink = $('#shareLink').val();
  73 + var shareData = {
  74 + title: shareTitle,
  75 + desc: shareDesc,
  76 + imgUrl: shareImg,
  77 + link: shareLink
  78 + };
  79 +
  80 + wx.onMenuShareAppMessage(shareData);
  81 + wx.onMenuShareTimeline(shareData);
  82 + wx.onMenuShareQQ(shareData);
  83 + wx.onMenuShareWeibo(shareData);
  84 + });
  85 +};
@@ -24,6 +24,7 @@ @@ -24,6 +24,7 @@
24 </script> 24 </script>
25 {{/if}} 25 {{/if}}
26 {{#if guangDetail}} 26 {{#if guangDetail}}
  27 +<script type="text/javascript" charset="utf-8" src="http://res.wx.qq.com/open/js/jweixin-1.0.0.js" defer></script>
27 <script> 28 <script>
28 seajs.use('js/guang/detail'); 29 seajs.use('js/guang/detail');
29 </script> 30 </script>