@jiangood/open-admin 2.5.8 → 3.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/package.json +20 -8
- package/src/framework/GlobalData.ts +85 -0
- package/src/framework/biz/OrgTree.tsx +2 -7
- package/src/framework/biz/Perm.tsx +11 -0
- package/src/framework/biz/PermActions.tsx +18 -15
- package/src/framework/biz/index.tsx +34 -19
- package/src/framework/components/ContextMenu/index.tsx +105 -78
- package/src/framework/components/DownloadModal/index.tsx +15 -17
- package/src/framework/components/ErrorBoundary/index.tsx +2 -2
- package/src/framework/components/FormModal/index.tsx +76 -0
- package/src/framework/components/Gap/index.tsx +1 -1
- package/src/framework/components/NamedIcon/index.tsx +55 -9
- package/src/framework/components/Page/index.less +0 -1
- package/src/framework/components/Page/index.tsx +34 -27
- package/src/framework/components/PageLoading/index.less +15 -0
- package/src/framework/components/PageLoading/index.tsx +32 -16
- package/src/framework/components/ProTable/index.tsx +86 -15
- package/src/framework/components/index.ts +1 -0
- package/src/framework/config/index.ts +1 -0
- package/src/framework/config/themeConfig.ts +39 -0
- package/src/framework/fields/FieldBoolean/index.tsx +11 -2
- package/src/framework/fields/FieldDate/index.tsx +22 -7
- package/src/framework/fields/FieldDateRange/index.tsx +24 -6
- package/src/framework/fields/FieldDictSelect/index.tsx +1 -0
- package/src/framework/fields/FieldEditor/index.tsx +7 -1
- package/src/framework/fields/FieldNumberRange/index.tsx +14 -5
- package/src/framework/fields/FieldPercent/index.tsx +16 -5
- package/src/framework/fields/FieldRemoteSelect/index.tsx +4 -2
- package/src/framework/fields/FieldRemoteTreeSelect/index.tsx +2 -1
- package/src/framework/fields/FieldSysOrgTree/index.tsx +6 -1
- package/src/framework/fields/FieldSysOrgTreeSelect/index.tsx +6 -1
- package/src/framework/fields/FieldTable/index.tsx +35 -6
- package/src/framework/fields/FieldTableSelect/index.tsx +18 -2
- package/src/framework/fields/FieldUploadFile/index.tsx +69 -28
- package/src/framework/fields/index.ts +0 -1
- package/src/framework/index.ts +2 -0
- package/src/framework/router/Link.tsx +26 -0
- package/src/framework/router/PageFrame.tsx +31 -0
- package/src/framework/router/history.ts +50 -0
- package/src/framework/router/index.ts +4 -0
- package/src/framework/router/matcher.ts +58 -0
- package/src/framework/utils/{ArrayUtils.js → ArrayUtils.ts} +5 -5
- package/src/framework/utils/{DateUtils.js → DateUtils.ts} +19 -19
- package/src/framework/utils/{DeviceUtils.js → DeviceUtils.ts} +8 -1
- package/src/framework/utils/{EventBus.js → EventBus.ts} +13 -6
- package/src/framework/utils/MessageApi.ts +5 -0
- package/src/framework/utils/ModalApi.ts +5 -0
- package/src/framework/utils/ObjectUtils.ts +15 -0
- package/src/framework/utils/{StorageUtils.js → StorageUtils.ts} +7 -7
- package/src/framework/utils/{StringUtils.js → StringUtils.ts} +15 -15
- package/src/framework/utils/{TreeUtils.js → TreeUtils.ts} +19 -12
- package/src/framework/utils/{UrlUtils.js → UrlUtils.ts} +10 -10
- package/src/framework/utils/index.ts +2 -1
- package/src/framework/utils/system/{DictUtils.js → DictUtils.ts} +16 -4
- package/src/framework/utils/system/{HttpUtils.js → HttpUtils.ts} +25 -21
- package/src/framework/utils/system/PageUtils.ts +49 -0
- package/src/framework/utils/system/{PermUtils.js → PermUtils.ts} +5 -6
- package/src/framework/utils/system/index.ts +0 -2
- package/src/framework/views/ViewBoolean/index.tsx +6 -3
- package/src/framework/views/ViewFileButton/index.tsx +13 -8
- package/src/framework/views/ViewImage/index.tsx +19 -14
- package/src/framework/views/ViewRange/index.tsx +10 -7
- package/src/framework/views/ViewText/index.tsx +9 -11
- package/src/layouts/admin/AdminTabs.jsx +79 -0
- package/src/layouts/admin/AdminTabs.less +63 -0
- package/src/layouts/admin/HeaderRight.jsx +66 -33
- package/src/layouts/admin/TabLayout.jsx +124 -0
- package/src/layouts/admin/index.jsx +12 -5
- package/src/layouts/admin/index.less +5 -83
- package/src/layouts/index.tsx +148 -0
- package/src/main.jsx +8 -0
- package/src/pages/account/changePassword.jsx +14 -10
- package/src/pages/article/$code.jsx +43 -0
- package/src/pages/index.jsx +6 -4
- package/src/pages/{login.jsx → public/login.jsx} +7 -10
- package/src/pages/public/test.jsx +30 -0
- package/src/pages/{forceUpdatePwd.jsx → standalone/forceUpdatePwd.jsx} +3 -32
- package/src/pages/system/article/index.jsx +147 -0
- package/src/pages/system/dict/index.jsx +60 -91
- package/src/pages/system/file/index.jsx +23 -17
- package/src/pages/system/job/index.jsx +63 -72
- package/src/pages/system/log/index.jsx +11 -8
- package/src/pages/system/org/index.jsx +60 -80
- package/src/pages/system/role/index.jsx +50 -86
- package/src/pages/system/role/rolePerm.jsx +2 -2
- package/src/pages/system/user/index.jsx +120 -73
- package/src/pages/system/user/userPerm.jsx +2 -2
- package/vite-plugin/index.js +107 -0
- package/config/common-plugin.js +0 -145
- package/config/config.js +0 -5
- package/config/utils.js +0 -73
- package/src/.umi-production/appData.json +0 -2237
- package/src/.umi-production/core/EmptyRoute.tsx +0 -9
- package/src/.umi-production/core/defineApp.ts +0 -16
- package/src/.umi-production/core/helmet.ts +0 -10
- package/src/.umi-production/core/helmetContext.ts +0 -4
- package/src/.umi-production/core/history.ts +0 -72
- package/src/.umi-production/core/historyIntelli.ts +0 -132
- package/src/.umi-production/core/plugin.ts +0 -40
- package/src/.umi-production/core/pluginConfig.ts +0 -330
- package/src/.umi-production/core/pluginConfigJoi.d.ts +0 -7
- package/src/.umi-production/core/polyfill.ts +0 -220
- package/src/.umi-production/core/route.tsx +0 -45
- package/src/.umi-production/core/routeProps.js +0 -5
- package/src/.umi-production/core/routeProps.ts +0 -6
- package/src/.umi-production/core/terminal.ts +0 -37
- package/src/.umi-production/exports.ts +0 -17
- package/src/.umi-production/testBrowser.tsx +0 -90
- package/src/.umi-production/tsconfig.json +0 -43
- package/src/.umi-production/typings.d.ts +0 -136
- package/src/.umi-production/umi.ts +0 -83
- package/src/framework/GlobalData.d.ts +0 -8
- package/src/framework/GlobalData.js +0 -33
- package/src/framework/biz/HasPerm.tsx +0 -14
- package/src/framework/fields/FieldRemoteSelectMultiple/index.tsx +0 -29
- package/src/framework/utils/ArrayUtils.d.ts +0 -6
- package/src/framework/utils/DateUtils.d.ts +0 -20
- package/src/framework/utils/DeviceUtils.d.ts +0 -3
- package/src/framework/utils/EventBus.d.ts +0 -6
- package/src/framework/utils/MessageUtils.d.ts +0 -10
- package/src/framework/utils/MessageUtils.js +0 -43
- package/src/framework/utils/ObjectUtils.d.ts +0 -14
- package/src/framework/utils/ObjectUtils.js +0 -12
- package/src/framework/utils/StorageUtils.d.ts +0 -4
- package/src/framework/utils/StringUtils.d.ts +0 -17
- package/src/framework/utils/TreeUtils.d.ts +0 -13
- package/src/framework/utils/UrlUtils.d.ts +0 -6
- package/src/framework/utils/system/DictUtils.d.ts +0 -20
- package/src/framework/utils/system/FormRegistry.d.ts +0 -8
- package/src/framework/utils/system/FormRegistry.js +0 -31
- package/src/framework/utils/system/HttpUtils.d.ts +0 -14
- package/src/framework/utils/system/PageUtils.d.ts +0 -14
- package/src/framework/utils/system/PageUtils.js +0 -59
- package/src/framework/utils/system/PermUtils.d.ts +0 -5
- package/src/framework/utils/system/ThemeUtils.d.ts +0 -6
- package/src/framework/utils/system/ThemeUtils.js +0 -52
- package/src/layouts/PageRender.tsx +0 -29
- package/src/layouts/admin/TabPageRender.jsx +0 -210
- package/src/layouts/index.jsx +0 -119
- package/src/loading.jsx +0 -19
- package/src/pages/about.jsx +0 -11
- /package/src/pages/{login.less → public/login.less} +0 -0
|
@@ -1,210 +0,0 @@
|
|
|
1
|
-
import React, {useState, useEffect, useRef} from "react";
|
|
2
|
-
import {history} from "umi";
|
|
3
|
-
import {PageRender} from "../PageRender";
|
|
4
|
-
import {UrlUtils, ContextMenu} from "../../framework";
|
|
5
|
-
|
|
6
|
-
const MAX_TABS = 20;
|
|
7
|
-
|
|
8
|
-
function getLabel(pathname, search, pathMenuMap) {
|
|
9
|
-
if (pathname === '/') return '首页';
|
|
10
|
-
const params = UrlUtils.getParams(search);
|
|
11
|
-
if (params._label) return params._label;
|
|
12
|
-
const menu = pathMenuMap[pathname];
|
|
13
|
-
if (menu) return menu.name;
|
|
14
|
-
return '未命名';
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
export function TabPageRender({pathMenuMap}) {
|
|
18
|
-
const [tabs, setTabs] = useState([]);
|
|
19
|
-
const [activeKey, setActiveKey] = useState(null);
|
|
20
|
-
const [contextMenu, setContextMenu] = useState(null);
|
|
21
|
-
const accessOrderRef = useRef([]);
|
|
22
|
-
const lastClickTimeRef = useRef({});
|
|
23
|
-
const activeKeyRef = useRef(activeKey);
|
|
24
|
-
activeKeyRef.current = activeKey;
|
|
25
|
-
const pathMenuMapRef = useRef(pathMenuMap);
|
|
26
|
-
pathMenuMapRef.current = pathMenuMap;
|
|
27
|
-
|
|
28
|
-
const recordAccess = (key) => {
|
|
29
|
-
accessOrderRef.current = accessOrderRef.current.filter(k => k !== key);
|
|
30
|
-
accessOrderRef.current.push(key);
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
// Use history.listen to monitor route changes
|
|
34
|
-
useEffect(() => {
|
|
35
|
-
const unlisten = history.listen(({location}) => {
|
|
36
|
-
const {pathname, search} = location;
|
|
37
|
-
const key = pathname + (search || '');
|
|
38
|
-
recordAccess(key);
|
|
39
|
-
|
|
40
|
-
setTabs(prev => {
|
|
41
|
-
if (prev.find(t => t.key === key)) return prev;
|
|
42
|
-
const content = <PageRender pathname={pathname}/>;
|
|
43
|
-
const label = getLabel(pathname, search, pathMenuMapRef.current);
|
|
44
|
-
const next = [...prev, {key, label, closable: true, content}];
|
|
45
|
-
if (next.length > MAX_TABS) {
|
|
46
|
-
const keep = new Set([key, ...accessOrderRef.current.slice(-3)]);
|
|
47
|
-
const removeIdx = next.findIndex(t => !keep.has(t.key));
|
|
48
|
-
if (removeIdx > -1) next.splice(removeIdx, 1);
|
|
49
|
-
}
|
|
50
|
-
return next;
|
|
51
|
-
});
|
|
52
|
-
|
|
53
|
-
setActiveKey(key);
|
|
54
|
-
});
|
|
55
|
-
|
|
56
|
-
// Trigger for initial route
|
|
57
|
-
const {pathname, search} = history.location;
|
|
58
|
-
const key = pathname + (search || '');
|
|
59
|
-
recordAccess(key);
|
|
60
|
-
setTabs([{key, label: getLabel(pathname, search, pathMenuMap), closable: true, content: <PageRender pathname={pathname}/>}]);
|
|
61
|
-
setActiveKey(key);
|
|
62
|
-
|
|
63
|
-
return unlisten;
|
|
64
|
-
}, []);
|
|
65
|
-
|
|
66
|
-
// Listen for close-page-event (stable listener, no re-registration)
|
|
67
|
-
useEffect(() => {
|
|
68
|
-
const handler = (e) => {
|
|
69
|
-
const url = e.detail.url;
|
|
70
|
-
setTabs(prev => {
|
|
71
|
-
const next = prev.filter(t => t.key !== url);
|
|
72
|
-
accessOrderRef.current = accessOrderRef.current.filter(k => k !== url);
|
|
73
|
-
if (url === activeKeyRef.current && next.length > 0) {
|
|
74
|
-
history.push(next[next.length - 1].key);
|
|
75
|
-
}
|
|
76
|
-
return next;
|
|
77
|
-
});
|
|
78
|
-
};
|
|
79
|
-
document.addEventListener('close-page-event', handler);
|
|
80
|
-
return () => document.removeEventListener('close-page-event', handler);
|
|
81
|
-
}, []);
|
|
82
|
-
|
|
83
|
-
const handleTabRefresh = (key) => {
|
|
84
|
-
setTabs(prev => {
|
|
85
|
-
const idx = prev.findIndex(t => t.key === key);
|
|
86
|
-
if (idx === -1) return prev;
|
|
87
|
-
const originalContent = prev[idx].content;
|
|
88
|
-
const next = [...prev];
|
|
89
|
-
next[idx] = {...next[idx], content: '刷新中...'};
|
|
90
|
-
requestAnimationFrame(() => {
|
|
91
|
-
setTabs(prev2 => {
|
|
92
|
-
const idx2 = prev2.findIndex(t => t.key === key);
|
|
93
|
-
if (idx2 === -1) return prev2;
|
|
94
|
-
const next2 = [...prev2];
|
|
95
|
-
next2[idx2] = {...next2[idx2], content: originalContent};
|
|
96
|
-
return next2;
|
|
97
|
-
});
|
|
98
|
-
});
|
|
99
|
-
return next;
|
|
100
|
-
});
|
|
101
|
-
};
|
|
102
|
-
|
|
103
|
-
const handleTabClick = (key) => {
|
|
104
|
-
const now = Date.now();
|
|
105
|
-
const last = lastClickTimeRef.current[key] || 0;
|
|
106
|
-
lastClickTimeRef.current[key] = now;
|
|
107
|
-
if (now - last < 300) {
|
|
108
|
-
handleTabRefresh(key);
|
|
109
|
-
} else if (key !== activeKey) {
|
|
110
|
-
history.push(key);
|
|
111
|
-
}
|
|
112
|
-
};
|
|
113
|
-
|
|
114
|
-
const closeTab = (key) => {
|
|
115
|
-
setTabs(prev => {
|
|
116
|
-
const next = prev.filter(t => t.key !== key);
|
|
117
|
-
accessOrderRef.current = accessOrderRef.current.filter(k => k !== key);
|
|
118
|
-
if (next.length === 0) {
|
|
119
|
-
history.push('/');
|
|
120
|
-
} else if (key === activeKeyRef.current) {
|
|
121
|
-
history.push(next[next.length - 1].key);
|
|
122
|
-
}
|
|
123
|
-
return next;
|
|
124
|
-
});
|
|
125
|
-
};
|
|
126
|
-
|
|
127
|
-
const handleClose = (key, e) => {
|
|
128
|
-
e.stopPropagation();
|
|
129
|
-
closeTab(key);
|
|
130
|
-
};
|
|
131
|
-
|
|
132
|
-
const handleTabContextMenu = (e, key) => {
|
|
133
|
-
e.preventDefault();
|
|
134
|
-
setContextMenu({x: e.clientX, y: e.clientY, tabKey: key});
|
|
135
|
-
};
|
|
136
|
-
|
|
137
|
-
const handleContextMenuClick = ({key: actionKey}) => {
|
|
138
|
-
const {tabKey} = contextMenu;
|
|
139
|
-
setContextMenu(null);
|
|
140
|
-
if (actionKey === 'refresh') {
|
|
141
|
-
handleTabRefresh(tabKey);
|
|
142
|
-
} else if (actionKey === 'close') {
|
|
143
|
-
closeTab(tabKey);
|
|
144
|
-
} else if (actionKey === 'closeOthers') {
|
|
145
|
-
setTabs(prev => {
|
|
146
|
-
const next = prev.filter(t => t.key === tabKey || !t.closable);
|
|
147
|
-
accessOrderRef.current = [tabKey];
|
|
148
|
-
if (tabKey !== activeKeyRef.current) {
|
|
149
|
-
history.push(tabKey);
|
|
150
|
-
}
|
|
151
|
-
return next;
|
|
152
|
-
});
|
|
153
|
-
} else if (actionKey === 'closeAll') {
|
|
154
|
-
accessOrderRef.current = [];
|
|
155
|
-
setTabs([]);
|
|
156
|
-
setTimeout(() => history.push('/'), 0);
|
|
157
|
-
}
|
|
158
|
-
};
|
|
159
|
-
|
|
160
|
-
if (tabs.length === 0) return null;
|
|
161
|
-
|
|
162
|
-
return (
|
|
163
|
-
<div className="oa-tabs">
|
|
164
|
-
<div className="oa-tab-bar">
|
|
165
|
-
{tabs.map(tab => (
|
|
166
|
-
<div
|
|
167
|
-
key={tab.key}
|
|
168
|
-
className={'oa-tab' + (tab.key === activeKey ? ' active' : '')}
|
|
169
|
-
onClick={() => handleTabClick(tab.key)}
|
|
170
|
-
onContextMenu={(e) => handleTabContextMenu(e, tab.key)}
|
|
171
|
-
>
|
|
172
|
-
<span className="oa-tab-label">{tab.label}</span>
|
|
173
|
-
{tab.closable && tabs.length > 1 && (
|
|
174
|
-
<span className="oa-tab-close" onClick={(e) => handleClose(tab.key, e)}>×</span>
|
|
175
|
-
)}
|
|
176
|
-
</div>
|
|
177
|
-
))}
|
|
178
|
-
</div>
|
|
179
|
-
{contextMenu && (() => {
|
|
180
|
-
const tab = tabs.find(t => t.key === contextMenu.tabKey);
|
|
181
|
-
const closableCount = tabs.filter(t => t.closable).length;
|
|
182
|
-
return (
|
|
183
|
-
<ContextMenu
|
|
184
|
-
x={contextMenu.x}
|
|
185
|
-
y={contextMenu.y}
|
|
186
|
-
items={[
|
|
187
|
-
{key: 'refresh', label: '刷新'},
|
|
188
|
-
{key: 'close', label: '关闭', disabled: !tab?.closable},
|
|
189
|
-
{key: 'closeOthers', label: '关闭其他', disabled: tabs.length <= 1},
|
|
190
|
-
{key: 'closeAll', label: '关闭全部', disabled: closableCount === 0},
|
|
191
|
-
]}
|
|
192
|
-
onClick={handleContextMenuClick}
|
|
193
|
-
onClose={() => setContextMenu(null)}
|
|
194
|
-
/>
|
|
195
|
-
);
|
|
196
|
-
})()}
|
|
197
|
-
<div className="oa-tabs-content">
|
|
198
|
-
{tabs.map(tab => (
|
|
199
|
-
<div
|
|
200
|
-
key={tab.key}
|
|
201
|
-
style={{display: tab.key === activeKey ? undefined : 'none'}}
|
|
202
|
-
className="oa-tab-pane"
|
|
203
|
-
>
|
|
204
|
-
{tab.content}
|
|
205
|
-
</div>
|
|
206
|
-
))}
|
|
207
|
-
</div>
|
|
208
|
-
</div>
|
|
209
|
-
);
|
|
210
|
-
}
|
package/src/layouts/index.jsx
DELETED
|
@@ -1,119 +0,0 @@
|
|
|
1
|
-
import {useState, useEffect} from "react";
|
|
2
|
-
import {App, ConfigProvider} from "antd";
|
|
3
|
-
import zhCN from 'antd/locale/zh_CN';
|
|
4
|
-
import dayjs from 'dayjs';
|
|
5
|
-
import 'dayjs/locale/zh-cn';
|
|
6
|
-
import {Outlet, useLocation, history} from "umi";
|
|
7
|
-
|
|
8
|
-
import AdminLayout from "./admin"
|
|
9
|
-
import {HttpUtils, PageLoading, PageUtils, GlobalData, ThemeUtils, DownloadModal} from "../framework";
|
|
10
|
-
import {ErrorBoundary} from "../framework";
|
|
11
|
-
|
|
12
|
-
import '../style/global.less'
|
|
13
|
-
import './index.less'
|
|
14
|
-
|
|
15
|
-
dayjs.locale('zh-cn');
|
|
16
|
-
|
|
17
|
-
const configProps = {
|
|
18
|
-
input: {autoComplete: 'off'},
|
|
19
|
-
form: {validateMessages: {required: '必填项'}, colon: false},
|
|
20
|
-
button: {autoInsertSpace: false},
|
|
21
|
-
locale: zhCN,
|
|
22
|
-
theme: {
|
|
23
|
-
token: {
|
|
24
|
-
colorPrimary: ThemeUtils.getColor("primary-color"),
|
|
25
|
-
colorSuccess: ThemeUtils.getColor("success-color"),
|
|
26
|
-
colorWarning: ThemeUtils.getColor("warning-color"),
|
|
27
|
-
colorError: ThemeUtils.getColor("error-color"),
|
|
28
|
-
borderRadius: 4,
|
|
29
|
-
},
|
|
30
|
-
components: {
|
|
31
|
-
Layout: {
|
|
32
|
-
headerBg: 'white',
|
|
33
|
-
triggerHeight: 32,
|
|
34
|
-
},
|
|
35
|
-
},
|
|
36
|
-
},
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
function AppWrapper({children}) {
|
|
40
|
-
return <ConfigProvider {...configProps}><App><DownloadModal />{children}</App></ConfigProvider>;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
const PUBLIC_PAGES = (() => {
|
|
44
|
-
const raw = typeof OPEN_ADMIN_PUBLIC_PAGES !== 'undefined' && OPEN_ADMIN_PUBLIC_PAGES;
|
|
45
|
-
return raw ? raw.split(',').map(s => s.trim()) : ['/login', '/test', '/forceUpdatePwd'];
|
|
46
|
-
})();
|
|
47
|
-
|
|
48
|
-
function isPublicPage(pathname, search) {
|
|
49
|
-
if (pathname === '/' || pathname === '/index') return false;
|
|
50
|
-
|
|
51
|
-
for (const pattern of PUBLIC_PAGES) {
|
|
52
|
-
if (pattern.endsWith('/**')) {
|
|
53
|
-
if (pathname.startsWith(pattern.slice(0, -3))) return true;
|
|
54
|
-
} else if (pathname === pattern) {
|
|
55
|
-
return true;
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
if (new URLSearchParams(search).has('_noLayout')) return true;
|
|
60
|
-
return false;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
export function Layouts() {
|
|
64
|
-
const location = useLocation();
|
|
65
|
-
const {pathname, search} = location;
|
|
66
|
-
const [siteInfoLoaded, setSiteInfoLoaded] = useState(false);
|
|
67
|
-
const [loginChecked, setLoginChecked] = useState(false);
|
|
68
|
-
|
|
69
|
-
const ready = siteInfoLoaded && loginChecked;
|
|
70
|
-
const isPublic = isPublicPage(pathname, search);
|
|
71
|
-
|
|
72
|
-
useEffect(() => {
|
|
73
|
-
if (isPublic) {
|
|
74
|
-
setSiteInfoLoaded(false);
|
|
75
|
-
setLoginChecked(false);
|
|
76
|
-
return;
|
|
77
|
-
}
|
|
78
|
-
if (ready) return;
|
|
79
|
-
|
|
80
|
-
Promise.all([
|
|
81
|
-
HttpUtils.get("/admin/public/site-info").then(data => {
|
|
82
|
-
GlobalData.setSiteInfo(data);
|
|
83
|
-
setSiteInfoLoaded(true);
|
|
84
|
-
}),
|
|
85
|
-
HttpUtils.get('/admin/public/user-info').then(data => {
|
|
86
|
-
GlobalData.setDictInfo(data.dictInfo);
|
|
87
|
-
GlobalData.setLoginInfo(data.loginInfo);
|
|
88
|
-
|
|
89
|
-
if (data.needUpdatePwd && pathname !== '/forceUpdatePwd') {
|
|
90
|
-
history.push('/forceUpdatePwd');
|
|
91
|
-
return;
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
setLoginChecked(true);
|
|
95
|
-
}),
|
|
96
|
-
]).catch(() => {
|
|
97
|
-
console.error('[Layout] 初始化应用失败');
|
|
98
|
-
PageUtils.redirectToLogin();
|
|
99
|
-
});
|
|
100
|
-
}, [location]);
|
|
101
|
-
|
|
102
|
-
if (isPublic) return <ErrorBoundary minimal><AppWrapper><Outlet/></AppWrapper></ErrorBoundary>;
|
|
103
|
-
|
|
104
|
-
return (
|
|
105
|
-
<ErrorBoundary minimal>
|
|
106
|
-
<AppWrapper>
|
|
107
|
-
{ready ? <AdminLayout/> : (
|
|
108
|
-
<PageLoading messages={[
|
|
109
|
-
!siteInfoLoaded && '加载站点信息...',
|
|
110
|
-
!loginChecked && '检查登录中...',
|
|
111
|
-
].filter(Boolean)}/>
|
|
112
|
-
)}
|
|
113
|
-
</AppWrapper>
|
|
114
|
-
</ErrorBoundary>
|
|
115
|
-
);
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
export default Layouts;
|
|
119
|
-
export * from './PageRender'
|
package/src/loading.jsx
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { Spin } from "antd";
|
|
3
|
-
import { ThemeUtils } from "./framework";
|
|
4
|
-
|
|
5
|
-
const Loading = () => (
|
|
6
|
-
<div
|
|
7
|
-
style={{
|
|
8
|
-
display: 'flex',
|
|
9
|
-
alignItems: 'center',
|
|
10
|
-
justifyContent: 'center',
|
|
11
|
-
height: '100vh',
|
|
12
|
-
background: ThemeUtils.getColor("background-color")
|
|
13
|
-
}}
|
|
14
|
-
>
|
|
15
|
-
<Spin size='large' />
|
|
16
|
-
</div>
|
|
17
|
-
);
|
|
18
|
-
|
|
19
|
-
export default Loading;
|
package/src/pages/about.jsx
DELETED
|
File without changes
|