626 lines
25 KiB
JavaScript
Executable File
626 lines
25 KiB
JavaScript
Executable File
/**
|
||
* 独立弹窗层级处理
|
||
* @author Devil
|
||
* @blog http://gong.gg/
|
||
* @version 1.0.0
|
||
* @date 2023-02-15
|
||
* @desc description
|
||
* @param {[string]} key [窗口可以]
|
||
*/
|
||
function LayerPagesLevelHandle (key) {
|
||
var index = 0;
|
||
var $content = $('#ifcontent');
|
||
$content.find('.window-layer-alone-layer').each(function () {
|
||
var temp_index = parseInt($(this).css('z-index') || 0);
|
||
if (temp_index > index) {
|
||
index = temp_index
|
||
}
|
||
});
|
||
$content.find('.window-layer .window-layer-seat').show();
|
||
var $layer = $content.find('.window-layer.iframe-item-key-' + key);
|
||
$layer.css({ 'z-index': index + 1, 'position': 'fixed' });
|
||
$layer.find('.window-layer-seat').hide();
|
||
}
|
||
|
||
/**
|
||
* 展开菜单
|
||
* @author kevin
|
||
* @blog http://gong.gg/
|
||
* @version 1.0.0
|
||
* @date 2023-12-06
|
||
* @desc description
|
||
*/
|
||
function OpenMenu () {
|
||
$('.menu-scaling-submit').addClass('open-menu');
|
||
$('.menu-scaling-submit').animate({ left: '135px' }, 300);
|
||
$('.menu-scaling-submit').removeClass('icon-stretch').addClass('icon-shrink');
|
||
$('#admin-offcanvas').addClass('open-child-menu');
|
||
$('#admin-offcanvas').animate({ width: '203px' }, 300);
|
||
$('#ifcontent').animate({ paddingLeft: '203px' }, 300);
|
||
$('header.admin-header').animate({ left: '203px' }, 300);
|
||
}
|
||
|
||
/**
|
||
* 收起菜单
|
||
* @author kevin
|
||
* @blog http://gong.gg/
|
||
* @version 1.0.0
|
||
* @date 2023-12-06
|
||
* @desc description
|
||
*/
|
||
function CloseMenu () {
|
||
$('.menu-scaling-submit').removeClass('open-menu');
|
||
$('.menu-scaling-submit').animate({ left: '30px' }, 300);
|
||
$('.menu-scaling-submit').removeClass('icon-shrink').addClass('icon-stretch');
|
||
$('#admin-offcanvas').removeClass('open-child-menu');
|
||
$('#admin-offcanvas').animate({ width: '80px' }, 300);
|
||
$('#ifcontent').animate({ paddingLeft: '80px' }, 300);
|
||
$('header.admin-header').animate({ left: '80px' }, 300);
|
||
}
|
||
|
||
/**
|
||
* 关闭tabs工具
|
||
* @author kevin
|
||
* @blog http://gong.gg/
|
||
* @version 1.0.0
|
||
* @date 2023-12-06
|
||
* @desc description
|
||
*/
|
||
function IframeCloseNavTabsRightTools () {
|
||
$('.tabs-list .tabs-tool').dropdown('close');
|
||
}
|
||
|
||
$(function () {
|
||
// 左侧菜单箭头方向回调处理
|
||
$('#admin-offcanvas li.admin-parent').on('open.collapse.amui', function () {
|
||
$(this).find('a i').toggleClass('top-menu-more-icon-rotate');
|
||
}).on('close.collapse.amui', function () {
|
||
$(this).find('a i').toggleClass('top-menu-more-icon-rotate');
|
||
});
|
||
|
||
// url加载
|
||
$(document).on('click', '.common-left-menu li a, .admin-header-right-list li a.new-window', function () {
|
||
var url = $(this).data('url') || null;
|
||
var type = $(this).data('type');
|
||
var key = $(this).data('key');
|
||
var name = $(this).data('node-name') || $(this).find('.nav-name').text();
|
||
AdminTopNavIframeAddHandle(url, name, key, type);
|
||
});
|
||
// 顶级左侧菜单选择
|
||
$(document).on('click', '.must-menu-list .common-left-menu li a', function (event) {
|
||
$('.common-left-menu li a').removeClass('common-left-menu-active');
|
||
$(this).addClass('common-left-menu-active');
|
||
if (window.innerWidth > 641) {
|
||
if ($(this).parent().find('ul').length > 0) {
|
||
OpenMenu();
|
||
$('.child-menu-list').find('ul.second').addClass('am-hide');
|
||
$('.child-menu-list').find('#power-menu-' + $(this).data('id')).removeClass('am-hide');
|
||
$('.child-menu-list .menu-name').text($(this).text().trim());
|
||
$('.menu-scaling-submit').removeClass('am-hide');
|
||
// 获取下级菜单第一个并打开
|
||
$('.child-menu-list').find('#power-menu-' + $(this).data('id') + '>li>a').addClass('am-collapsed');
|
||
$('.child-menu-list').find('#power-menu-' + $(this).data('id') + '>li>a i').removeClass('left-menu-more-icon-rotate');
|
||
$('.child-menu-list').find('#power-menu-' + $(this).data('id') + '>li>ul').removeClass('am-in');
|
||
$('.child-menu-list').find('#power-menu-' + $(this).data('id') + ' li:eq(0)>a').trigger('click');
|
||
|
||
|
||
if (!$('.child-menu-list').find('#power-menu-' + $(this).data('id') + ' li:eq(0)>a').hasClass('am-collapsed')) {
|
||
$('.child-menu-list').find('#power-menu-' + $(this).data('id') + ' li:eq(0)>ul li:eq(0) a').trigger('click');
|
||
} else {
|
||
if ($(this).parent().find('ul').length <= 0) {
|
||
$('.child-menu-list').find('#power-menu-' + $(this).data('id') + ' li:eq(0)>ul li:eq(0) a').trigger('click');
|
||
}
|
||
}
|
||
} else {
|
||
CloseMenu();
|
||
$('.menu-scaling-submit').addClass('am-hide');
|
||
}
|
||
}
|
||
});
|
||
// 二级右侧菜单选择(全部包含下级菜单)
|
||
$(document).on('click', '.child-menu-list .common-left-menu li a', function () {
|
||
$(this).parent().parent().find('a').removeClass('common-left-menu-active');
|
||
$(this).addClass('common-left-menu-active');
|
||
});
|
||
|
||
// 二级菜单开关
|
||
$(document).on('click', '.menu-scaling-submit', function () {
|
||
$('.must-menu-list .common-left-menu>li').each((k, v) => {
|
||
if ($(v).find('a').hasClass('common-left-menu-active') && $(v).find('ul.am-list').length > 0) {
|
||
if ($('#admin-offcanvas').hasClass('open-child-menu')) {
|
||
CloseMenu();
|
||
} else {
|
||
OpenMenu();
|
||
}
|
||
}
|
||
})
|
||
});
|
||
|
||
// 浏览器窗口实时事件
|
||
$(window).resize(function () {
|
||
var data_status = $('.menu-scaling-submit').hasClass('open-menu');
|
||
// 小屏幕关闭左侧导航
|
||
if ($(document).width() <= 640) {
|
||
$('#admin-offcanvas').css({ 'width': 'inherit' });
|
||
$('#ifconten |