...
|
...
|
@@ -19,6 +19,20 @@ let _getMiniappLoginUrl = function(url) { |
|
|
return `${miniAppEntrance}?url=${encodeURIComponent(h5Url)}`
|
|
|
};
|
|
|
|
|
|
const gotoLogin = function() {
|
|
|
if (window.__wxjs_environment === 'miniprogram' && typeof wx !== 'undefined' && wx.miniProgram) {
|
|
|
wx.miniProgram.navigateTo({
|
|
|
url: _getMiniappLoginUrl(location.href)
|
|
|
});
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
if ($('#intimacy-link').length <= 0) {
|
|
|
$('body').append('<a href=\'' + user.noLoginUrl() + '\' style="display:none;" id="intimacy-link"><span class="intimacy-link"></span></a>');
|
|
|
}
|
|
|
$('.intimacy-link').click();
|
|
|
}
|
|
|
|
|
|
let isSendCoin = false;
|
|
|
let _getCoin = function(data) {
|
|
|
data.app = utils.queryString();
|
...
|
...
|
@@ -80,6 +94,16 @@ let _getCoin = function(data) { |
|
|
img: res.data.popupImg
|
|
|
});
|
|
|
}
|
|
|
} else if (res.code === 401 && res.auth) {
|
|
|
utils.showCoinTip({
|
|
|
title: '领取失败',
|
|
|
content: '登录信息失效,请重新登录',
|
|
|
close: true,
|
|
|
img: res.data && res.data.popupImg
|
|
|
});
|
|
|
setTimeout(() => {
|
|
|
gotoLogin();
|
|
|
}, 1000);
|
|
|
} else if (res.message) {
|
|
|
utils.showCoinTip({
|
|
|
title: '领取失败',
|
...
|
...
|
@@ -130,8 +154,11 @@ let _getCoupon = function(data){ |
|
|
|
|
|
if (res.code === 200) {
|
|
|
utils.toast('领取成功', options);
|
|
|
} else if (res.code === 401) {
|
|
|
utils.toast('已经领取', options);
|
|
|
} else if (res.code === 401 && res.auth) {
|
|
|
utils.toast('登录信息失效,请重新登录', options);
|
|
|
setTimeout(() => {
|
|
|
gotoLogin();
|
|
|
}, 1000);
|
|
|
} else if (res.message) {
|
|
|
utils.toast(res.message, options);
|
|
|
} else {
|
...
|
...
|
@@ -177,9 +204,24 @@ let _getRedEnevlope = function(data){ |
|
|
close: true
|
|
|
});
|
|
|
}
|
|
|
} else if (res.code === 401 && res.auth) {
|
|
|
utils.showTip({
|
|
|
title: '领取失败',
|
|
|
content: '登录信息失效,请重新登录',
|
|
|
close: false
|
|
|
});
|
|
|
setTimeout(() => {
|
|
|
gotoLogin();
|
|
|
}, 1000);
|
|
|
} else if (res.message) {
|
|
|
utils.showTip({
|
|
|
title: '领取失败',
|
|
|
content: res.message,
|
|
|
close: false
|
|
|
});
|
|
|
} else {
|
|
|
utils.showTip({
|
|
|
title: '领取失败',
|
|
|
content: '请刷新重新领取,若多次领取失败,<br>可能网络故障或活动已结束。',
|
|
|
close: false
|
|
|
});
|
...
|
...
|
@@ -217,17 +259,7 @@ let _initCoin = function(uid){ |
|
|
} else {
|
|
|
cookies.setCookie('yoho-coin-token', token);
|
|
|
|
|
|
if (window.__wxjs_environment === 'miniprogram' && typeof wx !== 'undefined' && wx.miniProgram) {
|
|
|
wx.miniProgram.navigateTo({
|
|
|
url: _getMiniappLoginUrl(location.href)
|
|
|
});
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
if ($('#intimacy-link').length <= 0) {
|
|
|
$('body').append('<a href=\'' + user.noLoginUrl() + '\' style="display:none;" id="intimacy-link"><span class="intimacy-link"></span></a>');
|
|
|
}
|
|
|
$('.intimacy-link').click();
|
|
|
gotoLogin();
|
|
|
return;
|
|
|
}
|
|
|
});
|
...
|
...
|
@@ -262,17 +294,7 @@ let _initCoupon = function(uid) { |
|
|
cookies.setCookie('yoho-conpon-token', token);
|
|
|
cookies.setCookie('yoho-conpon-type', type);
|
|
|
|
|
|
if (window.__wxjs_environment === 'miniprogram' && typeof wx !== 'undefined' && wx.miniProgram) {
|
|
|
wx.miniProgram.navigateTo({
|
|
|
url: _getMiniappLoginUrl(location.href)
|
|
|
});
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
if ($('#intimacy-link').length <= 0) {
|
|
|
$('body').append('<a href=\'' + user.noLoginUrl() + '\' style="display:none;" id="intimacy-link"><span class="intimacy-link"></span></a>');
|
|
|
}
|
|
|
$('.intimacy-link').click();
|
|
|
gotoLogin();
|
|
|
return;
|
|
|
}
|
|
|
});
|
...
|
...
|
@@ -301,17 +323,7 @@ let _initRedEnvelope = function(uid) { |
|
|
} else {
|
|
|
cookies.setCookie('yoho-redenvelope-token', token);
|
|
|
|
|
|
if (window.__wxjs_environment === 'miniprogram' && typeof wx !== 'undefined' && wx.miniProgram) {
|
|
|
wx.miniProgram.navigateTo({
|
|
|
url: _getMiniappLoginUrl(location.href)
|
|
|
});
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
if ($('#intimacy-link').length <= 0) {
|
|
|
$('body').append('<a href=\'' + user.noLoginUrl() + '\' style="display:none;" id="intimacy-link"><span class="intimacy-link"></span></a>');
|
|
|
}
|
|
|
$('.intimacy-link').click();
|
|
|
gotoLogin();
|
|
|
return;
|
|
|
}
|
|
|
});
|
...
|
...
|
|