From 39baec4b69a79a29efe8a3963b0e8f5d08f75f2d Mon Sep 17 00:00:00 2001 From: smallchill Date: Thu, 21 Feb 2019 14:25:52 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 101 ++++++++++++++++++++++++++++------------- mock/menu.js | 18 ++++++++ package.json | 3 -- src/app.js | 12 +++-- src/utils/authority.js | 8 ++-- 5 files changed, 98 insertions(+), 44 deletions(-) diff --git a/README.md b/README.md index 9656ce8..1bbb96a 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,20 @@ ## 简介 Sword 是 [SpringBlade](https://gitee.com/smallc/SpringBlade)前端UI项目,基于react 、ant design、dva,用于快速构建系统中后台业务。 +## 官网 +* 官网地址:[https://bladex.vip](https://bladex.vip) + ## 在线演示 -演示地址:[http://sword.bladex.vip](http://sword.bladex.vip) +* Sword演示地址:[https://sword.bladex.vip](https://sword.bladex.vip) +* Saber演示地址:[https://saber.avue.top](https://saber.avue.top) + +## 后端项目地址 +* [Gitee地址](https://gitee.com/smallc/SpringBlade) +* [Github地址](https://github.com/chillzhuang/SpringBlade) + +## 前端项目地址 +* [Sword--基于React](https://gitee.com/smallc/Sword) +* [Saber--基于Vue](https://gitee.com/smallc/Saber) ## 特性 @@ -47,46 +59,71 @@ $ npm run start:no-mock # 访问 http://localhost:88 ``` -# 界面一览 +# 界面 +## Sword界面一览 - - + + - - + + - - + + - - + + - - - - - - - - - - - - - - - - - - - - - - + + + +
+ +## 监控界面一览 + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +## Saber界面一览 + + + + + + + + + + + +
diff --git a/mock/menu.js b/mock/menu.js index b547698..8478fb5 100644 --- a/mock/menu.js +++ b/mock/menu.js @@ -8,75 +8,91 @@ function getFakeRoutes(req, res) { { path: '/desk', code: 'desk', + name: '工作台', source: 'desktop', children: [ { path: '/desk/notice', code: 'notice', + name: '通知公告', }, ], }, { path: '/system', code: 'system', + name: '系统管理', source: 'setting', children: [ { path: '/system/user', code: 'user', + name: '用户管理', }, { path: '/system/dept', code: 'dept', + name: '部门管理', }, { path: '/system/dict', code: 'dict', + name: '字典管理', }, { path: '/system/menu', code: 'menu', + name: '菜单管理', }, { path: '/system/role', code: 'role', + name: '角色管理', }, { path: '/system/param', code: 'param', + name: '参数管理', }, ], }, { path: '/monitor', code: 'monitor', + name: '系统监控', source: 'fund', children: [ { path: 'http://localhost/doc.html', target: '_blank', code: 'doc', + name: '接口文档', }, { path: 'http://localhost:7002', target: '_blank', code: 'admin', + name: '服务治理', }, { path: '/monitor/log', code: 'log', + name: '日志管理', children: [ { path: '/monitor/log/usual', code: 'log_usual', + name: '通用日志', }, { path: '/monitor/log/api', code: 'log_api', + name: '接口日志', }, { path: '/monitor/log/error', code: 'log_error', + name: '错误日志', }, ], }, @@ -85,11 +101,13 @@ function getFakeRoutes(req, res) { { path: '/tool', code: 'tool', + name: '在线开发', source: 'tool', children: [ { path: '/tool/code', code: 'code', + name: '代码生成', }, ], }, diff --git a/package.json b/package.json index 44f2f3a..c8519b8 100644 --- a/package.json +++ b/package.json @@ -99,9 +99,6 @@ "umi-plugin-ga": "^1.1.3", "umi-plugin-react": "^1.4.2" }, - "optionalDependencies": { - "puppeteer": "^1.12.1" - }, "lint-staged": { "**/*.{js,ts,tsx,json,jsx,less}": [ "node ./scripts/lint-prettier.js", diff --git a/src/app.js b/src/app.js index 248a2ee..5507a4a 100644 --- a/src/app.js +++ b/src/app.js @@ -25,15 +25,17 @@ function ergodicRoutes(routes, authKey, authority) { } export function patchRoutes(routes) { - Object.keys(authRoutes).map(authKey => - ergodicRoutes(routes, authKey, authRoutes[authKey].authority) - ); - window.g_routes = routes; + if (authRoutes !== null && authRoutes !== undefined) { + Object.keys(authRoutes).map(authKey => + ergodicRoutes(routes, authKey, authRoutes[authKey].authority) + ); + window.g_routes = routes; + } } export function render(oldRender) { routesAuthority().then(response => { - if (response) { + if (response && response.success) { authRoutes = response.data; } oldRender(); diff --git a/src/utils/authority.js b/src/utils/authority.js index 9996f57..fee394c 100644 --- a/src/utils/authority.js +++ b/src/utils/authority.js @@ -38,6 +38,10 @@ export function setRoutes(routes) { localStorage.setItem('sword-routes', JSON.stringify(routes)); } +export function getButtons() { + return JSON.parse(localStorage.getItem('sword-buttons')) || []; +} + export function getButton(code) { const buttons = getButtons(); const data = buttons.filter(d => { @@ -46,10 +50,6 @@ export function getButton(code) { return data.length === 0 ? [] : data[0].buttons; } -export function getButtons() { - return JSON.parse(localStorage.getItem('sword-buttons')) || []; -} - export function setButtons(buttons) { localStorage.removeItem('sword-buttons'); localStorage.setItem('sword-buttons', JSON.stringify(buttons));