Authored by Lynnic

Merge branch 'develop' of git.dev.yoho.cn:web/yohobuy into develop

@@ -382,23 +382,27 @@ class AbstractAction extends Controller_Abstract @@ -382,23 +382,27 @@ class AbstractAction extends Controller_Abstract
382 $header['navHome'] = $homeUrl . '?go=1&t=' . time(); 382 $header['navHome'] = $homeUrl . '?go=1&t=' . time();
383 } 383 }
384 384
385 - // 根据COOKIE记录的频道进行导航定位  
386 - $channel = Helpers::getChannelByCookie();  
387 - switch ($channel) {  
388 - default:  
389 - case 1:  
390 - $header['boys'] = true;  
391 - break;  
392 - case 2:  
393 - $header['girls'] = true;  
394 - break;  
395 - case 3:  
396 - $header['kids'] = true;  
397 - break;  
398 - case 4:  
399 - $header['lifeStyle'] = true;  
400 - break;  
401 - } 385 + $controller = $this->getRequest()->getControllerName();
  386 + if ($controller !== 'Home') {
  387 + // 根据COOKIE记录的频道进行导航定位
  388 + $channel = Helpers::getChannelByCookie();
  389 + switch ($channel) {
  390 + default:
  391 + case 1:
  392 + $header['boys'] = true;
  393 + break;
  394 + case 2:
  395 + $header['girls'] = true;
  396 + break;
  397 + case 3:
  398 + $header['kids'] = true;
  399 + break;
  400 + case 4:
  401 + $header['lifeStyle'] = true;
  402 + break;
  403 + }
  404 + }
  405 +
402 $this->_view->assign('pageHeader', $header); 406 $this->_view->assign('pageHeader', $header);
403 } 407 }
404 /** 408 /**
@@ -16,10 +16,33 @@ var $action = $('.action'), @@ -16,10 +16,33 @@ var $action = $('.action'),
16 $area = $('.area'), 16 $area = $('.area'),
17 $footer = $('#yoho-footer'), 17 $footer = $('#yoho-footer'),
18 $confim = $('.confim-mask'), 18 $confim = $('.confim-mask'),
  19 + $pageWrap = $('.page-wrap'),
  20 + $backBtn = $('.nav-back'),
19 isSubmiting, 21 isSubmiting,
20 deleteId, 22 deleteId,
  23 + currentPage = 'address',
21 newArea = []; 24 newArea = [];
22 25
  26 +// 清除原有链接
  27 +$backBtn.attr('href', 'javascript:void(0);');
  28 +
  29 +// 自定义事件
  30 +$backBtn.on('touchend', function(e) {
  31 + if (currentPage === 'edit') {
  32 + $pageWrap.hide();
  33 + $pageWrap.first().show();
  34 + e.preventDefault();
  35 + currentPage = 'address';
  36 + } else if (currentPage === 'list') {
  37 + $pageWrap.hide();
  38 + $editAddressPage.show();
  39 + e.preventDefault();
  40 + currentPage = 'edit';
  41 + } else {
  42 + window.history.go(-1);
  43 + }
  44 +});
  45 +
23 function editAddress(data) { 46 function editAddress(data) {
24 data = data || {}; 47 data = data || {};
25 $addressForm.find('[name="id"]').val(data.id || ''); 48 $addressForm.find('[name="id"]').val(data.id || '');
@@ -28,10 +51,11 @@ function editAddress(data) { @@ -28,10 +51,11 @@ function editAddress(data) {
28 $addressForm.find('[name="area_code"]').val(data.areaCode || ''); 51 $addressForm.find('[name="area_code"]').val(data.areaCode || '');
29 $addressForm.find('[name="area"]').val(data.area || ''); 52 $addressForm.find('[name="area"]').val(data.area || '');
30 $addressForm.find('[name="address"]').val(data.address || ''); 53 $addressForm.find('[name="address"]').val(data.address || '');
31 - $editAddressPage.show();  
32 54
33 - // $addressForm.find('[name="address"]').blur();  
34 - // $addressForm.find('[name="consignee"]').focus(); 55 + currentPage = 'edit';
  56 + $footer.hide();
  57 + $pageWrap.hide();
  58 + $editAddressPage.show();
35 } 59 }
36 60
37 $confim.on('touchend', '.cancel', function() { 61 $confim.on('touchend', '.cancel', function() {
@@ -130,11 +154,15 @@ $addressForm.on('submit', function() { @@ -130,11 +154,15 @@ $addressForm.on('submit', function() {
130 // 省市区 154 // 省市区
131 $area.on('touchend', function() { 155 $area.on('touchend', function() {
132 $footer.hide(); 156 $footer.hide();
  157 + $pageWrap.hide();
133 $addressListPage.show(); 158 $addressListPage.show();
  159 + currentPage = 'list';
134 }); 160 });
135 161
136 $addressListPage.on('touchend', '.address', function() { 162 $addressListPage.on('touchend', '.address', function() {
137 - newArea.push($(this).children('.caption').text()); 163 + var caption = $(this).children('.caption').text();
  164 +
  165 + newArea.push(caption);
138 $(this).siblings().hide(); 166 $(this).siblings().hide();
139 $(this).children('ul').show(); 167 $(this).children('ul').show();
140 return false; 168 return false;
@@ -145,11 +173,13 @@ $addressListPage.on('touchend', '.address', function() { @@ -145,11 +173,13 @@ $addressListPage.on('touchend', '.address', function() {
145 $('[name="area"]').val(newArea.join(' ')); 173 $('[name="area"]').val(newArea.join(' '));
146 $('[name="area_code"]').val($(this).data('id')); 174 $('[name="area_code"]').val($(this).data('id'));
147 175
  176 + $editAddressPage.show();
  177 + currentPage = 'edit';
  178 +
148 // 恢复默认的三级选择 179 // 恢复默认的三级选择
149 $addressListPage.hide(); 180 $addressListPage.hide();
150 $addressListPage.find('ul').hide(); 181 $addressListPage.find('ul').hide();
151 $addressListPage.children('ul').show().children('li').show(); 182 $addressListPage.children('ul').show().children('li').show();
152 - $footer.show();  
153 newArea = []; 183 newArea = [];
154 return false; 184 return false;
155 }); 185 });
1 .my-address-page { 1 .my-address-page {
2 - position: absolute;  
3 - bottom: 0;  
4 - top: pxToRem(90px);  
5 width: 100%; 2 width: 100%;
6 background: #f0f0f0; 3 background: #f0f0f0;
  4 + padding-bottom: pxToRem(20px);
7 5
8 .address-item { 6 .address-item {
9 padding: pxToRem(20px) pxToRem(30px); 7 padding: pxToRem(20px) pxToRem(30px);
@@ -41,6 +39,7 @@ @@ -41,6 +39,7 @@
41 .add-address { 39 .add-address {
42 display: block; 40 display: block;
43 margin-top: pxToRem(30px); 41 margin-top: pxToRem(30px);
  42 + margin-bottom: pxToRem(30px);
44 font-size: pxToRem(32px); 43 font-size: pxToRem(32px);
45 line-height: pxToRem(88px); 44 line-height: pxToRem(88px);
46 color: #444; 45 color: #444;
@@ -100,9 +99,6 @@ @@ -100,9 +99,6 @@
100 } 99 }
101 100
102 .my-edit-address-page { 101 .my-edit-address-page {
103 - position: absolute;  
104 - bottom: 0;  
105 - top: 0;  
106 width: 100%; 102 width: 100%;
107 color: #d0d0d0; 103 color: #d0d0d0;
108 background: #f0f0f0; 104 background: #f0f0f0;
@@ -176,9 +172,6 @@ @@ -176,9 +172,6 @@
176 } 172 }
177 173
178 .my-address-list-page { 174 .my-address-list-page {
179 - position: absolute;  
180 - bottom: 0;  
181 - top: 0;  
182 width: 100%; 175 width: 100%;
183 color: #444; 176 color: #444;
184 background: #fff; 177 background: #fff;
1 .my-page { 1 .my-page {
2 color: #444; 2 color: #444;
3 background: #f0f0f0; 3 background: #f0f0f0;
  4 + padding-bottom: pxToRem(20px);
4 5
5 a { 6 a {
6 color: #444; 7 color: #444;
@@ -25,7 +25,7 @@ @@ -25,7 +25,7 @@
25 background-size: 100%; 25 background-size: 100%;
26 } 26 }
27 27
28 - span{ 28 + >span{
29 &:first-of-type{ 29 &:first-of-type{
30 color: #444; 30 color: #444;
31 line-height:100rem / $pxConvertRem; 31 line-height:100rem / $pxConvertRem;
@@ -45,11 +45,24 @@ @@ -45,11 +45,24 @@
45 border:1px solid #eee; 45 border:1px solid #eee;
46 } 46 }
47 .grade{ 47 .grade{
48 - width:85rem / $pxConvertRem;  
49 - height: 30rem / $pxConvertRem;  
50 - overflow: hidden;  
51 - display: inline-block;  
52 - margin-top: 25rem / $pxConvertRem; 48 + width: 100%;
  49 + height: 100%;
  50 + overflow: hidden;
  51 + display: block;
  52 + position: relative;
  53 + i{
  54 + width:80rem / $pxConvertRem;
  55 + height: 30rem / $pxConvertRem;
  56 + overflow: hidden;
  57 + display: block;
  58 + position: absolute;
  59 + right: 40rem / $pxConvertRem;
  60 + top:50%;
  61 + @include transform(translateY(-50%))
  62 + }
  63 + span{
  64 + color: #b0b0b0;
  65 + }
53 } 66 }
54 .vip-3 { 67 .vip-3 {
55 @include rem-sprite($vip, vip-3); 68 @include rem-sprite($vip, vip-3);
@@ -13,7 +13,7 @@ @@ -13,7 +13,7 @@
13 } 13 }
14 14
15 .swiper-container { 15 .swiper-container {
16 - padding: pxToRem(20px) 0; 16 + padding: pxToRem(30px) 0 pxToRem(20px);
17 width: 100%; 17 width: 100%;
18 height: pxToRem(252px); 18 height: pxToRem(252px);
19 overflow: hidden; 19 overflow: hidden;
1 {{> layout/header}} 1 {{> layout/header}}
2 <div class="my-address-page yoho-page"> 2 <div class="my-address-page yoho-page">
3 - {{# address}}  
4 - <div class="address-item">  
5 - <span class="name">{{consignee}}</span>  
6 - <span class="tel">{{mobile}}</span>  
7 - <p class="address-info">{{area}} {{address}}</p>  
8 - <div class="action iconfont">  
9 - <span class="edit" data-id="{{address_id}}" data-consignee="{{consignee}}" data-mobile="{{mobile}}" data-area-code="{{area_code}}" data-area="{{area}}" data-address="{{address}}">&#xe61e;</span>  
10 - <span class="del" data-id="{{address_id}}">&#xe621;</span> 3 + <div class="page-wrap">
  4 + {{# address}}
  5 + <div class="address-item">
  6 + <span class="name">{{consignee}}</span>
  7 + <span class="tel">{{mobile}}</span>
  8 + <p class="address-info">{{area}} {{address}}</p>
  9 + <div class="action iconfont">
  10 + <span class="edit" data-id="{{address_id}}" data-consignee="{{consignee}}" data-mobile="{{mobile}}" data-area-code="{{area_code}}" data-area="{{area}}" data-address="{{address}}">&#xe61e;</span>
  11 + <span class="del" data-id="{{address_id}}">&#xe621;</span>
  12 + </div>
11 </div> 13 </div>
12 - </div>  
13 - {{/ address}}  
14 - <a class="add-address">  
15 - 添加新地址  
16 - </a> 14 + {{/ address}}
  15 + <a class="add-address">
  16 + 添加新地址
  17 + </a>
17 18
18 - <div class="confim-mask hide">  
19 - <div class="confim-box">  
20 - <div class="content">  
21 - 你确定要删除地址吗?  
22 - </div>  
23 - <div class="action">  
24 - <span class="cancel">  
25 - 取消  
26 - </span>  
27 - <span class="confim">  
28 - 确认  
29 - </span> 19 + <div class="confim-mask hide">
  20 + <div class="confim-box">
  21 + <div class="content">
  22 + 你确定要删除地址吗?
  23 + </div>
  24 + <div class="action">
  25 + <span class="cancel">
  26 + 取消
  27 + </span>
  28 + <span class="confim">
  29 + 确认
  30 + </span>
  31 + </div>
30 </div> 32 </div>
31 </div> 33 </div>
32 </div> 34 </div>
@@ -5,28 +5,28 @@ @@ -5,28 +5,28 @@
5 </div> 5 </div>
6 {{# couponsUrl}} 6 {{# couponsUrl}}
7 <div class="employ-list"> 7 <div class="employ-list">
8 - {{# unused}} 8 + {{# used}}
9 <div class="employ-main"> 9 <div class="employ-main">
10 <span>{{ money}}</span> 10 <span>{{ money}}</span>
11 <p>{{ coupon_name}}</p> 11 <p>{{ coupon_name}}</p>
12 <p>{{ couponValidity}}</p> 12 <p>{{ couponValidity}}</p>
13 </div> 13 </div>
14 - {{/ unused}}  
15 - {{^ unused}} 14 + {{/ used}}
  15 + {{^ used}}
16 <p class="null">未找到相关相关优惠券</p> 16 <p class="null">未找到相关相关优惠券</p>
17 - {{/ unused}} 17 + {{/ used}}
18 </div> 18 </div>
19 <div class="employ-list not none"> 19 <div class="employ-list not none">
20 - {{# used}} 20 + {{# unused}}
21 <div class="employ-main"> 21 <div class="employ-main">
22 <span>{{ money}}</span> 22 <span>{{ money}}</span>
23 <p>{{ coupon_name}}</p> 23 <p>{{ coupon_name}}</p>
24 <p>{{ couponValidity}}</p> 24 <p>{{ couponValidity}}</p>
25 </div> 25 </div>
26 - {{/ used}}  
27 - {{^ used}} 26 + {{/ unused}}
  27 + {{^ unused}}
28 <p class="null">未找到相关相关优惠券</p> 28 <p class="null">未找到相关相关优惠券</p>
29 - {{/ used}} 29 + {{/ unused}}
30 </div> 30 </div>
31 {{/ couponsUrl}} 31 {{/ couponsUrl}}
32 {{> layout/footer}} 32 {{> layout/footer}}
@@ -8,40 +8,7 @@ @@ -8,40 +8,7 @@
8 <div class="fav-content" id="fav-content"> 8 <div class="fav-content" id="fav-content">
9 <div class="fav-type"> 9 <div class="fav-type">
10 <ul class="fav-product-list"> 10 <ul class="fav-product-list">
11 - {{# hasFavProduct}}  
12 - <li data-id="{{fav_id}}">  
13 - <a href="{{link}}">  
14 - <div class="fav-img-box">  
15 - <img src="{{imgUrl}}" alt=""/>  
16 - </div>  
17 - <div class="fav-info-list">  
18 - <h2>{{title}}</h2>  
19 - <div class="fav-price">  
20 - {{# discountPrice}}  
21 - <span class="new-price">{{.}}</span>  
22 - {{/ discountPrice}}  
23 - <span class="fav-price {{# discountPrice}}price-underline{{/ discountPrice}}">{{price}}</span>  
24 - </div>  
25 - {{# savePrice}}  
26 - <div class="save-price save-price-number">  
27 - 比收藏时降价了<span>{{.}}</span>  
28 - <span class="del-fav"></span>  
29 - </div>  
30 - {{/ savePrice}}  
31 -  
32 - {{^ savePrice}}  
33 - <div class="save-price">  
34 - {{# sellOut}}  
35 - <span class="sell-out">已售罄</span>  
36 - {{/ sellOut}}  
37 - <span class="del-fav"></span>  
38 - </div>  
39 - {{/ savePrice}}  
40 -  
41 - </div>  
42 - </a>  
43 - </li>  
44 - {{/ hasFavProduct}} 11 + {{> home/favorite_product_list}}
45 </ul> 12 </ul>
46 13
47 {{^ hasFavProduct}} 14 {{^ hasFavProduct}}
@@ -50,43 +17,7 @@ @@ -50,43 +17,7 @@
50 {{/ hasFavProduct}} 17 {{/ hasFavProduct}}
51 </div> 18 </div>
52 <div class="fav-type"> 19 <div class="fav-type">
53 - {{# hasFavBrand}}  
54 - <div class="fav-brand-swiper">  
55 - <div class="swiper-header">  
56 - <div class="swiper-logo">  
57 - <img src="{{brandImg}}" alt=""/>  
58 - </div>  
59 - <div class="brand-info">  
60 - <span class="brand-name">{{brandName}}</span>  
61 - <div class="brand-update">  
62 - {{# update}}  
63 - <span class="brand-new">上新<b>{{.}}</b></span>  
64 - {{/ update}}  
65 - {{# discount}}  
66 - <span class="brand-discount">折扣<b>{{.}}</b></span>  
67 - {{/ discount}}  
68 - </div>  
69 - </div>  
70 - <a class="fav-more" href="{{link}}"></a>  
71 - </div>  
72 - <div id="swiper-container-{{id}}" class="swiper-container" data-id="{{id}}">  
73 - <ul class="swiper-wrapper swiper-wrapper-{{id}}">  
74 - {{# productList}}  
75 - <li class="swiper-slide">  
76 - <img class="swiper-lazy" data-src="{{imgUrl}}" alt=""/>  
77 - <div class="brand-product">  
78 - <p class="{{# discount}}price-discount{{/ discount}}">  
79 - {{price}}  
80 - {{# discount}}<span>{{.}}{{/ discount}}<span>  
81 - </p>  
82 - </div>  
83 - <div class="swiper-lazy-preloader"></div>  
84 - </li>  
85 - {{/ productList}}  
86 - </ul>  
87 - </div>  
88 - </div>  
89 - {{/ hasFavBrand}} 20 + {{> home/favorite_brand_list}}
90 21
91 {{^ hasFavBrand}} 22 {{^ hasFavBrand}}
92 <span class="fav-null">您暂无收藏任何品牌</span> 23 <span class="fav-null">您暂无收藏任何品牌</span>
@@ -6,7 +6,7 @@ @@ -6,7 +6,7 @@
6 <span class="user-avatar" data-avatar="{{head_ico}}"></span> 6 <span class="user-avatar" data-avatar="{{head_ico}}"></span>
7 <span class="username">{{profile_name}}</span> 7 <span class="username">{{profile_name}}</span>
8 {{#vip_info}} 8 {{#vip_info}}
9 - <span class="vip-icon vip-{{next_level}}"></span> 9 + <span class="vip-icon vip-{{cur_level}}"></span>
10 {{/vip_info}} 10 {{/vip_info}}
11 <div class="iconfont more-icon">&#xe604;</div> 11 <div class="iconfont more-icon">&#xe604;</div>
12 </a> 12 </a>
@@ -7,10 +7,11 @@ @@ -7,10 +7,11 @@
7 <li><span>生日</span><span>{{ birthday }}</span></li> 7 <li><span>生日</span><span>{{ birthday }}</span></li>
8 <li><span>会员等级</span> 8 <li><span>会员等级</span>
9 <span> 9 <span>
10 - <a href="grade"> 10 + <a href="grade" class="grade">
11 {{# vip_info}} 11 {{# vip_info}}
12 - <i class="grade vip-icon vip-{{ next_level }}"></i> 12 + <i class="vip-icon vip-{{ cur_level}}"></i>
13 {{/ vip_info}} 13 {{/ vip_info}}
  14 + <span class="iconfont">&#xe604;</span>
14 </a> 15 </a>
15 </span> 16 </span>
16 </li> 17 </li>
  1 +{{# hasFavBrand}}
  2 +<div class="fav-brand-swiper">
  3 + <div class="swiper-header">
  4 + <div class="swiper-logo">
  5 + <img src="{{brandImg}}" alt=""/>
  6 + </div>
  7 + <div class="brand-info">
  8 + <span class="brand-name">{{brandName}}</span>
  9 + <div class="brand-update">
  10 + {{# update}}
  11 + <span class="brand-new">上新<b>{{.}}</b></span>
  12 + {{/ update}}
  13 + {{# discount}}
  14 + <span class="brand-discount">折扣<b>{{.}}</b></span>
  15 + {{/ discount}}
  16 + </div>
  17 + </div>
  18 + <a class="fav-more" href="{{link}}"></a>
  19 + </div>
  20 + <div id="swiper-container-{{id}}" class="swiper-container" data-id="{{id}}">
  21 + <ul class="swiper-wrapper swiper-wrapper-{{id}}">
  22 + {{# productList}}
  23 + <li class="swiper-slide">
  24 + <img class="swiper-lazy" data-src="{{imgUrl}}" alt=""/>
  25 + <div class="brand-product">
  26 + <p class="{{# discount}}price-discount{{/ discount}}">
  27 + {{price}}
  28 + {{# discount}}<span>{{.}}{{/ discount}}<span>
  29 + </p>
  30 + </div>
  31 + <div class="swiper-lazy-preloader"></div>
  32 + </li>
  33 + {{/ productList}}
  34 + </ul>
  35 + </div>
  36 +</div>
  37 +{{/ hasFavBrand}}
  1 +{{# hasFavProduct}}
  2 +<li data-id="{{fav_id}}">
  3 + <a href="{{link}}">
  4 + <div class="fav-img-box">
  5 + <img src="{{imgUrl}}" alt=""/>
  6 + </div>
  7 + <div class="fav-info-list">
  8 + <h2>{{title}}</h2>
  9 + <div class="fav-price">
  10 + {{# discountPrice}}
  11 + <span class="new-price">{{.}}</span>
  12 + {{/ discountPrice}}
  13 + <span class="fav-price {{# discountPrice}}price-underline{{/ discountPrice}}">{{price}}</span>
  14 + </div>
  15 + {{# savePrice}}
  16 + <div class="save-price save-price-number">
  17 + 比收藏时降价了<span>{{.}}</span>
  18 + <span class="del-fav"></span>
  19 + </div>
  20 + {{/ savePrice}}
  21 +
  22 + {{^ savePrice}}
  23 + <div class="save-price">
  24 + {{# sellOut}}
  25 + <span class="sell-out">已售罄</span>
  26 + {{/ sellOut}}
  27 + <span class="del-fav"></span>
  28 + </div>
  29 + {{/ savePrice}}
  30 +
  31 + </div>
  32 + </a>
  33 +</li>
  34 +{{/ hasFavProduct}}
1 -<div class="my-address-list-page hide"> 1 +<div class="my-address-list-page page-wrap hide">
2 <ul class="address-list"> 2 <ul class="address-list">
3 {{# addressList}} 3 {{# addressList}}
4 <li class="address"> 4 <li class="address">
1 -<div class="my-edit-address-page hide"> 1 +<div class="my-edit-address-page page-wrap hide">
2 <form class="edit-address"> 2 <form class="edit-address">
3 <input type="hidden" name="id" value=""> 3 <input type="hidden" name="id" value="">
4 <label class="username"> 4 <label class="username">
5 - 收件人 5 + 收件人姓名
6 <input type="text" name="consignee" value=""> 6 <input type="text" name="consignee" value="">
7 </label> 7 </label>
8 <label class="mobile"> 8 <label class="mobile">
1 -<div class="recommend-for-you"> 1 +<div class="recommend-for-you hide">
2 </div> 2 </div>
@@ -28,9 +28,9 @@ class HomeController extends AbstractAction @@ -28,9 +28,9 @@ class HomeController extends AbstractAction
28 // 检查用户是否登录, 未登录则跳转到登录页 28 // 检查用户是否登录, 未登录则跳转到登录页
29 // @todo 为了方便测试,支持传uid参数 29 // @todo 为了方便测试,支持传uid参数
30 $uid = $this->getUid(); 30 $uid = $this->getUid();
31 - if (!$uid) { 31 + /*if (!$uid) {
32 $uid = $this->_uid = $this->get('uid', 8826435); //$this->getUid(true); 32 $uid = $this->_uid = $this->get('uid', 8826435); //$this->getUid(true);
33 - } 33 + }*/
34 34
35 $action = $this->getRequest()->getActionName(); 35 $action = $this->getRequest()->getActionName();
36 if (!$uid && $action !== 'index') { 36 if (!$uid && $action !== 'index') {
@@ -61,7 +61,7 @@ class HomeController extends AbstractAction @@ -61,7 +61,7 @@ class HomeController extends AbstractAction
61 $data += UserModel::getUserProfileData($uid); 61 $data += UserModel::getUserProfileData($uid);
62 $data += UserModel::getInfoNumData($uid); 62 $data += UserModel::getInfoNumData($uid);
63 } 63 }
64 - 64 +
65 $this->_view->display('index', $data); 65 $this->_view->display('index', $data);
66 } 66 }
67 67
@@ -98,8 +98,8 @@ class HomeController extends AbstractAction @@ -98,8 +98,8 @@ class HomeController extends AbstractAction
98 $uid = $this->getUid(); 98 $uid = $this->getUid();
99 $gender = Helpers::getGenderByCookie(); 99 $gender = Helpers::getGenderByCookie();
100 100
101 - $favProducts = UserModel::getFavProductData($uid);  
102 - $favBrands = UserModel::getFavBrandData($uid, $gender); 101 + $favProducts = UserModel::getFavProductData($this->_uid, 1, 10);
  102 + $favBrands = UserModel::getFavBrandData($this->_uid, 10, 1, 10);
103 103
104 $data = array( 104 $data = array(
105 'favPage' => true, //加载js 105 'favPage' => true, //加载js
@@ -119,6 +119,44 @@ class HomeController extends AbstractAction @@ -119,6 +119,44 @@ class HomeController extends AbstractAction
119 } 119 }
120 120
121 /** 121 /**
  122 + * 用户收藏的商品数据获取接口
  123 + */
  124 + public function favProductAction() {
  125 + $result = array();
  126 +
  127 + if ($this->isAjax()) {
  128 + $page = $this->post('page', 1);
  129 +
  130 + $result = UserModel::getFavProductData($this->_uid, $page, 10);
  131 + }
  132 +
  133 + if (empty($result)) {
  134 + echo ' ';
  135 + } else {
  136 + $this->_view->display('favorite_product', $result);
  137 + }
  138 + }
  139 +
  140 + /**
  141 + * 用户收藏的品牌数据获取接口
  142 + */
  143 + public function favBrandAction() {
  144 + $result = array();
  145 +
  146 + if ($this->isAjax()) {
  147 + $page = $this->post('page', 1);
  148 +
  149 + $result = UserModel::getFavBrandData($this->_uid, 10, $page, 10);
  150 + }
  151 +
  152 + if (empty($result)) {
  153 + echo ' ';
  154 + } else {
  155 + $this->_view->display('favorite_brand', $result);
  156 + }
  157 + }
  158 +
  159 + /**
122 * 用户收藏的商品-删除 160 * 用户收藏的商品-删除
123 */ 161 */
124 public function favoriteDelAction() 162 public function favoriteDelAction()
@@ -205,6 +243,7 @@ class HomeController extends AbstractAction @@ -205,6 +243,7 @@ class HomeController extends AbstractAction
205 'couponsUrl' => UserModel::getCouponData($uid), 243 'couponsUrl' => UserModel::getCouponData($uid),
206 'couponsPage' => true 244 'couponsPage' => true
207 ); 245 );
  246 +
208 $this->_view->display('coupons', $coupons); 247 $this->_view->display('coupons', $coupons);
209 } 248 }
210 249
@@ -145,14 +145,16 @@ class UserModel @@ -145,14 +145,16 @@ class UserModel
145 * 处理用户收藏的商品数据 145 * 处理用户收藏的商品数据
146 * 146 *
147 * @param int $uid 用户ID 147 * @param int $uid 用户ID
  148 + * @param int $page 第几页
  149 + * @param int $limit 限制读取的数目,默认10
148 * @return array|mixed 处理之后的收藏的商品数据 150 * @return array|mixed 处理之后的收藏的商品数据
149 */ 151 */
150 - public static function getFavProductData($uid) 152 + public static function getFavProductData($uid, $page, $limit)
151 { 153 {
152 $result = array(); 154 $result = array();
153 155
154 // 调用接口获取用户收藏的商品数据 156 // 调用接口获取用户收藏的商品数据
155 - $favProduct = UserData::favoriteProductData($uid); 157 + $favProduct = UserData::favoriteProductData($uid, $page, $limit);
156 158
157 // 处理用户收藏的商品数据 159 // 处理用户收藏的商品数据
158 if (isset($favProduct['data']) && !empty($favProduct['data'])) { 160 if (isset($favProduct['data']) && !empty($favProduct['data'])) {