@jiangood/springboot-admin-starter 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/config/config.js +10 -0
- package/config/config.local.js +10 -0
- package/config/defaultConfig.js +35 -0
- package/config/plugins/forms.js +44 -0
- package/config/plugins/routes.js +82 -0
- package/package.json +41 -0
- package/src/.npmignore +6 -0
- package/src/app.js +0 -0
- package/src/asserts/login_bg.jpg +0 -0
- package/src/asserts/welcome.png +0 -0
- package/src/components/InstanceInfo.jsx +138 -0
- package/src/components/InstanceStatusInfo.jsx +79 -0
- package/src/components/StreamLog.jsx +27 -0
- package/src/components/flow/BpmnUtils.js +85 -0
- package/src/components/flow/customTranslate/customTranslate.js +19 -0
- package/src/components/flow/customTranslate/translations.js +79 -0
- package/src/components/flow/design/contextPad.js +50 -0
- package/src/components/flow/design/form/ConditionForm.jsx +316 -0
- package/src/components/flow/design/form/ServiceTaskForm.jsx +55 -0
- package/src/components/flow/design/form/TimerEventDefinitionForm.jsx +62 -0
- package/src/components/flow/design/form/UserTaskForm.jsx +211 -0
- package/src/components/flow/design/palette.js +39 -0
- package/src/components/monitor/AllDefinition.jsx +46 -0
- package/src/components/monitor/AllInstance.jsx +76 -0
- package/src/forms/demoForm.jsx +16 -0
- package/src/framework/components/ButtonList.d.ts +9 -0
- package/src/framework/components/ButtonList.jsx +91 -0
- package/src/framework/components/DownloadFileButton.d.ts +11 -0
- package/src/framework/components/DownloadFileButton.jsx +33 -0
- package/src/framework/components/Echarts/index.d.ts +10 -0
- package/src/framework/components/Echarts/index.jsx +49 -0
- package/src/framework/components/EditTable/index.d.ts +11 -0
- package/src/framework/components/EditTable/index.jsx +85 -0
- package/src/framework/components/EditTable/index.less +29 -0
- package/src/framework/components/Ellipsis.jsx +39 -0
- package/src/framework/components/Ellipsis.less +8 -0
- package/src/framework/components/FieldRemoteTree.jsx +20 -0
- package/src/framework/components/Gap/index.d.ts +10 -0
- package/src/framework/components/Gap/index.jsx +15 -0
- package/src/framework/components/Gap/index.less +3 -0
- package/src/framework/components/HasPerm.jsx +18 -0
- package/src/framework/components/ImageView.d.ts +12 -0
- package/src/framework/components/ImageView.jsx +64 -0
- package/src/framework/components/LinkButton.d.ts +14 -0
- package/src/framework/components/LinkButton.jsx +13 -0
- package/src/framework/components/MsgBox.jsx +180 -0
- package/src/framework/components/NamedIcon.tsx +15 -0
- package/src/framework/components/OrgTree.jsx +60 -0
- package/src/framework/components/Page/index.d.ts +10 -0
- package/src/framework/components/Page/index.jsx +30 -0
- package/src/framework/components/Page/index.less +10 -0
- package/src/framework/components/PageLoading.jsx +31 -0
- package/src/framework/components/Panel/index.d.ts +11 -0
- package/src/framework/components/Panel/index.jsx +24 -0
- package/src/framework/components/Panel/index.less +0 -0
- package/src/framework/components/ProModal/index.tsx +66 -0
- package/src/framework/components/ProTable/components/ToolBar/index.jsx +124 -0
- package/src/framework/components/ProTable/components/ToolBar/index.less +53 -0
- package/src/framework/components/ProTable/index.d.ts +38 -0
- package/src/framework/components/ProTable/index.jsx +258 -0
- package/src/framework/components/ProTable/index.less +3 -0
- package/src/framework/components/ProTable/utils/index.js +43 -0
- package/src/framework/components/RoleTree.jsx +53 -0
- package/src/framework/components/ValueType/index.jsx +34 -0
- package/src/framework/components/ValueType/registry.jsx +38 -0
- package/src/framework/components/field/FieldAutoTime/index.tsx +46 -0
- package/src/framework/components/field/FieldBoolean/index.tsx +92 -0
- package/src/framework/components/field/FieldEditTable/index.d.ts +13 -0
- package/src/framework/components/field/FieldEditTable/index.jsx +103 -0
- package/src/framework/components/field/FieldEditTable/index.less +29 -0
- package/src/framework/components/field/FieldEditor.jsx +48 -0
- package/src/framework/components/field/FieldFileBase64/index.d.ts +15 -0
- package/src/framework/components/field/FieldFileBase64/index.jsx +23 -0
- package/src/framework/components/field/FieldImageBase64/index.d.ts +15 -0
- package/src/framework/components/field/FieldImageBase64/index.jsx +22 -0
- package/src/framework/components/field/FieldInput.jsx +13 -0
- package/src/framework/components/field/FieldOrgTree/index.tsx +45 -0
- package/src/framework/components/field/FieldPassword.jsx +11 -0
- package/src/framework/components/field/FieldProps.ts +19 -0
- package/src/framework/components/field/FieldRemoteTreeCascader.jsx +75 -0
- package/src/framework/components/field/FieldRemoteTreeCheckable.jsx +81 -0
- package/src/framework/components/field/FieldRemoteTreeMultipleSelect.jsx +100 -0
- package/src/framework/components/field/FieldRemoteTreeSelect.jsx +82 -0
- package/src/framework/components/field/FieldSelectPosition/index.tsx +85 -0
- package/src/framework/components/field/FieldTree.jsx +45 -0
- package/src/framework/components/field/dict/index.tsx +110 -0
- package/src/framework/components/field/flat-multiple-select/index.d.ts +4 -0
- package/src/framework/components/field/flat-multiple-select/index.jsx +116 -0
- package/src/framework/components/field/flat-multiple-select/index.less +12 -0
- package/src/framework/components/field/flat-select/index.d.ts +4 -0
- package/src/framework/components/field/flat-select/index.jsx +107 -0
- package/src/framework/components/field/flat-select/index.less +12 -0
- package/src/framework/components/field/index.js +33 -0
- package/src/framework/components/field/input-number-percent/index.d.ts +11 -0
- package/src/framework/components/field/input-number-percent/index.jsx +28 -0
- package/src/framework/components/field/select/FieldSelect/index.d.ts +39 -0
- package/src/framework/components/field/select/FieldSelect/index.jsx +156 -0
- package/src/framework/components/field/select/FieldTableSelect/index.d.ts +29 -0
- package/src/framework/components/field/select/FieldTableSelect/index.jsx +155 -0
- package/src/framework/components/field/select/index.jsx +2 -0
- package/src/framework/components/field/switch-y-n/index.d.ts +11 -0
- package/src/framework/components/field/switch-y-n/index.jsx +31 -0
- package/src/framework/components/field/text/index.tsx +7 -0
- package/src/framework/components/field/time/DatePickerString.tsx +37 -0
- package/src/framework/components/field/time/DateTimePickerString.tsx +42 -0
- package/src/framework/components/field/time/FieldDateRange.d.ts +9 -0
- package/src/framework/components/field/time/FieldDateRange.jsx +49 -0
- package/src/framework/components/field/time/HHmmPickerString.tsx +42 -0
- package/src/framework/components/field/time/MonthPickerString.tsx +45 -0
- package/src/framework/components/field/time/TimePickerTool.ts +14 -0
- package/src/framework/components/field/time/YearPickerString.tsx +41 -0
- package/src/framework/components/field/time/YearQuarterString.tsx +38 -0
- package/src/framework/components/field/time/index.tsx +7 -0
- package/src/framework/components/field/upload/FieldUploadCropImage/index.d.ts +22 -0
- package/src/framework/components/field/upload/FieldUploadCropImage/index.jsx +11 -0
- package/src/framework/components/field/upload/FieldUploadFile.d.ts +35 -0
- package/src/framework/components/field/upload/FieldUploadFile.jsx +145 -0
- package/src/framework/components/field/upload/FieldUploadImage.d.ts +7 -0
- package/src/framework/components/field/upload/FieldUploadImage.jsx +16 -0
- package/src/framework/components/field/upload/index.jsx +3 -0
- package/src/framework/components/index.js +25 -0
- package/src/framework/components/system.jsx +29 -0
- package/src/framework/components/view/ViewBoolean.jsx +15 -0
- package/src/framework/components/view/ViewBooleanEnableDisable.jsx +16 -0
- package/src/framework/components/view/ViewEllipsis.d.ts +11 -0
- package/src/framework/components/view/ViewEllipsis.jsx +30 -0
- package/src/framework/components/view/ViewFile.d.ts +10 -0
- package/src/framework/components/view/ViewFile.jsx +50 -0
- package/src/framework/components/view/ViewFileButton.d.ts +10 -0
- package/src/framework/components/view/ViewFileButton.jsx +0 -0
- package/src/framework/components/view/ViewImage.d.ts +9 -0
- package/src/framework/components/view/ViewImage.jsx +61 -0
- package/src/framework/components/view/ViewPassword.jsx +24 -0
- package/src/framework/components/view/ViewRange/index.d.ts +16 -0
- package/src/framework/components/view/ViewRange/index.jsx +20 -0
- package/src/framework/components/view/ViewText.jsx +9 -0
- package/src/framework/components/view/index.js +12 -0
- package/src/framework/index.js +3 -0
- package/src/framework/system/FormRegistry.js +58 -0
- package/src/framework/system/dict.js +88 -0
- package/src/framework/system/http.jsx +290 -0
- package/src/framework/system/index.js +13 -0
- package/src/framework/system/page.js +109 -0
- package/src/framework/system/permission.js +44 -0
- package/src/framework/system/sys.js +60 -0
- package/src/framework/system/theme.js +17 -0
- package/src/framework/utils/arr.js +118 -0
- package/src/framework/utils/browser.js +24 -0
- package/src/framework/utils/color.js +269 -0
- package/src/framework/utils/date.js +173 -0
- package/src/framework/utils/debounce.js +33 -0
- package/src/framework/utils/dom.js +16 -0
- package/src/framework/utils/eventBus.js +70 -0
- package/src/framework/utils/html.js +13 -0
- package/src/framework/utils/index.js +17 -0
- package/src/framework/utils/obj.js +72 -0
- package/src/framework/utils/storage.js +37 -0
- package/src/framework/utils/str.js +297 -0
- package/src/framework/utils/tree.js +175 -0
- package/src/framework/utils/uid.js +76 -0
- package/src/framework/utils/url.js +84 -0
- package/src/framework/utils/validate.js +9 -0
- package/src/index.js +2 -0
- package/src/layouts/PageRender.d.ts +22 -0
- package/src/layouts/PageRender.jsx +90 -0
- package/src/layouts/admin/HeaderRight.jsx +104 -0
- package/src/layouts/admin/TabPageRender.jsx +158 -0
- package/src/layouts/admin/index.jsx +174 -0
- package/src/layouts/admin/index.less +64 -0
- package/src/layouts/index.jsx +163 -0
- package/src/layouts/index.less +45 -0
- package/src/loading.jsx +18 -0
- package/src/pages/404.jsx +13 -0
- package/src/pages/about.jsx +14 -0
- package/src/pages/api/accessLog/index.jsx +108 -0
- package/src/pages/api/accountResource/index.jsx +149 -0
- package/src/pages/api/doc.jsx +135 -0
- package/src/pages/api/index.jsx +163 -0
- package/src/pages/api/resource.jsx +18 -0
- package/src/pages/flowable/design/index.css +7 -0
- package/src/pages/flowable/design/index.jsx +297 -0
- package/src/pages/flowable/index.jsx +128 -0
- package/src/pages/flowable/instance/view.jsx +13 -0
- package/src/pages/flowable/monitor.jsx +106 -0
- package/src/pages/flowable/task/form.jsx +99 -0
- package/src/pages/flowable/task/index.jsx +200 -0
- package/src/pages/flowable/test/form.jsx +31 -0
- package/src/pages/flowable/test/index.jsx +54 -0
- package/src/pages/index.jsx +25 -0
- package/src/pages/job/index.jsx +239 -0
- package/src/pages/job/logList.jsx +100 -0
- package/src/pages/job/status.jsx +84 -0
- package/src/pages/login.jsx +144 -0
- package/src/pages/login.less +53 -0
- package/src/pages/system/config/index.jsx +136 -0
- package/src/pages/system/dict/Dict.jsx +73 -0
- package/src/pages/system/dict/DictItem.jsx +177 -0
- package/src/pages/system/dict/index.jsx +25 -0
- package/src/pages/system/file/index.jsx +152 -0
- package/src/pages/system/log/index.jsx +78 -0
- package/src/pages/system/org/index.jsx +263 -0
- package/src/pages/system/role/index.jsx +314 -0
- package/src/pages/system/role/perm.jsx +111 -0
- package/src/pages/system/sysManual/index.jsx +127 -0
- package/src/pages/system/user/UserPerm.jsx +132 -0
- package/src/pages/system/user/index.jsx +261 -0
- package/src/pages/test.jsx +16 -0
- package/src/pages/ureport/index.jsx +43 -0
- package/src/pages/userCenter/ChangePassword.jsx +64 -0
- package/src/pages/userCenter/index.jsx +90 -0
- package/src/pages/userCenter/manual.jsx +63 -0
- package/src/pages/userCenter/message.jsx +105 -0
- package/src/style/global.less +51 -0
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
// 全局路由
|
|
2
|
+
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import {Badge, Layout, Menu, Watermark} from 'antd';
|
|
5
|
+
|
|
6
|
+
import {history, Link} from 'umi';
|
|
7
|
+
import "./index.less"
|
|
8
|
+
import {MenuFoldOutlined, MenuUnfoldOutlined} from '@ant-design/icons';
|
|
9
|
+
import {HttpUtil, isMobileDevice, NamedIcon, PageUtil, SysUtil, theme, TreeUtil} from "../../framework";
|
|
10
|
+
|
|
11
|
+
import HeaderRight from "./HeaderRight";
|
|
12
|
+
import TabPageRender from "./TabPageRender";
|
|
13
|
+
|
|
14
|
+
const {Header, Footer, Sider, Content} = Layout;
|
|
15
|
+
/**
|
|
16
|
+
* 带菜单的布局,主要处理布局宇框架结构
|
|
17
|
+
*/
|
|
18
|
+
export default class extends React.Component {
|
|
19
|
+
|
|
20
|
+
state = {
|
|
21
|
+
loginInfo: {},
|
|
22
|
+
|
|
23
|
+
menuTree: [],
|
|
24
|
+
pathMenuMap: {},
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
currentMenuKey: null,
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
collapsed: false,
|
|
31
|
+
siteInfo: {},
|
|
32
|
+
isMobileDevice: false,
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
tabPageRenderRef = React.createRef()
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
componentDidMount() {
|
|
39
|
+
console.log('Admin Layout didMount')
|
|
40
|
+
// 判断是否手机端,自动收起菜单
|
|
41
|
+
if (isMobileDevice()) {
|
|
42
|
+
this.setState({collapsed: true, isMobileDevice: true})
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
let siteInfo = SysUtil.getSiteInfo();
|
|
46
|
+
const loginInfo = SysUtil.getLoginInfo()
|
|
47
|
+
this.setState({siteInfo,loginInfo})
|
|
48
|
+
|
|
49
|
+
this.initMenu()
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
initMenu = () => {
|
|
54
|
+
HttpUtil.get('admin/menuInfo').then(info => {
|
|
55
|
+
const {menuTree, pathMenuMap, menuMap} = info
|
|
56
|
+
|
|
57
|
+
let pathname = PageUtil.currentPathname();
|
|
58
|
+
|
|
59
|
+
TreeUtil.walk(menuTree, (item) => {
|
|
60
|
+
item.icon = <NamedIcon name={item.icon || 'AppstoreOutlined'} style={{fontSize: 12}}/>
|
|
61
|
+
})
|
|
62
|
+
|
|
63
|
+
if (pathname !== "" && pathname !== "/") {
|
|
64
|
+
let menu = pathMenuMap[pathname]
|
|
65
|
+
if(menu){
|
|
66
|
+
this.setState({currentMenuKey: menu.key})
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
this.setState({menuTree,pathMenuMap})
|
|
71
|
+
|
|
72
|
+
this.loadBadge(menuMap)
|
|
73
|
+
})
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
}
|
|
77
|
+
actionRef = React.createRef()
|
|
78
|
+
|
|
79
|
+
toggleCollapsed = (v) => {
|
|
80
|
+
this.setState({collapsed: v})
|
|
81
|
+
}
|
|
82
|
+
loadBadge = menuMap => {
|
|
83
|
+
for (let id in menuMap) {
|
|
84
|
+
const item = menuMap[id]
|
|
85
|
+
const {messageCountUrl} = item;
|
|
86
|
+
if(!messageCountUrl){
|
|
87
|
+
continue
|
|
88
|
+
}
|
|
89
|
+
HttpUtil.get(messageCountUrl).then(rs => {
|
|
90
|
+
const {menuTree} = this.state
|
|
91
|
+
const menu = TreeUtil.findByKey(id, menuTree,'key')
|
|
92
|
+
if (menu) {
|
|
93
|
+
menu.icon = <Badge dot count={rs} size={"small"}>{menu.icon}</Badge>
|
|
94
|
+
this.setState({menuTree: [...menuTree]})
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
})
|
|
98
|
+
}
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
render() {
|
|
105
|
+
const {siteInfo, loginInfo} = this.state
|
|
106
|
+
|
|
107
|
+
return <Layout className='main-layout'>
|
|
108
|
+
<Header className='header'>
|
|
109
|
+
<div className='header-left'>
|
|
110
|
+
|
|
111
|
+
<img className='logo-img' src={siteInfo.logoUrl} onClick={() => history.push('/')} alt='logo'/>
|
|
112
|
+
<h3 className='hide-on-mobile'>
|
|
113
|
+
<Link to="/" style={{color: theme["primary-color"]}}>{siteInfo.title} </Link>
|
|
114
|
+
</h3>
|
|
115
|
+
|
|
116
|
+
</div>
|
|
117
|
+
<HeaderRight/>
|
|
118
|
+
</Header>
|
|
119
|
+
|
|
120
|
+
<Layout style={{height: '100%'}}>
|
|
121
|
+
<Sider id='left-sider'
|
|
122
|
+
collapsible
|
|
123
|
+
collapsed={this.state.collapsed}
|
|
124
|
+
onCollapse={(value) => this.toggleCollapsed(value)}
|
|
125
|
+
trigger={null}>
|
|
126
|
+
|
|
127
|
+
<div style={{
|
|
128
|
+
color: 'white', fontSize: 16, cursor: "pointer", margin: 12
|
|
129
|
+
}} title='收起/展开' onClick={() => this.toggleCollapsed(!this.state.collapsed)}>
|
|
130
|
+
{this.state.collapsed ? <MenuUnfoldOutlined/> : <MenuFoldOutlined/>}
|
|
131
|
+
</div>
|
|
132
|
+
|
|
133
|
+
<Menu items={this.state.menuTree}
|
|
134
|
+
theme='dark'
|
|
135
|
+
mode="inline"
|
|
136
|
+
className='left-menu'
|
|
137
|
+
onClick={({key, item}) => {
|
|
138
|
+
let {path, id} = item.props;
|
|
139
|
+
this.setState({currentMenuKey: id})
|
|
140
|
+
history.push(path)
|
|
141
|
+
}}
|
|
142
|
+
selectedKeys={[this.state.currentMenuKey]}
|
|
143
|
+
inlineIndent={16}
|
|
144
|
+
>
|
|
145
|
+
</Menu>
|
|
146
|
+
|
|
147
|
+
</Sider>
|
|
148
|
+
|
|
149
|
+
<Content id='admin-layout-content'>
|
|
150
|
+
{this.getContent(loginInfo)}
|
|
151
|
+
</Content>
|
|
152
|
+
|
|
153
|
+
</Layout>
|
|
154
|
+
</Layout>
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
|
|
158
|
+
getContent = () => {
|
|
159
|
+
const {siteInfo, loginInfo} = this.state
|
|
160
|
+
if (this.state.menuTree.length === 0) { // 加载菜单中
|
|
161
|
+
return <></>
|
|
162
|
+
}
|
|
163
|
+
let tabPageRenderNode = <TabPageRender ref={this.tabPageRenderRef} pathMenuMap={this.state.pathMenuMap}/>;
|
|
164
|
+
if (siteInfo.waterMark === true) {
|
|
165
|
+
return <Watermark content={[loginInfo.name, loginInfo.account]}>
|
|
166
|
+
{tabPageRenderNode}
|
|
167
|
+
</Watermark>
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
return tabPageRenderNode
|
|
171
|
+
};
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
.main-layout {
|
|
2
|
+
min-height: 100vh;
|
|
3
|
+
.header {
|
|
4
|
+
padding: 0 20px;
|
|
5
|
+
height: 48px;
|
|
6
|
+
display: flex;
|
|
7
|
+
justify-content: space-between;
|
|
8
|
+
align-items: center;
|
|
9
|
+
border-bottom: 1px solid rgb(233, 237, 240);
|
|
10
|
+
background-color: rgb(246, 248, 250);
|
|
11
|
+
|
|
12
|
+
.header-left {
|
|
13
|
+
display: flex;
|
|
14
|
+
align-items: center;
|
|
15
|
+
gap: 8px;
|
|
16
|
+
|
|
17
|
+
.logo-img {
|
|
18
|
+
height: 38px;
|
|
19
|
+
cursor: pointer;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.header-right {
|
|
24
|
+
line-height: 36px;
|
|
25
|
+
display: flex;
|
|
26
|
+
align-items: center;
|
|
27
|
+
|
|
28
|
+
.item {
|
|
29
|
+
padding: 0 0.5rem;
|
|
30
|
+
cursor: pointer;
|
|
31
|
+
|
|
32
|
+
&:hover {
|
|
33
|
+
background: #063A69;
|
|
34
|
+
color: white;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
#left-sider {
|
|
43
|
+
.left-menu {
|
|
44
|
+
overflow: auto;
|
|
45
|
+
scrollbar-width: thin;
|
|
46
|
+
scrollbar-color: unset;
|
|
47
|
+
|
|
48
|
+
.ant-menu-submenu-selected {
|
|
49
|
+
div {
|
|
50
|
+
color: white !important;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
#admin-layout-content {
|
|
58
|
+
.tmgg-layout-tabs {
|
|
59
|
+
&>.ant-tabs-nav {
|
|
60
|
+
margin-bottom: 0;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
import AdminLayout from "./admin"
|
|
2
|
+
import React from "react";
|
|
3
|
+
|
|
4
|
+
import {ConfigProvider} from "antd";
|
|
5
|
+
import '@ant-design/v5-patch-for-react-19';
|
|
6
|
+
|
|
7
|
+
import {history, Outlet, withRouter} from "umi";
|
|
8
|
+
import zhCN from 'antd/locale/zh_CN';
|
|
9
|
+
import {ArrUtil, HttpUtil, MsgBoxComponent, PageLoading, PageUtil, SysUtil, theme} from "../framework";
|
|
10
|
+
import dayjs from 'dayjs';
|
|
11
|
+
import 'dayjs/locale/zh-cn';
|
|
12
|
+
|
|
13
|
+
import '../style/global.less'
|
|
14
|
+
import './index.less'
|
|
15
|
+
|
|
16
|
+
dayjs.locale('zh-cn');
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* 属性列表:
|
|
20
|
+
*
|
|
21
|
+
* logo: 自定义的logo图片
|
|
22
|
+
*
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
// 不需要登录的页面
|
|
26
|
+
const SIMPLE_URLS = ['/login', '/test']
|
|
27
|
+
|
|
28
|
+
class _Layouts extends React.Component {
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
state = {
|
|
32
|
+
siteInfoLoading: true,
|
|
33
|
+
loginInfoFinish: false
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
componentDidMount() {
|
|
38
|
+
HttpUtil.get("/admin/public/site-info").then(rs => {
|
|
39
|
+
SysUtil.setSiteInfo(rs)
|
|
40
|
+
this.setState({siteInfoLoading: false})
|
|
41
|
+
|
|
42
|
+
this.loadLoginInfo()
|
|
43
|
+
})
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
componentDidUpdate(prevProps, prevState, snapshot) {
|
|
47
|
+
const pre = prevProps.location.pathname
|
|
48
|
+
const cur = this.props.location.pathname
|
|
49
|
+
|
|
50
|
+
if (pre !== cur) {
|
|
51
|
+
this.loadLoginInfo()
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
isSimplePage() {
|
|
56
|
+
let {pathname} = this.props.location;
|
|
57
|
+
return ArrUtil.contains(SIMPLE_URLS, pathname)
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
loadLoginInfo = () => {
|
|
61
|
+
if (this.isSimplePage() || this.state.loginInfoFinish) {
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
HttpUtil.get('admin/public/checkLogin')
|
|
66
|
+
.then(rs => {
|
|
67
|
+
const {needUpdatePwd, dictTree, loginInfo} = rs
|
|
68
|
+
SysUtil.setDictInfo(dictTree)
|
|
69
|
+
SysUtil.setLoginInfo(loginInfo)
|
|
70
|
+
if (!needUpdatePwd) {
|
|
71
|
+
this.setState({loginInfoFinish: true});
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
if (needUpdatePwd) {
|
|
76
|
+
PageUtil.open('/userCenter/ChangePassword', '修改密码')
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
})
|
|
80
|
+
.catch(async () => {
|
|
81
|
+
PageUtil.redirectToLogin()
|
|
82
|
+
})
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
renderContent = () => {
|
|
89
|
+
if (this.state.siteInfoLoading) {
|
|
90
|
+
return <PageLoading message='加载站点信息...'/>
|
|
91
|
+
}
|
|
92
|
+
let {params = {}} = this.props.location;
|
|
93
|
+
console.log('layout: params', params)
|
|
94
|
+
let simple = this.isSimplePage();
|
|
95
|
+
if (simple || params.hasOwnProperty('_noLayout')) {
|
|
96
|
+
return <Outlet/>
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
if (!this.state.loginInfoFinish) {
|
|
100
|
+
return <PageLoading message='加载登录信息...'/>
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
return <AdminLayout path={this.state.path} logo={this.props.logo}/>
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
render() {
|
|
109
|
+
return <ConfigProvider
|
|
110
|
+
input={{autoComplete: 'off'}}
|
|
111
|
+
form={{
|
|
112
|
+
validateMessages: {
|
|
113
|
+
required: '必填项'
|
|
114
|
+
}, colon: false
|
|
115
|
+
}}
|
|
116
|
+
button={{
|
|
117
|
+
autoInsertSpace: false
|
|
118
|
+
}}
|
|
119
|
+
locale={zhCN}
|
|
120
|
+
theme={{
|
|
121
|
+
token: {
|
|
122
|
+
colorPrimary: theme["primary-color"],
|
|
123
|
+
colorSuccess: theme["success-color"],
|
|
124
|
+
colorWarning: theme["warning-color"],
|
|
125
|
+
colorError: theme["error-color"],
|
|
126
|
+
borderRadius: 4,
|
|
127
|
+
|
|
128
|
+
},
|
|
129
|
+
components: {
|
|
130
|
+
Menu: {
|
|
131
|
+
darkItemBg: theme["primary-color"],
|
|
132
|
+
darkPopupBg: theme["primary-color"],
|
|
133
|
+
darkItemSelectedBg: theme["primary-color-click"],
|
|
134
|
+
darkItemHoverBg: theme["primary-color-hover"],
|
|
135
|
+
darkSubMenuItemBg: theme["primary-color"]
|
|
136
|
+
},
|
|
137
|
+
Layout: {
|
|
138
|
+
siderBg: theme["primary-color"],
|
|
139
|
+
triggerBg: theme["primary-color-click"],
|
|
140
|
+
headerBg: 'white',
|
|
141
|
+
triggerHeight: 32
|
|
142
|
+
},
|
|
143
|
+
}
|
|
144
|
+
}}>
|
|
145
|
+
|
|
146
|
+
{this.renderContent()}
|
|
147
|
+
|
|
148
|
+
{this.renderGlobalComponent()}
|
|
149
|
+
</ConfigProvider>
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
|
|
153
|
+
renderGlobalComponent() {
|
|
154
|
+
console.log('渲染全局组件')
|
|
155
|
+
return <div className='global-component'>
|
|
156
|
+
<MsgBoxComponent/>
|
|
157
|
+
</div>
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
export const Layouts = withRouter(_Layouts);
|
|
162
|
+
export default Layouts
|
|
163
|
+
export * from './PageRender'
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
html,body{
|
|
2
|
+
margin: 0;
|
|
3
|
+
padding: 0;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
@media print {
|
|
7
|
+
.no-print {
|
|
8
|
+
display: none;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
.hide-on-mobile{ //电脑端css
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
@media (max-width: 767px) { //移动端css
|
|
16
|
+
|
|
17
|
+
.hide-on-mobile{
|
|
18
|
+
display: none !important;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.ant-modal-content {
|
|
24
|
+
padding: 0 !important;
|
|
25
|
+
.ant-modal-header{
|
|
26
|
+
padding: 16px 24px;
|
|
27
|
+
border-bottom: 1px solid rgba(0,0,0,.06) !important;
|
|
28
|
+
margin-bottom: 0 !important;
|
|
29
|
+
|
|
30
|
+
.ant-modal-title {
|
|
31
|
+
font-weight: 500 !important;
|
|
32
|
+
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.ant-modal-body {
|
|
37
|
+
padding: 24px !important;
|
|
38
|
+
}
|
|
39
|
+
.ant-modal-footer {
|
|
40
|
+
padding: 10px 16px;
|
|
41
|
+
border-top: 1px solid rgba(0,0,0,.06) !important;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
}
|
|
45
|
+
|
package/src/loading.jsx
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import {Spin} from "antd";
|
|
3
|
+
import {theme} from "./framework";
|
|
4
|
+
|
|
5
|
+
export default class extends React.Component {
|
|
6
|
+
render() {
|
|
7
|
+
return <div
|
|
8
|
+
style={{
|
|
9
|
+
display: 'flex',
|
|
10
|
+
alignItems: 'center',
|
|
11
|
+
justifyContent: 'center',
|
|
12
|
+
height: '100vh',
|
|
13
|
+
background: theme["background-color"]
|
|
14
|
+
}}>
|
|
15
|
+
<Spin size='large'/>
|
|
16
|
+
</div>
|
|
17
|
+
}
|
|
18
|
+
}
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import {HttpUtil, Page, ProTable} from "../../../framework";
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
export default class extends React.Component {
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
columns = [
|
|
10
|
+
|
|
11
|
+
{
|
|
12
|
+
title: '接口名称',
|
|
13
|
+
dataIndex: 'name',
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
},
|
|
19
|
+
|
|
20
|
+
{
|
|
21
|
+
title: '接口',
|
|
22
|
+
dataIndex: 'action',
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
},
|
|
28
|
+
|
|
29
|
+
{
|
|
30
|
+
title: 'requestId',
|
|
31
|
+
dataIndex: 'requestId',
|
|
32
|
+
|
|
33
|
+
},
|
|
34
|
+
|
|
35
|
+
{
|
|
36
|
+
title: '请求数据',
|
|
37
|
+
dataIndex: 'requestData',
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
},
|
|
43
|
+
|
|
44
|
+
{
|
|
45
|
+
title: '响应数据',
|
|
46
|
+
dataIndex: 'responseData',
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
},
|
|
52
|
+
|
|
53
|
+
{
|
|
54
|
+
title: 'ip',
|
|
55
|
+
dataIndex: 'ip',
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
},
|
|
61
|
+
|
|
62
|
+
{
|
|
63
|
+
title: 'ipLocation',
|
|
64
|
+
dataIndex: 'ipLocation',
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
},
|
|
70
|
+
|
|
71
|
+
{
|
|
72
|
+
title: '执行时间',
|
|
73
|
+
dataIndex: 'executionTime',
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
},
|
|
79
|
+
|
|
80
|
+
{
|
|
81
|
+
title: '接口账户',
|
|
82
|
+
dataIndex: 'accountName',
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
},
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
]
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
render() {
|
|
95
|
+
return <Page>
|
|
96
|
+
<ProTable
|
|
97
|
+
request={(params) => HttpUtil.pageData('admin/apiAccessLog/page', params)}
|
|
98
|
+
columns={this.columns}
|
|
99
|
+
/>
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
</Page>
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
|