1
0
mirror of https://github.com/chillzhuang/Sword synced 2024-11-24 11:19:26 +08:00

优化代码

This commit is contained in:
smallchill 2019-02-21 14:25:52 +08:00
parent 633669b2dc
commit 39baec4b69
5 changed files with 98 additions and 44 deletions

101
README.md
View File

@ -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界面一览
<table>
<tr>
<td><img src="https://raw.githubusercontent.com/chillzhuang/blade-tool/master/pic/springblade-k8s.png"/></td>
<td><img src="https://raw.githubusercontent.com/chillzhuang/blade-tool/master/pic/springblade-harbor.png"/></td>
<td><img src="https://gitee.com/smallc/SpringBlade/raw/master/pic/sword-main.png"/></td>
<td><img src="https://gitee.com/smallc/SpringBlade/raw/master/pic/sword-menu.png"/></td>
</tr>
<tr>
<td><img src="https://raw.githubusercontent.com/chillzhuang/blade-tool/master/pic/springblade-traefik.png"/></td>
<td><img src="https://raw.githubusercontent.com/chillzhuang/blade-tool/master/pic/springblade-traefik-health.png"/></td>
<td><img src="https://gitee.com/smallc/SpringBlade/raw/master/pic/sword-menu-edit.png"/></td>
<td><img src="https://gitee.com/smallc/SpringBlade/raw/master/pic/sword-menu-icon.png"/></td>
</tr>
<tr>
<td><img src="https://raw.githubusercontent.com/chillzhuang/blade-tool/master/pic/springblade-consul.png"/></td>
<td><img src="https://raw.githubusercontent.com/chillzhuang/blade-tool/master/pic/springblade-consul-nodes1.png"/></td>
<td><img src="https://gitee.com/smallc/SpringBlade/raw/master/pic/sword-role.png"/></td>
<td><img src="https://gitee.com/smallc/SpringBlade/raw/master/pic/sword-user.png"/></td>
</tr>
<tr>
<td><img src="https://raw.githubusercontent.com/chillzhuang/blade-tool/master/pic/springblade-admin1.png"/></td>
<td><img src="https://raw.githubusercontent.com/chillzhuang/blade-tool/master/pic/springblade-admin2.png"/></td>
<td><img src="https://gitee.com/smallc/SpringBlade/raw/master/pic/sword-dict.png "/></td>
<td><img src="https://gitee.com/smallc/SpringBlade/raw/master/pic/sword-log.png"/></td>
</tr>
<tr>
<td><img src="https://raw.githubusercontent.com/chillzhuang/blade-tool/master/pic/springblade-swagger1.png"/></td>
<td><img src="https://raw.githubusercontent.com/chillzhuang/blade-tool/master/pic/springblade-swagger2.png"/></td>
</tr>
<tr>
<td><img src="https://raw.githubusercontent.com/chillzhuang/blade-tool/master/pic/sword-main.png"/></td>
<td><img src="https://raw.githubusercontent.com/chillzhuang/blade-tool/master/pic/sword-menu.png"/></td>
</tr>
<tr>
<td><img src="https://raw.githubusercontent.com/chillzhuang/blade-tool/master/pic/sword-menu-edit.png"/></td>
<td><img src="https://raw.githubusercontent.com/chillzhuang/blade-tool/master/pic/sword-menu-icon.png"/></td>
</tr>
<tr>
<td><img src="https://raw.githubusercontent.com/chillzhuang/blade-tool/master/pic/sword-role.png"/></td>
<td><img src="https://raw.githubusercontent.com/chillzhuang/blade-tool/master/pic/sword-user.png"/></td>
</tr>
<tr>
<td><img src="https://raw.githubusercontent.com/chillzhuang/blade-tool/master/pic/sword-dict.png "/></td>
<td><img src="https://raw.githubusercontent.com/chillzhuang/blade-tool/master/pic/sword-log.png"/></td>
</tr>
<tr>
<td><img src="https://raw.githubusercontent.com/chillzhuang/blade-tool/master/pic/sword-locale-cn.png"/></td>
<td><img src="https://raw.githubusercontent.com/chillzhuang/blade-tool/master/pic/sword-locale-us.png"/></td>
<td><img src="https://gitee.com/smallc/SpringBlade/raw/master/pic/sword-locale-cn.png"/></td>
<td><img src="https://gitee.com/smallc/SpringBlade/raw/master/pic/sword-locale-us.png"/></td>
</tr>
</table>
## 监控界面一览
<table>
<tr>
<td><img src="https://gitee.com/smallc/SpringBlade/raw/master/pic/springblade-k8s1.png"/></td>
<td><img src="https://gitee.com/smallc/SpringBlade/raw/master/pic/springblade-k8s2.png"/></td>
</tr>
<tr>
<td><img src="https://gitee.com/smallc/SpringBlade/raw/master/pic/springblade-grafana.png"/></td>
<td><img src="https://gitee.com/smallc/SpringBlade/raw/master/pic/springblade-harbor.png"/></td>
</tr>
<tr>
<td><img src="https://gitee.com/smallc/SpringBlade/raw/master/pic/springblade-traefik.png"/></td>
<td><img src="https://gitee.com/smallc/SpringBlade/raw/master/pic/springblade-traefik-health.png"/></td>
</tr>
<tr>
<td><img src="https://gitee.com/smallc/SpringBlade/raw/master/pic/springblade-nacos.png"/></td>
<td><img src="https://gitee.com/smallc/SpringBlade/raw/master/pic/springblade-sentinel.png"/></td>
</tr>
<tr>
<td><img src="https://gitee.com/smallc/SpringBlade/raw/master/pic/springblade-admin1.png"/></td>
<td><img src="https://gitee.com/smallc/SpringBlade/raw/master/pic/springblade-admin2.png"/></td>
</tr>
<tr>
<td><img src="https://gitee.com/smallc/SpringBlade/raw/master/pic/springblade-swagger1.png"/></td>
<td><img src="https://gitee.com/smallc/SpringBlade/raw/master/pic/springblade-swagger2.png"/></td>
</tr>
</table>
## Saber界面一览
<table>
<tr>
<td><img src="https://gitee.com/smallc/SpringBlade/raw/master/pic/saber-user.png"/></td>
<td><img src="https://gitee.com/smallc/SpringBlade/raw/master/pic/saber-role.png"/></td>
</tr>
<tr>
<td><img src="https://gitee.com/smallc/SpringBlade/raw/master/pic/saber-dict.png"/></td>
<td><img src="https://gitee.com/smallc/SpringBlade/raw/master/pic/saber-dict-select.png"/></td>
</tr>
<tr>
<td><img src="https://gitee.com/smallc/SpringBlade/raw/master/pic/saber-log.png"/></td>
<td><img src="https://gitee.com/smallc/SpringBlade/raw/master/pic/saber-code.png"/></td>
</tr>
</table>

View File

@ -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: '代码生成',
},
],
},

View File

@ -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",

View File

@ -25,15 +25,17 @@ function ergodicRoutes(routes, authKey, authority) {
}
export function patchRoutes(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();

View File

@ -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));