brand.js
743 Bytes
/**
* 品牌页面
* @auhtor: bikai<kai.bi@yoho.cn>
* @date: 2016/1/21
*/
var $ = require('yoho.jquery');
$('#brand-favor').on('click', function() {
var $this = $(this),
uid = window.getUid();
if (!uid) {
location.href = '/signin.html?refer=' + location.href;
return;
}
$.ajax({
type: 'post',
url: '/product/index/favoriteBrand',
data: {
uid: uid,
brandId: $this.data('id')
}
}).then(function(res) {
if (res.code === 200) {
if (res.message === 'add') {
$this.find('i').addClass('coled');
} else {
$this.find('i').removeClass('coled');
}
}
});
});