Authored by 陈峰

Merge branch 'feature/coupon-expansion' into 'master'

Feature/coupon expansion



See merge request !10
... ... @@ -47,7 +47,7 @@ body {
background-color: #000; }
.rules-popup .bg {
position: relative;
height: 33.4rem;
height: 30.15rem;
width: 18.75rem;
background-size: 100% 100%;
background-image: url("../image/popup-rules.png"); }
... ...

61.7 KB | W: | H:

95.7 KB | W: | H:

  • 2-up
  • Swipe
  • Onion skin
$(function(){var o={get_coupon_list:"/activity/couponExp/couponList",receive_coupon:"/activity/couponExp/receiveCoupon",expand_one:"/activity/couponExp/expandOne",yh_login_success:"/activity/couponExp/yhLoginSuccess",get_login_url:"/user/getLoginUrl",clear_yh_login:"/activity/couponExp/clearYhLogin"};Object.keys(o).forEach(function(i){o[i]="https://action.yoho.cn"+o[i]}),{yoho:window.$coupon_exp_yoho,init:function(){this.bindEvents()},bindEvents:function(){var i=this,n={activity_id:"2033"};i.yoho.isApp&&(n.uid=i.yoho.getUid()||""),$.ajax({data:n,url:o.get_coupon_list,xhrFields:{withCredentials:!0}}),$(".join-btn").on("click",function(){if(i.yoho.isApp){var n=+i.yoho.isLogin();n?$.ajax({method:"POST",url:o.receive_coupon,xhrFields:{withCredentials:!0},data:{uid:n,isApp:!0}}).then(function(o){301===o.code&&o.data.url&&(window.location.href=o.data.url)}):i.yoho.goLogin("//huodong.yoho.cn/coupon-expansion/index.html")}else $.ajax({url:"//m.yohobuy.com/passport/login/user",jsonp:"callback",dataType:"jsonp"}).then(function(i){if(!i.data)return $.ajax({method:"POST",url:o.clear_yh_login,xhrFields:{withCredentials:!0}})}).then(function(){$.ajax({method:"POST",url:o.receive_coupon,xhrFields:{withCredentials:!0}}).then(function(i){if(200===i.code)return window.location.href="/coupon-expansion/progress.html",{};if(401===i.code){var n="?url="+o.yh_login_success;return $.ajax({url:o.get_login_url+n})}}).then(function(o){200===o.code&&(window.location.href=o.loginUrl)})})}),$(".rule-btn").on("click",function(){$(".rules-popup").show()}),$(".rules-popup").on("click",function(){$(".rules-popup").hide()}),i.bindTip()},bindTip:function(){$(".tip-box").on("click",function(){$(this).hide()}),$(".tip-switch").on("click",function(){var o=$(this).data("idx");$(".tip-box.id_"+o).show()})}}.init()});
\ No newline at end of file
$(function(){var n={get_coupon_list:"/activity/couponExp/couponList",receive_coupon:"/activity/couponExp/receiveCoupon",expand_one:"/activity/couponExp/expandOne",yh_login_success:"/activity/couponExp/yhLoginSuccess",get_login_url:"/user/getLoginUrl",clear_yh_login:"/activity/couponExp/clearYhLogin"};Object.keys(n).forEach(function(o){n[o]="https://action.yoho.cn"+n[o]}),{yoho:window.$coupon_exp_yoho,init:function(){this.bindEvents()},bindEvents:function(){var o=this,i={activity_id:"2033"};o.yoho.isApp&&(i.uid=o.yoho.getUid()||""),$.ajax({data:i,url:n.get_coupon_list,xhrFields:{withCredentials:!0}}),$(".join-btn").on("click",function(){if(o.yoho.isApp){var i=+o.yoho.isLogin();i?$.ajax({method:"POST",url:n.receive_coupon,xhrFields:{withCredentials:!0},data:{uid:i,isApp:!0}}).then(function(n){301===n.code&&n.data.url&&(window.location.href=n.data.url)}):o.yoho.goLogin("//huodong.yoho.cn/coupon-expansion/index.html")}else $.ajax({url:"//m.yohobuy.com/passport/login/user",jsonp:"callback",dataType:"jsonp"}).then(function(o){if(!o.data)return $.ajax({method:"POST",url:n.clear_yh_login,xhrFields:{withCredentials:!0}})}).then(function(){$.ajax({method:"POST",url:n.receive_coupon,xhrFields:{withCredentials:!0}}).then(function(o){if(200===o.code)return window.location.href="/coupon-expansion/progress.html",{};if(401===o.code){var i="?url="+n.yh_login_success;return $.ajax({url:n.get_login_url+i})}}).then(function(n){200===n.code&&(window.location.href=n.loginUrl)})})}),$(".rule-btn").on("click",function(){$(".rules-popup").show()}),$(".rules-popup").on("click",function(){$(".rules-popup").hide()}),o.bindTip(),o.setShareInfo()},bindTip:function(){$(".tip-box").on("click",function(){$(this).hide()}),$(".tip-switch").on("click",function(){var n=$(this).data("idx");$(".tip-box.id_"+n).show()})},setShareInfo:function(){var n={title:"11.11潮这看!为了【199减100】和【50元现金券】~快来为我助力吧!!",desc:"呼朋引伴来赚钱!来【有货】助力好友,立赢199减100券和50元现金券!",imgUrl:"https://huodong.yoho.cn/coupon-expansion/image/share-new-logo.jpg",link:"https://huodong.yoho.cn/coupon-expansion/index.html"};/QQ/i.test(navigator.userAgent)&&$.ajax({url:"//qzonestyle.gtimg.cn/qzone/qzact/common/share/share.js",dataType:"script",cache:!0,success:function(){window.setShareInfo&&window.setShareInfo({title:n.title,summary:n.desc,pic:n.imgUrl,url:n.link})}}),/MicroMessenger/i.test(navigator.userAgent)&&$.ajax({url:"//res.wx.qq.com/open/js/jweixin-1.1.0.js",dataType:"script",cache:!0,success:function(){if(window.wx){$.getJSON("//www.yohoshow.com/api/wechat/getSignPackage?pageurl="+encodeURIComponent(location.href.split("#")[0])+"&callback=?",function(o){if(void 0!==o&&""!==o){var i=o.appId.toString(),e=o.timestamp,t=o.nonceStr.toString(),c=o.signature.toString();window.wx.config({debug:!1,appId:i,timestamp:e,nonceStr:t,signature:c,jsApiList:["checkJsApi","onMenuShareTimeline","onMenuShareAppMessage","onMenuShareQQ","onMenuShareWeibo","onMenuShareQZone"]}),window.wx.ready(function(){window.wx.onMenuShareTimeline(n),window.wx.onMenuShareAppMessage(n),window.wx.onMenuShareQQ(n),window.wx.onMenuShareQZone(n),window.wx.onMenuShareWeibo(n)})}})}}})}}.init()});
\ No newline at end of file
... ...
... ... @@ -2,6 +2,7 @@ $(function () {
var GULP_ENV = '/* @echo GULP_ENV */';
var CONFIG_ACTIVITY_ID = '/* @echo CONFIG_ACTIVITY_ID */';
var domain = GULP_ENV === 'production' ? 'https://action.yoho.cn' : 'http://action.yoho.cn';
var protocol = GULP_ENV === 'production' ? 'https:' : 'http:';
var req_urls = {
get_coupon_list: '/activity/couponExp/couponList',
... ... @@ -119,6 +120,7 @@ $(function () {
});
_this.bindTip();
_this.setShareInfo();
},
bindTip: function () {
... ... @@ -130,6 +132,78 @@ $(function () {
var index = $(this).data('idx');
$('.tip-box.id_' + index).show();
});
},
setShareInfo: function () {
var shareData = {
title: '11.11潮这看!为了【199减100】和【50元现金券】~快来为我助力吧!!',
desc: '呼朋引伴来赚钱!来【有货】助力好友,立赢199减100券和50元现金券!',
imgUrl: protocol +'//huodong.yoho.cn/coupon-expansion/image/share-new-logo.jpg',
link: protocol + '//huodong.yoho.cn/coupon-expansion/index.html'
};
if (/QQ/i.test(navigator.userAgent)) {
$.ajax({
url: '//qzonestyle.gtimg.cn/qzone/qzact/common/share/share.js',
dataType: 'script',
cache: true,
success: function() {
window.setShareInfo && window.setShareInfo({
title: shareData.title,
summary: shareData.desc,
pic: shareData.imgUrl,
url: shareData.link
});
}
});
}
if (/MicroMessenger/i.test(navigator.userAgent)) {
$.ajax({
url: '//res.wx.qq.com/open/js/jweixin-1.1.0.js',
dataType: 'script',
cache: true,
success: function() {
if (window.wx) {
var _weChatInterface = '//www.yohoshow.com/api/wechat/getSignPackage';//签名等相关配置,yoho公众号
$.getJSON(_weChatInterface + "?pageurl=" + encodeURIComponent(location.href.split('#')[0]) + "&callback=?", function (json) {
if (json !== undefined && json !== '') {
var _appId = json.appId.toString();
var _timestamp = json.timestamp;
var _nonceStr = json.nonceStr.toString();
var _signature = json.signature.toString();
window.wx.config({
debug: false,
appId: _appId,
timestamp: _timestamp,
nonceStr: _nonceStr,
signature: _signature,
jsApiList: [
'checkJsApi',
'onMenuShareTimeline',
'onMenuShareAppMessage',
'onMenuShareQQ',
'onMenuShareWeibo',
'onMenuShareQZone'
]
});
window.wx.ready(function () {
window.wx.onMenuShareTimeline(shareData);
window.wx.onMenuShareAppMessage(shareData);
window.wx.onMenuShareQQ(shareData);
window.wx.onMenuShareQZone(shareData);
window.wx.onMenuShareWeibo(shareData);
});
}
});
}
}
});
}
}
};
... ...
... ... @@ -56,7 +56,7 @@ body {
.bg {
position: relative;
height: 1336px;
height: 1206px;
width: 750px;
background-size: 100% 100%;
background-image: url("../image/popup-rules.png");
... ...