新增简洁菜单模式

pull/495/head
Karson 2025-04-01 08:52:09 +08:00
parent b13ed1da95
commit 05a18ca601
6 changed files with 16 additions and 3 deletions

View File

@ -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)) {

View File

@ -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' => '多选项卡',
@ -25,7 +27,6 @@ return [
'Disable top menu badge' => '禁用顶部彩色小角标',
'Disable top menu badge without left menu' => '左边菜单栏的彩色小角标不受影响',
'Skins' => '皮肤',
'Username must be 3 to 30 characters' => '用户名只能由3-30位数字、字母、下划线组合',
'Password must be 6 to 30 characters' => '密码长度必须在6-30位之间不能包含空格',
'You\'ve logged in, do not login again' => '你已经登录,无需重复登录',
'Username or password can not be empty' => '用户名密码不能为空',

View File

@ -30,6 +30,7 @@
<!-- 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="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.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-layout="sidebar-collapse" class="pull-right"> {:__('Toggle Sidebar')}</label><p>{:__("Toggle the left sidebar's state (open or collapse)")}</p></div>

View File

@ -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">

View File

@ -281,6 +281,8 @@ return [
'loginip_check' => true,
//登录页默认背景图
'login_background' => "",
//是否启用简洁导航
'simplenav' => false,
//是否启用多级菜单导航
'multiplenav' => false,
//是否开启多选项卡(仅在开启多级菜单时起作用)

View File

@ -208,7 +208,7 @@ define(['jquery', 'bootstrap', 'backend', 'addtabs', 'adminlte', 'form'], functi
var addtabs = Config.referer ? sessionStorage.getItem("addtabs") : null;
//绑定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");
@ -342,6 +342,13 @@ define(['jquery', 'bootstrap', 'backend', 'addtabs', 'adminlte', 'form'], functi
}, 0);
});
// 切换简洁模式菜单
$(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;