|
|
|
@ -9,6 +9,9 @@ layui.define(["element", "layer", "jquery"], function (exports) { |
|
|
|
layer = layui.layer, |
|
|
|
$ = layui.$; |
|
|
|
|
|
|
|
// 用于储存移动端底部导航映射
|
|
|
|
let mobileFooterHash = {'/userAuthorityMenus':"功能","/message":"消息","/userInfo":"我的"}; |
|
|
|
|
|
|
|
|
|
|
|
var miniTab = { |
|
|
|
|
|
|
|
@ -259,7 +262,7 @@ layui.define(["element", "layer", "jquery"], function (exports) { |
|
|
|
* 判断是否为手机 |
|
|
|
* @returns {boolean} |
|
|
|
*/ |
|
|
|
checkMobile:function () { |
|
|
|
checkMobile: function () { |
|
|
|
var ua = navigator.userAgent.toLocaleLowerCase(); |
|
|
|
var pf = navigator.platform.toLocaleLowerCase(); |
|
|
|
var isAndroid = (/android/i).test(ua) || ((/iPhone|iPod|iPad/i).test(ua) && (/linux/i).test(pf)) |
|
|
|
@ -323,32 +326,33 @@ layui.define(["element", "layer", "jquery"], function (exports) { |
|
|
|
* 在iframe子菜单上打开新窗口 |
|
|
|
*/ |
|
|
|
$('body').on('click', '[layuimini-content-href]', function () { |
|
|
|
|
|
|
|
var loading = parent.layer.load(0, {shade: false, time: 2 * 1000}); |
|
|
|
var tabId = $(this).attr('layuimini-content-href'), |
|
|
|
href = $(this).attr('layuimini-content-href'), |
|
|
|
title = $(this).attr('data-title'), |
|
|
|
target = $(this).attr('target'); |
|
|
|
let footer = $(this).attr("footer"); |
|
|
|
if(footer === "1" || footer === 1){ |
|
|
|
miniTab.renderHome({"href":href,"title":title}) |
|
|
|
} |
|
|
|
if (target === '_blank') { |
|
|
|
parent.layer.close(loading); |
|
|
|
window.open(href, "_blank"); |
|
|
|
return false; |
|
|
|
} |
|
|
|
if (tabId === null || tabId === undefined) tabId = new Date().getTime(); |
|
|
|
var checkTab = miniTab.check(tabId, true); |
|
|
|
if (!checkTab) { |
|
|
|
miniTab.create({ |
|
|
|
tabId: tabId, |
|
|
|
href: href, |
|
|
|
title: title, |
|
|
|
isIframe: true, |
|
|
|
maxTabNum: options.maxTabNum, |
|
|
|
}); |
|
|
|
if (footer === "1" || footer === 1) { |
|
|
|
miniTab.renderHome({"href": href, "title": title}) |
|
|
|
} else { |
|
|
|
if (target === '_blank') { |
|
|
|
parent.layer.close(loading); |
|
|
|
window.open(href, "_blank"); |
|
|
|
return false; |
|
|
|
} |
|
|
|
if (tabId === null || tabId === undefined) tabId = new Date().getTime(); |
|
|
|
var checkTab = miniTab.check(tabId, true); |
|
|
|
if (!checkTab) { |
|
|
|
miniTab.create({ |
|
|
|
tabId: tabId, |
|
|
|
href: href, |
|
|
|
title: title, |
|
|
|
isIframe: true, |
|
|
|
maxTabNum: options.maxTabNum, |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
parent.layui.element.tabChange('layuiminiTab', tabId); |
|
|
|
parent.layer.close(loading); |
|
|
|
}); |
|
|
|
@ -492,9 +496,11 @@ layui.define(["element", "layer", "jquery"], function (exports) { |
|
|
|
if (!options.urlHashLocation) return false; |
|
|
|
var tabId = location.hash.replace(/^#\//, ''); |
|
|
|
if (tabId === null || tabId === undefined || tabId === '') return false; |
|
|
|
|
|
|
|
// 判断是否为首页
|
|
|
|
if (tabId === options.homeInfo.href) return false; |
|
|
|
// 判断是否为首页或者底部导航栏页面
|
|
|
|
if (tabId === options.homeInfo.href || Object.keys(mobileFooterHash).indexOf(tabId) !== -1) { |
|
|
|
miniTab.renderHome({"href":tabId,"title":mobileFooterHash[tabId]}); |
|
|
|
return false; |
|
|
|
} |
|
|
|
|
|
|
|
// 判断是否为右侧菜单
|
|
|
|
var menu = miniTab.searchMenu(tabId, options.menuList); |
|
|
|
@ -595,9 +601,9 @@ layui.define(["element", "layer", "jquery"], function (exports) { |
|
|
|
listenSwitchMultiModule: function (tabId) { |
|
|
|
$("[layuimini-href]").each(function () { |
|
|
|
if ($(this).attr("layuimini-href") === tabId) { |
|
|
|
var addMenuClass ; |
|
|
|
var addMenuClass; |
|
|
|
// 如果是移动端
|
|
|
|
if(miniTab.checkMobile()){ |
|
|
|
if (miniTab.checkMobile()) { |
|
|
|
addMenuClass = function ($element, type) { |
|
|
|
if (type === 1) { |
|
|
|
$element.addClass('layui-this'); |
|
|
|
@ -606,7 +612,7 @@ layui.define(["element", "layer", "jquery"], function (exports) { |
|
|
|
$(".layuimini-header-menu li").attr('class', 'layui-nav-item'); |
|
|
|
$("#" + moduleId + "HeaderId").addClass("layui-this"); |
|
|
|
let text = $("#" + moduleId + "HeaderId").text(); |
|
|
|
if(text === '仓库管理'){ |
|
|
|
if (text === '仓库管理') { |
|
|
|
$("#" + moduleId).attr('class', 'layui-nav layui-nav-tree layui-this'); |
|
|
|
$(".layuimini-menu-left .layui-nav.layui-nav-tree").attr('class', 'layui-nav layui-nav-tree layui-hide'); |
|
|
|
} |
|
|
|
@ -622,7 +628,7 @@ layui.define(["element", "layer", "jquery"], function (exports) { |
|
|
|
$(".layuimini-header-menu li").attr('class', 'layui-nav-item'); |
|
|
|
$("#" + moduleId + "HeaderId").addClass("layui-this"); |
|
|
|
let text = $("#" + moduleId + "HeaderId").text(); |
|
|
|
if(text === '仓库管理'){ |
|
|
|
if (text === '仓库管理') { |
|
|
|
$("#" + moduleId).attr('class', 'layui-nav layui-nav-tree layui-this'); |
|
|
|
$(".layuimini-menu-left .layui-nav.layui-nav-tree").attr('class', 'layui-nav layui-nav-tree layui-hide'); |
|
|
|
} |
|
|
|
@ -631,7 +637,7 @@ layui.define(["element", "layer", "jquery"], function (exports) { |
|
|
|
} |
|
|
|
} |
|
|
|
}; |
|
|
|
}else{ |
|
|
|
} else { |
|
|
|
addMenuClass = function ($element, type) { |
|
|
|
if (type === 1) { |
|
|
|
$element.addClass('layui-this'); |
|
|
|
|