Authored by 毕凯

收藏品牌 商品 使用异步返回来判断是否登录

... ... @@ -10,11 +10,6 @@ $('#brand-favor').on('click', function() {
var $this = $(this),
uid = window.getUid();
if (!uid) {
location.href = '/signin.html?refer=' + encodeURIComponent(location.href);
return;
}
$.ajax({
type: 'post',
url: '/product/index/favoriteBrand',
... ... @@ -29,6 +24,8 @@ $('#brand-favor').on('click', function() {
} else {
$this.find('i').removeClass('coled');
}
} else if (res.code === 403) {
location.href = '/signin.html?refer=' + encodeURIComponent(location.href);
}
});
});
... ...
... ... @@ -95,11 +95,6 @@ exports.init = function(num) {
wrapperPt, //鼠标移入时弹层的上内边距
containerPt; //商品列表容器的上内边距
// 获取图片之前,先把获取上一张图片的ajax请求取消。 网络差的时候会出现错误
// if (getProductAjax && getProductAjax.readyState!= 4) {
// getProductAjax.abort();
// }
$.ajax({
type: 'POST',
url: '/product/list/getProductPic',
... ... @@ -174,11 +169,6 @@ $(document).on('hover', '.good-select-color li', function() {
$goodInfoMain.on('click', '.col-btn', function() {
var $this = $(this);
if (!window.getUid()) {
location.href = '/signin.html?refer=' + encodeURIComponent(location.href);
return;
}
$.ajax({
type: 'POST',
url: '/product/list/changeFavorite',
... ... @@ -189,6 +179,8 @@ $goodInfoMain.on('click', '.col-btn', function() {
}).then(function(res) {
if (res.code === 200) {
$this.toggleClass('coled');
} else if (res.code === 403) {
location.href = '/signin.html?refer=' + encodeURIComponent(location.href);
}
});
});
... ...