Authored by ccbikai

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

framework @ e9d066dd
Subproject commit 75bbc3b075de19f239532f60c5995d06c5f814e2
Subproject commit e9d066dd88a8e7e37103021c427a205a5cfcdcec
... ...
... ... @@ -382,6 +382,8 @@ class AbstractAction extends Controller_Abstract
$header['navHome'] = $homeUrl . '?go=1&t=' . time();
}
$controller = $this->getRequest()->getControllerName();
if ($controller !== 'Home') {
// 根据COOKIE记录的频道进行导航定位
$channel = Helpers::getChannelByCookie();
switch ($channel) {
... ... @@ -399,6 +401,8 @@ class AbstractAction extends Controller_Abstract
$header['lifeStyle'] = true;
break;
}
}
$this->_view->assign('pageHeader', $header);
}
/**
... ...
... ... @@ -25,7 +25,7 @@
background-size: 100%;
}
span{
>span{
&:first-of-type{
color: #444;
line-height:100rem / $pxConvertRem;
... ... @@ -45,11 +45,24 @@
border:1px solid #eee;
}
.grade{
width:85rem / $pxConvertRem;
width: 100%;
height: 100%;
overflow: hidden;
display: block;
position: relative;
i{
width:80rem / $pxConvertRem;
height: 30rem / $pxConvertRem;
overflow: hidden;
display: inline-block;
margin-top: 25rem / $pxConvertRem;
display: block;
position: absolute;
right: 40rem / $pxConvertRem;
top:50%;
@include transform(translateY(-50%))
}
span{
color: #b0b0b0;
}
}
.vip-3 {
@include rem-sprite($vip, vip-3);
... ...
... ... @@ -5,28 +5,28 @@
</div>
{{# couponsUrl}}
<div class="employ-list">
{{# unused}}
{{# used}}
<div class="employ-main">
<span>{{ money}}</span>
<p>{{ coupon_name}}</p>
<p>{{ couponValidity}}</p>
</div>
{{/ unused}}
{{^ unused}}
{{/ used}}
{{^ used}}
<p class="null">未找到相关相关优惠券</p>
{{/ unused}}
{{/ used}}
</div>
<div class="employ-list not none">
{{# used}}
{{# unused}}
<div class="employ-main">
<span>{{ money}}</span>
<p>{{ coupon_name}}</p>
<p>{{ couponValidity}}</p>
</div>
{{/ used}}
{{^ used}}
{{/ unused}}
{{^ unused}}
<p class="null">未找到相关相关优惠券</p>
{{/ used}}
{{/ unused}}
</div>
{{/ couponsUrl}}
{{> layout/footer}}
\ No newline at end of file
... ...
... ... @@ -8,40 +8,7 @@
<div class="fav-content" id="fav-content">
<div class="fav-type">
<ul class="fav-product-list">
{{# hasFavProduct}}
<li data-id="{{fav_id}}">
<a href="{{link}}">
<div class="fav-img-box">
<img src="{{imgUrl}}" alt=""/>
</div>
<div class="fav-info-list">
<h2>{{title}}</h2>
<div class="fav-price">
{{# discountPrice}}
<span class="new-price">{{.}}</span>
{{/ discountPrice}}
<span class="fav-price {{# discountPrice}}price-underline{{/ discountPrice}}">{{price}}</span>
</div>
{{# savePrice}}
<div class="save-price save-price-number">
比收藏时降价了<span>{{.}}</span>
<span class="del-fav"></span>
</div>
{{/ savePrice}}
{{^ savePrice}}
<div class="save-price">
{{# sellOut}}
<span class="sell-out">已售罄</span>
{{/ sellOut}}
<span class="del-fav"></span>
</div>
{{/ savePrice}}
</div>
</a>
</li>
{{/ hasFavProduct}}
{{> home/favorite_product_list}}
</ul>
{{^ hasFavProduct}}
... ... @@ -50,43 +17,7 @@
{{/ hasFavProduct}}
</div>
<div class="fav-type">
{{# hasFavBrand}}
<div class="fav-brand-swiper">
<div class="swiper-header">
<div class="swiper-logo">
<img src="{{brandImg}}" alt=""/>
</div>
<div class="brand-info">
<span class="brand-name">{{brandName}}</span>
<div class="brand-update">
{{# update}}
<span class="brand-new">上新<b>{{.}}</b></span>
{{/ update}}
{{# discount}}
<span class="brand-discount">折扣<b>{{.}}</b></span>
{{/ discount}}
</div>
</div>
<a class="fav-more" href="{{link}}"></a>
</div>
<div id="swiper-container-{{id}}" class="swiper-container" data-id="{{id}}">
<ul class="swiper-wrapper swiper-wrapper-{{id}}">
{{# productList}}
<li class="swiper-slide">
<img class="swiper-lazy" data-src="{{imgUrl}}" alt=""/>
<div class="brand-product">
<p class="{{# discount}}price-discount{{/ discount}}">
{{price}}
{{# discount}}<span>{{.}}{{/ discount}}<span>
</p>
</div>
<div class="swiper-lazy-preloader"></div>
</li>
{{/ productList}}
</ul>
</div>
</div>
{{/ hasFavBrand}}
{{> home/favorite_brand_list}}
{{^ hasFavBrand}}
<span class="fav-null">您暂无收藏任何品牌</span>
... ...
{{> home/favorite_brand_list}}
\ No newline at end of file
... ...
{{> home/favorite_product_list}}
\ No newline at end of file
... ...
... ... @@ -7,10 +7,11 @@
<li><span>生日</span><span>{{ birthday }}</span></li>
<li><span>会员等级</span>
<span>
<a href="grade">
<a href="grade" class="grade">
{{# vip_info}}
<i class="grade vip-icon vip-{{ next_level }}"></i>
<i class="vip-icon vip-{{ cur_level}}"></i>
{{/ vip_info}}
<span class="iconfont">&#xe604;</span>
</a>
</span>
</li>
... ...
{{# hasFavBrand}}
<div class="fav-brand-swiper">
<div class="swiper-header">
<div class="swiper-logo">
<img src="{{brandImg}}" alt=""/>
</div>
<div class="brand-info">
<span class="brand-name">{{brandName}}</span>
<div class="brand-update">
{{# update}}
<span class="brand-new">上新<b>{{.}}</b></span>
{{/ update}}
{{# discount}}
<span class="brand-discount">折扣<b>{{.}}</b></span>
{{/ discount}}
</div>
</div>
<a class="fav-more" href="{{link}}"></a>
</div>
<div id="swiper-container-{{id}}" class="swiper-container" data-id="{{id}}">
<ul class="swiper-wrapper swiper-wrapper-{{id}}">
{{# productList}}
<li class="swiper-slide">
<img class="swiper-lazy" data-src="{{imgUrl}}" alt=""/>
<div class="brand-product">
<p class="{{# discount}}price-discount{{/ discount}}">
{{price}}
{{# discount}}<span>{{.}}{{/ discount}}<span>
</p>
</div>
<div class="swiper-lazy-preloader"></div>
</li>
{{/ productList}}
</ul>
</div>
</div>
{{/ hasFavBrand}}
\ No newline at end of file
... ...
{{# hasFavProduct}}
<li data-id="{{fav_id}}">
<a href="{{link}}">
<div class="fav-img-box">
<img src="{{imgUrl}}" alt=""/>
</div>
<div class="fav-info-list">
<h2>{{title}}</h2>
<div class="fav-price">
{{# discountPrice}}
<span class="new-price">{{.}}</span>
{{/ discountPrice}}
<span class="fav-price {{# discountPrice}}price-underline{{/ discountPrice}}">{{price}}</span>
</div>
{{# savePrice}}
<div class="save-price save-price-number">
比收藏时降价了<span>{{.}}</span>
<span class="del-fav"></span>
</div>
{{/ savePrice}}
{{^ savePrice}}
<div class="save-price">
{{# sellOut}}
<span class="sell-out">已售罄</span>
{{/ sellOut}}
<span class="del-fav"></span>
</div>
{{/ savePrice}}
</div>
</a>
</li>
{{/ hasFavProduct}}
\ No newline at end of file
... ...
... ... @@ -28,9 +28,9 @@ class HomeController extends AbstractAction
// 检查用户是否登录, 未登录则跳转到登录页
// @todo 为了方便测试,支持传uid参数
$uid = $this->getUid();
if (!$uid) {
/*if (!$uid) {
$uid = $this->_uid = $this->get('uid', 8826435); //$this->getUid(true);
}
}*/
$action = $this->getRequest()->getActionName();
if (!$uid && $action !== 'index') {
... ... @@ -98,8 +98,8 @@ class HomeController extends AbstractAction
$uid = $this->getUid();
$gender = Helpers::getGenderByCookie();
$favProducts = UserModel::getFavProductData($uid);
$favBrands = UserModel::getFavBrandData($uid, $gender);
$favProducts = UserModel::getFavProductData($this->_uid, 1, 10);
$favBrands = UserModel::getFavBrandData($this->_uid, 10, 1, 10);
$data = array(
'favPage' => true, //加载js
... ... @@ -119,6 +119,44 @@ class HomeController extends AbstractAction
}
/**
* 用户收藏的商品数据获取接口
*/
public function favProductAction() {
$result = array();
if ($this->isAjax()) {
$page = $this->post('page', 1);
$result = UserModel::getFavProductData($this->_uid, $page, 10);
}
if (empty($result)) {
echo ' ';
} else {
$this->_view->display('favorite_product', $result);
}
}
/**
* 用户收藏的品牌数据获取接口
*/
public function favBrandAction() {
$result = array();
if ($this->isAjax()) {
$page = $this->post('page', 1);
$result = UserModel::getFavBrandData($this->_uid, 10, $page, 10);
}
if (empty($result)) {
echo ' ';
} else {
$this->_view->display('favorite_brand', $result);
}
}
/**
* 用户收藏的商品-删除
*/
public function favoriteDelAction()
... ... @@ -205,6 +243,7 @@ class HomeController extends AbstractAction
'couponsUrl' => UserModel::getCouponData($uid),
'couponsPage' => true
);
$this->_view->display('coupons', $coupons);
}
... ...
... ... @@ -145,14 +145,16 @@ class UserModel
* 处理用户收藏的商品数据
*
* @param int $uid 用户ID
* @param int $page 第几页
* @param int $limit 限制读取的数目,默认10
* @return array|mixed 处理之后的收藏的商品数据
*/
public static function getFavProductData($uid)
public static function getFavProductData($uid, $page, $limit)
{
$result = array();
// 调用接口获取用户收藏的商品数据
$favProduct = UserData::favoriteProductData($uid);
$favProduct = UserData::favoriteProductData($uid, $page, $limit);
// 处理用户收藏的商品数据
if (isset($favProduct['data']) && !empty($favProduct['data'])) {
... ...