Authored by xuqi

Merge branch 'hotfix/wxshare'

@@ -8,6 +8,11 @@ module.exports = function(flag) { @@ -8,6 +8,11 @@ module.exports = function(flag) {
8 //"逛"页面模拟数据 8 //"逛"页面模拟数据
9 case 'saunter': 9 case 'saunter':
10 return { 10 return {
  11 + shareLink: '',
  12 + shareDesc: '',
  13 + shareImg: '',
  14 + shareTitle: '',
  15 + //上为微信分享相关
11 author: { 16 author: {
12 avatar: 'http://7xidk0.com1.z0.glb.clouddn.com/avater.png', 17 avatar: 'http://7xidk0.com1.z0.glb.clouddn.com/avater.png',
13 name: '山本耀司', 18 name: '山本耀司',
@@ -8,6 +8,7 @@ var $ = require('jquery'), @@ -8,6 +8,7 @@ var $ = require('jquery'),
8 Mustache = require('mustache'), 8 Mustache = require('mustache'),
9 ellipsis = require('mlellipsis'); 9 ellipsis = require('mlellipsis');
10 10
  11 +require('./wxshare')();
11 require('lazyload'); 12 require('lazyload');
12 13
13 /** 14 /**
@@ -3,11 +3,11 @@ @@ -3,11 +3,11 @@
3 * @author: yue.liu@yoho.cn 3 * @author: yue.liu@yoho.cn
4 * @date;2015/3/31 4 * @date;2015/3/31
5 */ 5 */
6 -  
7 var $ = require('jquery'), 6 var $ = require('jquery'),
8 IScroll = require('iscroll/iscroll-probe'), 7 IScroll = require('iscroll/iscroll-probe'),
9 ellipsis = require('mlellipsis'); 8 ellipsis = require('mlellipsis');
10 9
  10 +require('./wxshare')();
11 require('lazyload'); 11 require('lazyload');
12 12
13 //lazyLoad-Fn 13 //lazyLoad-Fn
@@ -27,6 +27,7 @@ function lazyLoad(imgs, options) { @@ -27,6 +27,7 @@ function lazyLoad(imgs, options) {
27 } 27 }
28 $imgs.lazyload(setting); 28 $imgs.lazyload(setting);
29 } 29 }
  30 +
30 /** 31 /**
31 * 初始化Android页面 32 * 初始化Android页面
32 */ 33 */
@@ -10,6 +10,7 @@ var $ = require('jquery'), @@ -10,6 +10,7 @@ var $ = require('jquery'),
10 Mustache = require('mustache'), 10 Mustache = require('mustache'),
11 timer = null; 11 timer = null;
12 12
  13 +require('./wxshare')();
13 require('lazyload'); 14 require('lazyload');
14 15
15 /** 16 /**
  1 +var $ = require('jquery');
  2 +/**
  3 + * 微信分享
  4 + */
  5 +module.exports = function() {
  6 + var _weChatInterface = 'http://www.yohoshow.com/api/wechat/getSignPackage';
  7 + $.getJSON(_weChatInterface + "?pageurl=" + encodeURIComponent(location.href.split('#')[0]) + "&callback=?", function (json) {
  8 + if (json !== undefined && json !== '') {
  9 + var _appId = json.appId.toString();
  10 + var _timestamp = json.timestamp;
  11 + var _nonceStr = json.nonceStr.toString();
  12 + var _signature = json.signature.toString();
  13 + wx.config({
  14 + debug: false,
  15 + appId: _appId,
  16 + timestamp: _timestamp,
  17 + nonceStr: _nonceStr,
  18 + signature: _signature,
  19 + jsApiList: [
  20 + 'checkJsApi',
  21 + 'onMenuShareTimeline',
  22 + 'onMenuShareAppMessage',
  23 + 'onMenuShareQQ',
  24 + 'onMenuShareWeibo',
  25 + 'hideMenuItems',
  26 + 'showMenuItems',
  27 + 'hideAllNonBaseMenuItem',
  28 + 'showAllNonBaseMenuItem',
  29 + 'translateVoice',
  30 + 'startRecord',
  31 + 'stopRecord',
  32 + 'onRecordEnd',
  33 + 'playVoice',
  34 + 'pauseVoice',
  35 + 'stopVoice',
  36 + 'uploadVoice',
  37 + 'downloadVoice',
  38 + 'chooseImage',
  39 + 'previewImage',
  40 + 'uploadImage',
  41 + 'downloadImage',
  42 + 'getNetworkType',
  43 + 'openLocation',
  44 + 'getLocation',
  45 + 'hideOptionMenu',
  46 + 'showOptionMenu',
  47 + 'closeWindow',
  48 + 'scanQRCode',
  49 + 'chooseWXPay',
  50 + 'openProductSpecificView',
  51 + 'addCard',
  52 + 'chooseCard',
  53 + 'openCard'
  54 + ]
  55 + });
  56 + }
  57 + });
  58 +
  59 + wx.ready(function () {
  60 + var shareTitle = $('#shareTitle').val();
  61 + var shareImg = $('#shareImg').val();
  62 + var shareDesc = $('#shareDesc').val();
  63 + var shareLink = $('#shareLink').val();
  64 + var shareData = {
  65 + title: shareTitle,
  66 + desc: shareDesc,
  67 + imgUrl: shareImg,
  68 + link: shareLink,
  69 + };
  70 +
  71 + wx.onMenuShareAppMessage(shareData);
  72 + wx.onMenuShareTimeline(shareData);
  73 + wx.onMenuShareQQ(shareData);
  74 + wx.onMenuShareWeibo(shareData);
  75 + });
  76 +};
@@ -51,5 +51,10 @@ @@ -51,5 +51,10 @@
51 </div> 51 </div>
52 </div> 52 </div>
53 {{/ article}} 53 {{/ article}}
  54 + {{! 微信分享相关 }}
  55 + <input id="shareLink" type="hidden" value="{{shareLink}}">
  56 + <input id="shareDesc" type="hidden" value="{{shareDesc}}">
  57 + <input id="shareImg" type="hidden" value="{{shareImg}}">
  58 + <input id="shareTitle" type="hidden" value="{{shareTitle}}">
54 {{/ data}} 59 {{/ data}}
55 </div> 60 </div>
@@ -6,6 +6,11 @@ @@ -6,6 +6,11 @@
6 {{> saunter/related_brand}} 6 {{> saunter/related_brand}}
7 {{> saunter/article_tag}} 7 {{> saunter/article_tag}}
8 {{> saunter/related_post}} 8 {{> saunter/related_post}}
  9 + {{! 微信分享相关 }}
  10 + <input id="shareLink" type="hidden" value="{{shareLink}}">
  11 + <input id="shareDesc" type="hidden" value="{{shareDesc}}">
  12 + <input id="shareImg" type="hidden" value="{{shareImg}}">
  13 + <input id="shareTitle" type="hidden" value="{{shareTitle}}">
9 {{/ data}} 14 {{/ data}}
10 </div> 15 </div>
11 </div> 16 </div>
@@ -87,5 +87,10 @@ @@ -87,5 +87,10 @@
87 <input id="promotion" type="hidden" value="{{promotionId}}"> 87 <input id="promotion" type="hidden" value="{{promotionId}}">
88 <input id="client-type" type="hidden" value="{{clientType}}"> 88 <input id="client-type" type="hidden" value="{{clientType}}">
89 <input id="content-code" type="hidden" value="{{contentCode}}"> 89 <input id="content-code" type="hidden" value="{{contentCode}}">
  90 + {{! 微信分享相关 }}
  91 + <input id="shareLink" type="hidden" value="{{shareLink}}">
  92 + <input id="shareDesc" type="hidden" value="{{shareDesc}}">
  93 + <input id="shareImg" type="hidden" value="{{shareImg}}">
  94 + <input id="shareTitle" type="hidden" value="{{shareTitle}}">
90 {{/ data}} 95 {{/ data}}
91 </div> 96 </div>
  1 +<script type="text/javascript" charset="utf-8" src="http://res.wx.qq.com/open/js/jweixin-1.0.0.js"></script>
1 <script src="http://localhost:8000/static/js/sea.js?nowrap"></script> 2 <script src="http://localhost:8000/static/js/sea.js?nowrap"></script>
2 <script> 3 <script>
3 seajs.config({ 4 seajs.config({