@jiangood/open-admin 1.0.0
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/dist/common-plugin.js +148 -0
- package/config/dist/config.js +45 -0
- package/config/dist/index.js +18 -0
- package/package.json +41 -0
- package/src/app.js +1 -0
- package/src/asserts/welcome.png +0 -0
- package/src/forms/demoForm.jsx +16 -0
- package/src/framework/components/DownloadFileButton.d.ts +11 -0
- package/src/framework/components/DownloadFileButton.jsx +33 -0
- package/src/framework/components/Ellipsis.jsx +39 -0
- package/src/framework/components/Ellipsis.less +8 -0
- package/src/framework/components/Gap/index.d.ts +23 -0
- package/src/framework/components/Gap/index.jsx +46 -0
- package/src/framework/components/LinkButton.d.ts +14 -0
- package/src/framework/components/LinkButton.jsx +10 -0
- package/src/framework/components/NamedIcon.tsx +15 -0
- package/src/framework/components/Page/index.d.ts +17 -0
- package/src/framework/components/Page/index.jsx +30 -0
- package/src/framework/components/Page/index.less +10 -0
- package/src/framework/components/PageLoading.tsx +27 -0
- package/src/framework/components/ProModal/index.tsx +66 -0
- package/src/framework/components/ProTable/components/ToolBar/index.jsx +123 -0
- package/src/framework/components/ProTable/components/ToolBar/index.less +53 -0
- package/src/framework/components/ProTable/index.d.ts +42 -0
- package/src/framework/components/ProTable/index.jsx +260 -0
- package/src/framework/components/ProTable/index.less +14 -0
- package/src/framework/components/ProTable/utils/index.js +43 -0
- package/src/framework/components/ValueType/index.jsx +34 -0
- package/src/framework/components/ValueType/registry.jsx +27 -0
- package/src/framework/components/index.ts +17 -0
- package/src/framework/components/system/ButtonList.d.ts +8 -0
- package/src/framework/components/system/ButtonList.jsx +42 -0
- package/src/framework/components/system/HasPerm.tsx +14 -0
- package/src/framework/components/system/index.tsx +29 -0
- package/src/framework/components/view/ViewBooleanEnableDisable.tsx +20 -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 +49 -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 +60 -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.tsx +16 -0
- package/src/framework/components/view/index.ts +10 -0
- package/src/framework/field-components/FieldBoolean.d.ts +13 -0
- package/src/framework/field-components/FieldBoolean.jsx +76 -0
- package/src/framework/field-components/FieldDate.d.ts +27 -0
- package/src/framework/field-components/FieldDate.jsx +114 -0
- package/src/framework/field-components/FieldDateRange.d.ts +6 -0
- package/src/framework/field-components/FieldDateRange.jsx +104 -0
- package/src/framework/field-components/FieldDictSelect.d.ts +13 -0
- package/src/framework/field-components/FieldDictSelect.jsx +16 -0
- package/src/framework/field-components/FieldEditor.d.ts +10 -0
- package/src/framework/field-components/FieldEditor.jsx +58 -0
- package/src/framework/field-components/FieldNumberRange.d.ts +13 -0
- package/src/framework/field-components/FieldNumberRange.jsx +59 -0
- package/src/framework/field-components/FieldPercent.d.ts +12 -0
- package/src/framework/field-components/FieldPercent.jsx +27 -0
- package/src/framework/field-components/FieldRemoteSelect.d.ts +13 -0
- package/src/framework/field-components/FieldRemoteSelect.jsx +87 -0
- package/src/framework/field-components/FieldRemoteSelectMultiple.d.ts +13 -0
- package/src/framework/field-components/FieldRemoteSelectMultiple.jsx +86 -0
- package/src/framework/field-components/FieldRemoteSelectMultipleInline.d.ts +20 -0
- package/src/framework/field-components/FieldRemoteSelectMultipleInline.jsx +86 -0
- package/src/framework/field-components/FieldRemoteTree.d.ts +21 -0
- package/src/framework/field-components/FieldRemoteTree.jsx +45 -0
- package/src/framework/field-components/FieldRemoteTreeCascader.d.ts +23 -0
- package/src/framework/field-components/FieldRemoteTreeCascader.jsx +61 -0
- package/src/framework/field-components/FieldRemoteTreeSelect.d.ts +17 -0
- package/src/framework/field-components/FieldRemoteTreeSelect.jsx +67 -0
- package/src/framework/field-components/FieldRemoteTreeSelectMultiple.d.ts +17 -0
- package/src/framework/field-components/FieldRemoteTreeSelectMultiple.jsx +72 -0
- package/src/framework/field-components/FieldSysOrgTree.d.ts +12 -0
- package/src/framework/field-components/FieldSysOrgTree.jsx +23 -0
- package/src/framework/field-components/FieldSysOrgTreeSelect.d.ts +12 -0
- package/src/framework/field-components/FieldSysOrgTreeSelect.jsx +23 -0
- package/src/framework/field-components/FieldTable.d.ts +17 -0
- package/src/framework/field-components/FieldTable.jsx +108 -0
- package/src/framework/field-components/FieldTable.less +29 -0
- package/src/framework/field-components/FieldTableSelect.d.ts +19 -0
- package/src/framework/field-components/FieldTableSelect.jsx +59 -0
- package/src/framework/field-components/FieldUploadFile.d.ts +34 -0
- package/src/framework/field-components/FieldUploadFile.jsx +141 -0
- package/src/framework/field-components/index.ts +21 -0
- package/src/framework/field-components/system/OrgTree.tsx +61 -0
- package/src/framework/field-components/system/RoleTree.tsx +53 -0
- package/src/framework/field-components/system/index.ts +2 -0
- package/src/framework/index.ts +5 -0
- package/src/framework/pages/LoginPage.d.ts +16 -0
- package/src/framework/pages/LoginPage.jsx +135 -0
- package/src/framework/pages/LoginPage.less +53 -0
- package/src/framework/pages/LoginPageUtils.ts +36 -0
- package/src/framework/pages/index.ts +2 -0
- package/src/framework/utils/ArrUtils.ts +229 -0
- package/src/framework/utils/ColorsUtils.ts +378 -0
- package/src/framework/utils/DateUtils.ts +187 -0
- package/src/framework/utils/DeviceUtils.ts +46 -0
- package/src/framework/utils/DomUtils.ts +50 -0
- package/src/framework/utils/EventBusUtils.ts +144 -0
- package/src/framework/utils/Logger.ts +40 -0
- package/src/framework/utils/MessageUtils.tsx +170 -0
- package/src/framework/utils/ObjectUtils.ts +118 -0
- package/src/framework/utils/StorageUtils.ts +50 -0
- package/src/framework/utils/StringUtils.ts +436 -0
- package/src/framework/utils/TreeUtils.ts +251 -0
- package/src/framework/utils/UrlUtils.ts +152 -0
- package/src/framework/utils/UuidUtils.ts +88 -0
- package/src/framework/utils/ValidateUtils.ts +28 -0
- package/src/framework/utils/index.ts +16 -0
- package/src/framework/utils/system/DictUtils.ts +97 -0
- package/src/framework/utils/system/FormRegistryUtils.ts +77 -0
- package/src/framework/utils/system/HttpUtils.ts +247 -0
- package/src/framework/utils/system/PageUtils.ts +163 -0
- package/src/framework/utils/system/PermUtils.ts +79 -0
- package/src/framework/utils/system/SysUtils.ts +97 -0
- package/src/framework/utils/system/ThemeUtils.ts +27 -0
- package/src/framework/utils/system/index.ts +7 -0
- package/src/framework/view-components/ViewApproveStatus.tsx +26 -0
- package/src/framework/view-components/ViewBoolean.tsx +6 -0
- package/src/framework/view-components/ViewFlowableInstanceProgress.d.ts +12 -0
- package/src/framework/view-components/ViewFlowableInstanceProgress.jsx +97 -0
- package/src/framework/view-components/ViewFlowableInstanceProgressButton.tsx +26 -0
- package/src/framework/view-components/ViewPassword.tsx +25 -0
- package/src/framework/view-components/ViewProps.ts +11 -0
- package/src/framework/view-components/index.ts +6 -0
- package/src/index.ts +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 +161 -0
- package/src/layouts/admin/index.less +65 -0
- package/src/layouts/index.jsx +165 -0
- package/src/layouts/index.less +24 -0
- package/src/loading.jsx +18 -0
- package/src/pages/404.jsx +13 -0
- package/src/pages/about.jsx +14 -0
- package/src/pages/index.jsx +25 -0
- package/src/pages/login.jsx +21 -0
- package/src/pages/system/api/ApiDoc.jsx +144 -0
- package/src/pages/system/api/index.jsx +268 -0
- package/src/pages/system/api/perm.jsx +69 -0
- package/src/pages/system/dict/Dict.jsx +72 -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 +160 -0
- package/src/pages/system/job/index.jsx +324 -0
- package/src/pages/system/log/index.jsx +78 -0
- package/src/pages/system/org/index.jsx +262 -0
- package/src/pages/system/role/index.jsx +308 -0
- package/src/pages/system/role/perm.jsx +108 -0
- package/src/pages/system/sysManual/index.jsx +127 -0
- package/src/pages/system/user/UserPerm.jsx +97 -0
- package/src/pages/system/user/index.jsx +258 -0
- package/src/pages/test.jsx +200 -0
- package/src/pages/ureport/index.jsx +16 -0
- package/src/pages/userCenter/ChangePassword.jsx +63 -0
- package/src/pages/userCenter/index.jsx +90 -0
- package/src/pages/userCenter/manual.jsx +59 -0
- package/src/pages/userCenter/message.jsx +105 -0
- package/src/style/global.less +51 -0
|
@@ -0,0 +1,161 @@
|
|
|
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 {Gap, HttpUtils, NamedIcon, PageUtils, SysUtils, ThemeUtils, TreeUtils} from "../../framework";
|
|
9
|
+
|
|
10
|
+
import HeaderRight from "./HeaderRight";
|
|
11
|
+
import TabPageRender from "./TabPageRender";
|
|
12
|
+
|
|
13
|
+
const {Header, Sider, Content} = Layout;
|
|
14
|
+
/**
|
|
15
|
+
* 带菜单的布局,主要处理布局宇框架结构
|
|
16
|
+
*/
|
|
17
|
+
export default class extends React.Component {
|
|
18
|
+
|
|
19
|
+
state = {
|
|
20
|
+
loginInfo: {},
|
|
21
|
+
|
|
22
|
+
menuTree: [],
|
|
23
|
+
menuMap: {},
|
|
24
|
+
pathMenuMap: {},
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
currentMenuKey: null,
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
siteInfo: {},
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
componentDidMount() {
|
|
35
|
+
console.log('Admin Layout didMount')
|
|
36
|
+
// 判断是否手机端,自动收起菜单
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
let siteInfo = SysUtils.getSiteInfo();
|
|
40
|
+
const loginInfo = SysUtils.getLoginInfo()
|
|
41
|
+
this.setState({siteInfo, loginInfo})
|
|
42
|
+
|
|
43
|
+
this.initMenu()
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
initMenu = () => {
|
|
48
|
+
HttpUtils.get('/admin/menuInfo').then(info => {
|
|
49
|
+
const {menuTree, pathMenuMap, menuMap} = info
|
|
50
|
+
this.setState({menuMap})
|
|
51
|
+
|
|
52
|
+
let pathname = PageUtils.currentPathname();
|
|
53
|
+
|
|
54
|
+
TreeUtils.walk(menuTree, (item) => {
|
|
55
|
+
item.icon = <NamedIcon name={item.icon || 'AppstoreOutlined'} style={{fontSize: 12}}/>
|
|
56
|
+
})
|
|
57
|
+
|
|
58
|
+
if (pathname !== "" && pathname !== "/") {
|
|
59
|
+
let menu = pathMenuMap[pathname]
|
|
60
|
+
if (menu) {
|
|
61
|
+
this.setState({currentMenuKey: menu.key})
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
this.setState({menuTree, pathMenuMap})
|
|
66
|
+
|
|
67
|
+
this.loadBadge(menuMap)
|
|
68
|
+
})
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
}
|
|
72
|
+
actionRef = React.createRef()
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
loadBadge = menuMap => {
|
|
76
|
+
for (let id in menuMap) {
|
|
77
|
+
const item = menuMap[id]
|
|
78
|
+
const {messageCountUrl} = item;
|
|
79
|
+
if (!messageCountUrl) {
|
|
80
|
+
continue
|
|
81
|
+
}
|
|
82
|
+
HttpUtils.get(messageCountUrl).then(rs => {
|
|
83
|
+
const {menuTree} = this.state
|
|
84
|
+
const menu = TreeUtils.findByKey(id, menuTree, 'key')
|
|
85
|
+
if (menu) {
|
|
86
|
+
menu.icon = <Badge dot count={rs} size={"small"}>{menu.icon}</Badge>
|
|
87
|
+
this.setState({menuTree: [...menuTree]})
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
})
|
|
91
|
+
}
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
render() {
|
|
96
|
+
const {siteInfo, loginInfo} = this.state
|
|
97
|
+
|
|
98
|
+
return <Layout className='main-layout'>
|
|
99
|
+
<Header className='header'>
|
|
100
|
+
<div className='header-left'>
|
|
101
|
+
{siteInfo.logoUrl &&
|
|
102
|
+
<img className='logo-img' src={siteInfo.logoUrl} onClick={() => history.push('/')} alt='logo'/>}
|
|
103
|
+
<h3 className='hide-on-mobile'>
|
|
104
|
+
<Link to="/" style={{color: ThemeUtils.getColor("primary-color")}}>{siteInfo.title} </Link>
|
|
105
|
+
</h3>
|
|
106
|
+
|
|
107
|
+
</div>
|
|
108
|
+
<HeaderRight/>
|
|
109
|
+
</Header>
|
|
110
|
+
|
|
111
|
+
<Layout style={{height: '100%'}}>
|
|
112
|
+
<Sider id='left-sider'
|
|
113
|
+
collapsible
|
|
114
|
+
breakpoint={'md'}
|
|
115
|
+
>
|
|
116
|
+
<Gap/>
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
<Menu items={this.state.menuTree}
|
|
120
|
+
theme='dark'
|
|
121
|
+
mode="inline"
|
|
122
|
+
className='left-menu'
|
|
123
|
+
onClick={({key}) => {
|
|
124
|
+
const menu = this.state.menuMap[key]
|
|
125
|
+
let {path} = menu;
|
|
126
|
+
this.setState({currentMenuKey: key})
|
|
127
|
+
history.push(path)
|
|
128
|
+
}}
|
|
129
|
+
selectedKeys={[this.state.currentMenuKey]}
|
|
130
|
+
inlineIndent={16}
|
|
131
|
+
>
|
|
132
|
+
</Menu>
|
|
133
|
+
|
|
134
|
+
</Sider>
|
|
135
|
+
|
|
136
|
+
<Content id='admin-layout-content'>
|
|
137
|
+
{this.getContent(loginInfo)}
|
|
138
|
+
</Content>
|
|
139
|
+
|
|
140
|
+
</Layout>
|
|
141
|
+
</Layout>
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
getContent = () => {
|
|
146
|
+
const {siteInfo, loginInfo} = this.state
|
|
147
|
+
if (this.state.menuTree.length === 0) { // 加载菜单中
|
|
148
|
+
return <></>
|
|
149
|
+
}
|
|
150
|
+
let tabPageRenderNode = <TabPageRender pathMenuMap={this.state.pathMenuMap}/>;
|
|
151
|
+
if (siteInfo.waterMark === true) {
|
|
152
|
+
return <Watermark content={[loginInfo.name, loginInfo.account]}>
|
|
153
|
+
{tabPageRenderNode}
|
|
154
|
+
</Watermark>
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
return tabPageRenderNode
|
|
158
|
+
};
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
|
|
@@ -0,0 +1,65 @@
|
|
|
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
|
+
|
|
14
|
+
display: flex;
|
|
15
|
+
align-items: center;
|
|
16
|
+
gap: 8px;
|
|
17
|
+
|
|
18
|
+
.logo-img {
|
|
19
|
+
height: 38px;
|
|
20
|
+
cursor: pointer;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.header-right {
|
|
25
|
+
line-height: 36px;
|
|
26
|
+
display: flex;
|
|
27
|
+
align-items: center;
|
|
28
|
+
|
|
29
|
+
.item {
|
|
30
|
+
padding: 0 0.5rem;
|
|
31
|
+
cursor: pointer;
|
|
32
|
+
|
|
33
|
+
&:hover {
|
|
34
|
+
background: #063A69;
|
|
35
|
+
color: white;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
#left-sider {
|
|
44
|
+
.left-menu {
|
|
45
|
+
overflow: auto;
|
|
46
|
+
scrollbar-width: thin;
|
|
47
|
+
scrollbar-color: unset;
|
|
48
|
+
|
|
49
|
+
.ant-menu-submenu-selected {
|
|
50
|
+
div {
|
|
51
|
+
color: white !important;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
#admin-layout-content {
|
|
59
|
+
.tmgg-layout-tabs {
|
|
60
|
+
&>.ant-tabs-nav {
|
|
61
|
+
margin-bottom: 8px;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
import AdminLayout from "./admin"
|
|
2
|
+
import React from "react";
|
|
3
|
+
|
|
4
|
+
import {ConfigProvider} from "antd";
|
|
5
|
+
|
|
6
|
+
import {Outlet, withRouter} from "umi";
|
|
7
|
+
import zhCN from 'antd/locale/zh_CN';
|
|
8
|
+
import {
|
|
9
|
+
ArrUtils,
|
|
10
|
+
HttpUtils,
|
|
11
|
+
MessageHolder,
|
|
12
|
+
PageLoading,
|
|
13
|
+
PageUtils,
|
|
14
|
+
SysUtils,
|
|
15
|
+
ThemeUtils,
|
|
16
|
+
} from "../framework";
|
|
17
|
+
import dayjs from 'dayjs';
|
|
18
|
+
import 'dayjs/locale/zh-cn';
|
|
19
|
+
|
|
20
|
+
import '../style/global.less'
|
|
21
|
+
import './index.less'
|
|
22
|
+
import {Logger} from "../framework/utils/Logger";
|
|
23
|
+
|
|
24
|
+
dayjs.locale('zh-cn');
|
|
25
|
+
|
|
26
|
+
// 不需要登录的页面
|
|
27
|
+
const SIMPLE_URLS = ['/login', '/test']
|
|
28
|
+
|
|
29
|
+
class _Layouts extends React.Component {
|
|
30
|
+
|
|
31
|
+
log = Logger.getLogger('Layouts')
|
|
32
|
+
|
|
33
|
+
state = {
|
|
34
|
+
messageHolderInit:false,
|
|
35
|
+
siteInfoLoading: true,
|
|
36
|
+
loginInfoFinish: false
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
onMessageHolderFinish = () => {
|
|
40
|
+
this.loadSiteInfo()
|
|
41
|
+
this.setState({messageHolderInit:true});
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
loadSiteInfo = () => {
|
|
46
|
+
HttpUtils.get("/admin/public/site-info").then(rs => {
|
|
47
|
+
SysUtils.setSiteInfo(rs)
|
|
48
|
+
this.setState({siteInfoLoading: false})
|
|
49
|
+
this.loadLoginInfo()
|
|
50
|
+
})
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
componentDidUpdate(prevProps, prevState, snapshot) {
|
|
54
|
+
const pre = prevProps.location.pathname
|
|
55
|
+
const cur = this.props.location.pathname
|
|
56
|
+
if (pre !== cur) {
|
|
57
|
+
this.loadLoginInfo()
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
isSimplePage() {
|
|
62
|
+
let {pathname} = this.props.location;
|
|
63
|
+
let isSimplePage = ArrUtils.contains(SIMPLE_URLS, pathname);
|
|
64
|
+
console.log('简单页面列表定义', SIMPLE_URLS)
|
|
65
|
+
console.log('当前页面是否简单页面',pathname,isSimplePage)
|
|
66
|
+
return isSimplePage
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
loadLoginInfo = () => {
|
|
70
|
+
if (this.isSimplePage() || this.state.loginInfoFinish) {
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
HttpUtils.get('/admin/public/checkLogin')
|
|
75
|
+
.then(rs => {
|
|
76
|
+
const {needUpdatePwd, dictMap, loginInfo} = rs
|
|
77
|
+
SysUtils.setDictInfo(dictMap)
|
|
78
|
+
SysUtils.setLoginInfo(loginInfo)
|
|
79
|
+
if (!needUpdatePwd) {
|
|
80
|
+
this.setState({loginInfoFinish: true});
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
if (needUpdatePwd) {
|
|
85
|
+
PageUtils.open('/userCenter/ChangePassword', '修改密码')
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
})
|
|
89
|
+
.catch(async () => {
|
|
90
|
+
PageUtils.redirectToLogin()
|
|
91
|
+
})
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
render() {
|
|
95
|
+
return <ConfigProvider
|
|
96
|
+
input={{autoComplete: 'off'}}
|
|
97
|
+
form={{
|
|
98
|
+
validateMessages: {
|
|
99
|
+
required: '必填项'
|
|
100
|
+
}, colon: false
|
|
101
|
+
}}
|
|
102
|
+
button={{
|
|
103
|
+
autoInsertSpace: false
|
|
104
|
+
}}
|
|
105
|
+
locale={zhCN}
|
|
106
|
+
theme={{
|
|
107
|
+
token: {
|
|
108
|
+
colorPrimary: ThemeUtils.getColor("primary-color"),
|
|
109
|
+
colorSuccess: ThemeUtils.getColor("success-color"),
|
|
110
|
+
colorWarning: ThemeUtils.getColor("warning-color"),
|
|
111
|
+
colorError: ThemeUtils.getColor("error-color"),
|
|
112
|
+
borderRadius: 4,
|
|
113
|
+
},
|
|
114
|
+
components: {
|
|
115
|
+
Menu: {
|
|
116
|
+
darkItemBg: ThemeUtils.getColor("primary-color"),
|
|
117
|
+
darkPopupBg: ThemeUtils.getColor("primary-color"),
|
|
118
|
+
darkItemSelectedBg: ThemeUtils.getColor("primary-color-click"),
|
|
119
|
+
darkItemHoverBg: ThemeUtils.getColor("primary-color-hover"),
|
|
120
|
+
darkSubMenuItemBg: ThemeUtils.getColor("primary-color")
|
|
121
|
+
},
|
|
122
|
+
Layout: {
|
|
123
|
+
siderBg: ThemeUtils.getColor("primary-color"),
|
|
124
|
+
triggerBg: ThemeUtils.getColor("primary-color-click"),
|
|
125
|
+
headerBg: 'white',
|
|
126
|
+
triggerHeight: 32
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
}}>
|
|
130
|
+
|
|
131
|
+
<MessageHolder onFinish={this.onMessageHolderFinish} />
|
|
132
|
+
{this.renderContent()}
|
|
133
|
+
</ConfigProvider>
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
|
|
137
|
+
renderContent = () => {
|
|
138
|
+
if(!this.state.messageHolderInit) {
|
|
139
|
+
this.log.info('加载message holder...')
|
|
140
|
+
return <PageLoading message='加载消息组件...'/>
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
if (this.state.siteInfoLoading) {
|
|
144
|
+
return <PageLoading message='加载站点信息...'/>
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
let {params = {}} = this.props.location;
|
|
148
|
+
console.log('layout: params', params)
|
|
149
|
+
let simple = this.isSimplePage();
|
|
150
|
+
if (simple || params.hasOwnProperty('_noLayout')) {
|
|
151
|
+
return <Outlet/>
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
if (!this.state.loginInfoFinish) {
|
|
155
|
+
return <PageLoading message='加载登录信息...'/>
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
return <AdminLayout path={this.state.path} logo={this.props.logo}/>
|
|
159
|
+
};
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
|
|
163
|
+
export const Layouts = withRouter(_Layouts);
|
|
164
|
+
export default Layouts
|
|
165
|
+
export * from './PageRender'
|
|
@@ -0,0 +1,24 @@
|
|
|
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
|
+
|
|
24
|
+
|
package/src/loading.jsx
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import {Spin} from "antd";
|
|
3
|
+
import {ThemeUtils} 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: ThemeUtils.getColor("background-color")
|
|
14
|
+
}}>
|
|
15
|
+
<Spin size='large'/>
|
|
16
|
+
</div>
|
|
17
|
+
}
|
|
18
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import {Card} from "antd";
|
|
3
|
+
import {MessageUtils} from "../framework";
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
export default class extends React.Component {
|
|
7
|
+
|
|
8
|
+
state = {}
|
|
9
|
+
|
|
10
|
+
componentDidMount() {
|
|
11
|
+
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
render() {
|
|
15
|
+
|
|
16
|
+
return <Card>
|
|
17
|
+
欢迎使用本系统
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
</Card>
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
import {LoginPage} from "../framework/pages/LoginPage";
|
|
4
|
+
import {Button} from "antd";
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
export default class extends React.Component {
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
render() {
|
|
13
|
+
return <LoginPage />
|
|
14
|
+
// 支持自定义
|
|
15
|
+
// return <LoginPage form={<Button type={"primary"} size='large'>xx登录</Button>} />
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
}
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import {FieldRemoteSelect, HttpUtils, PageUtils} from "../../../framework";
|
|
3
|
+
import {Button, Descriptions, message, Space, Table, Typography} from "antd";
|
|
4
|
+
|
|
5
|
+
const {Title, Paragraph, Text, Link} = Typography;
|
|
6
|
+
|
|
7
|
+
export class ApiDoc extends React.Component {
|
|
8
|
+
|
|
9
|
+
state = {
|
|
10
|
+
url: null,
|
|
11
|
+
appId: null,
|
|
12
|
+
apiList: [],
|
|
13
|
+
frameworkVersion: null,
|
|
14
|
+
errorList:[]
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
columns = [
|
|
18
|
+
{dataIndex: 'name', title: '名称', width: 150},
|
|
19
|
+
{dataIndex: 'type', title: '类型', width: 100},
|
|
20
|
+
{
|
|
21
|
+
dataIndex: 'required', title: '必填', width: 100, render: v => {
|
|
22
|
+
if (v == null) {
|
|
23
|
+
return null;
|
|
24
|
+
}
|
|
25
|
+
return v ? '是' : '否';
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
{dataIndex: 'desc', title: '描述'},
|
|
29
|
+
]
|
|
30
|
+
|
|
31
|
+
componentDidMount() {
|
|
32
|
+
const id = PageUtils.currentParams().id
|
|
33
|
+
this.loadData(id);
|
|
34
|
+
|
|
35
|
+
let url = window.location.protocol + '//' + window.location.host
|
|
36
|
+
this.setState({url})
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
async loadData(id) {
|
|
40
|
+
const hide = message.loading('加载中...', 0)
|
|
41
|
+
const rs = await HttpUtils.get('admin/apiAccount/docInfo', {id})
|
|
42
|
+
this.setState(rs)
|
|
43
|
+
hide()
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
render() {
|
|
49
|
+
const {apiList} = this.state
|
|
50
|
+
return <div>
|
|
51
|
+
|
|
52
|
+
<Space>
|
|
53
|
+
<FieldRemoteSelect url='admin/apiAccount/accountOptions' placeholder='请选择账号' onChange={v=>this.loadData(v)}/>
|
|
54
|
+
<Button type='primary' >导出PDF</Button>
|
|
55
|
+
</Space>
|
|
56
|
+
<div id='doc-content'>
|
|
57
|
+
<Title level={1}>接口说明文档</Title>
|
|
58
|
+
|
|
59
|
+
<Title level={2}>一、基本信息</Title>
|
|
60
|
+
<Paragraph>
|
|
61
|
+
<Descriptions column={1} bordered size='small'>
|
|
62
|
+
<Descriptions.Item label='请求地址'>
|
|
63
|
+
{this.state.url}/api/gateway/接口名称
|
|
64
|
+
</Descriptions.Item>
|
|
65
|
+
<Descriptions.Item label='appId'>
|
|
66
|
+
私发
|
|
67
|
+
</Descriptions.Item>
|
|
68
|
+
<Descriptions.Item label='appSecret'>
|
|
69
|
+
私发
|
|
70
|
+
</Descriptions.Item>
|
|
71
|
+
</Descriptions>
|
|
72
|
+
|
|
73
|
+
</Paragraph>
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
<Paragraph>
|
|
77
|
+
<Typography.Text>
|
|
78
|
+
<div>
|
|
79
|
+
请求使用HTTP POST发送,请求参数也使用json格式
|
|
80
|
+
</div>
|
|
81
|
+
<div> 响应报文以JSON方式返回</div>
|
|
82
|
+
</Typography.Text>
|
|
83
|
+
</Paragraph>
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
<Title level={4}>请求头</Title>
|
|
87
|
+
|
|
88
|
+
<Table rowKey='name' columns={this.columns} bordered dataSource={[
|
|
89
|
+
{name: 'appId', type: 'String', required: true, desc: '账号标识,appId'},
|
|
90
|
+
{name: 'timestamp', type: 'String', required: true, desc: '时间戳,当前UNIX时间戳,13位,精确到毫秒'},
|
|
91
|
+
{name: 'sign', type: 'String', required: true, desc: '数据签名,appId + appSecret + timestamp拼接后,进行md5摘要,值为32位小写'},
|
|
92
|
+
]} size='small' pagination={false}>
|
|
93
|
+
</Table>
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
<Typography.Title level={4}>公共错误码</Typography.Title>
|
|
98
|
+
<Table columns={[
|
|
99
|
+
{dataIndex:'code',title:'错误码'},
|
|
100
|
+
{dataIndex:'message', title:'错误描述'}
|
|
101
|
+
]} rowKey='code' bordered dataSource={this.state.errorList} size='small' pagination={false}>
|
|
102
|
+
</Table>
|
|
103
|
+
|
|
104
|
+
<Typography.Title level={2}>二、接口列表</Typography.Title>
|
|
105
|
+
{apiList.map((api, index) => {
|
|
106
|
+
return <div key={index}>
|
|
107
|
+
<Typography.Title level={3}>{ api.name} </Typography.Title>
|
|
108
|
+
<p>接口名称: {api.action}</p>
|
|
109
|
+
<p>功能描述:{api.desc}</p>
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
<Title level={5}>请求参数</Title>
|
|
113
|
+
<Table rowKey='name' columns={this.columns} bordered dataSource={api.parameterList}
|
|
114
|
+
size='small' pagination={false}>
|
|
115
|
+
</Table>
|
|
116
|
+
|
|
117
|
+
<Title level={5}>响应数据</Title>
|
|
118
|
+
<Table columns={this.columns} bordered
|
|
119
|
+
rowKey={'name'}
|
|
120
|
+
dataSource={[
|
|
121
|
+
{name: 'code', type: 'int', required: true, desc: '响应码,0表示成功'},
|
|
122
|
+
{name: 'message', type: 'String', required: false, desc: '结果提示信息'},
|
|
123
|
+
{name: 'data', type: api.returnType, required: false, desc: '返回数据'}
|
|
124
|
+
]} size='small' pagination={false}>
|
|
125
|
+
</Table>
|
|
126
|
+
{api.returnList != null && api.returnList.length > 0 && <>
|
|
127
|
+
<Title level={5}>data 对象 {api.returnType} 说明</Title>
|
|
128
|
+
|
|
129
|
+
<Table columns={this.columns}
|
|
130
|
+
rowKey={'name'}
|
|
131
|
+
bordered
|
|
132
|
+
dataSource={api.returnList} size='small' pagination={false}>
|
|
133
|
+
</Table>
|
|
134
|
+
</>
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
</div>
|
|
138
|
+
})}
|
|
139
|
+
|
|
140
|
+
|
|
141
|
+
</div>
|
|
142
|
+
</div>
|
|
143
|
+
}
|
|
144
|
+
}
|