Authored by 张丽霞

分享领券二次分享

... ... @@ -10,7 +10,7 @@ const sign = require(`${library}/sign`);
*/
const getPageInfo = (pageInfo) => {
var dest = {};
dest.pageInfo = pageInfo;
dest.code = pageInfo.code;
dest.activityID = pageInfo.id;
dest.title = pageInfo.data.h5Title;
... ...
... ... @@ -10,6 +10,7 @@
<p class="hidden" id="newUser">{{newUser}}</p>
<p class="hidden" id="tipMessage">{{message}}</p>
<p class="hidden" id="activityID">{{activityID}}</p>
<p class="hidden" id="pageInfo">{{pageInfo}}</p>
<div class="page">
<div class="gain-coupon-centent hidden">
<div class="coupon">
... ...
... ... @@ -6,7 +6,14 @@ var $ = require('yoho-jquery'),
oldUserCouponPic = $('#oldUserCouponPic').html(),
newUserCouponPic = $('#newUserCouponPic').html(),
tipMessage = $('#tipMessage').html(),
activityID = $('#activityID').html();
activityID = $('#activityID').html(),
pageInfo = $('#pageInfo').html(),
wx,
_weChatInterface = 'http://www.yohoshow.com/api/wechat/getSignPackage',
shareTitle = pageInfo.shareTitle,
shareImg = pageInfo.shareImg,
shareDesc = pageInfo.shareDesc,
shareLink = pageInfo.shareUrl;
$('#phone').bind('input propertychange', function() {
if ($(this).val().length === 11) {
... ... @@ -42,8 +49,84 @@ if (!$('#newUser').html()) {
$('.gain-coupon-centent .coupon img').attr('src', oldUserCouponPic);
}
$('.input-content').on('click', '.verification-code', function() {
$('.input-content div').eq('0').removeClass('verification-code');
/**
* 微信分享
*/
(function() {
if (typeof(wx) === 'undefined') {
return;
}
$.getJSON(_weChatInterface + '?pageurl=' +
encodeURIComponent(location.href.split('#')[0]) + '&callback=?', function(json) {
var _appId, _timestamp, _nonceStr, _signature;
if (json !== undefined && json !== '') {
_appId = json.appId.toString();
_timestamp = json.timestamp;
_nonceStr = json.nonceStr.toString();
_signature = json.signature.toString();
wx.config({
debug: false,
appId: _appId,
timestamp: _timestamp,
nonceStr: _nonceStr,
signature: _signature,
jsApiList: [
'checkJsApi',
'onMenuShareTimeline',
'onMenuShareAppMessage',
'onMenuShareQQ',
'onMenuShareWeibo',
'hideMenuItems',
'showMenuItems',
'hideAllNonBaseMenuItem',
'showAllNonBaseMenuItem',
'translateVoice',
'startRecord',
'stopRecord',
'onRecordEnd',
'playVoice',
'pauseVoice',
'stopVoice',
'uploadVoice',
'downloadVoice',
'chooseImage',
'previewImage',
'uploadImage',
'downloadImage',
'getNetworkType',
'openLocation',
'getLocation',
'hideOptionMenu',
'showOptionMenu',
'closeWindow',
'scanQRCode',
'chooseWXPay',
'openProductSpecificView',
'addCard',
'chooseCard',
'openCard'
]
});
}
});
wx.ready(function() {
var shareData = {
title: shareTitle,
desc: shareDesc,
imgUrl: shareImg,
link: shareLink
};
wx.onMenuShareAppMessage(shareData);
wx.onMenuShareTimeline(shareData);
wx.onMenuShareQQ(shareData);
wx.onMenuShareWeibo(shareData);
});
}());
$('.input-content div').on('click', function() {
phone = $(this).siblings('input').val();
reg = /[0-9]{11}/;
if (!reg.test(phone)) {
... ... @@ -63,7 +146,6 @@ $('.input-content').on('click', '.verification-code', function() {
mobile: $('#phone').val(),
ordercode: orderCode
},
dataType: 'json',
success: function(data) {
if (data.result.code === 200) {
if (window._yas) {
... ... @@ -122,11 +204,15 @@ $('.input-content').on('click', '.verification-code', function() {
}, 1400);
}
},
error: function(data) {
error: function() {
$('#dialog').removeClass('hidden');
$('.mask').removeClass('hidden');
$('#dialog .content').html('<p class="phone-error">网络错误,稍后再试!<p>');
console.log(data);
setTimeout(function() {
$('.messages').addClass('hidden');
$('.mask').addClass('hidden');
$('#dialog .content').html(' ');
}, 1400);
}
});
});
... ... @@ -211,11 +297,15 @@ $('.input-content').on('click', '.get', function() {
}, 1400);
}
},
error: function(data) {
error: function() {
$('#dialog').removeClass('hidden');
$('.mask').removeClass('hidden');
$('#dialog .content').html('<p class="phone-error">网络错误,稍后再试!<p>');
console.log(data);
setTimeout(function() {
$('.messages').addClass('hidden');
$('.mask').addClass('hidden');
$('#dialog .content').html(' ');
}, 1400);
}
});
} else {
... ...