Merge branch 'develop' of http://git.dev.yoho.cn/web/yohobuy into develop
Showing
6 changed files
with
26 additions
and
9 deletions
@@ -941,6 +941,7 @@ class HelperSearch | @@ -941,6 +941,7 @@ class HelperSearch | ||
941 | if ($data) { | 941 | if ($data) { |
942 | $result['conditions'] = $data; | 942 | $result['conditions'] = $data; |
943 | } | 943 | } |
944 | + $result['clearUrl'] = self::current(); | ||
944 | return $result; | 945 | return $result; |
945 | } | 946 | } |
946 | 947 | ||
@@ -1369,8 +1370,6 @@ class HelperSearch | @@ -1369,8 +1370,6 @@ class HelperSearch | ||
1369 | public static function filter() | 1370 | public static function filter() |
1370 | { | 1371 | { |
1371 | $result = array(); | 1372 | $result = array(); |
1372 | - //清除选中 | ||
1373 | - $result['checkedConditions']['clearUrl'] = self::current(); | ||
1374 | //频道 | 1373 | //频道 |
1375 | $result['channel'] = array(); | 1374 | $result['channel'] = array(); |
1376 | //性别 | 1375 | //性别 |
@@ -73,3 +73,9 @@ $action.on('touchend', '.del', function() { | @@ -73,3 +73,9 @@ $action.on('touchend', '.del', function() { | ||
73 | $confim.fadeIn(); | 73 | $confim.fadeIn(); |
74 | return false; | 74 | return false; |
75 | }); | 75 | }); |
76 | + | ||
77 | +$action.on('touchstart', 'a,span', function() { | ||
78 | + $(this).css('background', '#eee'); | ||
79 | +}).on('touchend touchcancel', 'a,span', function() { | ||
80 | + $(this).css('background', 'transparent'); | ||
81 | +}); |
@@ -16,12 +16,16 @@ function ajaxCurrencyDetail(page) { | @@ -16,12 +16,16 @@ function ajaxCurrencyDetail(page) { | ||
16 | }); | 16 | }); |
17 | } | 17 | } |
18 | 18 | ||
19 | -$(window).scroll(function() { | ||
20 | - if ($(window).scrollTop() + $(window).height() > $('body').height() - 1) { | 19 | +function scrollHandler() { |
20 | + if ($(window).scrollTop() + $(window).height() > $('body').height() - 100) { | ||
21 | page++; | 21 | page++; |
22 | ajaxCurrencyDetail(page); | 22 | ajaxCurrencyDetail(page); |
23 | return; | 23 | return; |
24 | } | 24 | } |
25 | +} | ||
26 | + | ||
27 | +$(window).scroll(function() { | ||
28 | + window.requestAnimationFrame(scrollHandler); | ||
25 | }); | 29 | }); |
26 | 30 | ||
27 | -ajaxCurrencyDetail(page); | ||
31 | +ajaxCurrencyDetail(page); |
@@ -217,7 +217,7 @@ class SearchModel | @@ -217,7 +217,7 @@ class SearchModel | ||
217 | $result = SearchData::getSuggest($query); | 217 | $result = SearchData::getSuggest($query); |
218 | if (isset($result['code']) && $result['code'] == 200 && isset($result['suggest']['items']) && !empty($result['suggest']['items'])) { | 218 | if (isset($result['code']) && $result['code'] == 200 && isset($result['suggest']['items']) && !empty($result['suggest']['items'])) { |
219 | foreach ($result['suggest']['items'] as $v) { | 219 | foreach ($result['suggest']['items'] as $v) { |
220 | - $data .= '<li><a style="display: block;" href="http://search.yohobuy.com/?query='.$v['item'].'" class="clearfix clear search-item" title="'.$v['item'].'" act="http://search.yohobuy.com/?query='.$v['item'].'"><span class="searchvalue" >'.$v['item'].'</span><span class="valuenum">约'.$v['frequency'].'个商品</span></a></li>'; | 220 | + $data []= '<li><a style="display: block;" href="http://search.yohobuy.com/?query='.$v['item'].'" class="clearfix clear search-item" title="'.$v['item'].'" act="http://search.yohobuy.com/?query='.$v['item'].'"><span class="searchvalue" >'.$v['item'].'</span><span class="valuenum">约'.$v['frequency'].'个商品</span></a></li>'; |
221 | } | 221 | } |
222 | } | 222 | } |
223 | return $data; | 223 | return $data; |
@@ -21,13 +21,21 @@ class SearchController extends WebAction | @@ -21,13 +21,21 @@ class SearchController extends WebAction | ||
21 | */ | 21 | */ |
22 | public function suggestAction() | 22 | public function suggestAction() |
23 | { | 23 | { |
24 | - $suggest = ''; | 24 | + $callback = $this->get('callback'); |
25 | $query = rawurldecode($this->get('query')); | 25 | $query = rawurldecode($this->get('query')); |
26 | + $size = rawurldecode($this->get('size',10)); | ||
27 | + if (empty($query)) { | ||
28 | + $this->helpJsonCallbackResult($callback, 412, '搜索词为空'); | ||
29 | + } | ||
30 | + if ($size > 50) { | ||
31 | + $size = 10; | ||
32 | + } | ||
26 | if ($query) { | 33 | if ($query) { |
27 | $param['query'] = $query; | 34 | $param['query'] = $query; |
35 | + $param['size'] = $size; | ||
28 | $suggest = SearchModel::getSuggest($param); | 36 | $suggest = SearchModel::getSuggest($param); |
29 | } | 37 | } |
30 | - echo $suggest; | 38 | + $this->helpJsonCallbackResult($callback, 200, 'suggest', $suggest); |
31 | } | 39 | } |
32 | 40 | ||
33 | /** | 41 | /** |
-
Please register or login to post a comment