diff --git a/web/src/main/resources/template/assets/lib/layui/customer/indexMenu.js b/web/src/main/resources/template/assets/lib/layui/customer/indexMenu.js index 65aebd54b76f821d4bd5c91f35b52f2d298b155c..c70cdf2dfcce0d00a94f4807f2a6d93e432fcade 100644 --- a/web/src/main/resources/template/assets/lib/layui/customer/indexMenu.js +++ b/web/src/main/resources/template/assets/lib/layui/customer/indexMenu.js @@ -2,9 +2,25 @@ // 菜单按钮相关工具类 var indexMenu = { - - getUrlPath: function (){ - + /** + * 分布式部署获取真实的访问路径 + * + * @param url 系统自定义路径 + * @param menuSysWinUrl 分布式系统域名 + * @returns {string|*} + */ + getUrlPath: function (url, menuSysWinUrl){ + if((url.substr(0, 7).toLowerCase() == "http://" + || url.substr(0, 8).toLowerCase() == "https://") + && url.indexOf("/tpl/") != -1){ + url += '?userToken=' + getCookie("userToken"); + return url; + } else { + if(!isNull(menuSysWinUrl)){ + url = menuSysWinUrl + url + '?userToken=' + getCookie("userToken"); + } + } + return url; }, /** @@ -17,26 +33,48 @@ var indexMenu = { if(isNull(icon)){ icon = ""; } + var id = dataMenu.attr("data-id"); + var title = dataMenu.attr("data-title"); + var sysWinUrl = dataMenu.attr("data-sysWinUrl"); + var url = dataMenu.attr("data-url"); + url = indexMenu.getUrlPath(url, sysWinUrl); // 这时会判断右侧#LAY_app_tabsheader属性下的有lay-id属性的li的数目,即已经打开的tab项数目 if($("#LAY_app_tabsheader li[lay-id]").length <= 0) { // 如果比零小,则直接打开新的tab项 - active.tabAdd(dataMenu.attr("data-url"), dataMenu.attr("data-id"), icon + dataMenu.attr("data-title")); + active.tabAdd(url, id, icon + title); } else { // 否则判断该tab项是否以及存在 var isData = false; // 初始化一个标志,为false说明未打开该tab项 为true则说明已有 $.each($("#LAY_app_tabsheader li[lay-id]"), function() { // 如果点击左侧菜单栏所传入的id 在右侧tab项中的lay-id属性可以找到,则说明该tab项已经打开 - if($(this).attr("lay-id") === dataMenu.attr("data-id")) { + if($(this).attr("lay-id") === id) { isData = true; } }) if(isData == false) { // 标志为false 新增一个tab项 - active.tabAdd(dataMenu.attr("data-url"), dataMenu.attr("data-id"), icon + dataMenu.attr("data-title")); + active.tabAdd(url, id, icon + title); } } // 最后不管是否新增tab,最后都转到要打开的选项页面上 - active.tabChange(dataMenu.attr("data-id")); + active.tabChange(id); + indexMenu.sendMessageToChildIFrame(url, id); + }, + + /** + * 分布式部署,发送消息给其他项目,实现权限点共享 + * + * @param url url地址 + * @param id frame的id + */ + sendMessageToChildIFrame: function (url, id){ + if((url.substr(0, 7).toLowerCase() == "http://" + || url.substr(0, 8).toLowerCase() == "https://") + && url.indexOf("/tpl/") != -1){ + var childIframe = $("#" + id).find('iframe')[0]; + // 发送消息,实现权限点共享 + childIframe.contentWindow.postMessage(localStorage.getItem("authpoints"), "*"); + } } } diff --git a/web/src/main/resources/template/assets/lib/winui/js/winui.desktop.js b/web/src/main/resources/template/assets/lib/winui/js/winui.desktop.js index 454b828d7252eef33985d91db305eb083cb8ce4c..a0fb73e6daf05caaf851a826195c9b75e83420bb 100644 --- a/web/src/main/resources/template/assets/lib/winui/js/winui.desktop.js +++ b/web/src/main/resources/template/assets/lib/winui/js/winui.desktop.js @@ -15,7 +15,7 @@ layui.define(['jquery', 'layer', 'winui'], function (exports) { this.data = null; }; - //渲染HTML + // 渲染HTML Desktop.prototype.render = function (callback) { if (this.data === null) return; var html = ''; @@ -23,17 +23,18 @@ layui.define(['jquery', 'layer', 'winui'], function (exports) { if(languageType == 'cn'){ item.name = item.menuNameEn; } - var id = (item.id == '' || item.id == undefined) ? '' : 'win-id="' + item.id + '"', - url = (item.pageURL == '' || item.pageURL == undefined) ? '' : 'win-url="' + item.pageURL + '"', + var id = isNull(item.id) ? '' : 'win-id="' + item.id + '"', + url = isNull(item.pageURL) ? '' : 'win-url="' + item.pageURL + '"', title = isNull(item.name) ? '' : 'win-title="' + item.name + '"', - opentype = (item.openType == '' || item.openType == undefined) ? '' : 'win-opentype="' + item.openType + '"', - maxOpen = (item.maxOpen == '' || item.maxOpen == undefined) ? '' : 'win-maxOpen="' + item.maxOpen + '"', - menuIconBg = (item.menuIconBg == '' || item.menuIconBg == undefined) ? '' : 'win-menuIconBg="' + item.menuIconBg + '"', - menuIconColor = (item.menuIconColor == '' || item.menuIconColor == undefined) ? '' : 'win-menuIconColor="' + item.menuIconColor + '"', + opentype = isNull(item.openType) ? '' : 'win-opentype="' + item.openType + '"', + maxOpen = isNull(item.maxOpen) ? '' : 'win-maxOpen="' + item.maxOpen + '"', + menuIconBg = isNull(item.menuIconBg) ? '' : 'win-menuIconBg="' + item.menuIconBg + '"', + menuIconColor = isNull(item.menuIconColor) ? '' : 'win-menuIconColor="' + item.menuIconColor + '"', + menuSysWinUrl = isNull(item.sysWinUrl) ? '' : 'win-sysWinUrl="' + item.sysWinUrl + '"', menuIcon = ''; var icon = "", isFaIcon = ""; if(item.menuIconType === '1'){//icon - menuIcon = (item.icon == '' || item.icon == undefined) ? '' : 'win-icon="' + item.icon + '"'; + menuIcon = isNull(item.icon) ? '' : 'win-icon="' + item.icon + '"'; if(!isNull(item.menuIconColor)){ icon = ''; }else{ @@ -41,8 +42,8 @@ layui.define(['jquery', 'layer', 'winui'], function (exports) { } isFaIcon = "winui-icon-font"; }else if(item.menuIconType === '2'){//图片 - menuIcon = (item.menuIconPic == '' || item.menuIconPic == undefined) ? '' : 'win-icon="' + item.menuIconPic + '"'; - icon = ''; + menuIcon = isNull(item.menuIconPic) ? '' : 'win-icon="' + item.menuIconPic + '"'; + icon = ''; isFaIcon = "winui-icon-img"; } if(isNull(item.childs)){//没有子菜单 @@ -55,7 +56,7 @@ layui.define(['jquery', 'layer', 'winui'], function (exports) { html += '

' + item.name + '

'; html += ''; }else{ - html += '
'; + html += '
'; if(!isNull(item.menuIconBg)){ html += '
'; }else{ @@ -67,7 +68,7 @@ layui.define(['jquery', 'layer', 'winui'], function (exports) { html += '
'; } }else{//有子菜单 - html += '
'; + html += '
'; html += '
'; html += '
'; var childsIconContent = ''; @@ -76,13 +77,14 @@ layui.define(['jquery', 'layer', 'winui'], function (exports) { if(languageType == 'cn'){ bean.name = bean.menuNameEn; } - var childsid = (bean.id == '' || bean.id == undefined) ? '' : 'win-id="' + bean.id + '"', - childsurl = (bean.pageURL == '' || bean.pageURL == undefined) ? '' : 'win-url="' + bean.pageURL + '"', + var childsid = isNull(bean.id) ? '' : 'win-id="' + bean.id + '"', + childsurl = isNull(bean.pageURL) ? '' : 'win-url="' + bean.pageURL + '"', childstitle = isNull(bean.name) ? '' : 'win-title="' + bean.name + '"', - childsopentype = (bean.openType == '' || bean.openType == undefined) ? '' : 'win-opentype="' + bean.openType + '"', - childsmaxOpen = (bean.maxOpen == '' || bean.maxOpen == undefined) ? '' : 'win-maxOpen="' + bean.maxOpen + '"', - childsmenuIconBg = (bean.menuIconBg == '' || bean.menuIconBg == undefined) ? '' : 'win-menuIconBg="' + bean.menuIconBg + '"', - childsmenuIconColor = (bean.menuIconColor == '' || bean.menuIconColor == undefined) ? '' : 'win-menuIconColor="' + bean.menuIconColor + '"', + childsopentype = isNull(bean.openType) ? '' : 'win-opentype="' + bean.openType + '"', + childsmaxOpen = isNull(bean.maxOpen) ? '' : 'win-maxOpen="' + bean.maxOpen + '"', + childsmenuIconBg = isNull(bean.menuIconBg) ? '' : 'win-menuIconBg="' + bean.menuIconBg + '"', + childsmenuIconColor = isNull(bean.menuIconColor) ? '' : 'win-menuIconColor="' + bean.menuIconColor + '"', + childsmenuSysWinUrl = isNull(bean.sysWinUrl) ? '' : 'win-sysWinUrl="' + bean.sysWinUrl + '"', childsmenuIcon = ''; //如果子菜单的所属桌面和父菜单的一样或者该菜单所属桌面不存在 if(bean.deskTopId === item.deskTopId || $('.winui-desktop').find("article[id='" + bean.deskTopId + "']").length == 0 || bean.deskTopId === 'winfixedpage00000000'){ @@ -90,7 +92,7 @@ layui.define(['jquery', 'layer', 'winui'], function (exports) { var childsiconsmall; var childsisFaIcon = ""; if(bean.menuIconType === '1'){//icon - childsmenuIcon = (bean.icon == '' || bean.icon == undefined) ? '' : 'win-icon="' + bean.icon + '"'; + childsmenuIcon = isNull(bean.icon) ? '' : 'win-icon="' + bean.icon + '"'; if(!isNull(bean.menuIconColor)){ if(!isNull(bean.menuIconBg)){ childsiconsmall = ''; @@ -110,14 +112,14 @@ layui.define(['jquery', 'layer', 'winui'], function (exports) { } childsisFaIcon = "winui-icon-font"; }else if(bean.menuIconType === '2'){//图片 - childsmenuIcon = (bean.menuIconPic == '' || bean.menuIconPic == undefined) ? '' : 'win-icon="' + bean.menuIconPic + '"'; + childsmenuIcon = isNull(bean.menuIconPic) ? '' : 'win-icon="' + bean.menuIconPic + '"'; childsiconsmall = ''; childsicon = ''; childsisFaIcon = "winui-icon-img"; } childsIconContent += childsiconsmall; - childsHtml += '
'; + childsHtml += '
'; if(!isNull(bean.menuIconBg)){ childsHtml += '
'; }else{ @@ -132,7 +134,7 @@ layui.define(['jquery', 'layer', 'winui'], function (exports) { var childsicon; var childsisFaIcon = ""; if(bean.menuIconType === '1'){//icon - childsmenuIcon = (bean.icon == '' || bean.icon == undefined) ? '' : 'win-icon="' + bean.icon + '"'; + childsmenuIcon = isNull(bean.icon) ? '' : 'win-icon="' + bean.icon + '"'; if(!isNull(bean.menuIconColor)){ if(!isNull(bean.menuIconBg)){ childsicon = ''; @@ -148,11 +150,11 @@ layui.define(['jquery', 'layer', 'winui'], function (exports) { } childsisFaIcon = "winui-icon-font"; }else if(bean.menuIconType === '2'){//图片 - childsmenuIcon = (bean.menuIconPic == '' || bean.menuIconPic == undefined) ? '' : 'win-icon="' + bean.menuIconPic + '"'; + childsmenuIcon = isNull(bean.menuIconPic) ? '' : 'win-icon="' + bean.menuIconPic + '"'; childsicon = ''; childsisFaIcon = "winui-icon-img"; } - childDeskHtml += '
'; + childDeskHtml += '
'; if(!isNull(bean.menuIconBg)){ childDeskHtml += '
'; }else{ diff --git a/web/src/main/resources/template/assets/lib/winui/js/winui.start.js b/web/src/main/resources/template/assets/lib/winui/js/winui.start.js index 02a8a25f998d0cd16c06fffb2536ec41d61fef94..7008939bb83ad0bef768888b0c1babd7b4042983 100644 --- a/web/src/main/resources/template/assets/lib/winui/js/winui.start.js +++ b/web/src/main/resources/template/assets/lib/winui/js/winui.start.js @@ -24,15 +24,16 @@ layui.define(['jquery', 'element', 'layer', 'winui'], function (exports) { if(languageType == 'cn'){ item.name = item.menuNameEn; } - var id = (item.id == '' || item.id == undefined) ? '' : 'win-id="' + item.id + '"', - url = (item.pageURL == '' || item.pageURL == undefined) ? '' : 'win-url="' + item.pageURL + '"', + var id = isNull(item.id) ? '' : 'win-id="' + item.id + '"', + url = isNull(item.pageURL) ? '' : 'win-url="' + item.pageURL + '"', title = isNull(item.name) ? '' : 'win-title="' + item.name + '"', - opentype = (item.openType == '' || item.openType == undefined) ? '' : 'win-opentype="' + item.openType + '"', - maxopen = (item.maxOpen == '' || item.maxOpen == undefined) ? '' : 'win-maxopen="' + item.maxOpen + '"', - winIcon = (item.icon == '' || item.icon == undefined) ? '' : 'win-icon="' + item.icon + '"', + opentype = isNull(item.openType) ? '' : 'win-opentype="' + item.openType + '"', + maxopen = isNull(item.maxOpen) ? '' : 'win-maxopen="' + item.maxOpen + '"', + winIcon = isNull(item.icon) ? '' : 'win-icon="' + item.icon + '"', isParent = item.childs ? ' parent' : '', - menuIconBg = (item.menuIconBg == '' || item.menuIconBg == undefined) ? '' : 'win-menuIconBg="' + item.menuIconBg + '"', - menuIconColor = (item.menuIconColor == '' || item.menuIconColor == undefined) ? '' : 'win-menuIconColor="' + item.menuIconColor + '"', + menuIconBg = isNull(item.menuIconBg) ? '' : 'win-menuIconBg="' + item.menuIconBg + '"', + menuIconColor = isNull(item.menuIconColor) ? '' : 'win-menuIconColor="' + item.menuIconColor + '"', + menuSysWinUrl = isNull(item.sysWinUrl) ? '' : 'win-sysWinUrl="' + item.sysWinUrl + '"', menuDeskTopId = 'win-menuDeskTopId="' + item.deskTopId + '"'; var icon = ""; if(item.menuIconType === '1' || item.menuIconType == 1){//icon @@ -51,7 +52,7 @@ layui.define(['jquery', 'element', 'layer', 'winui'], function (exports) { }else{ var extend = ''; } - html += '
  • '; + html += '
  • '; if(!isNull(item.menuIconBg)){ html += '
    '; }else{ @@ -74,6 +75,7 @@ layui.define(['jquery', 'element', 'layer', 'winui'], function (exports) { cWinIcon = (cItem.icon == '' || cItem.icon == undefined) ? '' : 'win-icon="' + cItem.icon + '"', cmenuIconBg = (cItem.menuIconBg == '' || cItem.menuIconBg == undefined) ? '' : 'win-menuIconBg="' + cItem.menuIconBg + '"', cmenuIconColor = (cItem.menuIconColor == '' || cItem.menuIconColor == undefined) ? '' : 'win-menuIconColor="' + cItem.menuIconColor + '"', + cmenuSysWinUrl = isNull(cItem.sysWinUrl) ? '' : 'win-sysWinUrl="' + cItem.sysWinUrl + '"', menuDeskTopId = 'win-menuDeskTopId="' + cItem.deskTopId + '"';; var cicon = ""; if(cItem.menuIconType === '1' || cItem.menuIconType == 1){//icon @@ -87,7 +89,7 @@ layui.define(['jquery', 'element', 'layer', 'winui'], function (exports) { cicon = ''; cWinIcon = (cItem.menuIconPic == '' || cItem.menuIconPic == undefined) ? '' : 'win-icon="' + cItem.menuIconPic + '"' } - html += '
    '; + html += '
    '; if(!isNull(cItem.menuIconBg)){ html += '
    '; }else{ diff --git a/web/src/main/resources/template/assets/lib/winui/js/winui.window.js b/web/src/main/resources/template/assets/lib/winui/js/winui.window.js index 04426351dbef3bb114a1239542ebb3c9c4c5be1e..cb81736b7b52ec24202a30e92a2117d2e514b9c1 100644 --- a/web/src/main/resources/template/assets/lib/winui/js/winui.window.js +++ b/web/src/main/resources/template/assets/lib/winui/js/winui.window.js @@ -556,7 +556,7 @@ layui.define(['layer', 'winui'], function (exports) { var winLayer = new WinLayer(); - //置顶窗口(显示窗口且置于顶层) + // 置顶窗口(显示窗口且置于顶层) winLayer.setTop = function (param) { var windowDom = common.getWindow(param); if (windowDom) { @@ -571,7 +571,7 @@ layui.define(['layer', 'winui'], function (exports) { } }; - //显示信息(为了显示在所有窗口最前面而添加的方法) + // 显示信息(为了显示在所有窗口最前面而添加的方法) winLayer.msg = function (msg, options, func) { //移除请求遮罩层 $("body").find(".mask-req-str").remove(); @@ -584,7 +584,7 @@ layui.define(['layer', 'winui'], function (exports) { layer.msg(msg, options, func); }; - //显示提示框(为了显示在所有窗口最前面而添加的方法) + // 显示提示框(为了显示在所有窗口最前面而添加的方法) winLayer.confirm = function (msg, options, yes, cancel) { var type = typeof options === 'function'; if (type) { @@ -598,15 +598,15 @@ layui.define(['layer', 'winui'], function (exports) { else options.skin = 'layer-ext-winconfirm'; layer.confirm(msg, options, yes, cancel); - //替换窗体的关闭图标 + // 替换窗体的关闭图标 $('.layer-ext-winconfirm').find('.layui-layer-close').html(''); - //移除移动窗体的div + // 移除移动窗体的div $('.layui-layer-move').remove(); - //移除最小化最大化关闭按钮a标签的href属性 + // 移除最小化最大化关闭按钮a标签的href属性 $('.layer-ext-winconfirm').find('.layui-layer-setwin').children('a').removeAttr('href'); }; - //显示加载(为了显示在所有窗口最前面而添加的方法) + // 显示加载(为了显示在所有窗口最前面而添加的方法) winLayer.load = function (icon, options) { icon = icon || 1; options = options || {}; @@ -614,7 +614,7 @@ layui.define(['layer', 'winui'], function (exports) { return layer.load(icon, options); }; - //打开主题设置窗口 + // 打开主题设置窗口 winLayer.openTheme = function (loadBottomMenuIcon) { var that = this; $.get(winui.path + '../../../tpl/systheme/systheme.html', {}, function (content) { @@ -631,7 +631,7 @@ layui.define(['layer', 'winui'], function (exports) { }); } - //打开我的消息通知 + // 打开我的消息通知 winLayer.openSysNotice = function (loadBottomMenuIcon) { var that = this; var title = '' + '消息中心'; diff --git a/web/src/main/resources/template/js/index/index.js b/web/src/main/resources/template/js/index/index.js index 7ae1f65b6b8459b48b4de46a80341c3e686abfaa..9a345948bb149d358b34aaf5bdc5e28cab03bb15 100644 --- a/web/src/main/resources/template/js/index/index.js +++ b/web/src/main/resources/template/js/index/index.js @@ -1007,6 +1007,7 @@ layui.config({ var menuIconBg = $this.attr("win-menuiconbg"); var menuIconColor = $this.attr("win-menuiconcolor"); var menuIcon = $this.attr("win-icon"); + var menuSysWinUrl = $this.attr("win-sysWinUrl"); var str = '', iconStr = ''; if(menuIcon.indexOf('fa-') != -1){//icon图标 str = ' {{#each childs}}
    - + {{{icon}}} {{name}} @@ -223,7 +224,8 @@