Authored by 张丽霞

gulp ge

@@ -52,7 +52,14 @@ @@ -52,7 +52,14 @@
52 oldUserCouponPic = $('#oldUserCouponPic').html(), 52 oldUserCouponPic = $('#oldUserCouponPic').html(),
53 newUserCouponPic = $('#newUserCouponPic').html(), 53 newUserCouponPic = $('#newUserCouponPic').html(),
54 tipMessage = $('#tipMessage').html(), 54 tipMessage = $('#tipMessage').html(),
55 - activityID = $('#activityID').html(); 55 + activityID = $('#activityID').html(),
  56 + pageInfo = $('#pageInfo').html(),
  57 + wx,
  58 + _weChatInterface = 'http://www.yohoshow.com/api/wechat/getSignPackage',
  59 + shareTitle = pageInfo.shareTitle,
  60 + shareImg = pageInfo.shareImg,
  61 + shareDesc = pageInfo.shareDesc,
  62 + shareLink = pageInfo.shareUrl;
56 63
57 $('#phone').bind('input propertychange', function() { 64 $('#phone').bind('input propertychange', function() {
58 if ($(this).val().length === 11) { 65 if ($(this).val().length === 11) {
@@ -88,8 +95,84 @@ @@ -88,8 +95,84 @@
88 $('.gain-coupon-centent .coupon img').attr('src', oldUserCouponPic); 95 $('.gain-coupon-centent .coupon img').attr('src', oldUserCouponPic);
89 } 96 }
90 97
91 - $('.input-content').on('click', '.verification-code', function() {  
92 - $('.input-content div').eq('0').removeClass('verification-code'); 98 + /**
  99 + * 微信分享
  100 + */
  101 + (function() {
  102 + if (typeof(wx) === 'undefined') {
  103 + return;
  104 + }
  105 +
  106 + $.getJSON(_weChatInterface + '?pageurl=' +
  107 + encodeURIComponent(location.href.split('#')[0]) + '&callback=?', function(json) {
  108 + var _appId, _timestamp, _nonceStr, _signature;
  109 + if (json !== undefined && json !== '') {
  110 + _appId = json.appId.toString();
  111 + _timestamp = json.timestamp;
  112 + _nonceStr = json.nonceStr.toString();
  113 + _signature = json.signature.toString();
  114 +
  115 + wx.config({
  116 + debug: false,
  117 + appId: _appId,
  118 + timestamp: _timestamp,
  119 + nonceStr: _nonceStr,
  120 + signature: _signature,
  121 + jsApiList: [
  122 + 'checkJsApi',
  123 + 'onMenuShareTimeline',
  124 + 'onMenuShareAppMessage',
  125 + 'onMenuShareQQ',
  126 + 'onMenuShareWeibo',
  127 + 'hideMenuItems',
  128 + 'showMenuItems',
  129 + 'hideAllNonBaseMenuItem',
  130 + 'showAllNonBaseMenuItem',
  131 + 'translateVoice',
  132 + 'startRecord',
  133 + 'stopRecord',
  134 + 'onRecordEnd',
  135 + 'playVoice',
  136 + 'pauseVoice',
  137 + 'stopVoice',
  138 + 'uploadVoice',
  139 + 'downloadVoice',
  140 + 'chooseImage',
  141 + 'previewImage',
  142 + 'uploadImage',
  143 + 'downloadImage',
  144 + 'getNetworkType',
  145 + 'openLocation',
  146 + 'getLocation',
  147 + 'hideOptionMenu',
  148 + 'showOptionMenu',
  149 + 'closeWindow',
  150 + 'scanQRCode',
  151 + 'chooseWXPay',
  152 + 'openProductSpecificView',
  153 + 'addCard',
  154 + 'chooseCard',
  155 + 'openCard'
  156 + ]
  157 + });
  158 + }
  159 + });
  160 + wx.ready(function() {
  161 +
  162 + var shareData = {
  163 + title: shareTitle,
  164 + desc: shareDesc,
  165 + imgUrl: shareImg,
  166 + link: shareLink
  167 + };
  168 + wx.onMenuShareAppMessage(shareData);
  169 + wx.onMenuShareTimeline(shareData);
  170 + wx.onMenuShareQQ(shareData);
  171 + wx.onMenuShareWeibo(shareData);
  172 + });
  173 + }());
  174 +
  175 + $('.input-content div').on('click', function() {
93 phone = $(this).siblings('input').val(); 176 phone = $(this).siblings('input').val();
94 reg = /[0-9]{11}/; 177 reg = /[0-9]{11}/;
95 if (!reg.test(phone)) { 178 if (!reg.test(phone)) {
@@ -109,7 +192,6 @@ @@ -109,7 +192,6 @@
109 mobile: $('#phone').val(), 192 mobile: $('#phone').val(),
110 ordercode: orderCode 193 ordercode: orderCode
111 }, 194 },
112 - dataType: 'json',  
113 success: function(data) { 195 success: function(data) {
114 if (data.result.code === 200) { 196 if (data.result.code === 200) {
115 if (window._yas) { 197 if (window._yas) {
@@ -168,11 +250,15 @@ @@ -168,11 +250,15 @@
168 }, 1400); 250 }, 1400);
169 } 251 }
170 }, 252 },
171 - error: function(data) { 253 + error: function() {
172 $('#dialog').removeClass('hidden'); 254 $('#dialog').removeClass('hidden');
173 $('.mask').removeClass('hidden'); 255 $('.mask').removeClass('hidden');
174 $('#dialog .content').html('<p class="phone-error">网络错误,稍后再试!<p>'); 256 $('#dialog .content').html('<p class="phone-error">网络错误,稍后再试!<p>');
175 - console.log(data); 257 + setTimeout(function() {
  258 + $('.messages').addClass('hidden');
  259 + $('.mask').addClass('hidden');
  260 + $('#dialog .content').html(' ');
  261 + }, 1400);
176 } 262 }
177 }); 263 });
178 }); 264 });
@@ -257,11 +343,15 @@ @@ -257,11 +343,15 @@
257 }, 1400); 343 }, 1400);
258 } 344 }
259 }, 345 },
260 - error: function(data) { 346 + error: function() {
261 $('#dialog').removeClass('hidden'); 347 $('#dialog').removeClass('hidden');
262 $('.mask').removeClass('hidden'); 348 $('.mask').removeClass('hidden');
263 $('#dialog .content').html('<p class="phone-error">网络错误,稍后再试!<p>'); 349 $('#dialog .content').html('<p class="phone-error">网络错误,稍后再试!<p>');
264 - console.log(data); 350 + setTimeout(function() {
  351 + $('.messages').addClass('hidden');
  352 + $('.mask').addClass('hidden');
  353 + $('#dialog .content').html(' ');
  354 + }, 1400);
265 } 355 }
266 }); 356 });
267 } else { 357 } else {
This diff could not be displayed because it is too large.