Authored by 郝肖肖

merage plusstar

This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
... ... @@ -15,18 +15,10 @@ var mySwiper;
lazyLoad($('img.lazy'));
$('.star-content li').each(function(key, item) {
$(item).find('.swiper-container').addClass('swiper-' + key);
mySwiper = new Swiper('.swiper-' + key, {
lazyLoading: true,
pagination: '.swiper-' + key + ' .pagination-inner'
});
});
$('#nav-tab').bind('contextmenu', function(e) {
return false;
});
$('#nav-tab').on('touchend touchcancel', function(e) {
var $this = $(e.target).closest('li');
... ... @@ -34,11 +26,32 @@ $('#nav-tab').on('touchend touchcancel', function(e) {
return;
}
$navs.toggleClass('focus');
$contents.toggleClass('hide');
$navs.removeClass('focus');
$this.addClass('focus');
$contents.addClass('hide');
$contents.eq($this.index()).removeClass('hide');
if (typeof $this.swiper === 'undefined') {//解决隐藏式,swiper不渲染
$this.swiper = false;
$contents.find('li').each(function(key, item) {
$(item).find('.swiper-container').addClass('swiper-' + key);
mySwiper = new Swiper('.swiper-' + key, {
lazyLoading: true,
pagination: '.swiper-' + key + ' .pagination-inner'
});
});
}
$(document).trigger('scroll'); //Trigger lazyLoad
});
if ($('#nav-tab').find('li:eq(0)').hasClass('focus')) {
//解决li隐藏 swiper不渲染的问题
$('#nav-tab').find('li:eq(0)').removeClass('focus');
$('#nav-tab').find('li:eq(0)').trigger('touchend');
}
$('#nav-tab').on('touchstart', function(e) {
var target = e.target || e.srcElement;
... ...
... ... @@ -9,28 +9,31 @@
height: 60px;
padding: 10px 0;
background-color: #fff;
}
.star-nav, .plus-nav {
box-sizing: border-box;
float: left;
width: 50%;
height: 60px;
line-height: 60px;
font-size: 16PX;
text-align: center;
color: #ccc;
li {
box-sizing: border-box;
float: left;
width: 50%;
height: 60px;
line-height: 60px;
font-size: 16PX;
text-align: center;
color: #ccc;
border-right: 1px solid #ccc;
&.focus {
color: #000;
&.focus {
color: #000;
}
&:last-child {
border-right: none;
}
}
}
.bytouch{
background:#eee;
}
.star-nav {
border-right: 1px solid #ccc;
}
.plus-star-row {
margin-bottom: 30px;
... ...
{{>layout/header}}
<div class="ps-list-page ps-page yoho-page">
{{# ps}}
{{#if ps}}
<ul id="nav-tab" class="nav-tab clearfix">
<li class="star-nav focus">{{sName}}</li>
<li class="plus-nav">{{pName}}</li>
{{# ps}}
<li {{#if focus}} class="focus" {{/if}} >{{name}}</li>
{{/ps}}
</ul>
<div id="ps-content" class="ps-content">
<ul class="star-content content">
{{# star}}
{{> guang/ps_item}}
{{/ star}}
</ul>
<ul class="plus-content content hide">
{{# plus}}
{{> guang/ps_item}}
{{/ plus}}
</ul>
{{# ps}}
<ul class="content{{#if focus}}{{^}} hide {{/if}}">
{{# list}}
{{> guang/ps_item}}
{{/list}}
</ul>
{{/ps}}
</div>
{{/ ps}}
{{/if}}
</div>
{{>layout/footer}}
\ No newline at end of file
... ...
... ... @@ -42,7 +42,7 @@ class PlusstarModel
}
if (USE_CACHE) {
$key = CacheConfig::KEY_ACTION_GUANG_PLUSSTAR_INDEX . $channel;
$key = CacheConfig::KEY_ACTION_GUANG_PLUSSTAR_INDEX . $channel . 'k1';
// 先尝试获取一级缓存(master), 有数据则直接返回.
$result = Cache::get($key, 'master');
if (!empty($result)) {
... ... @@ -61,8 +61,20 @@ class PlusstarModel
return $result;
}
$result['ps']['star'] = self::formatData($brandList['recom']['data']['list'][0]['data'], $gender, true);
$result['ps']['plus'] = self::formatData($brandList['all']['data']['list'][0]['data'], $gender, true);
if (!empty($brandList['recom']['data']['list'][0]['data'])) {
$result['ps'][] = array(
'list' => self::formatData($brandList['recom']['data']['list'][0]['data'], $gender, true),
'focus' => true,
'name' => '设计师',
);
}
if (!empty($brandList['all']['data']['list'][0]['data'])) {
$result['ps'][] = array(
'list' => self::formatData($brandList['all']['data']['list'][0]['data'], $gender, true),
'name' => '经典潮牌',
);
}
// 接口调用正常,数据封装完成, 则设置一级(master)和二级(slave)数据缓存
if (USE_CACHE) {
... ... @@ -95,7 +107,7 @@ class PlusstarModel
}
if (USE_CACHE) {
$key = CacheConfig::KEY_ACTION_GUANG_PLUSSTAR_LIST . $channel;
$key = CacheConfig::KEY_ACTION_GUANG_PLUSSTAR_LIST . $channel . 'k1';
// 先尝试获取一级缓存(master), 有数据则直接返回.
$result = Cache::get($key, 'master');
if (!empty($result)) {
... ... @@ -104,14 +116,22 @@ class PlusstarModel
}
$result = array();
$star = array();
$brandList = PlusstarData::brandList($gender, $channel);
if (!empty($brandList['star']['data']['list'][0]['data'])) {
$result['ps']['star'] = self::formatData($brandList['star']['data']['list'][0]['data'], $gender, false);
//$result['ps']['pName'] = isset($brandList['star']['data']['brand_type_name']) ? $brandList['star']['data']['brand_type_name'] : '';
}
if (!empty($brandList['original']['data']['list'][0]['data'])) {
$result['ps']['plus'] = self::formatData($brandList['original']['data']['list'][0]['data'], $gender, true);
//$result['ps']['sName'] = isset($brandList['original']['data']['brand_type_name']) ? $brandList['original']['data']['brand_type_name'] : '';
$result['ps'][] = array(
'list' => self::formatData($brandList['original']['data']['list'][0]['data'], $gender, true),
'focus' => true,
'name' => '原创潮牌',
);
}
if (!empty($brandList['star']['data']['list'][0]['data'])) {
$result['ps'][] = array(
'list' => self::formatData($brandList['star']['data']['list'][0]['data'], $gender, false),
'name' => '明星潮品',
);
}
if (USE_CACHE) {
... ...
... ... @@ -29,10 +29,7 @@ class PlusstarController extends AbstractAction
$data = Guang\PlusstarModel::getBrands($gender);
$data['psList'] = true; // 控制模板中的JS使用
$data['ps']['sName'] = '明星潮品';
$data['ps']['pName'] = '原创潮牌';
$data['pageFooter'] = true;
$this->_view->display('list', $data);
} else {
$this->setTitle('国际优选');
... ... @@ -40,8 +37,6 @@ class PlusstarController extends AbstractAction
$data = Guang\PlusstarModel::getFirstBrands($gender);
$data['psList'] = true; // 控制模板中的JS使用
$data['ps']['sName'] = '设计师';
$data['ps']['pName'] = '经典潮牌';
$data['pageFooter'] = true;
$this->_view->display('list', $data);
... ... @@ -50,8 +45,6 @@ class PlusstarController extends AbstractAction
/**
* 明星原创-品牌列表页
*
* 备注:已不使用暂留着,可去掉
* @param int gender "1,3"表示男, "2,3"表示女
*/
public function listAction()
... ... @@ -63,8 +56,6 @@ class PlusstarController extends AbstractAction
$data = Guang\PlusstarModel::getBrands($gender);
$data['psList'] = true; // 控制模板中的JS使用
$data['ps']['sName'] = '明星潮品';
$data['ps']['pName'] = '原创潮牌';
$this->_view->display('list', $data);
}
... ...