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(){  
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 - }); 7 +var page = 1,
  8 + winH,
  9 + hotnav,
  10 + sort = '',
  11 + id = '';
24 12
25 - }  
26 - }); 13 +function hotrank(page, sort, tab_id) {
  14 + $.ajax({
  15 + type: 'GET',
  16 + url: '/product/newsale/selectHotrank',
  17 + dataType: 'html',
  18 + data: {
  19 + page: page,
  20 + sort: sort,
  21 + tab_id: tab_id
  22 + },
  23 + success: function(data) {
  24 + if (page === 1) {
  25 + $('#hotRank').html('');
  26 + }
  27 + $('#hotRank').append(data);
  28 + lazyLoad($('img.lazy'));
  29 + $('#yoho-footer').css('position', 'static');
  30 + navSwiper = new Swiper('.s-goods-nav', {
  31 + grabCursor: true,
  32 + slidesPerView: 'auto',
  33 + slideElement: 'li'
  34 + });
  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 + });
  46 + }
  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}}  
6 - <span>{{name}}</span>  
7 - {{/ title}}  
8 - </li> 4 + {{# title}}
  5 + <li class="swiper-slide nav-item" data-sort="{{ params}}" data-id="{{ id}}">
  6 + <span>{{ name}}</span>
  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 {