Authored by 邱骏

修改优惠券领取bug

... ... @@ -17,7 +17,7 @@ let isWechat = /micromessenger/i.test(navigator.userAgent);
let isApp = /yohobuy/i.test(navigator.userAgent);
let isWechatMiniProgram = /miniprogram/i.test(navigator.userAgent);
let app_info = {
uid: '0',
uid: 0,
session_key: '',
app_version: '',
client_type: ''
... ... @@ -90,8 +90,8 @@ function hideShare() {
}
function getParams() { // 获取登录相关信息
let app_uid = cookie.get('app_uid') || qs.uid || app_info.uid;
let app_session_key = cookie.get('app_session_key') || qs.session_key || app_info.session_key;
let app_uid = parseInt(app_info.uid, 10) || cookie.get('app_uid') || qs.uid;
let app_session_key = app_info.session_key || cookie.get('app_session_key') || qs.session_key;
let app_version = cookie.get('app_version') || qs.app_version || '';
let app_client_type = cookie.get('app_client_type') || qs.app_client_type || '';
... ... @@ -129,9 +129,20 @@ function getCoupon() { // 分享成功后领券
if (result.code === 200) {
showWebShareTips(result.message);
} else if (result.code === 401) {
if (result.message) {
if (result.message.indexOf('登录') >= 0) {
showWebShareTips(result.message);
} else {
showWebShareTips('您已领取过该优惠券');
}
} else {
showWebShareTips('您已领取过该优惠券');
}
} else if (result.code === 501) {
showWebShareTips('您已领取过该优惠券');
} else if (result.code === 402) {
showWebShareTips('登录信息异常');
showWebShareTips('登录信息异常,请退出重新登录');
} else {
showWebShareTips(result.message);
}
... ... @@ -313,6 +324,21 @@ function initWebShare() {
if (appInterface) {
initWebShareButtons('app');
}
appInterface.triggerEvent(function(uid) {
if (parseInt(uid, 10)) {
app_info.uid = uid;
}
}, function() {}, {
method: 'get.uid'
});
appInterface.triggerEvent(function(sid) {
if (sid) {
app_info.session_key = sid;
}
}, function() {}, {
method: 'get.sessionId'
});
});
$('.web-share-buttons-container .button-download').hide();
} else if (isWechatMiniProgram) {
... ... @@ -401,7 +427,6 @@ function ceXuanFuInit() {
$('#sidebar').load(href + pageid + '.html', function() {
$('.sidebar-img').click(function() {
$('.sidebar').show();
$('.sidebar').show();
});
$('.sidebar').click(function(e) {
var $cur = $(e.target);
... ...