Authored by xuqi

plus star prise

@@ -14,6 +14,10 @@ var $intro = $('#intro'), @@ -14,6 +14,10 @@ var $intro = $('#intro'),
14 14
15 var info = require('../info'); 15 var info = require('../info');
16 16
  17 +var tip = require('../../plugin/tip');
  18 +
  19 +var brandId = $('#brand-info').data('id');
  20 +
17 var mIntro, aIntro; 21 var mIntro, aIntro;
18 22
19 ellipsis.init(); 23 ellipsis.init();
@@ -53,5 +57,31 @@ $('#more-intro').bind('touchstart', function() { @@ -53,5 +57,31 @@ $('#more-intro').bind('touchstart', function() {
53 57
54 //品牌收藏 58 //品牌收藏
55 $('#brand-like').bind('touchstart', function(e) { 59 $('#brand-like').bind('touchstart', function(e) {
  60 + var opt = 'ok',
  61 + $this = $(this);
  62 +
56 e.preventDefault(); 63 e.preventDefault();
  64 +
  65 + if ($this.hasClass('like')) {
  66 + opt = 'cancel';
  67 + }
  68 +
  69 + $.ajax({
  70 + type: 'POST',
  71 + url: '/guang/opt/favoriteBrand',
  72 + data: {
  73 + id: brandId,
  74 + opt: opt
  75 + },
  76 + success: function(data) {
  77 + if (data.code === 200) {
  78 + $this.toggleClass('like');
  79 + } else if (data.code === 400) {
  80 + tip.show('未登录');
  81 + }
  82 + },
  83 + error: function() {
  84 + tip.show('网络断开连接了~');
  85 + }
  86 + });
57 }); 87 });
1 {{>layout/header}} 1 {{>layout/header}}
2 <div class="ps-detail-page ps-page yoho-page"> 2 <div class="ps-detail-page ps-page yoho-page">
3 {{# ps}} 3 {{# ps}}
4 - <div class="header brand-info ps-block" data-id="{{id}}"> 4 + <div id="brand-info" class="header brand-info ps-block" data-id="{{id}}">
5 <img class="banner lazy" data-original="{{banner}}"> 5 <img class="banner lazy" data-original="{{banner}}">
6 <img class="logo lazy" data-original="{{logo}}"> 6 <img class="logo lazy" data-original="{{logo}}">
7 <div class="header-content clearfix"> 7 <div class="header-content clearfix">