mirror of https://gitee.com/karson/fastadmin.git
新增简洁模式菜单
parent
ec84778d3d
commit
9c422d6285
|
|
@ -32,7 +32,7 @@ class Index extends Backend
|
|||
*/
|
||||
public function index()
|
||||
{
|
||||
$cookieArr = ['adminskin' => "/^skin\-([a-z\-]+)\$/i", 'multiplenav' => "/^(0|1)\$/", 'multipletab' => "/^(0|1)\$/", 'show_submenu' => "/^(0|1)\$/"];
|
||||
$cookieArr = ['adminskin' => "/^skin\-([a-z\-]+)\$/i", 'simplenav' => "/^(0|1)\$/", 'multiplenav' => "/^(0|1)\$/", 'multipletab' => "/^(0|1)\$/", 'show_submenu' => "/^(0|1)\$/"];
|
||||
foreach ($cookieArr as $key => $regex) {
|
||||
$cookieValue = $this->request->cookie($key);
|
||||
if (!is_null($cookieValue) && preg_match($regex, $cookieValue)) {
|
||||
|
|
|
|||
|
|
@ -16,6 +16,8 @@ return [
|
|||
'Toggle between slide over content and push content effects' => '切换右侧操作栏覆盖或独占',
|
||||
'Toggle Right Sidebar Skin' => '切换右侧操作栏背景',
|
||||
'Toggle between dark and light skins for the right sidebar' => '将右侧操作栏背景亮色或深色切换',
|
||||
'Simple nav' => '简洁导航模式',
|
||||
'Simple nav tips' => '启用后顶部导航将不再显示,同时每次点击菜单都会刷新右侧内容',
|
||||
'Multiple nav' => '多级菜单导航',
|
||||
'Toggle the top menu state (multiple or single)' => '切换顶部菜单为多级菜单导航模式',
|
||||
'Multiple tab' => '多选项卡',
|
||||
|
|
|
|||
|
|
@ -30,8 +30,9 @@
|
|||
<!-- Home tab content -->
|
||||
<div class="tab-pane active" id="control-sidebar-setting-tab">
|
||||
<h4 class="control-sidebar-heading">{:__('Layout Options')}</h4>
|
||||
<div class="form-group"><label class="control-sidebar-subheading"><input type="checkbox" data-config="multiplenav" {if $Think.config.fastadmin.multiplenav}checked{/if} class="pull-right"> {:__('Multiple Nav')}</label><p>{:__("Toggle the top menu state (multiple or single)")}</p></div>
|
||||
<div class="form-group"><label class="control-sidebar-subheading"><input type="checkbox" data-config="multipletab" {if $Think.config.fastadmin.multipletab}checked{/if} class="pull-right"> {:__('Multiple Tab')}</label><p>{:__("Always show multiple tab when multiple nav is set")}</p></div>
|
||||
<div class="form-group"><label class="control-sidebar-subheading"><input type="checkbox" data-config="simplenav" {if $Think.config.fastadmin.simplenav}checked{/if} class="pull-right"> {:__('Simple Nav')}</label><p>{:__("Simple nav tips")}</p></div>
|
||||
<div class="form-group"><label class="control-sidebar-subheading"><input type="checkbox" data-config="multiplenav" {if $Think.config.fastadmin.simplenav}disabled{/if} {if $Think.config.fastadmin.multiplenav}checked{/if} class="pull-right"> {:__('Multiple Nav')}</label><p>{:__("Toggle the top menu state (multiple or single)")}</p></div>
|
||||
<div class="form-group"><label class="control-sidebar-subheading"><input type="checkbox" data-config="multipletab" {if !$Think.config.fastadmin.multiplenav}disabled{/if} {if $Think.config.fastadmin.multipletab}checked{/if} class="pull-right"> {:__('Multiple Tab')}</label><p>{:__("Always show multiple tab when multiple nav is set")}</p></div>
|
||||
<div class="form-group"><label class="control-sidebar-subheading"><input type="checkbox" data-layout="sidebar-collapse" class="pull-right"> {:__('Toggle Sidebar')}</label><p>{:__("Toggle the left sidebar's state (open or collapse)")}</p></div>
|
||||
<div class="form-group"><label class="control-sidebar-subheading"><input type="checkbox" data-enable="expandOnHover" class="pull-right"> {:__('Sidebar Expand on Hover')}</label><p>{:__('Let the sidebar mini expand on hover')}</p></div>
|
||||
<div class="form-group"><label class="control-sidebar-subheading"><input type="checkbox" data-menu="show-submenu" class="pull-right"> {:__('Show sub menu')}</label><p>{:__('Always show sub menu')}</p></div>
|
||||
|
|
|
|||
|
|
@ -18,7 +18,9 @@
|
|||
|
||||
<!--如果不想在顶部显示角标,则给ul加上disable-top-badge类即可-->
|
||||
<ul class="nav nav-tabs nav-addtabs disable-top-badge hidden-xs" role="tablist">
|
||||
{if !$Think.config.fastadmin.simplenav}
|
||||
{$navlist}
|
||||
{/if}
|
||||
</ul>
|
||||
|
||||
<div class="navbar-custom-menu">
|
||||
|
|
|
|||
|
|
@ -276,6 +276,8 @@ return [
|
|||
'loginip_check' => true,
|
||||
//登录页默认背景图
|
||||
'login_background' => "",
|
||||
//是否启用简洁导航
|
||||
'simplenav' => true,
|
||||
//是否启用多级菜单导航
|
||||
'multiplenav' => false,
|
||||
//是否开启多选项卡(仅在开启多级菜单时起作用)
|
||||
|
|
|
|||
|
|
@ -206,8 +206,9 @@ define(['jquery', 'bootstrap', 'backend', 'addtabs', 'adminlte', 'form'], functi
|
|||
//这一行需要放在点击左侧链接事件之前
|
||||
var addtabs = Config.referer ? localStorage.getItem("addtabs") : null;
|
||||
|
||||
console.log($("[data-config='simplenav']").prop("checked"))
|
||||
//绑定tabs事件,如果需要点击强制刷新iframe,则请将iframeForceRefresh置为true,iframeForceRefreshTable只强制刷新表格
|
||||
nav.addtabs({iframeHeight: "100%", iframeForceRefresh: false, iframeForceRefreshTable: true, nav: nav});
|
||||
nav.addtabs({iframeHeight: "100%", iframeForceRefresh: false, iframeForceRefreshTable: true, simple: $("[data-config='simplenav']").prop("checked"), nav: nav});
|
||||
|
||||
if ($("ul.sidebar-menu li.active a").length > 0) {
|
||||
$("ul.sidebar-menu li.active a").trigger("click");
|
||||
|
|
@ -339,6 +340,13 @@ define(['jquery', 'bootstrap', 'backend', 'addtabs', 'adminlte', 'form'], functi
|
|||
createCookie('sidebar_collapse', value);
|
||||
});
|
||||
|
||||
// 切换简洁模式菜单
|
||||
$(document).on("click", "[data-config='simplenav']", function () {
|
||||
var value = $(this).prop("checked") ? 1 : 0;
|
||||
createCookie('simplenav', value);
|
||||
location.reload();
|
||||
});
|
||||
|
||||
// 切换多级菜单
|
||||
$(document).on("click", "[data-config='multiplenav']", function () {
|
||||
var value = $(this).prop("checked") ? 1 : 0;
|
||||
|
|
|
|||
Loading…
Reference in New Issue