Authored by uedxwg

'hotrank'

framework @ 75bbc3b0
1 -Subproject commit 4216b36673d37eecf297c5cc8b7634a32c09dc51 1 +Subproject commit 75bbc3b075de19f239532f60c5995d06c5f814e2
1 var $ = require('jquery'), 1 var $ = require('jquery'),
2 - Swiper = require('yoho.iswiper'),  
3 - lazyLoad = require('yoho.lazyload'); 2 + Hammer = require('yoho.hammer');
4 3
5 -var navSwiper; 4 +Swiper = require('yoho.iswiper'),
  5 +lazyLoad = require('yoho.lazyload');
6 6
7 -function hotrank(){ 7 +var page = 1,
  8 + winH,
  9 + hotnav,
  10 + sort = '',
  11 + id = '';
  12 +
  13 +function hotrank(page, sort, tab_id) {
8 $.ajax({ 14 $.ajax({
9 type: 'GET', 15 type: 'GET',
10 url: '/product/newsale/selectHotrank', 16 url: '/product/newsale/selectHotrank',
11 dataType: 'html', 17 dataType: 'html',
12 data: { 18 data: {
13 - page: 1 19 + page: page,
  20 + sort: sort,
  21 + tab_id: tab_id
14 }, 22 },
15 success: function(data) { 23 success: function(data) {
  24 + if (page === 1) {
  25 + $('#hotRank').html('');
  26 + }
16 $('#hotRank').append(data); 27 $('#hotRank').append(data);
17 lazyLoad($('img.lazy')); 28 lazyLoad($('img.lazy'));
18 $('#yoho-footer').css('position', 'static'); 29 $('#yoho-footer').css('position', 'static');
@@ -22,7 +33,29 @@ function hotrank(){ @@ -22,7 +33,29 @@ function hotrank(){
22 slideElement: 'li' 33 slideElement: 'li'
23 }); 34 });
24 35
  36 + winH = $(window).height();
  37 + listTop = $('.rank-main').find('ul').offset().top;
  38 + $('.s-goods-nav .nav-item').each(function(index) {
  39 + hotnav = new Hammer($('.s-goods-nav .nav-item')[index]);
  40 + hotnav.on('tap', function(e) {
  41 + id = $('.s-goods-nav .nav-item').eq(index).data('id'),
  42 + sort = parseInt($('.s-goods-nav .nav-item').eq(index).data('sort').split('=')[1]);
  43 + hotrank(page, sort, id);
  44 + });
  45 + });
25 } 46 }
26 }); 47 });
27 } 48 }
28 -hotrank(); 49 +
  50 +$(window).scroll(function () {
  51 + if (page === 2) {
  52 + return;
  53 + }
  54 + if ($(window).scrollTop() + winH < listTop + $('#hotRank').height() - 100) {
  55 + return;
  56 + }
  57 + page = 2;
  58 + hotrank(page, sort, id);
  59 +
  60 +});
  61 +hotrank(page, sort, id);
1 <div class="s-goods-nav goods-nav"> 1 <div class="s-goods-nav goods-nav">
2 <ul class="swiper-wrapper clearfix"> 2 <ul class="swiper-wrapper clearfix">
3 {{# tabs}} 3 {{# tabs}}
4 - <li class="swiper-slide nav-item" data-sort="{{sort}}">  
5 {{# title}} 4 {{# title}}
6 - <span>{{name}}</span>  
7 - {{/ title}} 5 + <li class="swiper-slide nav-item" data-sort="{{ params}}" data-id="{{ id}}">
  6 + <span>{{ name}}</span>
8 </li> 7 </li>
  8 + {{/ title}}
9 {{/ tabs}} 9 {{/ tabs}}
10 </ul> 10 </ul>
11 </div> 11 </div>
@@ -184,6 +184,9 @@ class HomeController extends AbstractAction @@ -184,6 +184,9 @@ class HomeController extends AbstractAction
184 */ 184 */
185 public function personalDetailsAction() 185 public function personalDetailsAction()
186 { 186 {
  187 + $this->setTitle('个人信息');
  188 + $this->setNavHeader('个人信息', true, SITE_MAIN);
  189 +
187 // $uid = $this->getUid(); 190 // $uid = $this->getUid();
188 $uid = 967016; 191 $uid = 967016;
189 $data = \Index\UserModel::getUserProfileData($uid); 192 $data = \Index\UserModel::getUserProfileData($uid);
@@ -104,7 +104,7 @@ class NewsaleController extends AbstractAction @@ -104,7 +104,7 @@ class NewsaleController extends AbstractAction
104 if ($this->isAjax()) { 104 if ($this->isAjax()) {
105 $sort = $this->get('sort', null); 105 $sort = $this->get('sort', null);
106 $tab_id = $this->get('tab_id', null); 106 $tab_id = $this->get('tab_id', null);
107 - $limit = $this->get('limit', 34); 107 + $limit = $this->get('limit', 50);
108 $page = $this->get('page', 1); 108 $page = $this->get('page', 1);
109 109
110 // 获取性别 110 // 获取性别
@@ -155,7 +155,6 @@ class NewsaleController extends AbstractAction @@ -155,7 +155,6 @@ class NewsaleController extends AbstractAction
155 ); 155 );
156 $result = \Product\NewsaleModel::selectData($data); 156 $result = \Product\NewsaleModel::selectData($data);
157 } 157 }
158 -  
159 if (empty($result)) { 158 if (empty($result)) {
160 echo ' '; 159 echo ' ';
161 } else { 160 } else {