Showing
5 changed files
with
41 additions
and
3 deletions
@@ -11,6 +11,7 @@ | @@ -11,6 +11,7 @@ | ||
11 | {{!-- 搜索 --}} | 11 | {{!-- 搜索 --}} |
12 | {{#if searchListPage}} | 12 | {{#if searchListPage}} |
13 | <script> | 13 | <script> |
14 | + seajs.use('js/product/brand'); | ||
14 | seajs.use(['js/product/list', 'js/product/product'], function (list, product) { | 15 | seajs.use(['js/product/list', 'js/product/product'], function (list, product) { |
15 | 16 | ||
16 | product.init(5); | 17 | product.init(5); |
@@ -14,7 +14,7 @@ | @@ -14,7 +14,7 @@ | ||
14 | <i class="iconfont"></i> | 14 | <i class="iconfont"></i> |
15 | 品牌介绍 | 15 | 品牌介绍 |
16 | </a> | 16 | </a> |
17 | - <span id="brand-favor" class="brand-favor"> | 17 | + <span id="brand-favor" class="brand-favor" data-id="{{brandId}}"> |
18 | <i class="iconfont{{#if coled}} coled{{/if}}"></i> | 18 | <i class="iconfont{{#if coled}} coled{{/if}}"></i> |
19 | </span> | 19 | </span> |
20 | </p> | 20 | </p> |
@@ -58,4 +58,4 @@ | @@ -58,4 +58,4 @@ | ||
58 | </div> | 58 | </div> |
59 | {{/ list}} | 59 | {{/ list}} |
60 | </div> | 60 | </div> |
61 | -{{> layout/footer}} | ||
61 | +{{> layout/footer}} |
web-static/js/product/brand.js
0 → 100644
1 | +/** | ||
2 | + * 品牌页面 | ||
3 | + * @auhtor: bikai<kai.bi@yoho.cn> | ||
4 | + * @date: 2016/1/21 | ||
5 | + */ | ||
6 | + | ||
7 | +var $ = require('yoho.jquery'); | ||
8 | + | ||
9 | +$('#brand-favor').on('click', function() { | ||
10 | + var $this = $(this), | ||
11 | + uid = window.getUid(); | ||
12 | + | ||
13 | + if (!uid) { | ||
14 | + location.href = '/signin.html?refer=' + location.href; | ||
15 | + return; | ||
16 | + } | ||
17 | + | ||
18 | + $.ajax({ | ||
19 | + type: 'post', | ||
20 | + url: '/product/index/favoriteBrand', | ||
21 | + data: { | ||
22 | + uid: uid, | ||
23 | + brandId: $this.data('id') | ||
24 | + } | ||
25 | + }).then(function(res) { | ||
26 | + if (res.code === 200) { | ||
27 | + $this.addClass('favored'); | ||
28 | + } | ||
29 | + }); | ||
30 | +}); |
-
Please register or login to post a comment