diff --git a/application/index/view/default/public/header_nav.html b/application/index/view/default/public/header_nav.html
index 467038092..fe0dcc3a0 100755
--- a/application/index/view/default/public/header_nav.html
+++ b/application/index/view/default/public/header_nav.html
@@ -27,43 +27,44 @@
{{if empty($user)}}
-
+
{{/if}}
-
- - 首页
- {{if !empty($nav_header)}}
+ {{if !empty($nav_header)}}
+
+
+ {{/if}}
+
diff --git a/application/service/NavigationService.php b/application/service/NavigationService.php
index 4c98aa844..6ac2d94ed 100755
--- a/application/service/NavigationService.php
+++ b/application/service/NavigationService.php
@@ -47,6 +47,7 @@ class NavigationService
// 缓存没数据则从数据库重新读取,顶部菜单
if(empty($header))
{
+ // 获取导航数据
$header = self::NavDataDealWith(Db::name('Navigation')->field($field)->where(array('nav_type'=>'header', 'is_show'=>1, 'pid'=>0))->order('sort')->select());
if(!empty($header))
{
@@ -55,6 +56,7 @@ class NavigationService
$v['items'] = self::NavDataDealWith(Db::name('Navigation')->field($field)->where(array('nav_type'=>'header', 'is_show'=>1, 'pid'=>$v['id']))->order('sort')->select());
}
}
+
// 大导航钩子
$hook_name = 'plugins_service_navigation_header_handle';
Hook::listen($hook_name, [
@@ -91,7 +93,46 @@ class NavigationService
cache(config('shopxo.cache_common_home_nav_footer_key'), $footer);
}
- //print_r($header);
+ // 中间大导航添加首页导航
+ array_unshift($header, [
+ 'id' => 0,
+ 'pid' => 0,
+ 'name' => '首页',
+ 'url' => __MY_URL__,
+ 'data_type' => 'system',
+ 'is_show' => 1,
+ 'is_new_window_open' => 0,
+ 'items' => [],
+ ]);
+
+ // 选中处理
+ if(!empty($header))
+ {
+ foreach($header as &$v)
+ {
+ $v['active'] = ($v['url'] == __MY_VIEW_URL__) ? 1 : 0;
+ if($v['active'] == 0 && !empty($v['items']))
+ {
+ $status = false;
+ foreach($v['items'] as &$vs)
+ {
+ if($vs['url'] == __MY_VIEW_URL__)
+ {
+ $vs['active'] = 1;
+ $status = true;
+ } else {
+ $vs['active'] = 0;
+ }
+ }
+
+ // 当子元素被选中则父级也选中
+ if($status)
+ {
+ $v['active'] = 1;
+ }
+ }
+ }
+ }
return [
'header' => $header,
diff --git a/public/static/index/default/css/common.css b/public/static/index/default/css/common.css
index ad6094d81..e6611ce41 100755
--- a/public/static/index/default/css/common.css
+++ b/public/static/index/default/css/common.css
@@ -662,10 +662,20 @@ ul.am-dropdown-content > .am-active > a:focus,
font-weight: 600;
vertical-align: middle;
}
-.shop-navigation .am-nav > li > a:hover, .shop-navigation .am-nav > li > a:focus {
+.shop-navigation .am-nav > li > a:after {
+ bottom: -3px;
+}
+.shop-navigation .am-nav > li > a:hover,
+.shop-navigation .am-nav > li > a:focus,
+.shop-navigation .am-nav > li > a.active {
background-color: transparent;
color: #d2354c;
}
+.shop-navigation .am-nav > li ul.am-dropdown-content > li > a.active {
+ text-decoration: none;
+ color: #d2354c;
+ background-color: #fff5f6;
+}
.shop-navigation .wap-logo {
max-width: 100px;
max-height: 45px;
@@ -683,9 +693,13 @@ ul.am-dropdown-content > .am-active > a:focus,
.shop-navigation .am-topbar-nav > li > a {
line-height: 40px;
}
- .shop-navigation .am-topbar-nav > li > a:hover:after {
+ .shop-navigation .am-topbar-nav > li > a:hover:after,
+ .shop-navigation .am-topbar-nav > li > a.active:after {
border-bottom-color: #d2354c;
}
+ .shop-navigation .am-topbar-nav > li > a.active:after {
+ opacity: 1;
+ }
.shop-navigation .am-topbar-collapse {
margin-left: 150px;
}