Authored by 阿达

fix bug 下滑刷新bug && 少brand参数

@@ -18,6 +18,7 @@ var $ = require('jquery'), @@ -18,6 +18,7 @@ var $ = require('jquery'),
18 scH, 18 scH,
19 $nav1 = $('#pos-nav'), 19 $nav1 = $('#pos-nav'),
20 $nav2 = $('#pos-list'), 20 $nav2 = $('#pos-list'),
  21 + $homePage = $('.discount-area'),
21 sTop; 22 sTop;
22 23
23 var tip = require('../plugin/tip'), 24 var tip = require('../plugin/tip'),
@@ -31,7 +32,8 @@ var $subNav = $('.home-sub-nav'), @@ -31,7 +32,8 @@ var $subNav = $('.home-sub-nav'),
31 $pgc = $($goodsChildren.get(1)), 32 $pgc = $($goodsChildren.get(1)),
32 $dgc = $($goodsChildren.get(2)), 33 $dgc = $($goodsChildren.get(2)),
33 shopId = $('input[name="shop_id"]').val(), 34 shopId = $('input[name="shop_id"]').val(),
34 - appVersion = $('input[name="app_version"]').val(); 35 + appVersion = $('input[name="app_version"]').val(),
  36 + brand = $('input[name="brand"]').val();
35 37
36 var winH = $(window).height(), 38 var winH = $(window).height(),
37 noResult = '<p class="no-result">未找到相关搜索结果</p>'; 39 noResult = '<p class="no-result">未找到相关搜索结果</p>';
@@ -135,7 +137,8 @@ function newData(callback) { @@ -135,7 +137,8 @@ function newData(callback) {
135 type: 'newest', 137 type: 'newest',
136 order: '1', 138 order: '1',
137 page: navInfo.new.page, 139 page: navInfo.new.page,
138 - shop_id: shopId 140 + shop_id: shopId,
  141 + brand: brand
139 }; 142 };
140 req.callBack = function(data) { 143 req.callBack = function(data) {
141 $('#new-arrival').append(data); 144 $('#new-arrival').append(data);
@@ -157,7 +160,8 @@ function hotData(callback) { @@ -157,7 +160,8 @@ function hotData(callback) {
157 type: 'sales', 160 type: 'sales',
158 order: '1', 161 order: '1',
159 page: navInfo.hot.page, 162 page: navInfo.hot.page,
160 - shop_id: shopId 163 + shop_id: shopId,
  164 + brand: brand
161 }; 165 };
162 req.callBack = function(data) { 166 req.callBack = function(data) {
163 $('#popularity').append(data); 167 $('#popularity').append(data);
@@ -497,7 +501,8 @@ $.ajax({ @@ -497,7 +501,8 @@ $.ajax({
497 type: 'GET', 501 type: 'GET',
498 url: '/product/newsale/filter', 502 url: '/product/newsale/filter',
499 data: { 503 data: {
500 - shop_id: shopId 504 + shop_id: shopId,
  505 + brand: brand
501 }, 506 },
502 success: function(data) { 507 success: function(data) {
503 $goodsContainer.append(data); 508 $goodsContainer.append(data);
@@ -626,6 +631,7 @@ $subNav.on('touchend touchcancel', function(e) { @@ -626,6 +631,7 @@ $subNav.on('touchend touchcancel', function(e) {
626 search({ 631 search({
627 type: 'shop_id', 632 type: 'shop_id',
628 id: shopId, 633 id: shopId,
  634 + brand: brand,
629 url: '/index/search/search', 635 url: '/index/search/search',
630 nextPage: false 636 nextPage: false
631 }); 637 });
@@ -646,6 +652,7 @@ function scrollHandler() { @@ -646,6 +652,7 @@ function scrollHandler() {
646 search({ 652 search({
647 type: 'shop_id', 653 type: 'shop_id',
648 id: shopId, 654 id: shopId,
  655 + brand: brand,
649 url: '/index/search/search', 656 url: '/index/search/search',
650 nextPage: true 657 nextPage: true
651 }); 658 });
@@ -654,14 +661,18 @@ function scrollHandler() { @@ -654,14 +661,18 @@ function scrollHandler() {
654 } 661 }
655 662
656 //srcoll to load more 663 //srcoll to load more
657 -$(window).scroll(function() { 664 +if ($homePage.length > 0) {
  665 + $(window).scroll(function() {
658 window.requestAnimationFrame(scrollHandler); 666 window.requestAnimationFrame(scrollHandler);
659 -}); 667 + });
  668 +}
  669 +
660 670
661 //初始请求最新第一页数据 671 //初始请求最新第一页数据
662 search({ 672 search({
663 type: 'shop_id', 673 type: 'shop_id',
664 id: shopId, 674 id: shopId,
  675 + brand: brand,
665 url: '/index/search/search', 676 url: '/index/search/search',
666 nextPage: false 677 nextPage: false
667 }); 678 });
@@ -7,6 +7,7 @@ @@ -7,6 +7,7 @@
7 {{#if appVersion}} 7 {{#if appVersion}}
8 <input type="hidden" name="app_version" value="{{appVersion}}"> 8 <input type="hidden" name="app_version" value="{{appVersion}}">
9 <input type="hidden" name="shop_id" value="{{shopId}}"> 9 <input type="hidden" name="shop_id" value="{{shopId}}">
  10 + <input type="hidden" name="brand" value="{{brand}}">
10 {{else}} 11 {{else}}
11 <div class="search-area"> 12 <div class="search-area">
12 <div id="search-input" class="search-input"> 13 <div id="search-input" class="search-input">
@@ -15,6 +16,7 @@ @@ -15,6 +16,7 @@
15 <input type="text" placeholder="搜索店铺内潮品" name="query" class="buriedpoint"> 16 <input type="text" placeholder="搜索店铺内潮品" name="query" class="buriedpoint">
16 <input type="hidden" name="shop_id" value="{{shopId}}"> 17 <input type="hidden" name="shop_id" value="{{shopId}}">
17 <input type="hidden" name="app_version" value="{{appVersion}}"> 18 <input type="hidden" name="app_version" value="{{appVersion}}">
  19 + <input type="hidden" name="brand" value="{{brand}}">
18 <i class="clear-input iconfont hide">&#xe626;</i> 20 <i class="clear-input iconfont hide">&#xe626;</i>
19 <button id="search" class="search buriedpoint" type="submit">搜索</button> 21 <button id="search" class="search buriedpoint" type="submit">搜索</button>
20 </form> 22 </form>