aldehyde 0.2.478 → 0.2.479
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/lib/controls/2dEditor/components/image.js +1 -1
- package/lib/controls/2dEditor/components/image.js.map +1 -1
- package/lib/controls/upload/index.js +1 -1
- package/lib/controls/upload/index.js.map +1 -1
- package/lib/controls/upload/mult-file-upload.js +2 -2
- package/lib/controls/upload/mult-file-upload.js.map +1 -1
- package/lib/draw-canvas-edit/components/asset-bar/index.js +1 -1
- package/lib/draw-canvas-edit/components/asset-bar/index.js.map +1 -1
- package/lib/draw-canvas-edit/components/render/index.d.ts.map +1 -1
- package/lib/draw-canvas-edit/components/render/index.js +1 -1
- package/lib/draw-canvas-edit/components/render/index.js.map +1 -1
- package/lib/draw-canvas-edit/components/setting-form/imag-upload.js +1 -1
- package/lib/draw-canvas-edit/components/setting-form/imag-upload.js.map +1 -1
- package/lib/draw-canvas-edit/index.d.ts.map +1 -1
- package/lib/draw-canvas-edit/index.js +2 -1
- package/lib/draw-canvas-edit/index.js.map +1 -1
- package/lib/export/export-frame.d.ts.map +1 -1
- package/lib/export/export-frame.js +1 -1
- package/lib/export/export-frame.js.map +1 -1
- package/lib/export/select-code-export-frame.js +1 -1
- package/lib/export/select-code-export-frame.js.map +1 -1
- package/lib/import/excel-import.d.ts.map +1 -1
- package/lib/import/excel-import.js +1 -1
- package/lib/import/excel-import.js.map +1 -1
- package/lib/layout2/page.d.ts +1 -1
- package/lib/layout2/page.d.ts.map +1 -1
- package/lib/layout2/page.js +17 -4
- package/lib/layout2/page.js.map +1 -1
- package/lib/layout3/page.js +1 -1
- package/lib/layout3/page.js.map +1 -1
- package/lib/layout4/page.js +1 -1
- package/lib/layout4/page.js.map +1 -1
- package/lib/layout5/page.js +1 -1
- package/lib/layout5/page.js.map +1 -1
- package/lib/login/login.d.ts +1 -0
- package/lib/login/login.d.ts.map +1 -1
- package/lib/login/login.js +8 -6
- package/lib/login/login.js.map +1 -1
- package/lib/login2/login.d.ts +1 -0
- package/lib/login2/login.d.ts.map +1 -1
- package/lib/login2/login.js +10 -9
- package/lib/login2/login.js.map +1 -1
- package/lib/lowcode-components/base-button/index.js +1 -1
- package/lib/lowcode-components/base-button/index.js.map +1 -1
- package/lib/lowcode-components/base-image/index.js +1 -1
- package/lib/lowcode-components/base-image/index.js.map +1 -1
- package/lib/lowcode-components/base-map/index.js +1 -1
- package/lib/lowcode-components/base-map/index.js.map +1 -1
- package/lib/lowcode-components/base-tabs/index.js +1 -1
- package/lib/lowcode-components/base-tabs/index.js.map +1 -1
- package/lib/lowcode-components/carousel/index.js +1 -1
- package/lib/lowcode-components/carousel/index.js.map +1 -1
- package/lib/lowcode-components/effectScatter-map/index.js +1 -1
- package/lib/lowcode-components/effectScatter-map/index.js.map +1 -1
- package/lib/lowcode-components/effectScatter-map-3d/index.js +1 -1
- package/lib/lowcode-components/effectScatter-map-3d/index.js.map +1 -1
- package/lib/lowcode-components/lowcode-view/index.js +1 -1
- package/lib/lowcode-components/lowcode-view/index.js.map +1 -1
- package/lib/lowcode-components/radar-chart/index.js +3 -3
- package/lib/lowcode-components/radar-chart/index.js.map +1 -1
- package/lib/sso-Login/index.d.ts.map +1 -1
- package/lib/sso-Login/index.js +4 -3
- package/lib/sso-Login/index.js.map +1 -1
- package/lib/sso-Login/service/index.d.ts.map +1 -1
- package/lib/sso-Login/service/index.js +2 -1
- package/lib/sso-Login/service/index.js.map +1 -1
- package/lib/sso-Login/service/login.js +8 -7
- package/lib/sso-Login/service/login.js.map +1 -1
- package/lib/tmpl/hcservice-v3.d.ts +7 -7
- package/lib/tmpl/hcservice-v3.d.ts.map +1 -1
- package/lib/tmpl/hcservice-v3.js +22 -17
- package/lib/tmpl/hcservice-v3.js.map +1 -1
- package/lib/tmpl/interface.d.ts +1 -0
- package/lib/tmpl/interface.d.ts.map +1 -1
- package/lib/tmpl/superagent.d.ts +1 -0
- package/lib/tmpl/superagent.d.ts.map +1 -1
- package/lib/tmpl/superagent.js +7 -3
- package/lib/tmpl/superagent.js.map +1 -1
- package/lib/units/index.d.ts +7 -4
- package/lib/units/index.d.ts.map +1 -1
- package/lib/units/index.js +64 -22
- package/lib/units/index.js.map +1 -1
- package/lib/welcome/HCWelcome.js +4 -2
- package/lib/welcome/HCWelcome.js.map +1 -1
- package/package.json +1 -1
- package/src/aldehyde/controls/2dEditor/components/image.tsx +1 -1
- package/src/aldehyde/controls/upload/index.tsx +1 -1
- package/src/aldehyde/controls/upload/mult-file-upload.tsx +2 -2
- package/src/aldehyde/draw-canvas-edit/components/asset-bar/index.tsx +1 -1
- package/src/aldehyde/draw-canvas-edit/components/render/index.ts +1 -1
- package/src/aldehyde/draw-canvas-edit/components/setting-form/imag-upload.tsx +1 -1
- package/src/aldehyde/draw-canvas-edit/index.tsx +2 -1
- package/src/aldehyde/export/export-frame.tsx +27 -27
- package/src/aldehyde/export/select-code-export-frame.tsx +1 -1
- package/src/aldehyde/import/excel-import.tsx +9 -9
- package/src/aldehyde/layout2/page.tsx +16 -4
- package/src/aldehyde/layout3/page.tsx +1 -1
- package/src/aldehyde/layout4/page.tsx +1 -1
- package/src/aldehyde/layout5/page.tsx +1 -1
- package/src/aldehyde/login/login.tsx +113 -110
- package/src/aldehyde/login2/login.tsx +14 -8
- package/src/aldehyde/lowcode-components/base-button/index.tsx +1 -1
- package/src/aldehyde/lowcode-components/base-image/index.tsx +1 -1
- package/src/aldehyde/lowcode-components/base-map/index.tsx +1 -1
- package/src/aldehyde/lowcode-components/base-tabs/index.tsx +1 -1
- package/src/aldehyde/lowcode-components/carousel/index.tsx +1 -1
- package/src/aldehyde/lowcode-components/effectScatter-map/index.tsx +1 -1
- package/src/aldehyde/lowcode-components/effectScatter-map-3d/index.tsx +1 -1
- package/src/aldehyde/lowcode-components/lowcode-view/index.tsx +1 -1
- package/src/aldehyde/lowcode-components/radar-chart/index.tsx +3 -3
- package/src/aldehyde/sso-Login/index.tsx +4 -3
- package/src/aldehyde/sso-Login/service/index.js +2 -1
- package/src/aldehyde/sso-Login/service/login.js +8 -7
- package/src/aldehyde/tmpl/hcservice-v3.tsx +23 -16
- package/src/aldehyde/tmpl/interface.tsx +1 -0
- package/src/aldehyde/tmpl/superagent.js +6 -2
- package/src/aldehyde/units/index.tsx +65 -28
- package/src/aldehyde/welcome/HCWelcome.js +3 -2
|
@@ -7,18 +7,18 @@ import { PageInfo, QueryKey } from "../tmpl/interface";
|
|
|
7
7
|
import { LocaleContext } from "../locale/LocaleProvider";
|
|
8
8
|
const RadioGroup = Radio.Group;
|
|
9
9
|
export type ExportStatus = "ready" | "exporting" | "success" | "fail" | "stop";
|
|
10
|
-
export type ExportMode = "current"|"page"| "all";
|
|
11
|
-
export
|
|
10
|
+
export type ExportMode = "current" | "page" | "all";
|
|
11
|
+
export type ExportType = "ltmpl-data-excel" | "ltmpl-data-filedata";
|
|
12
12
|
|
|
13
13
|
interface ExportFrameProps {
|
|
14
14
|
defaultExportMode?: string;
|
|
15
15
|
serverKey?: string;
|
|
16
|
-
sourceId?:string;
|
|
16
|
+
sourceId?: string;
|
|
17
17
|
queryKey: QueryKey;
|
|
18
18
|
currentPage?: PageInfo;
|
|
19
19
|
title: string;
|
|
20
|
-
type:ExportType;
|
|
21
|
-
exportModes:ExportMode[];
|
|
20
|
+
type: ExportType;
|
|
21
|
+
exportModes: ExportMode[];
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
interface ExportFrameStat {
|
|
@@ -41,8 +41,8 @@ export default class ExportFrame extends React.PureComponent<
|
|
|
41
41
|
> {
|
|
42
42
|
static defaultProps = {
|
|
43
43
|
defaultExportMode: "all",
|
|
44
|
-
type:"ltmpl-data-excel",
|
|
45
|
-
exportModes:["current","page","all"],
|
|
44
|
+
type: "ltmpl-data-excel",
|
|
45
|
+
exportModes: ["current", "page", "all"],
|
|
46
46
|
};
|
|
47
47
|
|
|
48
48
|
state = {
|
|
@@ -84,16 +84,16 @@ export default class ExportFrame extends React.PureComponent<
|
|
|
84
84
|
};
|
|
85
85
|
|
|
86
86
|
shouldComponentUpdate(prevProps, prevState) {
|
|
87
|
-
if(prevProps && prevProps.queryKey && this.props.queryKey){
|
|
88
|
-
if(this.props.queryKey?.key!=prevProps.queryKey?.key){
|
|
89
|
-
this.setState({exportStatus:'ready',percent:0,exportingMsg:"",exportMode:"all"})
|
|
87
|
+
if (prevProps && prevProps.queryKey && this.props.queryKey) {
|
|
88
|
+
if (this.props.queryKey?.key != prevProps.queryKey?.key) {
|
|
89
|
+
this.setState({ exportStatus: 'ready', percent: 0, exportingMsg: "", exportMode: "all" })
|
|
90
90
|
}
|
|
91
91
|
}
|
|
92
92
|
return true;
|
|
93
93
|
}
|
|
94
94
|
|
|
95
95
|
handleStart = () => {
|
|
96
|
-
const { queryKey, currentPage, title, serverKey,type,sourceId } = this.props;
|
|
96
|
+
const { queryKey, currentPage, title, serverKey, type, sourceId } = this.props;
|
|
97
97
|
const { startPageNo, endPageNo, exportMode } = this.state;
|
|
98
98
|
|
|
99
99
|
this.setState({
|
|
@@ -106,7 +106,7 @@ export default class ExportFrame extends React.PureComponent<
|
|
|
106
106
|
method: "GET",
|
|
107
107
|
query: {
|
|
108
108
|
sourceId,
|
|
109
|
-
language:getServiceLangStr(),
|
|
109
|
+
language: getServiceLangStr(),
|
|
110
110
|
scope: exportMode,
|
|
111
111
|
withDetail: false,
|
|
112
112
|
queryKey: queryKey.key,
|
|
@@ -188,7 +188,7 @@ export default class ExportFrame extends React.PureComponent<
|
|
|
188
188
|
Units.api(serverKey),
|
|
189
189
|
`/v3/export/download?exportId=${exportId}&@token=${hydrocarbonToken}&@programToken=${Units.programCode(
|
|
190
190
|
serverKey
|
|
191
|
-
)}`
|
|
191
|
+
)}&@applicationToken=${Units.applicationCode(serverKey)}`
|
|
192
192
|
),
|
|
193
193
|
title
|
|
194
194
|
);
|
|
@@ -203,7 +203,7 @@ export default class ExportFrame extends React.PureComponent<
|
|
|
203
203
|
};
|
|
204
204
|
|
|
205
205
|
render() {
|
|
206
|
-
const { defaultExportMode, currentPage,exportModes } = this.props;
|
|
206
|
+
const { defaultExportMode, currentPage, exportModes } = this.props;
|
|
207
207
|
const {
|
|
208
208
|
startPageNo,
|
|
209
209
|
endPageNo,
|
|
@@ -219,20 +219,20 @@ export default class ExportFrame extends React.PureComponent<
|
|
|
219
219
|
<div style={{ width: "400px" }} className="exportFrame">
|
|
220
220
|
{
|
|
221
221
|
<>
|
|
222
|
-
|
|
222
|
+
<RadioGroup
|
|
223
223
|
onChange={this.onChangeRadio}
|
|
224
224
|
value={exportMode}
|
|
225
225
|
defaultValue={defaultExportMode}
|
|
226
226
|
>
|
|
227
|
-
|
|
227
|
+
{exportModes.includes("current") ? <Radio value={"current"} disabled={exportStatus == "exporting"}>
|
|
228
228
|
{translate("${当前页}")}
|
|
229
|
-
</Radio
|
|
230
|
-
|
|
229
|
+
</Radio> : null}
|
|
230
|
+
{exportModes.includes("page") ? <Radio value={"page"} disabled={exportStatus == "exporting"}>
|
|
231
231
|
{translate("${多页}")}
|
|
232
|
-
</Radio
|
|
233
|
-
|
|
232
|
+
</Radio> : null}
|
|
233
|
+
{exportModes.includes("all") ? <Radio value={"all"} disabled={exportStatus == "exporting"}>
|
|
234
234
|
{translate("${全部}")}
|
|
235
|
-
</Radio
|
|
235
|
+
</Radio> : null}
|
|
236
236
|
</RadioGroup>
|
|
237
237
|
<Divider />
|
|
238
238
|
</>
|
|
@@ -262,11 +262,11 @@ export default class ExportFrame extends React.PureComponent<
|
|
|
262
262
|
)}
|
|
263
263
|
<div>
|
|
264
264
|
{exportStatus == "ready" ? (
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
265
|
+
<>
|
|
266
|
+
<Button type="primary" onClick={this.handleStart}>
|
|
267
|
+
{translate("${开始导出}")}
|
|
268
|
+
</Button>
|
|
269
|
+
</>
|
|
270
270
|
) : exportStatus == "exporting" ? (
|
|
271
271
|
<Button onClick={this.handleCancel}>
|
|
272
272
|
{translate("${取消导出}")}
|
|
@@ -293,7 +293,7 @@ export default class ExportFrame extends React.PureComponent<
|
|
|
293
293
|
) : (
|
|
294
294
|
""
|
|
295
295
|
)}
|
|
296
|
-
<p>{translate("${"+exportingMsg+"}")}</p>
|
|
296
|
+
<p>{translate("${" + exportingMsg + "}")}</p>
|
|
297
297
|
</div>
|
|
298
298
|
</div>
|
|
299
299
|
);
|
|
@@ -146,7 +146,7 @@ export default class SelectCodeExportFrame extends React.PureComponent<
|
|
|
146
146
|
Units.api(serverKey),
|
|
147
147
|
`/v3/export/download?exportId=${exportId}&@token=${hydrocarbonToken}&@programToken=${Units.programCode(
|
|
148
148
|
serverKey
|
|
149
|
-
)}`
|
|
149
|
+
)}&@applicationToken=${Units.applicationCode(serverKey)}`
|
|
150
150
|
),
|
|
151
151
|
fileExport.title
|
|
152
152
|
);
|
|
@@ -57,7 +57,7 @@ interface ExcelImportStat {
|
|
|
57
57
|
importFile?: any;
|
|
58
58
|
logSerialId?: string;
|
|
59
59
|
ltmplConfig?: LtmplConfig;
|
|
60
|
-
msgIndex?:number;
|
|
60
|
+
msgIndex?: number;
|
|
61
61
|
}
|
|
62
62
|
|
|
63
63
|
export default class ExcelImport extends React.PureComponent<
|
|
@@ -76,7 +76,7 @@ export default class ExcelImport extends React.PureComponent<
|
|
|
76
76
|
showLogLevelList: [...logLevelList],
|
|
77
77
|
logSerialId: undefined,
|
|
78
78
|
ltmplConfig: undefined,
|
|
79
|
-
msgIndex:0,
|
|
79
|
+
msgIndex: 0,
|
|
80
80
|
};
|
|
81
81
|
static contextType = LocaleContext;
|
|
82
82
|
context: React.ContextType<typeof LocaleContext>;
|
|
@@ -126,7 +126,7 @@ export default class ExcelImport extends React.PureComponent<
|
|
|
126
126
|
});
|
|
127
127
|
this.timerId = setInterval(() => this.handleStatus(res.importId), 500);
|
|
128
128
|
} else {
|
|
129
|
-
message.error(translate("${失败}!"),5);
|
|
129
|
+
message.error(translate("${失败}!"), 5);
|
|
130
130
|
this.setState({
|
|
131
131
|
importStatus: "fail",
|
|
132
132
|
});
|
|
@@ -142,7 +142,7 @@ export default class ExcelImport extends React.PureComponent<
|
|
|
142
142
|
|
|
143
143
|
handleStatus = (importId) => {
|
|
144
144
|
const { serverKey } = this.props;
|
|
145
|
-
const { maxMsgCount, importStatus, logs,msgIndex } = this.state;
|
|
145
|
+
const { maxMsgCount, importStatus, logs, msgIndex } = this.state;
|
|
146
146
|
const { translate } = this.context;
|
|
147
147
|
Super.super(
|
|
148
148
|
{
|
|
@@ -214,7 +214,7 @@ export default class ExcelImport extends React.PureComponent<
|
|
|
214
214
|
: loggs;
|
|
215
215
|
this.setState({
|
|
216
216
|
statusMsg: res.message,
|
|
217
|
-
msgIndex:res.messageSequence?.messages?.length ? msgIndex+res.messageSequence?.messages.length:msgIndex,
|
|
217
|
+
msgIndex: res.messageSequence?.messages?.length ? msgIndex + res.messageSequence?.messages.length : msgIndex,
|
|
218
218
|
percent,
|
|
219
219
|
importStatus: percent == 100 ? "success" : "importing",
|
|
220
220
|
logs: loggs,
|
|
@@ -263,7 +263,7 @@ export default class ExcelImport extends React.PureComponent<
|
|
|
263
263
|
Units.api(serverKey),
|
|
264
264
|
`/v3/ltmpl/importer/template?sourceId=${sourceId}&@token=${hydrocarbonToken}&@programToken=${Units.programCode(
|
|
265
265
|
serverKey
|
|
266
|
-
)}`
|
|
266
|
+
)}&@applicationToken=${Units.applicationCode(serverKey)}`
|
|
267
267
|
),
|
|
268
268
|
"导入模板.xlsx"
|
|
269
269
|
);
|
|
@@ -292,7 +292,7 @@ export default class ExcelImport extends React.PureComponent<
|
|
|
292
292
|
const props = {
|
|
293
293
|
accept:
|
|
294
294
|
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,application/vnd.ms-excel,application/vnd.ms-excel",
|
|
295
|
-
onChange: () => {},
|
|
295
|
+
onChange: () => { },
|
|
296
296
|
onRemove: (file) => {
|
|
297
297
|
this.setState({
|
|
298
298
|
importFile: undefined,
|
|
@@ -370,8 +370,8 @@ export default class ExcelImport extends React.PureComponent<
|
|
|
370
370
|
{importStatus == "importing"
|
|
371
371
|
? translate("${正在导入}")
|
|
372
372
|
: importStatus == "stop"
|
|
373
|
-
|
|
374
|
-
|
|
373
|
+
? translate("${重新导入}")
|
|
374
|
+
: translate("${开始导入}")}
|
|
375
375
|
</Button>
|
|
376
376
|
<Button
|
|
377
377
|
onClick={this.handleStopImport}
|
|
@@ -28,13 +28,25 @@ type PagePropsType = {
|
|
|
28
28
|
};
|
|
29
29
|
|
|
30
30
|
// 跳转主题指定首页
|
|
31
|
-
export const routeNavigationThemeHome = (theme: ThemeConfig, menus: MenuType[], pathname: string, navigate: NavigateFunction, closeTab) => {
|
|
31
|
+
export const routeNavigationThemeHome = (theme: ThemeConfig, menus: MenuType[], pathname: string, navigate: NavigateFunction, closeTab, version?: string) => {
|
|
32
32
|
const defHomePath = ["/home", "/home/"];
|
|
33
33
|
const isHome = defHomePath.some(r => pathname.endsWith(r));
|
|
34
|
-
|
|
34
|
+
const { homeSourceId, homePageUrl } = theme || {};
|
|
35
|
+
if (isHome && homePageUrl) { // 首页自定义链接
|
|
36
|
+
if (homePageUrl.startsWith("http")) {
|
|
37
|
+
window.open(homePageUrl, "_self");
|
|
38
|
+
return homePageUrl;
|
|
39
|
+
} else {
|
|
40
|
+
// version 版本路由 v2/v3/v4/v5
|
|
41
|
+
const temUrl = homePageUrl.startsWith("/") ? `/${version}${homePageUrl}` : `/${version}/${homePageUrl}`;
|
|
42
|
+
navigate(temUrl, { replace: true });
|
|
43
|
+
return temUrl;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
if (!homeSourceId || !menus?.length) {
|
|
35
47
|
return;
|
|
36
48
|
}
|
|
37
|
-
const item = Units.findItemByIdIterative(menus,
|
|
49
|
+
const item = Units.findItemByIdIterative(menus, homeSourceId);
|
|
38
50
|
if (!item) {
|
|
39
51
|
return;
|
|
40
52
|
}
|
|
@@ -241,7 +253,7 @@ const Page: React.FC<PagePropsType> = (props: PagePropsType) => {
|
|
|
241
253
|
SetMenu(menuConfig?.menu);
|
|
242
254
|
updateMenuItemIdToFirstFloorIdxMap(menuConfig?.menu);
|
|
243
255
|
setThemeConfig(tConfig);
|
|
244
|
-
const temCustomHome = routeNavigationThemeHome(tConfig, menuConfig?.menu, pathname, navigate, closeTab);
|
|
256
|
+
const temCustomHome = routeNavigationThemeHome(tConfig, menuConfig?.menu, pathname, navigate, closeTab, "v2");
|
|
245
257
|
setCustomHome(temCustomHome);
|
|
246
258
|
};
|
|
247
259
|
|
|
@@ -46,7 +46,7 @@ const Page: React.FC<PagePropsType> = (props: PagePropsType) => {
|
|
|
46
46
|
setMenu(menuConfig?.menu);
|
|
47
47
|
updateMenuItemIdToFirstFloorIdxMap(menuConfig?.menu);
|
|
48
48
|
setThemeConfig(tConfig);
|
|
49
|
-
const temCustomHome = routeNavigationThemeHome(tConfig, menuConfig?.menu, pathname, navigate, closeTab);
|
|
49
|
+
const temCustomHome = routeNavigationThemeHome(tConfig, menuConfig?.menu, pathname, navigate, closeTab, "v3");
|
|
50
50
|
setCustomHome(temCustomHome);
|
|
51
51
|
};
|
|
52
52
|
|
|
@@ -51,7 +51,7 @@ const Page: React.FC<PagePropsType> = (props: PagePropsType) => {
|
|
|
51
51
|
setMenu(menuConfig?.menu);
|
|
52
52
|
updateMenuItemIdToFirstFloorIdxMap(menuConfig?.menu);
|
|
53
53
|
setThemeConfig(tConfig);
|
|
54
|
-
const temCustomHome = routeNavigationThemeHome(tConfig, menuConfig?.menu, pathname, navigate, closeTab);
|
|
54
|
+
const temCustomHome = routeNavigationThemeHome(tConfig, menuConfig?.menu, pathname, navigate, closeTab, "v4");
|
|
55
55
|
setCustomHome(temCustomHome);
|
|
56
56
|
};
|
|
57
57
|
|
|
@@ -50,7 +50,7 @@ const Page: React.FC<PagePropsType> = (props: PagePropsType) => {
|
|
|
50
50
|
setMenu(menuConfig?.menu);
|
|
51
51
|
updateMenuItemIdToFirstFloorIdxMap(menuConfig?.menu);
|
|
52
52
|
setThemeConfig(tConfig);
|
|
53
|
-
const temCustomHome = routeNavigationThemeHome(tConfig, menuConfig?.menu, pathname, navigate, closeTab);
|
|
53
|
+
const temCustomHome = routeNavigationThemeHome(tConfig, menuConfig?.menu, pathname, navigate, closeTab, "v5");
|
|
54
54
|
setCustomHome(temCustomHome);
|
|
55
55
|
};
|
|
56
56
|
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import React, {CSSProperties} from "react";
|
|
1
|
+
import React, { CSSProperties } from "react";
|
|
2
2
|
import "./index.css";
|
|
3
|
-
import {Button, Col, Form, Input, Row, FormInstance} from "antd";
|
|
3
|
+
import { Button, Col, Form, Input, Row, FormInstance } from "antd";
|
|
4
4
|
import {
|
|
5
5
|
LockOutlined,
|
|
6
6
|
SafetyCertificateOutlined,
|
|
7
7
|
UserOutlined,
|
|
8
8
|
} from "@ant-design/icons";
|
|
9
9
|
import HCserviceV3 from "../tmpl/hcservice-v3";
|
|
10
|
-
import {LocaleContext} from "../locale/LocaleProvider";
|
|
10
|
+
import { LocaleContext } from "../locale/LocaleProvider";
|
|
11
11
|
import Vertify from "./vertify/index";
|
|
12
12
|
import Units from "../units";
|
|
13
13
|
import ResetPassword from "../layout/menu/reset-password";
|
|
@@ -17,6 +17,7 @@ interface LoginProps {
|
|
|
17
17
|
title?: any;
|
|
18
18
|
programCode?: string;
|
|
19
19
|
autoSaveUser?: boolean;
|
|
20
|
+
applicationCode?: string;
|
|
20
21
|
}
|
|
21
22
|
|
|
22
23
|
interface LoginState {
|
|
@@ -44,12 +45,13 @@ class Login extends React.PureComponent<LoginProps, LoginState> {
|
|
|
44
45
|
context: React.ContextType<typeof LocaleContext>;
|
|
45
46
|
|
|
46
47
|
componentDidMount = async () => {
|
|
47
|
-
const {programCode} = this.props;
|
|
48
|
+
const { programCode, applicationCode } = this.props;
|
|
48
49
|
localStorage.setItem("version", "v1");
|
|
49
50
|
|
|
50
51
|
if (programCode) Units.setProgramCode(programCode);
|
|
52
|
+
if (applicationCode) Units.setApplicationCode(applicationCode);
|
|
51
53
|
window.removeEventListener("keydown", this.handleKeyDown);
|
|
52
|
-
let pubkey = await HCserviceV3.getRasPubkey(null, programCode);
|
|
54
|
+
let pubkey = await HCserviceV3.getRasPubkey(null, programCode, applicationCode);
|
|
53
55
|
this.setState({
|
|
54
56
|
pubkey,
|
|
55
57
|
loading: false,
|
|
@@ -57,8 +59,8 @@ class Login extends React.PureComponent<LoginProps, LoginState> {
|
|
|
57
59
|
};
|
|
58
60
|
|
|
59
61
|
getKaptchaToken = async () => {
|
|
60
|
-
const {programCode} = this.props;
|
|
61
|
-
let res = await HCserviceV3.getKaptchaToken(programCode);
|
|
62
|
+
const { programCode, applicationCode } = this.props;
|
|
63
|
+
let res = await HCserviceV3.getKaptchaToken(programCode, applicationCode);
|
|
62
64
|
if (res) {
|
|
63
65
|
let kaptchaImg;
|
|
64
66
|
if (res.img && res.img.indexOf("data:") == 0) {
|
|
@@ -78,7 +80,7 @@ class Login extends React.PureComponent<LoginProps, LoginState> {
|
|
|
78
80
|
this.setState({
|
|
79
81
|
loading: true,
|
|
80
82
|
});
|
|
81
|
-
let {kaptchaToken, pubkey, needKaptcha, vertify} = this.state;
|
|
83
|
+
let { kaptchaToken, pubkey, needKaptcha, vertify } = this.state;
|
|
82
84
|
|
|
83
85
|
await this.formRef.current
|
|
84
86
|
.validateFields()
|
|
@@ -86,19 +88,20 @@ class Login extends React.PureComponent<LoginProps, LoginState> {
|
|
|
86
88
|
// if (needKaptcha && !vertify)
|
|
87
89
|
// return this.setState({ showSlideVertify: false });
|
|
88
90
|
|
|
89
|
-
const {programCode} = this.props;
|
|
90
|
-
let json = {username: values.username, password: values.password};
|
|
91
|
+
const { programCode, applicationCode } = this.props;
|
|
92
|
+
let json = { username: values.username, password: values.password };
|
|
91
93
|
let res = await HCserviceV3.login(
|
|
92
94
|
json,
|
|
93
95
|
kaptchaToken,
|
|
94
96
|
values.kaptchaText,
|
|
95
97
|
pubkey,
|
|
96
|
-
programCode
|
|
98
|
+
programCode,
|
|
99
|
+
applicationCode
|
|
97
100
|
);
|
|
98
101
|
if (res.status === "success") {
|
|
99
102
|
this.props.onFinish(res.token);
|
|
100
103
|
} else if (res.status === "error") {
|
|
101
|
-
this.setState({needKaptcha: true, vertify: false});
|
|
104
|
+
this.setState({ needKaptcha: true, vertify: false });
|
|
102
105
|
await this.getKaptchaToken();
|
|
103
106
|
}
|
|
104
107
|
})
|
|
@@ -126,118 +129,118 @@ class Login extends React.PureComponent<LoginProps, LoginState> {
|
|
|
126
129
|
};
|
|
127
130
|
|
|
128
131
|
render() {
|
|
129
|
-
const {loading, needKaptcha, kaptchaImg, showSlideVertify} = this.state;
|
|
132
|
+
const { loading, needKaptcha, kaptchaImg, showSlideVertify } = this.state;
|
|
130
133
|
|
|
131
|
-
const {autoSaveUser = true} = this.props;
|
|
134
|
+
const { autoSaveUser = true } = this.props;
|
|
132
135
|
|
|
133
|
-
const {translate} = this.context;
|
|
136
|
+
const { translate } = this.context;
|
|
134
137
|
return (
|
|
135
138
|
<>
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
139
|
+
<Form
|
|
140
|
+
style={{ width: 350 }}
|
|
141
|
+
ref={this.formRef}
|
|
142
|
+
name="normal_login"
|
|
143
|
+
initialValues={{ remember: true }}
|
|
144
|
+
>
|
|
145
|
+
{this.props.title}
|
|
146
|
+
<Form.Item
|
|
147
|
+
name="username"
|
|
148
|
+
rules={[
|
|
149
|
+
{ required: true, message: translate("${请输入}${用户名}!") },
|
|
150
|
+
{
|
|
151
|
+
max: 30,
|
|
152
|
+
min: 0,
|
|
153
|
+
message: translate("${请输入}${0-30个字符}!"),
|
|
154
|
+
},
|
|
155
|
+
]}
|
|
141
156
|
>
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
157
|
+
<Input
|
|
158
|
+
prefix={<UserOutlined className="site-form-item-icon" />}
|
|
159
|
+
placeholder={translate("${用户名}")}
|
|
160
|
+
autoComplete={autoSaveUser ? "on" : "off"}
|
|
161
|
+
/>
|
|
162
|
+
</Form.Item>
|
|
163
|
+
<Form.Item
|
|
164
|
+
name="password"
|
|
165
|
+
rules={[
|
|
166
|
+
{ required: true, message: translate("${请输入}${密码}!") },
|
|
167
|
+
]}
|
|
168
|
+
>
|
|
169
|
+
<Input
|
|
170
|
+
style={
|
|
171
|
+
autoSaveUser
|
|
172
|
+
? {}
|
|
173
|
+
: ({ "-webkit-text-security": "disc" } as CSSProperties)
|
|
174
|
+
}
|
|
175
|
+
type={autoSaveUser ? "password" : "text"}
|
|
176
|
+
placeholder={translate("${密码}")}
|
|
177
|
+
onKeyDown={this.handleKeyDown}
|
|
178
|
+
autoComplete={autoSaveUser ? "on" : "off"}
|
|
179
|
+
prefix={<LockOutlined className="site-form-item-icon" />}
|
|
180
|
+
/>
|
|
181
|
+
</Form.Item>
|
|
182
|
+
{needKaptcha ? (
|
|
183
|
+
<Row gutter={8}>
|
|
184
|
+
<Col span={12}>
|
|
185
|
+
<Form.Item
|
|
186
|
+
name="kaptchaText"
|
|
187
|
+
rules={[
|
|
188
|
+
{
|
|
189
|
+
required: true,
|
|
190
|
+
message: translate("${请输入}${验证码}!"),
|
|
191
|
+
},
|
|
192
|
+
]}
|
|
193
|
+
>
|
|
194
|
+
<Input
|
|
195
|
+
prefix={
|
|
196
|
+
<SafetyCertificateOutlined className="site-form-item-icon" />
|
|
197
|
+
}
|
|
198
|
+
placeholder={translate("${验证码}")}
|
|
199
|
+
onKeyDown={this.handleKeyDown}
|
|
200
|
+
/>
|
|
201
|
+
</Form.Item>
|
|
202
|
+
</Col>
|
|
203
|
+
<Col span={12}>
|
|
204
|
+
<img
|
|
205
|
+
style={{ cursor: "pointer" }}
|
|
206
|
+
height={30}
|
|
207
|
+
width={90}
|
|
208
|
+
title={translate("${点击刷新}")}
|
|
209
|
+
onClick={this.changeKaptcha}
|
|
210
|
+
src={kaptchaImg}
|
|
211
|
+
></img>
|
|
212
|
+
</Col>
|
|
213
|
+
</Row>
|
|
214
|
+
) : (
|
|
215
|
+
""
|
|
216
|
+
)}
|
|
217
|
+
<Form.Item>
|
|
218
|
+
<Button
|
|
219
|
+
type="primary"
|
|
220
|
+
style={{ width: "100%" }}
|
|
221
|
+
loading={loading}
|
|
222
|
+
onClick={this.handleSubmit}
|
|
165
223
|
>
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
autoComplete={autoSaveUser ? "on" : "off"}
|
|
176
|
-
prefix={<LockOutlined className="site-form-item-icon"/>}
|
|
177
|
-
/>
|
|
178
|
-
</Form.Item>
|
|
179
|
-
{needKaptcha ? (
|
|
180
|
-
<Row gutter={8}>
|
|
181
|
-
<Col span={12}>
|
|
182
|
-
<Form.Item
|
|
183
|
-
name="kaptchaText"
|
|
184
|
-
rules={[
|
|
185
|
-
{
|
|
186
|
-
required: true,
|
|
187
|
-
message: translate("${请输入}${验证码}!"),
|
|
188
|
-
},
|
|
189
|
-
]}
|
|
190
|
-
>
|
|
191
|
-
<Input
|
|
192
|
-
prefix={
|
|
193
|
-
<SafetyCertificateOutlined className="site-form-item-icon"/>
|
|
194
|
-
}
|
|
195
|
-
placeholder={translate("${验证码}")}
|
|
196
|
-
onKeyDown={this.handleKeyDown}
|
|
197
|
-
/>
|
|
198
|
-
</Form.Item>
|
|
199
|
-
</Col>
|
|
200
|
-
<Col span={12}>
|
|
201
|
-
<img
|
|
202
|
-
style={{cursor: "pointer"}}
|
|
203
|
-
height={30}
|
|
204
|
-
width={90}
|
|
205
|
-
title={translate("${点击刷新}")}
|
|
206
|
-
onClick={this.changeKaptcha}
|
|
207
|
-
src={kaptchaImg}
|
|
208
|
-
></img>
|
|
209
|
-
</Col>
|
|
210
|
-
</Row>
|
|
211
|
-
) : (
|
|
212
|
-
""
|
|
213
|
-
)}
|
|
214
|
-
<Form.Item>
|
|
215
|
-
<Button
|
|
216
|
-
type="primary"
|
|
217
|
-
style={{width: "100%"}}
|
|
218
|
-
loading={loading}
|
|
219
|
-
onClick={this.handleSubmit}
|
|
220
|
-
>
|
|
221
|
-
{translate("${登录}")}
|
|
222
|
-
</Button>
|
|
223
|
-
</Form.Item>
|
|
224
|
-
<Form.Item style={{marginBottom:0}}>
|
|
225
|
-
<Row gutter={8}>
|
|
226
|
-
<Col span={6} offset={18}><ResetPassword showUserName={true}></ResetPassword></Col>
|
|
227
|
-
</Row>
|
|
228
|
-
</Form.Item>
|
|
229
|
-
</Form>
|
|
224
|
+
{translate("${登录}")}
|
|
225
|
+
</Button>
|
|
226
|
+
</Form.Item>
|
|
227
|
+
<Form.Item style={{ marginBottom: 0 }}>
|
|
228
|
+
<Row gutter={8}>
|
|
229
|
+
<Col span={6} offset={18}><ResetPassword showUserName={true}></ResetPassword></Col>
|
|
230
|
+
</Row>
|
|
231
|
+
</Form.Item>
|
|
232
|
+
</Form>
|
|
230
233
|
|
|
231
234
|
{showSlideVertify ? (
|
|
232
|
-
<div style={{width: "100%", height: "100%", background: "white"}}>
|
|
235
|
+
<div style={{ width: "100%", height: "100%", background: "white" }}>
|
|
233
236
|
<Vertify
|
|
234
237
|
onSuccess={() =>
|
|
235
|
-
this.setState({vertify: true, showSlideVertify: false}, () =>
|
|
238
|
+
this.setState({ vertify: true, showSlideVertify: false }, () =>
|
|
236
239
|
this.handleSubmit()
|
|
237
240
|
)
|
|
238
241
|
}
|
|
239
242
|
onFail={() =>
|
|
240
|
-
this.setState({vertify: false, showSlideVertify: true})
|
|
243
|
+
this.setState({ vertify: false, showSlideVertify: true })
|
|
241
244
|
}
|
|
242
245
|
></Vertify>
|
|
243
246
|
</div>
|
|
@@ -15,6 +15,7 @@ type LoginPropType = {
|
|
|
15
15
|
autoSaveUser?: boolean;
|
|
16
16
|
version?: string;
|
|
17
17
|
style?: { [key: string]: any };
|
|
18
|
+
applicationCode?: string;
|
|
18
19
|
};
|
|
19
20
|
|
|
20
21
|
type FormType = {
|
|
@@ -41,11 +42,14 @@ const Login = (props: LoginPropType) => {
|
|
|
41
42
|
localStorage.setItem("version", version);
|
|
42
43
|
}, []);
|
|
43
44
|
|
|
44
|
-
const { programCode: routeProgramCode } = useParams();
|
|
45
|
+
const { programCode: routeProgramCode, applicationCode: routeApplicationCode } = useParams();
|
|
46
|
+
|
|
47
|
+
|
|
45
48
|
useEffect(() => {
|
|
46
|
-
if (routeProgramCode
|
|
47
|
-
Units.
|
|
48
|
-
}, [routeProgramCode]);
|
|
49
|
+
if (routeProgramCode) Units.setProgramCode(routeProgramCode);
|
|
50
|
+
if (routeApplicationCode) Units.setApplicationCode(routeApplicationCode);
|
|
51
|
+
}, [routeProgramCode, routeApplicationCode]);
|
|
52
|
+
|
|
49
53
|
const [loading, setLoading] = useState<boolean>(false);
|
|
50
54
|
const [needKaptcha, setNeedKaptcha] = useState<boolean>(false);
|
|
51
55
|
const [kaptchaImg, setKaptchaImg] = useState<string>(null);
|
|
@@ -59,17 +63,19 @@ const Login = (props: LoginPropType) => {
|
|
|
59
63
|
const { username, password, kaptchaText } = await form.validateFields();
|
|
60
64
|
|
|
61
65
|
setLoading(true);
|
|
62
|
-
const { programCode, onFinish } = props;
|
|
66
|
+
const { programCode, applicationCode, onFinish } = props;
|
|
63
67
|
const pubkey = await HCserviceV3.getRasPubkey(
|
|
64
68
|
null,
|
|
65
|
-
programCode
|
|
69
|
+
programCode || routeProgramCode,
|
|
70
|
+
applicationCode || routeApplicationCode
|
|
66
71
|
);
|
|
67
72
|
const res = await HCserviceV3.login(
|
|
68
73
|
{ username, password },
|
|
69
74
|
kaptchaToken,
|
|
70
75
|
kaptchaText,
|
|
71
76
|
pubkey,
|
|
72
|
-
programCode
|
|
77
|
+
programCode || routeProgramCode,
|
|
78
|
+
applicationCode || routeApplicationCode
|
|
73
79
|
);
|
|
74
80
|
if (res.status === "success") {
|
|
75
81
|
onFinish(res.token);
|
|
@@ -96,7 +102,7 @@ const Login = (props: LoginPropType) => {
|
|
|
96
102
|
|
|
97
103
|
const getKaptchaToken = async () => {
|
|
98
104
|
|
|
99
|
-
let res = await HCserviceV3.getKaptchaToken(routeProgramCode);
|
|
105
|
+
let res = await HCserviceV3.getKaptchaToken(routeProgramCode, routeApplicationCode);
|
|
100
106
|
if (res) {
|
|
101
107
|
let kaptchaImg;
|
|
102
108
|
if (res.img && res.img.indexOf("data:") == 0) {
|
|
@@ -21,7 +21,7 @@ const handleImgUrl = (basePath: string) => {
|
|
|
21
21
|
ProgramConfig.joinPath(ProgramConfig.api(), "/v3/files"),
|
|
22
22
|
basePath
|
|
23
23
|
)) +
|
|
24
|
-
`?@token=${ProgramConfig.hydrocarbonToken()}&@programToken=${ProgramConfig.programCode()}`;
|
|
24
|
+
`?@token=${ProgramConfig.hydrocarbonToken()}&@programToken=${ProgramConfig.programCode()}&@applicationToken=${ProgramConfig.applicationCode()}`;
|
|
25
25
|
return url;
|
|
26
26
|
}
|
|
27
27
|
|