Authored by yyq

mini购物车 搜索提示降级

@@ -82,7 +82,9 @@ @@ -82,7 +82,9 @@
82 {{/ navbars}} 82 {{/ navbars}}
83 </ul> 83 </ul>
84 <div class="func-area hide"> 84 <div class="func-area hide">
  85 + {{#unless @root.pc.common.disSearchAssociation}}
85 <ul class="search-suggest"></ul> 86 <ul class="search-suggest"></ul>
  87 + {{/unless}}
86 <div class="search-2016"> 88 <div class="search-2016">
87 <form action="//search.yohobuy.com" method="get" id="search-form"> 89 <form action="//search.yohobuy.com" method="get" id="search-form">
88 <input type="hidden" id="defaultsearch"> 90 <input type="hidden" id="defaultsearch">
@@ -101,6 +103,7 @@ @@ -101,6 +103,7 @@
101 <span class="goods-num-tip">0</span> 103 <span class="goods-num-tip">0</span>
102 {{/unless}} 104 {{/unless}}
103 </a> 105 </a>
  106 + {{#unless @root.pc.common.disCartHover}}
104 <div class="mini-cart-wrapper"> 107 <div class="mini-cart-wrapper">
105 <div class="loading-cart"> 108 <div class="loading-cart">
106 <h3>加载中,请稍后</h3> 109 <h3>加载中,请稍后</h3>
@@ -109,6 +112,7 @@ @@ -109,6 +112,7 @@
109 <h3>您的购物车暂无商品</h3> 112 <h3>您的购物车暂无商品</h3>
110 </div> 113 </div>
111 </div> 114 </div>
  115 + {{/unless}}
112 </div> 116 </div>
113 </div> 117 </div>
114 </div> 118 </div>
@@ -608,22 +608,25 @@ $searchForm.on('keyup', '.search-key', function(e) { @@ -608,22 +608,25 @@ $searchForm.on('keyup', '.search-key', function(e) {
608 $focus.addClass('action'); 608 $focus.addClass('action');
609 $(this).val($focus.find('.searchvalue').text()); 609 $(this).val($focus.find('.searchvalue').text());
610 } else if (e.which === 13) { 610 } else if (e.which === 13) {
  611 + val = val.replace(new RegExp('\'', 'gm'), '');
611 if (val !== '') { 612 if (val !== '') {
  613 + $(this).val(val);
612 $searchForm.submit(); 614 $searchForm.submit();
613 } 615 }
614 } else { 616 } else {
  617 + if ($searchSug && $searchSug.length) {
615 val = val.replace(new RegExp('\'', 'gm'), ''); // 去掉特殊字符 618 val = val.replace(new RegExp('\'', 'gm'), ''); // 去掉特殊字符
616 -  
617 - $(this).val(val);  
618 searchSuggest(val); 619 searchSuggest(val);
619 } 620 }
  621 + }
620 }).on('blur', '.search-key', function() { 622 }).on('blur', '.search-key', function() {
621 setTimeout(function() { 623 setTimeout(function() {
622 $searchSug.hide(); 624 $searchSug.hide();
623 }, 200); 625 }, 200);
624 }); 626 });
625 627
626 -$goCart.hover(function() { 628 +if ($miniCart && $miniCart.length) {
  629 + $goCart.hover(function() {
627 var data, _html = ''; 630 var data, _html = '';
628 631
629 if ($goCart.hasClass('on-hover')) { 632 if ($goCart.hasClass('on-hover')) {
@@ -639,11 +642,11 @@ $goCart.hover(function() { @@ -639,11 +642,11 @@ $goCart.hover(function() {
639 } 642 }
640 $miniCart.html(_html); 643 $miniCart.html(_html);
641 $goCart.addClass('on-hover'); 644 $goCart.addClass('on-hover');
642 -}, function() { 645 + }, function() {
643 $goCart.removeClass('on-hover'); 646 $goCart.removeClass('on-hover');
644 -}); 647 + });
645 648
646 -$goCart.on('click', '.cart-goods-del', function() { 649 + $goCart.on('click', '.cart-goods-del', function() {
647 var $dom = $(this), 650 var $dom = $(this),
648 data = $dom.data(), 651 data = $dom.data(),
649 callback; 652 callback;
@@ -655,7 +658,8 @@ $goCart.on('click', '.cart-goods-del', function() { @@ -655,7 +658,8 @@ $goCart.on('click', '.cart-goods-del', function() {
655 data.key = $goCart.data().key; 658 data.key = $goCart.data().key;
656 delCartGoods(data, callback); 659 delCartGoods(data, callback);
657 } 660 }
658 -}); 661 + });
  662 +}
659 663
660 $subNav.on({ 664 $subNav.on({
661 mouseenter: function() { 665 mouseenter: function() {