Authored by uedxwg

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

framework @ e9d066dd
1 -Subproject commit 75bbc3b075de19f239532f60c5995d06c5f814e2 1 +Subproject commit e9d066dd88a8e7e37103021c427a205a5cfcdcec
@@ -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 /**
@@ -28,10 +28,8 @@ function editAddress(data) { @@ -28,10 +28,8 @@ function editAddress(data) {
28 $addressForm.find('[name="area_code"]').val(data.areaCode || ''); 28 $addressForm.find('[name="area_code"]').val(data.areaCode || '');
29 $addressForm.find('[name="area"]').val(data.area || ''); 29 $addressForm.find('[name="area"]').val(data.area || '');
30 $addressForm.find('[name="address"]').val(data.address || ''); 30 $addressForm.find('[name="address"]').val(data.address || '');
  31 + $footer.hide();
31 $editAddressPage.show(); 32 $editAddressPage.show();
32 -  
33 - // $addressForm.find('[name="address"]').blur();  
34 - // $addressForm.find('[name="consignee"]').focus();  
35 } 33 }
36 34
37 $confim.on('touchend', '.cancel', function() { 35 $confim.on('touchend', '.cancel', function() {
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;
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;
@@ -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;
@@ -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>
  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}}
@@ -2,7 +2,7 @@ @@ -2,7 +2,7 @@
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'])) {