Authored by uedxwg

'hotrank'

1 -var $ = require('jquery'); 1 +var $ = require('jquery'),
  2 + Swiper = require('yoho.iswiper'),
  3 + lazyLoad = require('yoho.lazyload');
2 4
3 -$.ajax({  
4 - type: 'GET',  
5 - url: '/product/newsale/selectHotrank',  
6 - dataType: 'html',  
7 - success: function(date) {  
8 - $('#hotRank').append(date);  
9 - $('#yoho-footer').css('position', 'static');  
10 - }  
11 -});  
  5 +var navSwiper;
  6 +
  7 +function hotrank(){
  8 + $.ajax({
  9 + type: 'GET',
  10 + url: '/product/newsale/selectHotrank',
  11 + dataType: 'html',
  12 + data: {
  13 + page: 1
  14 + },
  15 + success: function(data) {
  16 + $('#hotRank').append(data);
  17 + lazyLoad($('img.lazy'));
  18 + $('#yoho-footer').css('position', 'static');
  19 + navSwiper = new Swiper('.s-goods-nav', {
  20 + grabCursor: true,
  21 + slidesPerView: 'auto',
  22 + slideElement: 'li'
  23 + });
  24 +
  25 + }
  26 + });
  27 +}
  28 +hotrank();
@@ -10,7 +10,6 @@ @@ -10,7 +10,6 @@
10 </ul> 10 </ul>
11 </div> 11 </div>
12 12
13 -{{# goods}}  
14 <div class="rank-main"> 13 <div class="rank-main">
15 <ul> 14 <ul>
16 {{# goods}} 15 {{# goods}}
@@ -31,5 +30,4 @@ @@ -31,5 +30,4 @@
31 </li> 30 </li>
32 {{/ goods}} 31 {{/ goods}}
33 </ul> 32 </ul>
34 - </div>  
35 -{{/ goods}}  
  33 + </div>
@@ -89,7 +89,6 @@ class NewsaleController extends AbstractAction @@ -89,7 +89,6 @@ class NewsaleController extends AbstractAction
89 'cartUrl' => Helpers::url('/product/newsale/selectHotrank', null), 89 'cartUrl' => Helpers::url('/product/newsale/selectHotrank', null),
90 ); 90 );
91 91
92 - // print_r($data);  
93 $this->_view->display('hotrank', $data); 92 $this->_view->display('hotrank', $data);
94 } 93 }
95 94
@@ -105,7 +104,7 @@ class NewsaleController extends AbstractAction @@ -105,7 +104,7 @@ class NewsaleController extends AbstractAction
105 if ($this->isAjax()) { 104 if ($this->isAjax()) {
106 $sort = $this->get('sort', null); 105 $sort = $this->get('sort', null);
107 $tab_id = $this->get('tab_id', null); 106 $tab_id = $this->get('tab_id', null);
108 - $limit = $this->get('limit', 50); 107 + $limit = $this->get('limit', 34);
109 $page = $this->get('page', 1); 108 $page = $this->get('page', 1);
110 109
111 // 获取性别 110 // 获取性别
@@ -115,11 +114,10 @@ class NewsaleController extends AbstractAction @@ -115,11 +114,10 @@ class NewsaleController extends AbstractAction
115 $result = \Product\NewsaleModel::selectTopData($data); 114 $result = \Product\NewsaleModel::selectTopData($data);
116 } 115 }
117 116
118 - // print_r($result);  
119 if (empty($result)) { 117 if (empty($result)) {
120 echo ' '; 118 echo ' ';
121 } else { 119 } else {
122 - $this->_view->display('hotList', $result); 120 + $this->_view->display('hotlist', $result);
123 } 121 }
124 } 122 }
125 123