module-menu 0.1.35 → 0.2.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/dist/index.html +22 -0
- package/dist/static/admin_logo.436045b7.svg +48 -0
- package/dist/static/admin_slogo.cc12b7d8.svg +48 -0
- package/dist/static/alert_logo.461428a2.svg +26 -0
- package/dist/static/alert_slogo.d7000af9.svg +26 -0
- package/dist/static/dataManager_logo.e27b3137.svg +42 -0
- package/dist/static/dataanalytic_logo.76dd2fda.svg +44 -0
- package/dist/static/dataanalytic_slogo.69fa2eee.svg +47 -0
- package/dist/static/dataasset_logo.9f1e48b2.svg +52 -0
- package/dist/static/dataasset_slogo.84d16e23.svg +52 -0
- package/dist/static/datacollection_logo.348102ed.svg +70 -0
- package/dist/static/datacollection_slogo.743ac405.svg +70 -0
- package/dist/static/datadev_logo.e57f9325.svg +26 -0
- package/dist/static/datadev_slogo.db9ce68f.svg +26 -0
- package/dist/static/datalabel_slogo.62e8f571.svg +26 -0
- package/dist/static/datamanager_slogo.8028bc5f.svg +42 -0
- package/dist/static/dataservice_logo.9a737452.svg +209 -0
- package/dist/static/dataservice_slogo.b9f136dc.svg +209 -0
- package/dist/static/datasharing_logo.6c828c61.svg +28 -0
- package/dist/static/datasharing_slogo.d0ccda7a.svg +28 -0
- package/dist/static/home.c9f8fbce.svg +12 -0
- package/dist/static/ic_gonggongmokuai_m.870acd57.svg +5 -0
- package/dist/static/ic_shujuhuiju_m.aceecaa1.svg +5 -0
- package/dist/static/ic_shujukaifa_m.a1b978b5.svg +15 -0
- package/dist/static/ic_shujukaifang_m.205ec04f.svg +5 -0
- package/dist/static/ic_shujuyingyong_m.4fed335c.svg +5 -0
- package/dist/static/ic_shujuzhili_m.9762b4f0.svg +5 -0
- package/dist/static/menuIcon.a281e69f.svg +1 -0
- package/dist/static/messageCenter.87236800.svg +1 -0
- package/dist/static/metadata_logo.45d05339.svg +25 -0
- package/dist/static/metadata_slogo.64e545f1.svg +25 -0
- package/dist/static/operate_logo.2a7ee3a9.svg +63 -0
- package/dist/static/operate_slogo.b46625a9.svg +63 -0
- package/dist/static/personalCenter.40f40e04.svg +16 -0
- package/dist/static/quality_logo.ef4e102a.svg +26 -0
- package/dist/static/quality_slogo.3557a527.svg +26 -0
- package/dist/static/systemManage.cc20d139.svg +16 -0
- package/dist/static/workorder_slogo.72b76127.svg +54 -0
- package/dist/umi.css +1 -0
- package/dist/umi.js +1 -0
- package/package.json +3 -2
- package/src/.umi/.cache/babel-loader/0cf458567cfdaa4bcc98ad17f126d505.json.gz +0 -0
- package/src/.umi/.cache/babel-loader/172487ddf659c5e5ed4c4cc43ab177d9.json.gz +0 -0
- package/src/.umi/.cache/babel-loader/1d496c36e309d0a102e0dac5294c7868.json.gz +0 -0
- package/src/.umi/.cache/babel-loader/1d61f257af04e239d0ea836688a06494.json.gz +0 -0
- package/src/.umi/.cache/babel-loader/2778829a08334bd378a2fdd98391a43c.json.gz +0 -0
- package/src/.umi/.cache/babel-loader/2a52a607066a02cb72bc9f72140998a3.json.gz +0 -0
- package/src/.umi/.cache/babel-loader/3076ff60b33bd715e63da884712660ff.json.gz +0 -0
- package/src/.umi/.cache/babel-loader/35fcc056042728656dfce9dd67b6bbc6.json.gz +0 -0
- package/src/.umi/.cache/babel-loader/382b0d400111ab0b80c259db1aa480ae.json.gz +0 -0
- package/src/.umi/.cache/babel-loader/38966e8352b47ea30f67e98ce8dfbce1.json.gz +0 -0
- package/src/.umi/.cache/babel-loader/61ed376d37914f796e6ee3e7206c53bd.json.gz +0 -0
- package/src/.umi/.cache/babel-loader/66357c799ae9dc8d0fdcab0abb98e3be.json.gz +0 -0
- package/src/.umi/.cache/babel-loader/713975e5f8979c076b77105bcc664433.json.gz +0 -0
- package/src/.umi/.cache/babel-loader/737e9e5ca4f0aa3883a7d8623a1560f3.json.gz +0 -0
- package/src/.umi/.cache/babel-loader/78278b5a6929a5a79cdf84421140a995.json.gz +0 -0
- package/src/.umi/.cache/babel-loader/80e5871bc78e732263638960b11de875.json.gz +0 -0
- package/src/.umi/.cache/babel-loader/8ce21ab4f5fb95407c2f635f6e0e9713.json.gz +0 -0
- package/src/.umi/.cache/babel-loader/8e6fb4487c51c552ca584b2f53dc3810.json.gz +0 -0
- package/src/.umi/.cache/babel-loader/8e7e40a2e6770c8f279024db25bc8fcf.json.gz +0 -0
- package/src/.umi/.cache/babel-loader/91ab7e7c6e4b220534b7b8dde5825001.json.gz +0 -0
- package/src/.umi/.cache/babel-loader/956e66fcc9441e07247197b2ecf6b440.json.gz +0 -0
- package/src/.umi/.cache/babel-loader/975afa5d1bc90c4c8f37aa402468675d.json.gz +0 -0
- package/src/.umi/.cache/babel-loader/a320cf81322ac1c1440132f0a1713345.json.gz +0 -0
- package/src/.umi/.cache/babel-loader/ae4616202782e31e14cf4b17641b1fe6.json.gz +0 -0
- package/src/.umi/.cache/babel-loader/b501b37dd395c6fe3df5b9f9f2217710.json.gz +0 -0
- package/src/.umi/.cache/babel-loader/c052495a4884502f57654ee834ae0a85.json.gz +0 -0
- package/src/.umi/.cache/babel-loader/c1062507fd6703590141de4c872c47de.json.gz +0 -0
- package/src/.umi/.cache/babel-loader/c14e03befcbd217f8aa57a7a7600590c.json.gz +0 -0
- package/src/.umi/.cache/babel-loader/c84d64ffe481659b495089907db80c2c.json.gz +0 -0
- package/src/.umi/.cache/babel-loader/d55b6d19818be24dbc615a2bf90f5c53.json.gz +0 -0
- package/src/.umi/.cache/babel-loader/de423f345d70a7488000626c81305752.json.gz +0 -0
- package/src/.umi/.cache/babel-loader/ec3a1cda1f0c32a803e9a9140d97110d.json.gz +0 -0
- package/src/.umi/.cache/babel-loader/f5c49dbe2f3c9fbba9c8b04c3254d7bb.json.gz +0 -0
- package/src/.umi/core/history.ts +21 -0
- package/src/.umi/core/plugin.ts +8 -0
- package/src/.umi/core/pluginConfig.d.ts +304 -0
- package/src/.umi/core/pluginRegister.ts +15 -0
- package/src/.umi/core/polyfill.ts +4 -0
- package/src/.umi/core/routes.ts +24 -0
- package/src/.umi/core/umiExports.ts +7 -0
- package/src/.umi/plugin-helmet/exports.ts +3 -0
- package/src/.umi/plugin-initial-state/Provider.tsx +37 -0
- package/src/.umi/plugin-initial-state/exports.ts +7 -0
- package/src/.umi/plugin-initial-state/models/initialState.ts +2 -0
- package/src/.umi/plugin-initial-state/runtime.tsx +13 -0
- package/src/.umi/plugin-model/Provider.tsx +39 -0
- package/src/.umi/plugin-model/helpers/constant.tsx +4 -0
- package/src/.umi/plugin-model/helpers/dispatcher.tsx +19 -0
- package/src/.umi/plugin-model/helpers/executor.tsx +83 -0
- package/src/.umi/plugin-model/runtime.tsx +12 -0
- package/src/.umi/plugin-model/useModel.tsx +71 -0
- package/src/.umi/plugin-request/request.ts +278 -0
- package/src/.umi/umi.ts +58 -0
- package/src/assets/muluguanli_slogo.png +0 -0
- package/src/assets/ziyuanguanli_slogo.png +0 -0
- package/src/pages/ModuleMenu/constData.jsx +15 -5
- package/src/pages/ModuleMenu/index.jsx +43 -66
- package/src/pages/ModuleMenu/index.less +109 -90
- package/src/pages/ModuleUser/index.jsx +103 -25
- package/src/pages/ModuleUser/index.less +46 -34
- package/src/pages/util/axios.js +35 -10
- package/src/pages/util/config.js +4 -8
- package/src/pages/util/permessionUtils.js +1 -19
- package/src/pages/util/userInfo.js +64 -39
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "module-menu",
|
|
3
|
-
"version": "0.1
|
|
3
|
+
"version": "0.2.1",
|
|
4
4
|
"description": "城市大数据平台公共头部及尾部",
|
|
5
5
|
"main": "src/pages/index.jsx",
|
|
6
6
|
"scripts": {
|
|
@@ -26,11 +26,12 @@
|
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
28
|
"@ant-design/pro-layout": "^6.5.0",
|
|
29
|
+
"@umijs/preset-react": "^1.8.17",
|
|
29
30
|
"antd": "^4.17.0",
|
|
30
31
|
"axios": "^0.27.2",
|
|
32
|
+
"lodash": "^4.17.0",
|
|
31
33
|
"react": "^17.0.0",
|
|
32
34
|
"react-dom": "^17.0.0",
|
|
33
|
-
"@umijs/preset-react": "^1.8.17",
|
|
34
35
|
"umi": "^3.5.0"
|
|
35
36
|
},
|
|
36
37
|
"devDependencies": {
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
// @ts-nocheck
|
|
2
|
+
import { createBrowserHistory, History } from '/Users/le/Desktop/work/compact-bigdata/module-menu/node_modules/@umijs/runtime';
|
|
3
|
+
|
|
4
|
+
let options = {
|
|
5
|
+
"basename": "/"
|
|
6
|
+
};
|
|
7
|
+
if ((<any>window).routerBase) {
|
|
8
|
+
options.basename = (<any>window).routerBase;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
// remove initial history because of ssr
|
|
12
|
+
let history: History = process.env.__IS_SERVER ? null : createBrowserHistory(options);
|
|
13
|
+
export const createHistory = (hotReload = false) => {
|
|
14
|
+
if (!hotReload) {
|
|
15
|
+
history = createBrowserHistory(options);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
return history;
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export { history };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
// @ts-nocheck
|
|
2
|
+
import { Plugin } from '/Users/le/Desktop/work/compact-bigdata/module-menu/node_modules/@umijs/runtime';
|
|
3
|
+
|
|
4
|
+
const plugin = new Plugin({
|
|
5
|
+
validKeys: ['modifyClientRenderOpts','patchRoutes','rootContainer','render','onRouteChange','__mfsu','getInitialState','initialStateConfig','request',],
|
|
6
|
+
});
|
|
7
|
+
|
|
8
|
+
export { plugin };
|
|
@@ -0,0 +1,304 @@
|
|
|
1
|
+
// Created by Umi Plugin
|
|
2
|
+
|
|
3
|
+
export interface IConfigFromPlugins {
|
|
4
|
+
"404"?: boolean
|
|
5
|
+
routes?: {
|
|
6
|
+
/**
|
|
7
|
+
* Any valid URL path
|
|
8
|
+
*/
|
|
9
|
+
path?: string
|
|
10
|
+
/**
|
|
11
|
+
* A React component to render only when the location matches.
|
|
12
|
+
*/
|
|
13
|
+
component?: (string | (() => any))
|
|
14
|
+
wrappers?: string[]
|
|
15
|
+
/**
|
|
16
|
+
* navigate to a new location
|
|
17
|
+
*/
|
|
18
|
+
redirect?: string
|
|
19
|
+
/**
|
|
20
|
+
* When true, the active class/style will only be applied if the location is matched exactly.
|
|
21
|
+
*/
|
|
22
|
+
exact?: boolean
|
|
23
|
+
routes?: any[]
|
|
24
|
+
[k: string]: any
|
|
25
|
+
}[]
|
|
26
|
+
history?: {
|
|
27
|
+
type?: ("browser" | "hash" | "memory")
|
|
28
|
+
options?: {
|
|
29
|
+
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
polyfill?: {
|
|
33
|
+
imports?: string[]
|
|
34
|
+
}
|
|
35
|
+
alias?: {
|
|
36
|
+
|
|
37
|
+
}
|
|
38
|
+
analyze?: {
|
|
39
|
+
analyzerMode?: ("server" | "static" | "disabled")
|
|
40
|
+
analyzerHost?: string
|
|
41
|
+
analyzerPort?: any
|
|
42
|
+
openAnalyzer?: boolean
|
|
43
|
+
generateStatsFile?: boolean
|
|
44
|
+
statsFilename?: string
|
|
45
|
+
logLevel?: ("info" | "warn" | "error" | "silent")
|
|
46
|
+
defaultSizes?: ("stat" | "parsed" | "gzip")
|
|
47
|
+
[k: string]: any
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* postcss autoprefixer, default flexbox: no-2009
|
|
51
|
+
*/
|
|
52
|
+
autoprefixer?: {
|
|
53
|
+
|
|
54
|
+
}
|
|
55
|
+
base?: string
|
|
56
|
+
chainWebpack?: (() => any)
|
|
57
|
+
chunks?: string[]
|
|
58
|
+
/**
|
|
59
|
+
* more css-loader options see https://webpack.js.org/loaders/css-loader/#options
|
|
60
|
+
*/
|
|
61
|
+
cssLoader?: {
|
|
62
|
+
url?: (boolean | (() => any))
|
|
63
|
+
import?: (boolean | (() => any))
|
|
64
|
+
modules?: (boolean | string | {
|
|
65
|
+
|
|
66
|
+
})
|
|
67
|
+
sourceMap?: boolean
|
|
68
|
+
importLoaders?: number
|
|
69
|
+
onlyLocals?: boolean
|
|
70
|
+
esModule?: boolean
|
|
71
|
+
localsConvention?: ("asIs" | "camelCase" | "camelCaseOnly" | "dashes" | "dashesOnly")
|
|
72
|
+
}
|
|
73
|
+
cssModulesTypescriptLoader?: {
|
|
74
|
+
mode?: ("emit" | "verify")
|
|
75
|
+
}
|
|
76
|
+
cssnano?: {
|
|
77
|
+
|
|
78
|
+
}
|
|
79
|
+
copy?: any[]
|
|
80
|
+
define?: {
|
|
81
|
+
|
|
82
|
+
}
|
|
83
|
+
devScripts?: {
|
|
84
|
+
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* devServer configs
|
|
88
|
+
*/
|
|
89
|
+
devServer?: {
|
|
90
|
+
/**
|
|
91
|
+
* devServer port, default 8000
|
|
92
|
+
*/
|
|
93
|
+
port?: number
|
|
94
|
+
host?: string
|
|
95
|
+
https?: ({
|
|
96
|
+
key?: string
|
|
97
|
+
cert?: string
|
|
98
|
+
http2?: boolean
|
|
99
|
+
[k: string]: any
|
|
100
|
+
} | boolean)
|
|
101
|
+
headers?: {
|
|
102
|
+
|
|
103
|
+
}
|
|
104
|
+
writeToDisk?: (boolean | (() => any))
|
|
105
|
+
[k: string]: any
|
|
106
|
+
}
|
|
107
|
+
devtool?: string
|
|
108
|
+
/**
|
|
109
|
+
* Code splitting for performance optimization
|
|
110
|
+
*/
|
|
111
|
+
dynamicImport?: {
|
|
112
|
+
/**
|
|
113
|
+
* loading the component before loaded
|
|
114
|
+
*/
|
|
115
|
+
loading?: string
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Code splitting for import statement syntax
|
|
119
|
+
*/
|
|
120
|
+
dynamicImportSyntax?: {
|
|
121
|
+
|
|
122
|
+
}
|
|
123
|
+
exportStatic?: {
|
|
124
|
+
htmlSuffix?: boolean
|
|
125
|
+
dynamicRoot?: boolean
|
|
126
|
+
supportWin?: boolean
|
|
127
|
+
/**
|
|
128
|
+
* extra render paths only enable in ssr
|
|
129
|
+
*/
|
|
130
|
+
extraRoutePaths?: (() => any)
|
|
131
|
+
}
|
|
132
|
+
externals?: ({
|
|
133
|
+
|
|
134
|
+
} | string | (() => any))
|
|
135
|
+
extraBabelIncludes?: any[]
|
|
136
|
+
extraBabelPlugins?: any[]
|
|
137
|
+
extraBabelPresets?: any[]
|
|
138
|
+
extraPostCSSPlugins?: any[]
|
|
139
|
+
/**
|
|
140
|
+
* fork-ts-checker-webpack-plugin options see https://github.com/TypeStrong/fork-ts-checker-webpack-plugin#options
|
|
141
|
+
*/
|
|
142
|
+
forkTSChecker?: {
|
|
143
|
+
async?: boolean
|
|
144
|
+
typescript?: (boolean | {
|
|
145
|
+
|
|
146
|
+
})
|
|
147
|
+
eslint?: {
|
|
148
|
+
|
|
149
|
+
}
|
|
150
|
+
issue?: {
|
|
151
|
+
|
|
152
|
+
}
|
|
153
|
+
formatter?: (string | {
|
|
154
|
+
|
|
155
|
+
})
|
|
156
|
+
logger?: {
|
|
157
|
+
|
|
158
|
+
}
|
|
159
|
+
[k: string]: any
|
|
160
|
+
}
|
|
161
|
+
fastRefresh?: {
|
|
162
|
+
|
|
163
|
+
}
|
|
164
|
+
hash?: boolean
|
|
165
|
+
ignoreMomentLocale?: boolean
|
|
166
|
+
inlineLimit?: number
|
|
167
|
+
lessLoader?: {
|
|
168
|
+
|
|
169
|
+
}
|
|
170
|
+
manifest?: {
|
|
171
|
+
fileName?: string
|
|
172
|
+
publicPath?: ""
|
|
173
|
+
basePath?: string
|
|
174
|
+
writeToFileEmit?: boolean
|
|
175
|
+
}
|
|
176
|
+
/**
|
|
177
|
+
* open mfsu feature
|
|
178
|
+
*/
|
|
179
|
+
mfsu?: {
|
|
180
|
+
development?: {
|
|
181
|
+
output?: string
|
|
182
|
+
}
|
|
183
|
+
production?: {
|
|
184
|
+
output?: string
|
|
185
|
+
}
|
|
186
|
+
mfName?: string
|
|
187
|
+
exportAllMembers?: {
|
|
188
|
+
|
|
189
|
+
}
|
|
190
|
+
chunks?: string[]
|
|
191
|
+
ignoreNodeBuiltInModules?: boolean
|
|
192
|
+
}
|
|
193
|
+
mountElementId?: ""
|
|
194
|
+
mpa?: {
|
|
195
|
+
|
|
196
|
+
}
|
|
197
|
+
nodeModulesTransform?: {
|
|
198
|
+
type?: ("all" | "none")
|
|
199
|
+
exclude?: string[]
|
|
200
|
+
}
|
|
201
|
+
outputPath?: ""
|
|
202
|
+
plugins?: string[]
|
|
203
|
+
postcssLoader?: {
|
|
204
|
+
|
|
205
|
+
}
|
|
206
|
+
presets?: string[]
|
|
207
|
+
proxy?: {
|
|
208
|
+
|
|
209
|
+
}
|
|
210
|
+
publicPath?: string
|
|
211
|
+
runtimePublicPath?: boolean
|
|
212
|
+
ssr?: {
|
|
213
|
+
/**
|
|
214
|
+
* force execing Page getInitialProps functions
|
|
215
|
+
*/
|
|
216
|
+
forceInitial?: boolean
|
|
217
|
+
/**
|
|
218
|
+
* remove window.g_initialProps in html
|
|
219
|
+
*/
|
|
220
|
+
removeWindowInitialProps?: boolean
|
|
221
|
+
/**
|
|
222
|
+
* disable serve-side render in umi dev mode.
|
|
223
|
+
*/
|
|
224
|
+
devServerRender?: boolean
|
|
225
|
+
mode?: ("stream" | "string")
|
|
226
|
+
/**
|
|
227
|
+
* static markup in static site
|
|
228
|
+
*/
|
|
229
|
+
staticMarkup?: boolean
|
|
230
|
+
}
|
|
231
|
+
singular?: boolean
|
|
232
|
+
styleLoader?: {
|
|
233
|
+
|
|
234
|
+
}
|
|
235
|
+
targets?: {
|
|
236
|
+
|
|
237
|
+
}
|
|
238
|
+
terserOptions?: {
|
|
239
|
+
|
|
240
|
+
}
|
|
241
|
+
theme?: {
|
|
242
|
+
|
|
243
|
+
}
|
|
244
|
+
runtimeHistory?: {
|
|
245
|
+
|
|
246
|
+
}
|
|
247
|
+
webpack5?: {
|
|
248
|
+
lazyCompilation?: {
|
|
249
|
+
entries?: boolean
|
|
250
|
+
imports?: boolean
|
|
251
|
+
test?: any
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
workerLoader?: {
|
|
255
|
+
|
|
256
|
+
}
|
|
257
|
+
favicon?: string
|
|
258
|
+
headScripts?: any[]
|
|
259
|
+
links?: any[]
|
|
260
|
+
metas?: any[]
|
|
261
|
+
scripts?: any[]
|
|
262
|
+
styles?: any[]
|
|
263
|
+
title?: string
|
|
264
|
+
mock?: {
|
|
265
|
+
exclude?: string[]
|
|
266
|
+
}
|
|
267
|
+
antd?: {
|
|
268
|
+
dark?: boolean
|
|
269
|
+
compact?: boolean
|
|
270
|
+
mobile?: boolean
|
|
271
|
+
disableBabelPluginImport?: boolean
|
|
272
|
+
config?: {
|
|
273
|
+
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
dva?: {
|
|
277
|
+
disableModelsReExport?: boolean
|
|
278
|
+
/**
|
|
279
|
+
* lazy load dva model avoiding the import modules from umi undefined
|
|
280
|
+
*/
|
|
281
|
+
lazyLoad?: boolean
|
|
282
|
+
extraModels?: string[]
|
|
283
|
+
hmr?: boolean
|
|
284
|
+
immer?: (boolean | {
|
|
285
|
+
|
|
286
|
+
})
|
|
287
|
+
skipModelValidate?: boolean
|
|
288
|
+
}
|
|
289
|
+
locale?: {
|
|
290
|
+
default?: string
|
|
291
|
+
useLocalStorage?: boolean
|
|
292
|
+
baseNavigator?: boolean
|
|
293
|
+
title?: boolean
|
|
294
|
+
antd?: boolean
|
|
295
|
+
baseSeparator?: string
|
|
296
|
+
}
|
|
297
|
+
layout?: {
|
|
298
|
+
|
|
299
|
+
}
|
|
300
|
+
request?: {
|
|
301
|
+
dataField?: ""
|
|
302
|
+
}
|
|
303
|
+
[k: string]: any
|
|
304
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
// @ts-nocheck
|
|
2
|
+
import { plugin } from './plugin';
|
|
3
|
+
import * as Plugin_0 from '../plugin-initial-state/runtime';
|
|
4
|
+
import * as Plugin_1 from '../plugin-model/runtime';
|
|
5
|
+
|
|
6
|
+
plugin.register({
|
|
7
|
+
apply: Plugin_0,
|
|
8
|
+
path: '../plugin-initial-state/runtime',
|
|
9
|
+
});
|
|
10
|
+
plugin.register({
|
|
11
|
+
apply: Plugin_1,
|
|
12
|
+
path: '../plugin-model/runtime',
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
export const __mfsu = 1;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
// @ts-nocheck
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { ApplyPluginsType } from '/Users/le/Desktop/work/compact-bigdata/module-menu/node_modules/@umijs/runtime';
|
|
4
|
+
import * as umiExports from './umiExports';
|
|
5
|
+
import { plugin } from './plugin';
|
|
6
|
+
|
|
7
|
+
export function getRoutes() {
|
|
8
|
+
const routes = [
|
|
9
|
+
{
|
|
10
|
+
"path": "/",
|
|
11
|
+
"component": require('@/pages/index').default,
|
|
12
|
+
"exact": true
|
|
13
|
+
}
|
|
14
|
+
];
|
|
15
|
+
|
|
16
|
+
// allow user to extend routes
|
|
17
|
+
plugin.applyPlugins({
|
|
18
|
+
key: 'patchRoutes',
|
|
19
|
+
type: ApplyPluginsType.event,
|
|
20
|
+
args: { routes },
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
return routes;
|
|
24
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
// @ts-nocheck
|
|
2
|
+
export { history } from './history';
|
|
3
|
+
export { plugin } from './plugin';
|
|
4
|
+
export * from '../plugin-initial-state/exports';
|
|
5
|
+
export * from '../plugin-model/useModel';
|
|
6
|
+
export * from '../plugin-request/request';
|
|
7
|
+
export * from '../plugin-helmet/exports';
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
// @ts-nocheck
|
|
2
|
+
|
|
3
|
+
import React, { useRef, useEffect } from "react";
|
|
4
|
+
import { plugin } from "../core/umiExports";
|
|
5
|
+
import { ApplyPluginsType } from 'umi';
|
|
6
|
+
import { useModel } from "../plugin-model/useModel";
|
|
7
|
+
if (typeof useModel !== "function") {
|
|
8
|
+
throw new Error(
|
|
9
|
+
"[plugin-initial-state]: useModel is not a function, @umijs/plugin-model is required."
|
|
10
|
+
);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
interface Props {
|
|
14
|
+
children: React.ReactNode;
|
|
15
|
+
}
|
|
16
|
+
export default (props: Props) => {
|
|
17
|
+
const { children } = props;
|
|
18
|
+
const appLoaded = useRef(false);
|
|
19
|
+
// 获取用户的配置,暂时只支持 loading
|
|
20
|
+
const useRuntimeConfig =
|
|
21
|
+
plugin.applyPlugins({
|
|
22
|
+
key: "initialStateConfig",
|
|
23
|
+
type: ApplyPluginsType.modify,
|
|
24
|
+
initialValue: {},
|
|
25
|
+
}) || {};
|
|
26
|
+
const { loading = false } = useModel("@@initialState") || {};
|
|
27
|
+
useEffect(() => {
|
|
28
|
+
if (!loading) {
|
|
29
|
+
appLoaded.current = true;
|
|
30
|
+
}
|
|
31
|
+
}, [loading]);
|
|
32
|
+
// initial state loading 时,阻塞渲染
|
|
33
|
+
if (loading && !appLoaded.current) {
|
|
34
|
+
return useRuntimeConfig.loading || null;
|
|
35
|
+
}
|
|
36
|
+
return children;
|
|
37
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
// @ts-nocheck
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import Provider from './Provider';
|
|
4
|
+
|
|
5
|
+
export function rootContainer(container: React.ReactNode) {
|
|
6
|
+
return React.createElement(
|
|
7
|
+
// 这里的 plugin-initial-state 不能从 constant 里取,里面有 path 依赖
|
|
8
|
+
// 但 webpack-5 没有 node 补丁(包括 path)
|
|
9
|
+
Provider,
|
|
10
|
+
null,
|
|
11
|
+
container,
|
|
12
|
+
);
|
|
13
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
// @ts-nocheck
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import initialState from '/Users/le/Desktop/work/compact-bigdata/module-menu/src/.umi/plugin-initial-state/models/initialState';
|
|
4
|
+
|
|
5
|
+
// @ts-ignore
|
|
6
|
+
import Dispatcher from './helpers/dispatcher';
|
|
7
|
+
// @ts-ignore
|
|
8
|
+
import Executor from './helpers/executor';
|
|
9
|
+
// @ts-ignore
|
|
10
|
+
import { UmiContext } from './helpers/constant';
|
|
11
|
+
|
|
12
|
+
export const models = { '@@initialState': initialState, };
|
|
13
|
+
|
|
14
|
+
export type Model<T extends keyof typeof models> = {
|
|
15
|
+
[key in keyof typeof models]: ReturnType<typeof models[T]>;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export type Models<T extends keyof typeof models> = Model<T>[T]
|
|
19
|
+
|
|
20
|
+
const dispatcher = new Dispatcher!();
|
|
21
|
+
const Exe = Executor!;
|
|
22
|
+
|
|
23
|
+
export default ({ children }: { children: React.ReactNode }) => {
|
|
24
|
+
|
|
25
|
+
return (
|
|
26
|
+
<UmiContext.Provider value={dispatcher}>
|
|
27
|
+
{
|
|
28
|
+
Object.entries(models).map(pair => (
|
|
29
|
+
<Exe key={pair[0]} namespace={pair[0]} hook={pair[1] as any} onUpdate={(val: any) => {
|
|
30
|
+
const [ns] = pair as [keyof typeof models, any];
|
|
31
|
+
dispatcher.data[ns] = val;
|
|
32
|
+
dispatcher.update(ns);
|
|
33
|
+
}} />
|
|
34
|
+
))
|
|
35
|
+
}
|
|
36
|
+
{children}
|
|
37
|
+
</UmiContext.Provider>
|
|
38
|
+
)
|
|
39
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
// @ts-nocheck
|
|
2
|
+
export default class Dispatcher {
|
|
3
|
+
callbacks = {};
|
|
4
|
+
|
|
5
|
+
data = {};
|
|
6
|
+
|
|
7
|
+
update = (namespace: string) => {
|
|
8
|
+
(this.callbacks[namespace] || []).forEach(
|
|
9
|
+
(callback: (val: any) => void) => {
|
|
10
|
+
try {
|
|
11
|
+
const data = this.data[namespace];
|
|
12
|
+
callback(data);
|
|
13
|
+
} catch (e) {
|
|
14
|
+
callback(undefined);
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
);
|
|
18
|
+
};
|
|
19
|
+
}
|