Merge branch 'develop' of http://git.dev.yoho.cn/web/yohobuy into develop
Showing
12 changed files
with
174 additions
and
111 deletions
framework @ e9d066dd
@@ -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 | /** |
@@ -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); |
@@ -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> |
1 | +{{> home/favorite_brand_list}} |
1 | +{{> home/favorite_product_list}} |
@@ -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"></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}} |
@@ -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') { |
@@ -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'])) { |
-
Please register or login to post a comment