Authored by 张丽霞

分享领券二次分享

@@ -10,7 +10,7 @@ const sign = require(`${library}/sign`); @@ -10,7 +10,7 @@ const sign = require(`${library}/sign`);
10 */ 10 */
11 const getPageInfo = (pageInfo) => { 11 const getPageInfo = (pageInfo) => {
12 var dest = {}; 12 var dest = {};
13 - 13 + dest.pageInfo = pageInfo;
14 dest.code = pageInfo.code; 14 dest.code = pageInfo.code;
15 dest.activityID = pageInfo.id; 15 dest.activityID = pageInfo.id;
16 dest.title = pageInfo.data.h5Title; 16 dest.title = pageInfo.data.h5Title;
@@ -10,6 +10,7 @@ @@ -10,6 +10,7 @@
10 <p class="hidden" id="newUser">{{newUser}}</p> 10 <p class="hidden" id="newUser">{{newUser}}</p>
11 <p class="hidden" id="tipMessage">{{message}}</p> 11 <p class="hidden" id="tipMessage">{{message}}</p>
12 <p class="hidden" id="activityID">{{activityID}}</p> 12 <p class="hidden" id="activityID">{{activityID}}</p>
  13 + <p class="hidden" id="pageInfo">{{pageInfo}}</p>
13 <div class="page"> 14 <div class="page">
14 <div class="gain-coupon-centent hidden"> 15 <div class="gain-coupon-centent hidden">
15 <div class="coupon"> 16 <div class="coupon">
@@ -6,7 +6,14 @@ var $ = require('yoho-jquery'), @@ -6,7 +6,14 @@ var $ = require('yoho-jquery'),
6 oldUserCouponPic = $('#oldUserCouponPic').html(), 6 oldUserCouponPic = $('#oldUserCouponPic').html(),
7 newUserCouponPic = $('#newUserCouponPic').html(), 7 newUserCouponPic = $('#newUserCouponPic').html(),
8 tipMessage = $('#tipMessage').html(), 8 tipMessage = $('#tipMessage').html(),
9 - activityID = $('#activityID').html(); 9 + activityID = $('#activityID').html(),
  10 + pageInfo = $('#pageInfo').html(),
  11 + wx,
  12 + _weChatInterface = 'http://www.yohoshow.com/api/wechat/getSignPackage',
  13 + shareTitle = pageInfo.shareTitle,
  14 + shareImg = pageInfo.shareImg,
  15 + shareDesc = pageInfo.shareDesc,
  16 + shareLink = pageInfo.shareUrl;
10 17
11 $('#phone').bind('input propertychange', function() { 18 $('#phone').bind('input propertychange', function() {
12 if ($(this).val().length === 11) { 19 if ($(this).val().length === 11) {
@@ -42,8 +49,84 @@ if (!$('#newUser').html()) { @@ -42,8 +49,84 @@ if (!$('#newUser').html()) {
42 $('.gain-coupon-centent .coupon img').attr('src', oldUserCouponPic); 49 $('.gain-coupon-centent .coupon img').attr('src', oldUserCouponPic);
43 } 50 }
44 51
45 -$('.input-content').on('click', '.verification-code', function() {  
46 - $('.input-content div').eq('0').removeClass('verification-code'); 52 +/**
  53 + * 微信分享
  54 + */
  55 +(function() {
  56 + if (typeof(wx) === 'undefined') {
  57 + return;
  58 + }
  59 +
  60 + $.getJSON(_weChatInterface + '?pageurl=' +
  61 + encodeURIComponent(location.href.split('#')[0]) + '&callback=?', function(json) {
  62 + var _appId, _timestamp, _nonceStr, _signature;
  63 + if (json !== undefined && json !== '') {
  64 + _appId = json.appId.toString();
  65 + _timestamp = json.timestamp;
  66 + _nonceStr = json.nonceStr.toString();
  67 + _signature = json.signature.toString();
  68 +
  69 + wx.config({
  70 + debug: false,
  71 + appId: _appId,
  72 + timestamp: _timestamp,
  73 + nonceStr: _nonceStr,
  74 + signature: _signature,
  75 + jsApiList: [
  76 + 'checkJsApi',
  77 + 'onMenuShareTimeline',
  78 + 'onMenuShareAppMessage',
  79 + 'onMenuShareQQ',
  80 + 'onMenuShareWeibo',
  81 + 'hideMenuItems',
  82 + 'showMenuItems',
  83 + 'hideAllNonBaseMenuItem',
  84 + 'showAllNonBaseMenuItem',
  85 + 'translateVoice',
  86 + 'startRecord',
  87 + 'stopRecord',
  88 + 'onRecordEnd',
  89 + 'playVoice',
  90 + 'pauseVoice',
  91 + 'stopVoice',
  92 + 'uploadVoice',
  93 + 'downloadVoice',
  94 + 'chooseImage',
  95 + 'previewImage',
  96 + 'uploadImage',
  97 + 'downloadImage',
  98 + 'getNetworkType',
  99 + 'openLocation',
  100 + 'getLocation',
  101 + 'hideOptionMenu',
  102 + 'showOptionMenu',
  103 + 'closeWindow',
  104 + 'scanQRCode',
  105 + 'chooseWXPay',
  106 + 'openProductSpecificView',
  107 + 'addCard',
  108 + 'chooseCard',
  109 + 'openCard'
  110 + ]
  111 + });
  112 + }
  113 + });
  114 + wx.ready(function() {
  115 +
  116 + var shareData = {
  117 + title: shareTitle,
  118 + desc: shareDesc,
  119 + imgUrl: shareImg,
  120 + link: shareLink
  121 + };
  122 + wx.onMenuShareAppMessage(shareData);
  123 + wx.onMenuShareTimeline(shareData);
  124 + wx.onMenuShareQQ(shareData);
  125 + wx.onMenuShareWeibo(shareData);
  126 + });
  127 +}());
  128 +
  129 +$('.input-content div').on('click', function() {
47 phone = $(this).siblings('input').val(); 130 phone = $(this).siblings('input').val();
48 reg = /[0-9]{11}/; 131 reg = /[0-9]{11}/;
49 if (!reg.test(phone)) { 132 if (!reg.test(phone)) {
@@ -63,7 +146,6 @@ $('.input-content').on('click', '.verification-code', function() { @@ -63,7 +146,6 @@ $('.input-content').on('click', '.verification-code', function() {
63 mobile: $('#phone').val(), 146 mobile: $('#phone').val(),
64 ordercode: orderCode 147 ordercode: orderCode
65 }, 148 },
66 - dataType: 'json',  
67 success: function(data) { 149 success: function(data) {
68 if (data.result.code === 200) { 150 if (data.result.code === 200) {
69 if (window._yas) { 151 if (window._yas) {
@@ -122,11 +204,15 @@ $('.input-content').on('click', '.verification-code', function() { @@ -122,11 +204,15 @@ $('.input-content').on('click', '.verification-code', function() {
122 }, 1400); 204 }, 1400);
123 } 205 }
124 }, 206 },
125 - error: function(data) { 207 + error: function() {
126 $('#dialog').removeClass('hidden'); 208 $('#dialog').removeClass('hidden');
127 $('.mask').removeClass('hidden'); 209 $('.mask').removeClass('hidden');
128 $('#dialog .content').html('<p class="phone-error">网络错误,稍后再试!<p>'); 210 $('#dialog .content').html('<p class="phone-error">网络错误,稍后再试!<p>');
129 - console.log(data); 211 + setTimeout(function() {
  212 + $('.messages').addClass('hidden');
  213 + $('.mask').addClass('hidden');
  214 + $('#dialog .content').html(' ');
  215 + }, 1400);
130 } 216 }
131 }); 217 });
132 }); 218 });
@@ -211,11 +297,15 @@ $('.input-content').on('click', '.get', function() { @@ -211,11 +297,15 @@ $('.input-content').on('click', '.get', function() {
211 }, 1400); 297 }, 1400);
212 } 298 }
213 }, 299 },
214 - error: function(data) { 300 + error: function() {
215 $('#dialog').removeClass('hidden'); 301 $('#dialog').removeClass('hidden');
216 $('.mask').removeClass('hidden'); 302 $('.mask').removeClass('hidden');
217 $('#dialog .content').html('<p class="phone-error">网络错误,稍后再试!<p>'); 303 $('#dialog .content').html('<p class="phone-error">网络错误,稍后再试!<p>');
218 - console.log(data); 304 + setTimeout(function() {
  305 + $('.messages').addClass('hidden');
  306 + $('.mask').addClass('hidden');
  307 + $('#dialog .content').html(' ');
  308 + }, 1400);
219 } 309 }
220 }); 310 });
221 } else { 311 } else {