Authored by yyq

merge release/wechat

... ... @@ -10,7 +10,10 @@ const sign = require(`${library}/sign`);
*/
const getPageInfo = (pageInfo) => {
var dest = {};
dest.shareTitle = pageInfo.data.shareTitle;
dest.shareDesc = pageInfo.data.shareContent;
dest.shareImg = pageInfo.data.shareImgUrl;
dest.shareLink = pageInfo.data.shareUrl;
dest.code = pageInfo.code;
dest.activityID = pageInfo.id;
dest.title = pageInfo.data.h5Title;
... ...
... ... @@ -10,6 +10,11 @@
<p class="hidden" id="newUser">{{newUser}}</p>
<p class="hidden" id="tipMessage">{{message}}</p>
<p class="hidden" id="activityID">{{activityID}}</p>
<input type="hidden" id="shareTitle" value="{{shareTitle}}">
<input type="hidden" id="shareDesc" value="{{shareDesc}}">
<input type="hidden" id="shareImg" value="{{shareImg}}">
<input type="hidden" id="shareLink" value="{{shareLink}}">
<div class="page">
<div class="gain-coupon-centent hidden">
<div class="coupon">
... ...
... ... @@ -17,6 +17,7 @@
<script type="text/javascript">
(function(d,c){var e=d.documentElement,a="orientationchange" in window?"orientationchange":"resize",b=function(){var f=e.clientWidth;if(!f){return}if(f>=640){e.style.fontSize="40px"}else{e.style.fontSize=40*(f/640)+"px"}};if(!d.addEventListener){return}b();c.addEventListener(a,b,false);d.addEventListener("DOMContentLoaded",b,false)})(document,window);
</script>
<script type="text/javascript" src="http://res.wx.qq.com/open/js/jweixin-1.1.0.js"></script>
{{#if devEnv}}
<link rel="stylesheet" href="//localhost:5001/css/index.css">
{{^}}
... ...
... ... @@ -52,7 +52,14 @@
oldUserCouponPic = $('#oldUserCouponPic').html(),
newUserCouponPic = $('#newUserCouponPic').html(),
tipMessage = $('#tipMessage').html(),
activityID = $('#activityID').html();
activityID = $('#activityID').html(),
pageInfo = $('#pageInfo').html(),
_weChatInterface = 'http://www.yohoshow.com/api/wechat/getSignPackage',
shareTitle = $('#shareTitle').val(),
shareImg = $('#shareImg').val(),
shareDesc = $('#shareDesc').val(),
shareLink = $('#shareLink').val(),
wx = window.wx;
$('#phone').bind('input propertychange', function() {
if ($(this).val().length === 11) {
... ... @@ -88,8 +95,90 @@
$('.gain-coupon-centent .coupon img').attr('src', oldUserCouponPic);
}
$('.input-content').on('click', '.verification-code', function() {
$('.input-content div').eq('0').removeClass('verification-code');
/**
* 微信分享
*/
if (typeof wx !== 'undefined') {
$.getJSON(_weChatInterface + '?pageurl=' +
encodeURIComponent(location.href.split('#')[0]) + '&callback=?',
function(json) {
var _appId, _timestamp, _nonceStr, _signature;
if (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);
// 分享到QQ
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)) {
... ... @@ -109,7 +198,6 @@
mobile: $('#phone').val(),
ordercode: orderCode
},
dataType: 'json',
success: function(data) {
if (data.result.code === 200) {
if (window._yas) {
... ... @@ -168,11 +256,15 @@
}, 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);
}
});
});
... ... @@ -257,11 +349,15 @@
}, 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 {
... ... @@ -289,7 +385,7 @@
$('.mask').removeClass('hidden');
});
$('.input-content').on('click', '.get', function() {
$('.use-coupon-btn').on('click', function() {
if (window._yas) {
window._yas.sendCustomInfo({
activityID: activityID
... ...
This diff could not be displayed because it is too large.
... ... @@ -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(),
_weChatInterface = 'http://www.yohoshow.com/api/wechat/getSignPackage',
shareTitle = $('#shareTitle').val(),
shareImg = $('#shareImg').val(),
shareDesc = $('#shareDesc').val(),
shareLink = $('#shareLink').val(),
wx = window.wx;
$('#phone').bind('input propertychange', function() {
if ($(this).val().length === 11) {
... ... @@ -42,8 +49,90 @@ 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');
/**
* 微信分享
*/
if (typeof wx !== 'undefined') {
$.getJSON(_weChatInterface + '?pageurl=' +
encodeURIComponent(location.href.split('#')[0]) + '&callback=?',
function(json) {
var _appId, _timestamp, _nonceStr, _signature;
if (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);
// 分享到QQ
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 +152,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 +210,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 +303,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 {
... ... @@ -243,7 +339,7 @@ $('.description').on('click', function() {
$('.mask').removeClass('hidden');
});
$('.input-content').on('click', '.get', function() {
$('.use-coupon-btn').on('click', function() {
if (window._yas) {
window._yas.sendCustomInfo({
activityID: activityID
... ...