Authored by 毕凯

搜索页面品牌可以收藏

... ... @@ -11,6 +11,7 @@
{{!-- 搜索 --}}
{{#if searchListPage}}
<script>
seajs.use('js/product/brand');
seajs.use(['js/product/list', 'js/product/product'], function (list, product) {
product.init(5);
... ...
... ... @@ -14,7 +14,7 @@
<i class="iconfont">&#xe618;</i>
品牌介绍
</a>
<span id="brand-favor" class="brand-favor">
<span id="brand-favor" class="brand-favor" data-id="{{brandId}}">
<i class="iconfont{{#if coled}} coled{{/if}}">&#xe616;</i>
</span>
</p>
... ... @@ -58,4 +58,4 @@
</div>
{{/ list}}
</div>
{{> layout/footer}}
\ No newline at end of file
{{> layout/footer}}
... ...
/**
* 品牌页面
* @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) {
$this.addClass('favored');
}
});
});
... ...
... ... @@ -6,4 +6,6 @@
require('./list');
require('./hotrank');
\ No newline at end of file
require('./brand');
require('./hotrank');
... ...
... ... @@ -149,6 +149,11 @@
.brand-favor {
margin-right: 0;
cursor: pointer;
&.favored {
color: #ee0014;
}
}
.coled {
... ...