...
|
...
|
@@ -88,54 +88,54 @@ moreHammer.on('tap', function(e) { |
|
|
e.preventDefault(); // 防止收缩后误点到商品产生跳转
|
|
|
});
|
|
|
|
|
|
// 品牌收藏
|
|
|
likeHammer = new Hammer(document.getElementById('brand-like'));
|
|
|
likeHammer.on('tap', function(e) {
|
|
|
var opt = 'ok',
|
|
|
$this = $(e.target);
|
|
|
|
|
|
// jumpToApp = 1表示APP未登录的情况,此时不发送ajax请求而由a链接直接跳转APP
|
|
|
// if (jumpToApp === '1') {
|
|
|
// return true;
|
|
|
// }
|
|
|
e.preventDefault();
|
|
|
|
|
|
if ($this.hasClass('like')) {
|
|
|
opt = 'cancel';
|
|
|
}
|
|
|
$.ajax({
|
|
|
type: 'POST',
|
|
|
url: '/guang/opt/favoriteBrand',
|
|
|
data: {
|
|
|
id: brandId,
|
|
|
opt: opt,
|
|
|
uid: uid,
|
|
|
isBrand: 'brand'
|
|
|
},
|
|
|
success: function(data) {
|
|
|
if (data.code === 200) {
|
|
|
$this.toggleClass('like');
|
|
|
tip.show(data.message);
|
|
|
|
|
|
} else if (data.code === 400 || data.code === 412) {
|
|
|
if (jumpToApp === '1') {
|
|
|
var url = location.href + '&openby:yohobuy={"action":"go.weblogin","params":{"jumpurl":{"url":"http:\/\/guang.m.yohobuy.com\/plustar\/brandinfo","param":{"id":'
|
|
|
+ window.queryString.id + '}},"requesturl":{"url":"\/guang\/api\/v1\/favorite\/togglebrand","param":{"brand_id":"' + $('#brand-info').data('id') + '"}},"priority":"Y"}}';
|
|
|
$('body').append('<a href=' + url + ' style="display:none;"><span class="jump-login"> </span></a>');
|
|
|
|
|
|
$('.jump-login').click();
|
|
|
if ($('#brand-like').length) {
|
|
|
// 品牌收藏
|
|
|
likeHammer = new Hammer(document.getElementById('brand-like'));
|
|
|
likeHammer.on('tap', function(e) {
|
|
|
var opt = 'ok',
|
|
|
$this = $(e.target);
|
|
|
|
|
|
// jumpToApp = 1表示APP未登录的情况,此时不发送ajax请求而由a链接直接跳转APP
|
|
|
// if (jumpToApp === '1') {
|
|
|
// return true;
|
|
|
// }
|
|
|
e.preventDefault();
|
|
|
|
|
|
if ($this.hasClass('like')) {
|
|
|
opt = 'cancel';
|
|
|
}
|
|
|
$.ajax({
|
|
|
type: 'POST',
|
|
|
url: '/guang/opt/favoriteBrand',
|
|
|
data: {
|
|
|
id: brandId,
|
|
|
opt: opt,
|
|
|
uid: uid,
|
|
|
isBrand: 'brand'
|
|
|
},
|
|
|
success: function(data) {
|
|
|
if (data.code === 200) {
|
|
|
$this.toggleClass('like');
|
|
|
tip.show(data.message);
|
|
|
|
|
|
} else if (data.code === 400 || data.code === 412) {
|
|
|
if (jumpToApp === '1') {
|
|
|
var url = location.href + '&openby:yohobuy={"action":"go.weblogin","params":{"jumpurl":{"url":"http:\/\/guang.m.yohobuy.com\/plustar\/brandinfo","param":{"id":'
|
|
|
+ window.queryString.id + '}},"requesturl":{"url":"\/guang\/api\/v1\/favorite\/togglebrand","param":{"brand_id":"' + $('#brand-info').data('id') + '"}},"priority":"Y"}}';
|
|
|
$('body').append('<a href=' + url + ' style="display:none;"><span class="jump-login"> </span></a>');
|
|
|
|
|
|
$('.jump-login').click();
|
|
|
} else {
|
|
|
location.href = data.data; // 未登录跳转登录页面
|
|
|
}
|
|
|
} else {
|
|
|
location.href = data.data; // 未登录跳转登录页面
|
|
|
tip.show(data.message);
|
|
|
}
|
|
|
} else {
|
|
|
tip.show(data.message);
|
|
|
}
|
|
|
},
|
|
|
error: function() {
|
|
|
tip.show('网络断开连接了~');
|
|
|
}
|
|
|
});
|
|
|
return false;
|
|
|
});
|
|
|
return false;
|
|
|
});
|
|
|
}
|
|
|
|
|
|
|
|
|
// console.log($('.logo').attr('src')) |
...
|
...
|
|