Authored by xuqi

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

framework @ 119c247f
Subproject commit 75bbc3b075de19f239532f60c5995d06c5f814e2
Subproject commit 119c247f5cf929aa1e059e40609bb16dd6b58f05
... ...
... ... @@ -11,27 +11,42 @@ class FloorProcess
{
/**
* 频道参数
*
* @var array
*/
private static $channel = array(
'1' => '1,3',
'2' => '2,3'
);
/**
* 处理首页内容
* @param $data
* @param $type 类型 默认1:男首页 2:女首页 3:kids 4:lifestyle
*/
public static function getContent($data, $type = 1)
{
if (empty($data['list'])) {
return array();
}
$result = array();
if (!empty($data['list'])) {
$build = array();
foreach ($data['list'] as $v) {
$fun = $v['template_name'];
if (!is_callable("self::$fun")) {
continue;
}
$build = self::$fun($v['data'], $type);
if (empty($build)) {
continue;
}
$result[] = $build;
$build = array();
foreach ($data['list'] as $v) {
$fun = $v['template_name'];
if (empty($v['data']) || !is_callable("self::$fun")) {
continue;
}
$build = self::$fun($v['data'], $type);
if (empty($build)) {
continue;
}
$result[] = $build;
}
$build = array();
return $result;
}
... ... @@ -46,16 +61,35 @@ class FloorProcess
$result = array();
foreach ($data as &$one) {
$one['img'] = Helpers::getImageUrl($one['src'], 750, 364, 1);
$one['url'] = Helpers::getFilterUrl($one['url']);
$one['img'] = Helpers::getImageUrl($one['src'], 640, 310);
unset($one['src']);
}
$result['bannerTop']['list'] = $data;
return $result;
}
/**
* 图标
*/
private static function floor($data)
{
$result = array();
foreach ($data as &$one) {
$one['url'] = Helpers::getFilterUrl($one['url']);
$one['img'] = Helpers::getImageUrl($one['src'], 98, 98);
unset($one['src']);
}
$result['list'] = $data;
$result['iconsEnter']['list'] = $data;
return array('bannerTop' => $result);
return $result;
}
/**
* 图标列表数据处理方法
*
* @param array $data 图标列表数据
* @param $type 类型 默认1:男首页 2:女首页 3:kids 4:lifestyle
* @return array 处理之后的图标列表数据
... ... @@ -65,36 +99,66 @@ class FloorProcess
$result = array();
foreach ($data as &$one) {
$one['img'] = Helpers::getImageUrl($one['src'], 186, 203, 1);
$one['url'] = Helpers::getFilterUrl($one['url']);
$one['img'] = Helpers::getImageUrl($one['src'], 98, 98);
unset($one['src']);
}
$result['list'] = $data;
$result['iconsEnter']['list'] = $data;
return array('iconsEnter' => $result);
return $result;
}
/**
* 单图片数据处理方法
* 单广告图片数据处理方法
*
* @param array $data 单图片数据
* @param $type 类型 默认1:男首页 2:女首页 3:kids 4:lifestyle
* @return array 处理之后的单图片数据
*/
private static function single_image($data, $type)
{
if (empty($data)) {
return array();
}
$result = array();
foreach ($data as &$one) {
$one['img'] = Helpers::getImageUrl($one['src'], 750, 364, 1);
$one['url'] = Helpers::getFilterUrl($one['url']);
$one['img'] = Helpers::getImageUrl($one['src'], 640, 200);
unset($one['src']);
}
$result['banner'] = $data;
return $result;
}
/**
* 女生品类
*/
private static function recommend_content_three($data, $type)
{
$result = array();
$build = array();
if (!empty($data['big_image'][0])) {
$build['img'] = Helpers::getImageUrl($data['big_image'][0]['src'], 640, 198);
$build['url'] = Helpers::getFilterUrl($data['big_image'][0]['url']);
$result['hotCategory']['banner'] = $build;
}
$build = array();
foreach ($data['list'] as $one) {
$build['url'] = Helpers::getFilterUrl($one['url']);
$build['img'] = Helpers::getImageUrl($one['src'], 140, 140);
$build['textCn'] = $one['title'];
$result['hotCategory']['list'][] = $build;
}
return array('banner' => $data);
return $result;
}
/**
* 带标题的12个小图推荐数据处理方法
*
* @param array $data 带标题的12个小图推荐数据
* @param $type 类型 默认1:男首页 2:女首页 3:kids 4:lifestyle
* @return array 处理之后的带标题的12个小图推荐数据
... ... @@ -104,15 +168,20 @@ class FloorProcess
$result = array();
foreach ($data['list'] as &$one) {
$one['img'] = Helpers::getImageUrl($one['src'], 186, 203, 1);
if (isset($one['url'])) {
$one['url'] = Helpers::getFilterUrl($one['url']);
}
$one['img'] = Helpers::getImageUrl($one['src'], 140, 140);
$one['textCn'] = $one['title'];
unset($one['src']);
}
$data['is_show_name'] = $data['title']['is_show'];
$data['name'] = $data['title']['title'];
unset($data['title']);
$result = $data;
return array('hotCategory' => $result);
$result['hotCategory'] = $data;
return $result;
}
/**
... ... @@ -125,16 +194,20 @@ class FloorProcess
{
$result = array();
$data['is_show_name'] = (isset($data['is_show_name']) && $data['is_show_name'] == 'Y') ? 1 : 0;
$data['is_show_name'] = (isset($data['is_show_name']) && $data['is_show_name'] === 'Y') ? 1 : 0;
$data['name'] = $data['title']['title'];
unset($data['title']);
foreach ($data['list'] as &$one) {
$one['img'] = Helpers::getImageUrl($one['src'], 186, 203, 1);
if (isset($one['url'])) {
$one['url'] = Helpers::getFilterUrl($one['url']);
}
$one['img'] = Helpers::getImageUrl($one['src'], 158, 174);
unset($one['src']);
}
$result = $data;
$data['more'] = '/category/brand/index?channel=' . $type;
$result['hotBrands'] = $data;
return array('hotBrands' => $result);
return $result;
}
/**
... ... @@ -148,16 +221,22 @@ class FloorProcess
$result = array();
foreach ($data['article'] as &$one) {
$one['img'] = Helpers::getImageUrl($one['src'], 186, 203, 1);
if (isset($one['url'])) {
$one['url'] = Helpers::getFilterUrl($one['url']);
}
$one['img'] = Helpers::getImageUrl($one['src'], 400, 400);
unset($one['src']);
}
foreach ($data['recommend_collocation'] as &$one) {
$one['img'] = Helpers::getImageUrl($one['src'], 186, 203, 1);
if (isset($one['url'])) {
$one['url'] = Helpers::getFilterUrl($one['url']);
}
$one['img'] = Helpers::getImageUrl($one['src'], 140, 140);
unset($one['src']);
}
$result = $data;
$result['trendColloaction'] = $data;
return array('trendColloaction' => $result);
return $result;
}
/**
... ... @@ -171,12 +250,15 @@ class FloorProcess
$result = array();
foreach ($data['list'] as &$one) {
$one['img'] = Helpers::getImageUrl($one['src'], 186, 203, 1);
if (isset($one['url'])) {
$one['url'] = Helpers::getFilterUrl($one['url']);
}
$one['img'] = Helpers::getImageUrl($one['src'], 580, 360);
unset($one['src']);
}
$result = $data;
$result['trendTopics'] = $data;
return array('trendTopics' => $result);
return $result;
}
/**
... ... @@ -190,19 +272,33 @@ class FloorProcess
$result = array();
foreach ($data['big_image'] as &$one) {
$one['img'] = Helpers::getImageUrl($one['src'], 186, 203, 1);
if (isset($one['url'])) {
$one['url'] = Helpers::getFilterUrl($one['url']);
}
$one['img'] = Helpers::getImageUrl($one['src'], 640, 403);
unset($one['src']);
}
$data['banner']['list'] = $data['big_image'];
unset($data['big_image']);
foreach ($data['list'] as &$one) {
$one['img'] = Helpers::getImageUrl($one['src'], 186, 203, 1);
foreach ($data['list'] as $kk => &$one) {
if ($kk == 0) {
$one['img'] = Helpers::getImageUrl($one['src'], 253, 383);
} else {
$one['img'] = Helpers::getImageUrl($one['src'], 191, 191);
}
if (isset($one['url'])) {
$one['url'] = Helpers::getFilterUrl($one['url']);
}
$one['textCn'] = $one['title'];
unset($one['src']);
}
$result = $data;
return array('goodsCategory' => $result);
unset($data['big_image']);
$result['goodsCategory'] = $data;
return $result;
}
/**
... ... @@ -217,19 +313,25 @@ class FloorProcess
$data['banner'] = array();
foreach ($data['big_image'] as &$one) {
$one['img'] = Helpers::getImageUrl($one['src'], 186, 203, 1);
if (isset($one['url'])) {
$one['url'] = Helpers::getFilterUrl($one['url']);
}
$one['img'] = Helpers::getImageUrl($one['src'], 640, 400);
unset($one['src']);
}
$data['banner'] = $data['big_image'];
unset($data['big_image']);
foreach ($data['list'] as &$one) {
$one['img'] = Helpers::getImageUrl($one['src'], 186, 203, 1);
if (isset($one['url'])) {
$one['url'] = Helpers::getFilterUrl($one['url']);
}
$one['img'] = Helpers::getImageUrl($one['src'], 212, 192);
unset($one['src']);
}
$result = $data;
$result['creativeLife'] = $data;
return array('creativeLife' => $result);
return $result;
}
/**
... ... @@ -240,15 +342,21 @@ class FloorProcess
*/
private static function small_pic($data, $type)
{
// 按照以前业务操作,不显示
return array();
$result = array();
foreach ($data as &$one) {
$one['img'] = Helpers::getImageUrl($one['src'], 186, 203, 1);
if (isset($one['url'])) {
$one['url'] = Helpers::getFilterUrl($one['url']);
}
$one['img'] = Helpers::getImageUrl($one['src'], 98, 98);
unset($one['src']);
}
$result = $data;
$result['small_pic'] = $data;
return array('small_pic' => $result);
return $result;
}
/**
... ... @@ -264,9 +372,47 @@ class FloorProcess
}
$data['name'] = $data['title'];
$data['img'] = Helpers::getImageUrl($data['src'], 640, 198, 2);
$data['img'] = Helpers::getImageUrl($data['src'], 640, 198);
if (isset($data['url'])) {
$data['url'] = Helpers::getFilterUrl($data['url']);
}
return array('plusStar' => $data);
}
/**
* 自定义品牌
*
* @param unknown $data
* @param mixed $type
* @return multitype:
*/
private static function custom_brands($data, $type)
{
// URL附加参数
$param = '';
if (isset(self::$channel[$type])) {
$param = '/?gender=' . self::$channel[$type];
}
$result = array();
$result['hotBrandsScroll']['name'] = $data['title']['title'];
foreach ($data['list'] as &$one) {
if (isset($one['url'])) {
$one['url'] = Helpers::getFilterUrl($one['url']);
}
$one['img'] = Helpers::getImageUrl($one['src'], 140, 140);
$one['textCn'] = $one['name'];
if (isset($one['url'])) {
$one['url'] .= $param;
}
}
if (!empty($data['is_show_name']) && $data['is_show_name'] == 'Y') {
$result['hotBrandsScroll']['is_show_name'] = true;
}
$result['hotBrandsScroll']['list'] = $data['list'];
return $result;
}
}
... ...
This diff could not be displayed because it is too large.
.brand-page {
.newbrand-search {
width: 93.75%;
height: 30px;
padding: 7px 3.125%;
background-color: #f8f8f8;
left: 0;
z-index: 10;
.search-box {
position: relative;
height: 30px;
background-color: #FFF;
border-radius: 15px;
padding: 0 16px 0 26px;
.search-input {
width: 100%;
height: 30px;
border: 0;
}
.search-icon {
position: absolute;
font-size: 12px;
top: 16px;
left: 24px;
}
}
}
.hot-brand {
margin: (30rem / $pxConvertRem) 0 0;
... ...
... ... @@ -43,11 +43,7 @@
white-space: nowrap;
}
}
.brand:nth-child(4n) {
border-right: none;
}
.more {
float: left;
width: 317rem / $pxConvertRem;
... ...
... ... @@ -17,9 +17,6 @@
display: -webkit-flex;
width: 98rem / $pxConvertRem;
height: 98rem / $pxConvertRem;
border-radius: 50%;
border: 2rem / $pxConvertRem solid #e0e0e0;
box-sizing: border-box;
overflow: hidden;
align-items:center;
justify-content: center;
... ...
... ... @@ -39,4 +39,18 @@
color: #000;
}
}
.load-more-info {
width: 100%;
height: 570rem / $pxConvertRem;
line-height: 70rem / $pxConvertRem;
text-align: center;
font-size: 14px;
overflow: hidden;
.status {
&.hide {
display: none;
}
}
}
}
\ No newline at end of file
... ...
{{> layout/header}}
<div class="brand-page yoho-page">
<div class="newbrand-search" style="position: fixed; top: 44px;">
<div class="search-box clearfix">
<a href="/index/search/index" >
<input type="text" class="search-input" placeholder="查找品牌" name="query" id="query" value="" disabled="">
<i class="search-icon iconfont clearfix"></i>
</a>
</div>
</div>
{{# bannerTop}}
{{> home/banner_top}}
{{/ bannerTop}}
... ...
<div class="floor-header">
<h2>{{name}}</h2>
</div>
... ...
<div class="hot-category">
{{> home/floor_header}}
{{# banner}}
<a class="banner" href="{{url}}">
<img class="lazy" data-original="{{img}}">
</a>
{{/ banner}}
<ul class="category-list clearfix">
{{# list}}
<li>
... ...
... ... @@ -7,7 +7,7 @@
<div id="goods-list" class="goods-list clearfix"></div>
<div id="load-more-info" class="load-more-info">
<div class="loading status">
<div class="loading status hide">
正在加载...
</div>
<span class="no-more status hide">没有更多啦</span>
... ...
... ... @@ -12,7 +12,7 @@
<div class="recommend-swiper">
<ul class="recommend-list clearfix">
{{# recommend_collocation}}
<li class="recommend-item swiper-slide"><a href="{{url}}"><img class="lazy" src="{{img}}" alt="" /></a></li>
<li class="recommend-item swiper-slide"><a href="{{url}}"><img class="img" src="{{img}}" alt="" /></a></li>
{{/ recommend_collocation}}
</ul>
</div>
... ...
... ... @@ -23,11 +23,238 @@ class BrandController extends AbstractAction
}
/* 获取渲染模板需要的数据 */
$data = Category\BrandModel::getBrandByChannel($channel);
/*$data = Category\BrandModel::getBrandByChannel($channel);
if (!is_array($data)) {
$data = array();
}
$data['brandPage'] = true;
$brandTop = array();
if($brandTopData['code'] == 200)
{
$brandTop = $brandTopData['data'];
}
$brands = array();
if($brandsData['code'] == 200)
{
$brands = $brandsData['data'];
}
echo '<pre>';
var_dump($brandTop, $brands);exit;*/
$data = array (
'brandPage' => true,
'pageHeader' => array (
'navBack' => 'sss ',
'navHome' => 'sss ',
'navTitle' => 'sss '
),
'bannerTop' => array (
'list' => array (
array (
'url' => '',
'img' => 'http://img10.static.yhbimg.com/adpic/2015/10/15/10/01c161398d3baec2868abe85e26ba1a71d.jpg?imageMogr2/thumbnail/640x300/extent/640x300/background/d2hpdGU=/position/center/quality/90'
),
array (
'url' => '',
'img' => 'http://img13.static.yhbimg.com/adpic/2015/10/15/10/027c45cdc03e23c367ec0ff3d29b7c3f79.jpg?imageMogr2/thumbnail/640x300/extent/640x300/background/d2hpdGU=/position/center/quality/90'
),
array (
'url' => '',
'img' => 'http://img13.static.yhbimg.com/adpic/2015/10/15/10/022e2ac6daa33fc3cb8a0f04025a35994f.jpg?imageMogr2/thumbnail/640x300/extent/640x300/background/d2hpdGU=/position/center/quality/90'
)
)
),
'hotBrand' => array (
'list' => array (
array (
'url' => '',
'img' => 'http://img13.static.yhbimg.com/brandLogo/2014/08/12/17/0233d54f34d2534c08271a8fc27090a6af.jpg?imageMogr2/thumbnail/144x144/extent/144x144/background/d2hpdGU=/position/center/quality/90'
),
array (
'url' => '',
'img' => 'http://img12.static.yhbimg.com/brandLogo/2014/01/27/11/020b17265b2103b49005c57395b8b154a9.jpg?imageMogr2/thumbnail/144x144/extent/144x144/background/d2hpdGU=/position/center/quality/90'
),
array (
'url' => '',
'img' => 'http://img13.static.yhbimg.com/brandLogo/2014/11/27/09/02b403bdcbfb965bdc632fea5c29816746.png?imageMogr2/thumbnail/144x144/extent/144x144/background/d2hpdGU=/position/center/quality/90'
),
array (
'url' => '',
'img' => 'http://img13.static.yhbimg.com/brandLogo/2013/11/01/14/027e68260ba30c01b165c17fe043f2ce2c.jpg?imageMogr2/thumbnail/144x144/extent/144x144/background/d2hpdGU=/position/center/quality/90'
),
array (
'url' => '',
'img' => 'http://img11.static.yhbimg.com/brandLogo/2014/04/25/14/0179fa8eacf51fd1a89ec6f7fdeab88fc2.jpg?imageMogr2/thumbnail/144x144/extent/144x144/background/d2hpdGU=/position/center/quality/90'
),
array (
'url' => '',
'img' => 'http://img12.static.yhbimg.com/brandLogo/2014/01/27/11/02608437f8d8b6b7b15786214b0a5ef502.jpg?imageMogr2/thumbnail/144x144/extent/144x144/background/d2hpdGU=/position/center/quality/90'
),
array (
'url' => '',
'img' => 'http://img12.static.yhbimg.com/brandLogo/2013/02/28/17/020aae69720d683a7962c9b7fd3a92c801.jpg?imageMogr2/thumbnail/144x144/extent/144x144/background/d2hpdGU=/position/center/quality/90'
),
array (
'url' => '',
'img' => 'http://img13.static.yhbimg.com/brandLogo/2014/01/27/11/02bca7ac6414c7475b4a337e28a0365590.jpg?imageMogr2/thumbnail/144x144/extent/144x144/background/d2hpdGU=/position/center/quality/90'
)
)
),
'brandList' => array (
array (
'title' => '0~9',
'list' => array(
array (
'name' => '004',
'isHot' => true
),
array (
'name' => '10*1',
'isNew' => true
),
array (
'name' => '2%'
)
)
),
array (
'title' => 'A',
'list' => array(
array (
'name' => 'Aape',
'isHot' => true
),
array (
'name' => 'Adfdfd',
'isNew' => true
),
array (
'name' => 'Acrwewwe'
)
)
),
array (
'title' => 'B',
'list' => array(
array (
'name' => 'Bape'
),
array (
'name' => 'Bdfdfd'
),
array (
'name' => 'Bcrwewwe'
)
)
),
array (
'title' => 'B',
'list' => array(
array (
'name' => 'Bape'
),
array (
'name' => 'Bdfdfd'
),
array (
'name' => 'Bcrwewwe'
)
)
),
array (
'title' => 'B',
'list' => array(
array (
'name' => 'Bape'
),
array (
'name' => 'Bdfdfd'
),
array (
'name' => 'Bcrwewwe'
)
)
),
array (
'title' => 'B',
'list' => array(
array (
'name' => 'Bape'
),
array (
'name' => 'Bdfdfd'
),
array (
'name' => 'Bcrwewwe'
)
)
),
array (
'title' => 'B',
'list' => array(
array (
'name' => 'Bape'
),
array (
'name' => 'Bdfdfd'
),
array (
'name' => 'Bcrwewwe'
)
)
),
array (
'title' => 'B',
'list' => array(
array (
'name' => 'Bape'
),
array (
'name' => 'Bdfdfd'
),
array (
'name' => 'Bcrwewwe'
)
)
),
array (
'title' => 'B',
'list' => array(
array (
'name' => 'Bape'
),
array (
'name' => 'Bdfdfd'
),
array (
'name' => 'Bcrwewwe'
)
)
),
array (
'title' => 'B',
'list' => array(
array (
'name' => 'Bape'
),
array (
'name' => 'Bdfdfd'
),
array (
'name' => 'Bcrwewwe'
)
)
)
)
);
$this->_view->assign('title', 'YOHO!有货');
//$this->_view->display('brand', compact('brands'));
// 渲染模板
$this->_view->display('index', $data);
... ...