提交 63d7d2b2 编写于 作者: Skyeye云's avatar Skyeye云

新增分布式域名属性

上级 a32f8baa
...@@ -2,9 +2,25 @@ ...@@ -2,9 +2,25 @@
// 菜单按钮相关工具类 // 菜单按钮相关工具类
var indexMenu = { 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 = { ...@@ -17,26 +33,48 @@ var indexMenu = {
if(isNull(icon)){ if(isNull(icon)){
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项数目 // 这时会判断右侧#LAY_app_tabsheader属性下的有lay-id属性的li的数目,即已经打开的tab项数目
if($("#LAY_app_tabsheader li[lay-id]").length <= 0) { if($("#LAY_app_tabsheader li[lay-id]").length <= 0) {
// 如果比零小,则直接打开新的tab项 // 如果比零小,则直接打开新的tab项
active.tabAdd(dataMenu.attr("data-url"), dataMenu.attr("data-id"), icon + dataMenu.attr("data-title")); active.tabAdd(url, id, icon + title);
} else { } else {
// 否则判断该tab项是否以及存在 // 否则判断该tab项是否以及存在
var isData = false; // 初始化一个标志,为false说明未打开该tab项 为true则说明已有 var isData = false; // 初始化一个标志,为false说明未打开该tab项 为true则说明已有
$.each($("#LAY_app_tabsheader li[lay-id]"), function() { $.each($("#LAY_app_tabsheader li[lay-id]"), function() {
// 如果点击左侧菜单栏所传入的id 在右侧tab项中的lay-id属性可以找到,则说明该tab项已经打开 // 如果点击左侧菜单栏所传入的id 在右侧tab项中的lay-id属性可以找到,则说明该tab项已经打开
if($(this).attr("lay-id") === dataMenu.attr("data-id")) { if($(this).attr("lay-id") === id) {
isData = true; isData = true;
} }
}) })
if(isData == false) { if(isData == false) {
// 标志为false 新增一个tab项 // 标志为false 新增一个tab项
active.tabAdd(dataMenu.attr("data-url"), dataMenu.attr("data-id"), icon + dataMenu.attr("data-title")); active.tabAdd(url, id, icon + title);
} }
} }
// 最后不管是否新增tab,最后都转到要打开的选项页面上 // 最后不管是否新增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"), "*");
}
} }
} }
......
...@@ -15,7 +15,7 @@ layui.define(['jquery', 'layer', 'winui'], function (exports) { ...@@ -15,7 +15,7 @@ layui.define(['jquery', 'layer', 'winui'], function (exports) {
this.data = null; this.data = null;
}; };
//渲染HTML // 渲染HTML
Desktop.prototype.render = function (callback) { Desktop.prototype.render = function (callback) {
if (this.data === null) return; if (this.data === null) return;
var html = ''; var html = '';
...@@ -23,17 +23,18 @@ layui.define(['jquery', 'layer', 'winui'], function (exports) { ...@@ -23,17 +23,18 @@ layui.define(['jquery', 'layer', 'winui'], function (exports) {
if(languageType == 'cn'){ if(languageType == 'cn'){
item.name = item.menuNameEn; item.name = item.menuNameEn;
} }
var id = (item.id == '' || item.id == undefined) ? '' : 'win-id="' + item.id + '"', var id = isNull(item.id) ? '' : 'win-id="' + item.id + '"',
url = (item.pageURL == '' || item.pageURL == undefined) ? '' : 'win-url="' + item.pageURL + '"', url = isNull(item.pageURL) ? '' : 'win-url="' + item.pageURL + '"',
title = isNull(item.name) ? '' : 'win-title="' + item.name + '"', title = isNull(item.name) ? '' : 'win-title="' + item.name + '"',
opentype = (item.openType == '' || item.openType == undefined) ? '' : 'win-opentype="' + item.openType + '"', opentype = isNull(item.openType) ? '' : 'win-opentype="' + item.openType + '"',
maxOpen = (item.maxOpen == '' || item.maxOpen == undefined) ? '' : 'win-maxOpen="' + item.maxOpen + '"', maxOpen = isNull(item.maxOpen) ? '' : 'win-maxOpen="' + item.maxOpen + '"',
menuIconBg = (item.menuIconBg == '' || item.menuIconBg == undefined) ? '' : 'win-menuIconBg="' + item.menuIconBg + '"', menuIconBg = isNull(item.menuIconBg) ? '' : 'win-menuIconBg="' + item.menuIconBg + '"',
menuIconColor = (item.menuIconColor == '' || item.menuIconColor == undefined) ? '' : 'win-menuIconColor="' + item.menuIconColor + '"', menuIconColor = isNull(item.menuIconColor) ? '' : 'win-menuIconColor="' + item.menuIconColor + '"',
menuSysWinUrl = isNull(item.sysWinUrl) ? '' : 'win-sysWinUrl="' + item.sysWinUrl + '"',
menuIcon = ''; menuIcon = '';
var icon = "", isFaIcon = ""; var icon = "", isFaIcon = "";
if(item.menuIconType === '1'){//icon 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)){ if(!isNull(item.menuIconColor)){
icon = '<i class="fa ' + item.icon + ' fa-fw" style="color: ' + item.menuIconColor + '" win-i-id="' + item.id + '"></i>'; icon = '<i class="fa ' + item.icon + ' fa-fw" style="color: ' + item.menuIconColor + '" win-i-id="' + item.id + '"></i>';
}else{ }else{
...@@ -41,8 +42,8 @@ layui.define(['jquery', 'layer', 'winui'], function (exports) { ...@@ -41,8 +42,8 @@ layui.define(['jquery', 'layer', 'winui'], function (exports) {
} }
isFaIcon = "winui-icon-font"; isFaIcon = "winui-icon-font";
}else if(item.menuIconType === '2'){//图片 }else if(item.menuIconType === '2'){//图片
menuIcon = (item.menuIconPic == '' || item.menuIconPic == undefined) ? '' : 'win-icon="' + item.menuIconPic + '"'; menuIcon = isNull(item.menuIconPic) ? '' : 'win-icon="' + item.menuIconPic + '"';
icon = '<img src="' + fileBasePath + item.menuIconPic + '" class="desktop-img"/>'; icon = '<img src="' + fileBasePath + item.menuIconPic + '" class="desktop-img"/>';
isFaIcon = "winui-icon-img"; isFaIcon = "winui-icon-img";
} }
if(isNull(item.childs)){//没有子菜单 if(isNull(item.childs)){//没有子菜单
...@@ -55,7 +56,7 @@ layui.define(['jquery', 'layer', 'winui'], function (exports) { ...@@ -55,7 +56,7 @@ layui.define(['jquery', 'layer', 'winui'], function (exports) {
html += '<p>' + item.name + '</p>'; html += '<p>' + item.name + '</p>';
html += '</div>'; html += '</div>';
}else{ }else{
html += '<div class="winui-desktop-item sec-btn" ' + id + ' ' + url + ' ' + title + ' ' + opentype + ' ' + maxOpen + ' ' + menuIconBg + ' ' + menuIconColor + ' ' + menuIcon + '>'; html += '<div class="winui-desktop-item sec-btn" ' + id + ' ' + url + ' ' + title + ' ' + opentype + ' ' + maxOpen + ' ' + menuIconBg + ' ' + menuIconColor + ' ' + menuIcon + ' ' + menuSysWinUrl + '>';
if(!isNull(item.menuIconBg)){ if(!isNull(item.menuIconBg)){
html += '<div class="winui-icon ' + isFaIcon + '" style="background-color: ' + item.menuIconBg + '">'; html += '<div class="winui-icon ' + isFaIcon + '" style="background-color: ' + item.menuIconBg + '">';
}else{ }else{
...@@ -67,7 +68,7 @@ layui.define(['jquery', 'layer', 'winui'], function (exports) { ...@@ -67,7 +68,7 @@ layui.define(['jquery', 'layer', 'winui'], function (exports) {
html += '</div>'; html += '</div>';
} }
}else{//有子菜单 }else{//有子菜单
html += '<div class="winui-desktop-item win-menu-group" id="' + item.id + '" ' + id + ' ' + url + ' ' + title + ' ' + opentype + ' ' + maxOpen + ' ' + menuIconBg + ' ' + menuIconColor + '>'; html += '<div class="winui-desktop-item win-menu-group" id="' + item.id + '" ' + id + ' ' + url + ' ' + title + ' ' + opentype + ' ' + maxOpen + ' ' + menuIconBg + ' ' + menuIconColor + ' ' + menuSysWinUrl + '>';
html += '<div class="winui-icon ' + isFaIcon + '">'; html += '<div class="winui-icon ' + isFaIcon + '">';
html += '<div class="icon-drawer">'; html += '<div class="icon-drawer">';
var childsIconContent = ''; var childsIconContent = '';
...@@ -76,13 +77,14 @@ layui.define(['jquery', 'layer', 'winui'], function (exports) { ...@@ -76,13 +77,14 @@ layui.define(['jquery', 'layer', 'winui'], function (exports) {
if(languageType == 'cn'){ if(languageType == 'cn'){
bean.name = bean.menuNameEn; bean.name = bean.menuNameEn;
} }
var childsid = (bean.id == '' || bean.id == undefined) ? '' : 'win-id="' + bean.id + '"', var childsid = isNull(bean.id) ? '' : 'win-id="' + bean.id + '"',
childsurl = (bean.pageURL == '' || bean.pageURL == undefined) ? '' : 'win-url="' + bean.pageURL + '"', childsurl = isNull(bean.pageURL) ? '' : 'win-url="' + bean.pageURL + '"',
childstitle = isNull(bean.name) ? '' : 'win-title="' + bean.name + '"', childstitle = isNull(bean.name) ? '' : 'win-title="' + bean.name + '"',
childsopentype = (bean.openType == '' || bean.openType == undefined) ? '' : 'win-opentype="' + bean.openType + '"', childsopentype = isNull(bean.openType) ? '' : 'win-opentype="' + bean.openType + '"',
childsmaxOpen = (bean.maxOpen == '' || bean.maxOpen == undefined) ? '' : 'win-maxOpen="' + bean.maxOpen + '"', childsmaxOpen = isNull(bean.maxOpen) ? '' : 'win-maxOpen="' + bean.maxOpen + '"',
childsmenuIconBg = (bean.menuIconBg == '' || bean.menuIconBg == undefined) ? '' : 'win-menuIconBg="' + bean.menuIconBg + '"', childsmenuIconBg = isNull(bean.menuIconBg) ? '' : 'win-menuIconBg="' + bean.menuIconBg + '"',
childsmenuIconColor = (bean.menuIconColor == '' || bean.menuIconColor == undefined) ? '' : 'win-menuIconColor="' + bean.menuIconColor + '"', childsmenuIconColor = isNull(bean.menuIconColor) ? '' : 'win-menuIconColor="' + bean.menuIconColor + '"',
childsmenuSysWinUrl = isNull(bean.sysWinUrl) ? '' : 'win-sysWinUrl="' + bean.sysWinUrl + '"',
childsmenuIcon = ''; childsmenuIcon = '';
//如果子菜单的所属桌面和父菜单的一样或者该菜单所属桌面不存在 //如果子菜单的所属桌面和父菜单的一样或者该菜单所属桌面不存在
if(bean.deskTopId === item.deskTopId || $('.winui-desktop').find("article[id='" + bean.deskTopId + "']").length == 0 || bean.deskTopId === 'winfixedpage00000000'){ 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) { ...@@ -90,7 +92,7 @@ layui.define(['jquery', 'layer', 'winui'], function (exports) {
var childsiconsmall; var childsiconsmall;
var childsisFaIcon = ""; var childsisFaIcon = "";
if(bean.menuIconType === '1'){//icon 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.menuIconColor)){
if(!isNull(bean.menuIconBg)){ if(!isNull(bean.menuIconBg)){
childsiconsmall = '<i class="fa ' + bean.icon + ' fa-fw icon-drawer-icon" style="color: ' + bean.menuIconColor + ';background-color: ' + bean.menuIconBg + '" win-i-id="' + bean.id + '"></i>'; childsiconsmall = '<i class="fa ' + bean.icon + ' fa-fw icon-drawer-icon" style="color: ' + bean.menuIconColor + ';background-color: ' + bean.menuIconBg + '" win-i-id="' + bean.id + '"></i>';
...@@ -110,14 +112,14 @@ layui.define(['jquery', 'layer', 'winui'], function (exports) { ...@@ -110,14 +112,14 @@ layui.define(['jquery', 'layer', 'winui'], function (exports) {
} }
childsisFaIcon = "winui-icon-font"; childsisFaIcon = "winui-icon-font";
}else if(bean.menuIconType === '2'){//图片 }else if(bean.menuIconType === '2'){//图片
childsmenuIcon = (bean.menuIconPic == '' || bean.menuIconPic == undefined) ? '' : 'win-icon="' + bean.menuIconPic + '"'; childsmenuIcon = isNull(bean.menuIconPic) ? '' : 'win-icon="' + bean.menuIconPic + '"';
childsiconsmall = '<i class="fa icon-drawer-icon" win-i-id="' + bean.id + '"><img src="' + fileBasePath + bean.menuIconPic + '" class="desktop-img"/></i>'; childsiconsmall = '<i class="fa icon-drawer-icon" win-i-id="' + bean.id + '"><img src="' + fileBasePath + bean.menuIconPic + '" class="desktop-img"/></i>';
childsicon = '<img src="' + fileBasePath + bean.menuIconPic + '" class="desktop-img"/>'; childsicon = '<img src="' + fileBasePath + bean.menuIconPic + '" class="desktop-img"/>';
childsisFaIcon = "winui-icon-img"; childsisFaIcon = "winui-icon-img";
} }
childsIconContent += childsiconsmall; childsIconContent += childsiconsmall;
childsHtml += '<div class="winui-desktop-item sec-clsss-btn sec-btn" ' + childsid + ' ' + childsurl + ' ' + childstitle + ' ' + childsopentype + ' ' + childsmaxOpen + ' ' + childsmenuIconBg + ' ' + childsmenuIconColor + ' ' + childsmenuIcon + '>'; childsHtml += '<div class="winui-desktop-item sec-clsss-btn sec-btn" ' + childsid + ' ' + childsurl + ' ' + childstitle + ' ' + childsopentype + ' ' + childsmaxOpen + ' ' + childsmenuIconBg + ' ' + childsmenuIconColor + ' ' + childsmenuIcon + ' ' + childsmenuSysWinUrl + '>';
if(!isNull(bean.menuIconBg)){ if(!isNull(bean.menuIconBg)){
childsHtml += '<div class="winui-icon ' + childsisFaIcon + '" style="background-color: ' + bean.menuIconBg + '">'; childsHtml += '<div class="winui-icon ' + childsisFaIcon + '" style="background-color: ' + bean.menuIconBg + '">';
}else{ }else{
...@@ -132,7 +134,7 @@ layui.define(['jquery', 'layer', 'winui'], function (exports) { ...@@ -132,7 +134,7 @@ layui.define(['jquery', 'layer', 'winui'], function (exports) {
var childsicon; var childsicon;
var childsisFaIcon = ""; var childsisFaIcon = "";
if(bean.menuIconType === '1'){//icon 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.menuIconColor)){
if(!isNull(bean.menuIconBg)){ if(!isNull(bean.menuIconBg)){
childsicon = '<i class="fa ' + bean.icon + ' fa-fw" style="color: ' + bean.menuIconColor + ';background-color: ' + bean.menuIconBg + '" win-i-id="' + bean.id + '"></i>'; childsicon = '<i class="fa ' + bean.icon + ' fa-fw" style="color: ' + bean.menuIconColor + ';background-color: ' + bean.menuIconBg + '" win-i-id="' + bean.id + '"></i>';
...@@ -148,11 +150,11 @@ layui.define(['jquery', 'layer', 'winui'], function (exports) { ...@@ -148,11 +150,11 @@ layui.define(['jquery', 'layer', 'winui'], function (exports) {
} }
childsisFaIcon = "winui-icon-font"; childsisFaIcon = "winui-icon-font";
}else if(bean.menuIconType === '2'){//图片 }else if(bean.menuIconType === '2'){//图片
childsmenuIcon = (bean.menuIconPic == '' || bean.menuIconPic == undefined) ? '' : 'win-icon="' + bean.menuIconPic + '"'; childsmenuIcon = isNull(bean.menuIconPic) ? '' : 'win-icon="' + bean.menuIconPic + '"';
childsicon = '<img src="' + fileBasePath + bean.menuIconPic + '" class="desktop-img"/>'; childsicon = '<img src="' + fileBasePath + bean.menuIconPic + '" class="desktop-img"/>';
childsisFaIcon = "winui-icon-img"; childsisFaIcon = "winui-icon-img";
} }
childDeskHtml += '<div class="winui-desktop-item sec-btn" ' + childsid + ' ' + childsurl + ' ' + childstitle + ' ' + childsopentype + ' ' + childsmaxOpen + ' ' + childsmenuIconBg + ' ' + childsmenuIconColor + ' ' + childsmenuIcon + '>'; childDeskHtml += '<div class="winui-desktop-item sec-btn" ' + childsid + ' ' + childsurl + ' ' + childstitle + ' ' + childsopentype + ' ' + childsmaxOpen + ' ' + childsmenuIconBg + ' ' + childsmenuIconColor + ' ' + childsmenuIcon + ' ' + childsmenuSysWinUrl + '>';
if(!isNull(bean.menuIconBg)){ if(!isNull(bean.menuIconBg)){
childDeskHtml += '<div class="winui-icon ' + childsisFaIcon + '" style="background-color: ' + bean.menuIconBg + '">'; childDeskHtml += '<div class="winui-icon ' + childsisFaIcon + '" style="background-color: ' + bean.menuIconBg + '">';
}else{ }else{
......
...@@ -24,15 +24,16 @@ layui.define(['jquery', 'element', 'layer', 'winui'], function (exports) { ...@@ -24,15 +24,16 @@ layui.define(['jquery', 'element', 'layer', 'winui'], function (exports) {
if(languageType == 'cn'){ if(languageType == 'cn'){
item.name = item.menuNameEn; item.name = item.menuNameEn;
} }
var id = (item.id == '' || item.id == undefined) ? '' : 'win-id="' + item.id + '"', var id = isNull(item.id) ? '' : 'win-id="' + item.id + '"',
url = (item.pageURL == '' || item.pageURL == undefined) ? '' : 'win-url="' + item.pageURL + '"', url = isNull(item.pageURL) ? '' : 'win-url="' + item.pageURL + '"',
title = isNull(item.name) ? '' : 'win-title="' + item.name + '"', title = isNull(item.name) ? '' : 'win-title="' + item.name + '"',
opentype = (item.openType == '' || item.openType == undefined) ? '' : 'win-opentype="' + item.openType + '"', opentype = isNull(item.openType) ? '' : 'win-opentype="' + item.openType + '"',
maxopen = (item.maxOpen == '' || item.maxOpen == undefined) ? '' : 'win-maxopen="' + item.maxOpen + '"', maxopen = isNull(item.maxOpen) ? '' : 'win-maxopen="' + item.maxOpen + '"',
winIcon = (item.icon == '' || item.icon == undefined) ? '' : 'win-icon="' + item.icon + '"', winIcon = isNull(item.icon) ? '' : 'win-icon="' + item.icon + '"',
isParent = item.childs ? ' parent' : '', isParent = item.childs ? ' parent' : '',
menuIconBg = (item.menuIconBg == '' || item.menuIconBg == undefined) ? '' : 'win-menuIconBg="' + item.menuIconBg + '"', menuIconBg = isNull(item.menuIconBg) ? '' : 'win-menuIconBg="' + item.menuIconBg + '"',
menuIconColor = (item.menuIconColor == '' || item.menuIconColor == undefined) ? '' : 'win-menuIconColor="' + item.menuIconColor + '"', menuIconColor = isNull(item.menuIconColor) ? '' : 'win-menuIconColor="' + item.menuIconColor + '"',
menuSysWinUrl = isNull(item.sysWinUrl) ? '' : 'win-sysWinUrl="' + item.sysWinUrl + '"',
menuDeskTopId = 'win-menuDeskTopId="' + item.deskTopId + '"'; menuDeskTopId = 'win-menuDeskTopId="' + item.deskTopId + '"';
var icon = ""; var icon = "";
if(item.menuIconType === '1' || item.menuIconType == 1){//icon if(item.menuIconType === '1' || item.menuIconType == 1){//icon
...@@ -51,7 +52,7 @@ layui.define(['jquery', 'element', 'layer', 'winui'], function (exports) { ...@@ -51,7 +52,7 @@ layui.define(['jquery', 'element', 'layer', 'winui'], function (exports) {
}else{ }else{
var extend = ''; var extend = '';
} }
html += '<li class="layui-nav-item ' + isParent + ' ' + extend + '" ' + id + ' ' + url + ' ' + title + ' ' + opentype + ' ' + maxopen + ' ' + winIcon + ' ' + menuIconBg + ' ' + menuIconColor + ' ' + menuDeskTopId + '>'; html += '<li class="layui-nav-item ' + isParent + ' ' + extend + '" ' + id + ' ' + url + ' ' + title + ' ' + opentype + ' ' + maxopen + ' ' + winIcon + ' ' + menuIconBg + ' ' + menuIconColor + ' ' + menuSysWinUrl + ' ' + menuDeskTopId + '>';
if(!isNull(item.menuIconBg)){ if(!isNull(item.menuIconBg)){
html += '<a><div class="winui-menu-icon" style="background-color: ' + item.menuIconBg + '!important;">'; html += '<a><div class="winui-menu-icon" style="background-color: ' + item.menuIconBg + '!important;">';
}else{ }else{
...@@ -74,6 +75,7 @@ layui.define(['jquery', 'element', 'layer', 'winui'], function (exports) { ...@@ -74,6 +75,7 @@ layui.define(['jquery', 'element', 'layer', 'winui'], function (exports) {
cWinIcon = (cItem.icon == '' || cItem.icon == undefined) ? '' : 'win-icon="' + cItem.icon + '"', cWinIcon = (cItem.icon == '' || cItem.icon == undefined) ? '' : 'win-icon="' + cItem.icon + '"',
cmenuIconBg = (cItem.menuIconBg == '' || cItem.menuIconBg == undefined) ? '' : 'win-menuIconBg="' + cItem.menuIconBg + '"', cmenuIconBg = (cItem.menuIconBg == '' || cItem.menuIconBg == undefined) ? '' : 'win-menuIconBg="' + cItem.menuIconBg + '"',
cmenuIconColor = (cItem.menuIconColor == '' || cItem.menuIconColor == undefined) ? '' : 'win-menuIconColor="' + cItem.menuIconColor + '"', cmenuIconColor = (cItem.menuIconColor == '' || cItem.menuIconColor == undefined) ? '' : 'win-menuIconColor="' + cItem.menuIconColor + '"',
cmenuSysWinUrl = isNull(cItem.sysWinUrl) ? '' : 'win-sysWinUrl="' + cItem.sysWinUrl + '"',
menuDeskTopId = 'win-menuDeskTopId="' + cItem.deskTopId + '"';; menuDeskTopId = 'win-menuDeskTopId="' + cItem.deskTopId + '"';;
var cicon = ""; var cicon = "";
if(cItem.menuIconType === '1' || cItem.menuIconType == 1){//icon if(cItem.menuIconType === '1' || cItem.menuIconType == 1){//icon
...@@ -87,7 +89,7 @@ layui.define(['jquery', 'element', 'layer', 'winui'], function (exports) { ...@@ -87,7 +89,7 @@ layui.define(['jquery', 'element', 'layer', 'winui'], function (exports) {
cicon = '<img src="' + fileBasePath + cItem.menuIconPic + '" />'; cicon = '<img src="' + fileBasePath + cItem.menuIconPic + '" />';
cWinIcon = (cItem.menuIconPic == '' || cItem.menuIconPic == undefined) ? '' : 'win-icon="' + cItem.menuIconPic + '"' cWinIcon = (cItem.menuIconPic == '' || cItem.menuIconPic == undefined) ? '' : 'win-icon="' + cItem.menuIconPic + '"'
} }
html += '<dd ' + cId + ' ' + cUrl + ' ' + cTitle + ' ' + cOpentype + ' ' + cMaxopen + ' ' + cWinIcon + ' ' + cmenuIconBg + ' ' + cmenuIconColor + ' ' + menuDeskTopId + '>'; html += '<dd ' + cId + ' ' + cUrl + ' ' + cTitle + ' ' + cOpentype + ' ' + cMaxopen + ' ' + cWinIcon + ' ' + cmenuIconBg + ' ' + cmenuIconColor + ' ' + cmenuSysWinUrl + ' ' + menuDeskTopId + '>';
if(!isNull(cItem.menuIconBg)){ if(!isNull(cItem.menuIconBg)){
html += '<a><div class="winui-menu-icon" style="background-color: ' + cItem.menuIconBg + '!important;">'; html += '<a><div class="winui-menu-icon" style="background-color: ' + cItem.menuIconBg + '!important;">';
}else{ }else{
......
...@@ -556,7 +556,7 @@ layui.define(['layer', 'winui'], function (exports) { ...@@ -556,7 +556,7 @@ layui.define(['layer', 'winui'], function (exports) {
var winLayer = new WinLayer(); var winLayer = new WinLayer();
//置顶窗口(显示窗口且置于顶层) // 置顶窗口(显示窗口且置于顶层)
winLayer.setTop = function (param) { winLayer.setTop = function (param) {
var windowDom = common.getWindow(param); var windowDom = common.getWindow(param);
if (windowDom) { if (windowDom) {
...@@ -571,7 +571,7 @@ layui.define(['layer', 'winui'], function (exports) { ...@@ -571,7 +571,7 @@ layui.define(['layer', 'winui'], function (exports) {
} }
}; };
//显示信息(为了显示在所有窗口最前面而添加的方法) // 显示信息(为了显示在所有窗口最前面而添加的方法)
winLayer.msg = function (msg, options, func) { winLayer.msg = function (msg, options, func) {
//移除请求遮罩层 //移除请求遮罩层
$("body").find(".mask-req-str").remove(); $("body").find(".mask-req-str").remove();
...@@ -584,7 +584,7 @@ layui.define(['layer', 'winui'], function (exports) { ...@@ -584,7 +584,7 @@ layui.define(['layer', 'winui'], function (exports) {
layer.msg(msg, options, func); layer.msg(msg, options, func);
}; };
//显示提示框(为了显示在所有窗口最前面而添加的方法) // 显示提示框(为了显示在所有窗口最前面而添加的方法)
winLayer.confirm = function (msg, options, yes, cancel) { winLayer.confirm = function (msg, options, yes, cancel) {
var type = typeof options === 'function'; var type = typeof options === 'function';
if (type) { if (type) {
...@@ -598,15 +598,15 @@ layui.define(['layer', 'winui'], function (exports) { ...@@ -598,15 +598,15 @@ layui.define(['layer', 'winui'], function (exports) {
else else
options.skin = 'layer-ext-winconfirm'; options.skin = 'layer-ext-winconfirm';
layer.confirm(msg, options, yes, cancel); layer.confirm(msg, options, yes, cancel);
//替换窗体的关闭图标 // 替换窗体的关闭图标
$('.layer-ext-winconfirm').find('.layui-layer-close').html('<i class="layui-icon">&#x1006;<i>'); $('.layer-ext-winconfirm').find('.layui-layer-close').html('<i class="layui-icon">&#x1006;<i>');
//移除移动窗体的div // 移除移动窗体的div
$('.layui-layer-move').remove(); $('.layui-layer-move').remove();
//移除最小化最大化关闭按钮a标签的href属性 // 移除最小化最大化关闭按钮a标签的href属性
$('.layer-ext-winconfirm').find('.layui-layer-setwin').children('a').removeAttr('href'); $('.layer-ext-winconfirm').find('.layui-layer-setwin').children('a').removeAttr('href');
}; };
//显示加载(为了显示在所有窗口最前面而添加的方法) // 显示加载(为了显示在所有窗口最前面而添加的方法)
winLayer.load = function (icon, options) { winLayer.load = function (icon, options) {
icon = icon || 1; icon = icon || 1;
options = options || {}; options = options || {};
...@@ -614,7 +614,7 @@ layui.define(['layer', 'winui'], function (exports) { ...@@ -614,7 +614,7 @@ layui.define(['layer', 'winui'], function (exports) {
return layer.load(icon, options); return layer.load(icon, options);
}; };
//打开主题设置窗口 // 打开主题设置窗口
winLayer.openTheme = function (loadBottomMenuIcon) { winLayer.openTheme = function (loadBottomMenuIcon) {
var that = this; var that = this;
$.get(winui.path + '../../../tpl/systheme/systheme.html', {}, function (content) { $.get(winui.path + '../../../tpl/systheme/systheme.html', {}, function (content) {
...@@ -631,7 +631,7 @@ layui.define(['layer', 'winui'], function (exports) { ...@@ -631,7 +631,7 @@ layui.define(['layer', 'winui'], function (exports) {
}); });
} }
//打开我的消息通知 // 打开我的消息通知
winLayer.openSysNotice = function (loadBottomMenuIcon) { winLayer.openSysNotice = function (loadBottomMenuIcon) {
var that = this; var that = this;
var title = '<i class="fa title-icon fa-fw fa-list-ul" style="background-color: #0491fe;color: #ecf3f8;"></i>' + '<font class="win-title-class">消息中心</font>'; var title = '<i class="fa title-icon fa-fw fa-list-ul" style="background-color: #0491fe;color: #ecf3f8;"></i>' + '<font class="win-title-class">消息中心</font>';
......
...@@ -1007,6 +1007,7 @@ layui.config({ ...@@ -1007,6 +1007,7 @@ layui.config({
var menuIconBg = $this.attr("win-menuiconbg"); var menuIconBg = $this.attr("win-menuiconbg");
var menuIconColor = $this.attr("win-menuiconcolor"); var menuIconColor = $this.attr("win-menuiconcolor");
var menuIcon = $this.attr("win-icon"); var menuIcon = $this.attr("win-icon");
var menuSysWinUrl = $this.attr("win-sysWinUrl");
var str = '', iconStr = ''; var str = '', iconStr = '';
if(menuIcon.indexOf('fa-') != -1){//icon图标 if(menuIcon.indexOf('fa-') != -1){//icon图标
str = '<i class="fa fa-fw title-icon ';//图标+文字 str = '<i class="fa fa-fw title-icon ';//图标+文字
...@@ -1044,76 +1045,34 @@ layui.config({ ...@@ -1044,76 +1045,34 @@ layui.config({
winui.window.msg('菜单配置错误(菜单链接、标题、id缺一不可)'); winui.window.msg('菜单配置错误(菜单链接、标题、id缺一不可)');
return; return;
} }
if((url.substr(0, 7).toLowerCase() == "http://" url = indexMenu.getUrlPath(url, menuSysWinUrl);
|| url.substr(0, 8).toLowerCase() == "https://")
&& url.indexOf("/tpl/") != -1){
url += '?userToken=' + getCookie("userToken");
}
var content;
if (type === 1) { if (type === 1) {
$.ajax({ // 新窗口打开
type: 'get', window.open(url);
url: url,
async: false,
success: function (data) {
content = data;
},
error: function (e) {
var page = '';
switch (e.status) {
case 404:
page = '404.html';
break;
case 500:
page = '500.html';
break;
default:
content = "打开窗口失败";
}
$.ajax({
type: 'get',
url: reqBasePath + 'tpl/sysmessage/' + page,
async: false,
success: function (data) {
content = data;
},
error: function () {
layer.close(load);
}
});
}
});
} else { } else {
content = url; // 核心方法(参数请看文档,config是全局配置 open是本次窗口配置 open优先级大于config)
} winui.window.config({
//核心方法(参数请看文档,config是全局配置 open是本次窗口配置 open优先级大于config) anim: 0,
winui.window.config({ miniAnim: 0,
anim: 0, maxOpen: -1
miniAnim: 0, }).open({
maxOpen: -1 id: id,
}).open({ type: type,
id: id, title: title,
type: type, content: url,
title: title, loadBgColor: menuIconBg,
content: content, loadIcon: menuIcon,
loadBgColor: menuIconBg, loadIconColor: menuIconColor,
loadIcon: menuIcon, area: ['90vw','90vh'],
loadIconColor: menuIconColor, maxOpen: maxOpen,
area: ['90vw','90vh'], loadBottomMenuIcon: loadBottomMenuIcon,
maxOpen: maxOpen, iconTitle: iconTitle,
loadBottomMenuIcon: loadBottomMenuIcon, refresh: true,
iconTitle: iconTitle, success: function(){
refresh: true, indexMenu.sendMessageToChildIFrame(url, id);
success: function(){ }
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"),"*");
}
}
});
} }
//打开二级窗口 //打开二级窗口
...@@ -1162,19 +1121,11 @@ layui.config({ ...@@ -1162,19 +1121,11 @@ layui.config({
}).on('drop', function (el, container) {//放置 }).on('drop', function (el, container) {//放置
var times = $("#childWindow").parent().attr("times"); var times = $("#childWindow").parent().attr("times");
$("#layui-layer-shade" + times).css({width: '100%'}); $("#layui-layer-shade" + times).css({width: '100%'});
var boxId = $(container).attr("win-id");//盒子id
var drawer = $('#' + boxId).find(".icon-drawer");//盒子icon
var child = $('#' + boxId).find(".icon-child");//盒子child
var thisMenuIcon = $(el).eq(0).attr("win-icon"); var thisMenuIcon = $(el).eq(0).attr("win-icon");
var thisMenuBg = $(el).eq(0).attr("win-menuiconbg"); var thisMenuBg = $(el).eq(0).attr("win-menuiconbg");
var thisMenuIconColor = $(el).eq(0).attr("win-menuIconColor"); var thisMenuIconColor = $(el).eq(0).attr("win-menuIconColor");
var thisMenuId = $(el).eq(0).attr("win-id"); var thisMenuId = $(el).eq(0).attr("win-id");
var thisMenuUrl = $(el).eq(0).attr("win-url");
var thisMenuTitle = $(el).eq(0).attr("win-title");
var thisMenuOpenType = $(el).eq(0).attr("win-opentype");
var thisMenuMaxOpen = $(el).eq(0).attr("win-maxopen");
$('i[win-i-id="' + thisMenuId + '"]').remove(); $('i[win-i-id="' + thisMenuId + '"]').remove();
$('div[class="winui-desktop-item sec-clsss-btn sec-btn"][win-id="' + thisMenuId + '"]').remove(); $('div[class="winui-desktop-item sec-clsss-btn sec-btn"][win-id="' + thisMenuId + '"]').remove();
$(el).removeClass('sec-clsss-btn'); $(el).removeClass('sec-clsss-btn');
...@@ -1238,7 +1189,7 @@ layui.config({ ...@@ -1238,7 +1189,7 @@ layui.config({
}; };
AjaxPostUtil.request({url:reqBasePath + "sysevewindragdrop007", params:params, type:'json', callback:function(json){ AjaxPostUtil.request({url:reqBasePath + "sysevewindragdrop007", params:params, type:'json', callback:function(json){
if(json.returnCode == 0){ if(json.returnCode == 0){
//此处不需要去获取当前滚动展示的模块 // 此处不需要去获取当前滚动展示的模块
$("#winui-desktop").find('div[id="' + rowId + '"]').attr("win-title", menuName); $("#winui-desktop").find('div[id="' + rowId + '"]').attr("win-title", menuName);
$("#winui-desktop").find('div[id="' + rowId + '"]').find('p').html(menuName); $("#winui-desktop").find('div[id="' + rowId + '"]').find('p').html(menuName);
$('#childWindowtext').show(); $('#childWindowtext').show();
...@@ -1256,7 +1207,7 @@ layui.config({ ...@@ -1256,7 +1207,7 @@ layui.config({
} }
}); });
//注销登录 // 注销登录
$('.logout').on('click', function () { $('.logout').on('click', function () {
winui.hideStartMenu(); winui.hideStartMenu();
winui.window.confirm('确认注销吗?', {id: 'exit-confim', icon: 3, title: '提示', skin: 'msg-skin-message', success: function(layero, index){ winui.window.confirm('确认注销吗?', {id: 'exit-confim', icon: 3, title: '提示', skin: 'msg-skin-message', success: function(layero, index){
......
...@@ -208,7 +208,8 @@ ...@@ -208,7 +208,8 @@
<dl class="layui-nav-child"> <dl class="layui-nav-child">
{{#each childs}} {{#each childs}}
<dd> <dd>
<a href="javascript:;" class="page-item-click" data-url="{{pageURL}}" data-id="{{id}}" data-title="{{icon}}{{name}}" data-type="{{menuType}}"> <a href="javascript:;" class="page-item-click" data-url="{{pageURL}}" data-id="{{id}}" data-title="{{icon}}{{name}}" data-type="{{menuType}}"
data-sysWinUrl="{{sysWinUrl}}">
{{{icon}}} {{{icon}}}
<cite>{{name}}</cite> <cite>{{name}}</cite>
</a> </a>
...@@ -223,7 +224,8 @@ ...@@ -223,7 +224,8 @@
<script type="text/x-handlebars-template" id="menuTemplate"> <script type="text/x-handlebars-template" id="menuTemplate">
{{#bean}} {{#bean}}
<li class="layui-nav-item"> <li class="layui-nav-item">
<a href="javascript:;" class="page-item-click" data-url="{{pageURL}}" data-id="{{id}}" data-title="{{icon}}{{name}}" data-type="{{menuType}}"> <a href="javascript:;" class="page-item-click" data-url="{{pageURL}}" data-id="{{id}}" data-title="{{icon}}{{name}}" data-type="{{menuType}}"
data-sysWinUrl="{{sysWinUrl}}">
{{{icon}}} {{{icon}}}
<cite>{{name}}</cite> <cite>{{name}}</cite>
</a> </a>
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册