diff --git a/admin/data/menu.json b/admin/data/menu.json index c22096a..436fdff 100644 --- a/admin/data/menu.json +++ b/admin/data/menu.json @@ -284,7 +284,7 @@ "icon": "layui-icon layui-icon-face-smile", "type": 1, "openType": "_iframe", - "href": "login.html" + "href": "view/common/login.html" }] } ] diff --git a/component/pear/module/admin.js b/component/pear/module/admin.js index 1661ee2..b3303a5 100644 --- a/component/pear/module/admin.js +++ b/component/pear/module/admin.js @@ -16,6 +16,9 @@ layui.define(['table', 'jquery', 'element', 'form', 'tab', 'menu', 'frame'], var pearAdmin = new function() { this.render = function(option) { + + var option = getData(); + this.menuRender(option); this.bodyRender(option); this.keepLoad(option); @@ -32,7 +35,7 @@ layui.define(['table', 'jquery', 'element', 'form', 'tab', 'menu', 'frame'], sideMenu = pearMenu.render({ elem: 'sideMenu', //依赖容器 async: true, //数据形式 - theme: option.theme, + theme: "dark-theme", height: '100%', control: option.control ? 'control' : false, // control defaultMenu: 1, @@ -54,14 +57,14 @@ layui.define(['table', 'jquery', 'element', 'form', 'tab', 'menu', 'frame'], width: '100%', height: '100%', index: 0, - tabMax: 20, + tabMax: option.tabMax, closeEvent: function(id) { sideMenu.selectItem(id); }, data: [{ id: '0', url: option.index, - title: '首页', + title: option.indexTitle, close: false }] //初始化数据 }); @@ -253,6 +256,21 @@ layui.define(['table', 'jquery', 'element', 'form', 'tab', 'menu', 'frame'], } }); } + + /** 同 步 请 求 获 取 数 据 */ + function getData() { + + $.ajaxSettings.async = false; + var data = null; + + $.get("setting.json", function(result) { + data = result; + }); + + $.ajaxSettings.async = true; + return data; + } + exports('admin', pearAdmin); }) diff --git a/index.html b/index.html index 1be16b8..b85203a 100644 --- a/index.html +++ b/index.html @@ -67,19 +67,8 @@ layui.use(['admin', 'document'], function() { var admin = layui.admin; - var config = { - keepLoad: 2000, // 主 页 加 载 过 度 时 长 可为 false - muiltTab: true, // 是 否 开 启 多 标 签 页 true 开启 false 关闭 - control: false, // 是 否 开 启 多 系 统 菜 单 true 开启 false 关闭 - index: 'view/console/console1.html', // 默 认 加 载 主 页 - data: 'admin/data/menu.json', // 菜 单 数 据 加 载 地 址 - select: '0', // 默 认 选 中 菜 单 项 - logoTitle: "Pear Admin", // 网站标题 - logoImage: "admin/images/logo.png" // 网站Logo - }; - - admin.render(config); + admin.render(); }) - + \ No newline at end of file diff --git a/setting.json b/setting.json index e69de29..35022e5 100644 --- a/setting.json +++ b/setting.json @@ -0,0 +1,12 @@ +{ + "keepLoad": 2000, + "muiltTab": true, + "tabMax": 30, + "control": false, + "index": "view/console/console1.html", + "indexTitle": "首页", + "data": "admin/data/menu.json", + "select": "0", + "logoTitle": "Pear Admin", + "logoImage": "admin/images/logo.png" +} diff --git a/login.html b/view/common/login.html similarity index 79% rename from login.html rename to view/common/login.html index e791259..76a63d2 100644 --- a/login.html +++ b/view/common/login.html @@ -3,13 +3,13 @@ - - + + - +
- +
Pear Admin
明 湖 区 最 具 影 响 力 的 设 计 规 范 之 一 @@ -30,7 +30,7 @@
- +