Authored by xuqi

brand col

... ... @@ -68,7 +68,7 @@ $('#brand-like').bind('tap', function(e) {
$.ajax({
type: 'POST',
url: '/guang/opt/favoriteBrand',
url: '/product/opt/favoriteBrand',
data: {
id: brandId,
opt: opt
... ...
... ... @@ -13,6 +13,8 @@ var $brandHeader = $('#brand-header'),
var filter = require('../plugin/filter');
var tip = require('../plugin/tip');
var $goodsContainer = $('#goods-container'),
$ngc = $goodsContainer.children('.new-goods'),
$pgc = $goodsContainer.children('.price-goods'),
... ... @@ -323,5 +325,33 @@ $('#brand-intro').tap(function(e) {
//品牌收藏
$brandHeader.children('.btn-col').bind('tap', function() {
$(this).toggleClass('coled');
var $this = $(this);
var id = $brandHeader.data('id'),
opt;
if ($this.hasClass('coled')) {
opt = 'cancel';
} else {
opt = 'ok';
}
$.ajax({
type: 'POST',
url: '/product/opt/favoriteBrand',
data: {
id: id,
opt: opt
},
success: function(data) {
if (data.code === 200) {
$this.toggleClass('coled');
} else if (data.code === 400) {
tip.show('未登录');
}
},
error: function() {
tip.show('网络断开连接了~');
}
});
});
\ No newline at end of file
... ...