| | |
| | | //add by owen 修复 path 无法引用http://页面的问题 begin |
| | | String.prototype.startWith = function(str) { |
| | | if (str == null || str == "" || this.length == 0 |
| | | || str.length > this.length) |
| | | return false; |
| | | if (this.substr(0, str.length) == str) |
| | | return true; |
| | | else |
| | | return false; |
| | | return true; |
| | | String.prototype.startWith = function (str) { |
| | | if (str == null || str == "" || this.length == 0 |
| | | || str.length > this.length) |
| | | return false; |
| | | if (this.substr(0, str.length) == str) |
| | | return true; |
| | | else |
| | | return false; |
| | | return true; |
| | | } |
| | | |
| | | |
| | |
| | | return; |
| | | } |
| | | if ($parent.hasClass('layui-tab-item')) { |
| | | $parent.css({'padding': '0', 'overflow-y': 'hidden'}); |
| | | $parent.css({ 'padding': '0', 'overflow-y': 'hidden' }); |
| | | } else { |
| | | $parent.css({'width': '100%', 'height': '100%'}); |
| | | $parent.css({ 'width': '100%', 'height': '100%' }); |
| | | } |
| | | } |
| | | //add by owen 修复 path 无法引用http://页面的问题 end |
| | |
| | | var laytpl = layui.laytpl; |
| | | var element = layui.element; |
| | | var form = layui.form; |
| | | |
| | | |
| | | var index = { |
| | | // 渲染左侧菜单栏 |
| | | initLeftNav: function () { |
| | |
| | | //data = data[1]; |
| | | // console.log(data); |
| | | // debugger; |
| | | admin.putTempData("menus",data.data); |
| | | admin.putTempData("menus", data.data); |
| | | var menus = data.data; |
| | | // 判断权限 |
| | | for (var i = menus.length - 1; i >= 0; i--) { |
| | |
| | | window.open(data.path); |
| | | } else { |
| | | //临时保存url |
| | | data.path.startWith("http://") ? admin.putTempData("params",data.path) : null ; |
| | | data.path.startWith("http://") ? admin.putTempData("params", data.path) : null; |
| | | |
| | | var menuId = data.url.substring(2); |
| | | //add by owen 修复 path 无法引用http://页面的问题 |
| | |
| | | var contentDom = '.layui-layout-admin .layui-body'; |
| | | admin.showLoading('.layui-layout-admin .layui-body'); |
| | | var flag; // 选项卡是否添加 |
| | | flag = menuPath.startWith("http://") ? false : flag ; |
| | | flag = menuPath.startWith("http://") ? false : flag; |
| | | // 判断是否开启了选项卡功能 |
| | | if (config.pageTabs) { |
| | | $('.layui-layout-admin .layui-body .layui-tab .layui-tab-title>li').each(function (index) { |
| | |
| | | if (!flag) { |
| | | element.tabAdd('admin-pagetabs', { |
| | | title: menuName, |
| | | //add by owen 修复 path 无法引用http://页面的问题 |
| | | content: menuPath.startWith("http://") ? '<div id="admin-iframe" style="width: 100%; height: 100%;"><iframe id="' + menuId + '" src="' + menuPath + '" marginwidth="0" marginheight="0" width="100%" height="100%" frameborder="0" onload="initIFrame()"></iframe> </div>' : '<div id="' + menuId + '"></div>' , |
| | | //add by owen 修复 path 无法引用http://页面的问题 |
| | | content: menuPath.startWith("http://") ? '<div id="admin-iframe" style="width: 100%; height: 100%;"><iframe id="' + menuId + '" src="' + menuPath + '" marginwidth="0" marginheight="0" width="100%" height="100%" frameborder="0" onload="initIFrame()"></iframe> </div>' : '<div id="' + menuId + '"></div>', |
| | | id: menuId |
| | | }); |
| | | } |
| | |
| | | layer.load(2); |
| | | admin.req('api-user/users/current', {}, function (data) { |
| | | layer.closeAll('loading'); |
| | | // console.log(data.code); |
| | | // debugger; |
| | | // console.log(data); |
| | | if (data && data.code === 0) { |
| | | let user = data.data; |
| | | // console.log(user); |
| | | // debugger; |
| | | config.putUser(user); |
| | | admin.putTempData("permissions",user.permissions); |
| | | admin.putTempData("permissions", user.permissions); |
| | | admin.putTempData("organization",user.organizations[user.organizations.length-1]); |
| | | success(user); |
| | | } else { |
| | | layer.msg('获取用户失败', {icon: 2}); |
| | | config.removeToken(); |
| | | location.replace('login.html'); |
| | | if (data.code === 1000) { |
| | | layer.msg(data.msg, { icon: 2, time: 4 * 1000 }, function () { |
| | | //回调 |
| | | config.removeToken(); |
| | | location.replace('login.html'); |
| | | }) |
| | | |
| | | } else { |
| | | layer.msg('获取用户失败,请联系管理员', { icon: 2, time: 4 * 1000 }, function () { |
| | | //回调 |
| | | config.removeToken(); |
| | | location.replace('login.html'); |
| | | }) |
| | | } |
| | | |
| | | |
| | | |
| | | } |
| | | }, 'GET'); |
| | | }, |
| | | //获取菜单 |
| | | getMenus: function () { |
| | | admin.req('api-user/menus/current', {}, function (data) { |
| | | admin.putTempData("menus",data); |
| | | admin.putTempData("menus", data); |
| | | }, 'GET'); |
| | | }, |
| | | // 页面元素绑定事件监听 |
| | |
| | | layer.confirm('确定退出登录?', function () { |
| | | //通过认证中心 tuic |
| | | admin.req('api-uaa/oauth/remove/token', {}, function (data) { |
| | | config.removeToken(); |
| | | location.replace('login.html'); |
| | | config.removeToken(); |
| | | location.replace('login.html'); |
| | | }, 'POST'); |
| | | }); |
| | | }); |