Authored by 梁志锋

Merge branch 'fix/issue' into 'develop'

购物车删除商品的代码优化

See merge request !74
... ... @@ -22,23 +22,10 @@ var navHammer,
freebieHammer,
switchChose = false;
//require('./good');
function isCookiesEnabled() {
var cookieEnabled = (navigator.cookieEnabled) ? true : false;
if (typeof navigator.cookieEnabled === 'undefined' && !cookieEnabled) {
document.cookie = 'testcookie';
cookieEnabled = (document.cookie.indexOf('testcookie') !== -1) ? true : false;
}
return (cookieEnabled);
}
function needLoadRecommandForYou() {
return isCookiesEnabled() ?
$('.shopping-cart-good').length <= 0 && window.cookie('yoho-cart-refreshByDelete') !== 'true' :
return window.isCookiesEnabled() ?
$('.shopping-cart-good').length <= 0 && window.cookie('_yoho-cart-refreshByDelete') !== 'true' :
$('.shopping-cart-good').length <= 0;
}
... ... @@ -48,7 +35,7 @@ if (needLoadRecommandForYou()) {
require('./good');
}
window.setCookie('yoho-cart-refreshByDelete', false);
window.setCookie('_yoho-cart-refreshByDelete', false);
ellipsis.init();
... ...
... ... @@ -108,7 +108,7 @@ $('.icon-del').on('touchstart', function(e) {
});
orderInfo('couponCode', null);
orderInfo('couponName', null);
window.setCookie('yoho-cart-refreshByDelete', true);
window.setCookie('_yoho-cart-refreshByDelete', true);
window.location.href = '/cart/index/index?cartType=' + $('#cartType').val();
} else {
tip.show(data.message);
... ...
... ... @@ -58,6 +58,17 @@ function setCookie(name, value, options) {
}
}
function isCookiesEnabled() {
var cookieEnabled = (navigator.cookieEnabled) ? true : false;
if (typeof navigator.cookieEnabled === 'undefined' && !cookieEnabled) {
document.cookie = 'testcookie';
cookieEnabled = (document.cookie.indexOf('testcookie') !== -1) ? true : false;
}
return (cookieEnabled);
}
function getUser() {
var c = cookie('_UID'),
user;
... ... @@ -276,6 +287,8 @@ window.cookie = cookie;
window.setCookie = setCookie;
window.isCookiesEnabled = isCookiesEnabled;
window.getUser = getUser;
window.getUid = getUid;
... ...