Authored by 毕凯

侧边栏前端样式完成

... ... @@ -181,8 +181,8 @@
@include transition(transform 0.3s);
li {
height: 109rem / $pxConvertRem;
line-height: 109rem / $pxConvertRem;
height: 80rem / $pxConvertRem;
line-height: 80rem / $pxConvertRem;
border: none;
border-bottom: 1px solid #e0e0e0;
... ... @@ -235,7 +235,7 @@
a {
color: #fff;
border-bottom: none;
padding-left: 110rem / $pxConvertRem;
padding-left: 70rem / $pxConvertRem;
}
.nav-back {
... ... @@ -247,6 +247,7 @@
.sub-nav.show {
display: block;
z-index: 1;
@include transform(translateX(0));
@include transition(transform 0.3s);
}
... ...
... ... @@ -2,13 +2,12 @@
{{# sideNav}}
<ul {{#if @first}}class="first"{{/if}}>
{{# this}}
<li class="{{styleClass}}" style="{{#if color}}color:{{color}};{{/if}}">
{{# url}}
<a href="{{.}}">
{{/ url}}
{{^ url}}
<a href="javascript:;">
{{/ url}}
<li class="{{styleClass}}">
{{#if url}}
<a href="{{url}}" style="{{#if color}}color:{{color}};{{/if}}">
{{else}}
<a href="javascript:;" style="{{#if color}}color:{{color}};{{/if}}">
{{/if}}
{{# img}}
<span class="nav-img" style="background-image: url({{.}})"></span>
{{/ img}}
... ... @@ -24,13 +23,12 @@
{{# subNav}}
<ul class="sub-nav">
{{# list}}
<li class="{{# isSelect}}current{{/ isSelect}}" style="background-color:{{bgColor}};{{#if color}}color:{{color}};{{/if}}">
{{# url}}
<a href="{{.}}">
{{/ url}}
{{^ url}}
<a href="javascript:;">
{{/ url}}
<li class="{{# isSelect}}current{{/ isSelect}}" style="background-color:{{bgColor}};">
{{#if url}}
<a href="{{url}}" style="{{#if color}}color:{{color}};{{/if}}">
{{else}}
<a href="javascript:;" style="{{#if color}}color:{{color}};{{/if}}">
{{/if}}
{{^ back}}
<span class="nav-point iconfont">&#xe60c;</span>
{{/ back}}
... ...
... ... @@ -59,7 +59,15 @@ class SideModel
// 如果存在子菜单,就输出子菜单
if (isset($value['sub']) && !empty($value['sub'])) {
$subs = array();
$subs = array(
array(
'textCn' => $group[$groupKey]['textCn'],
'textEn' => $group[$groupKey]['textEn'],
'back' => true,
'isSelect' => false,
'bgColor' => self::getSideTopColor($guangChoosed)
)
);
foreach ($value['sub'] as $oneSub) {
$subs[] = self::formatSideItem($oneSub);
}
... ... @@ -88,6 +96,7 @@ class SideModel
// 追加逛的子分类数据
$result[] = self::genLeftNavGuang($guangChoosed);
return $result;
}
... ... @@ -100,14 +109,7 @@ class SideModel
private static function genLeftNavGuang($guangChoosed = 'all')
{
// 判断逛的背景色
$color = false;
if ($guangChoosed === 'girls') {
$color = '#FF88AE';
} else if ($guangChoosed === 'kids') {
$color = '#7ad9f9';
} else if ($guangChoosed === 'lifestyle') {
$color = '#4f4138';
}
$color = self::getSideTopColor($guangChoosed);
return
array(
... ... @@ -151,6 +153,26 @@ class SideModel
);
}
/**
* 根据选择的频道获取逛的背景色
* @param string $guangChoosed 逛默认选中项 "all"表示全部,"boys":只看男生,"girls":只看女生
* @return string color值
*/
private static function getSideTopColor($guangChoosed)
{
// 判断逛的背景色
$color = false;
if ($guangChoosed === 'girls') {
$color = '#FF88AE';
} else if ($guangChoosed === 'kids') {
$color = '#7ad9f9';
} else if ($guangChoosed === 'lifestyle') {
$color = '#4f4138';
}
return $color;
}
/**
* 格式化侧边栏数据
... ...