@jiangood/open-admin 2.0.0 → 2.2.4

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.
Files changed (39) hide show
  1. package/config/config.js +9 -22
  2. package/package.json +5 -1
  3. package/src/.umi-production/appData.json +67 -108
  4. package/src/.umi-production/core/route.tsx +1 -2
  5. package/src/.umi-production/umi.ts +2 -2
  6. package/src/framework/components/Gap/index.tsx +37 -41
  7. package/src/framework/components/Page/index.less +1 -1
  8. package/src/framework/components/Page/index.tsx +19 -22
  9. package/src/framework/components/ViewRange/index.tsx +12 -17
  10. package/src/framework/components/system/ButtonList.tsx +12 -32
  11. package/src/framework/fields/FieldEditor/index.tsx +3 -2
  12. package/src/framework/fields/FieldUploadFile/index.tsx +8 -4
  13. package/src/framework/utils/MessageUtils.tsx +21 -99
  14. package/src/framework/utils/system/HttpUtils.ts +2 -1
  15. package/src/framework/utils/system/SysUtils.ts +8 -0
  16. package/src/layouts/PageRender.d.ts +2 -17
  17. package/src/layouts/PageRender.jsx +14 -76
  18. package/src/layouts/admin/TabPageRender.jsx +138 -158
  19. package/src/layouts/admin/index.jsx +120 -17
  20. package/src/layouts/admin/index.less +123 -5
  21. package/src/layouts/index.jsx +78 -161
  22. package/src/loading.jsx +17 -16
  23. package/src/pages/404.jsx +7 -5
  24. package/src/pages/about.jsx +3 -3
  25. package/src/pages/index.jsx +4 -5
  26. package/src/pages/login.jsx +16 -9
  27. package/src/pages/login.less +0 -1
  28. package/src/pages/system/dict/index.jsx +7 -10
  29. package/src/pages/system/file/index.jsx +5 -5
  30. package/src/pages/system/job/index.jsx +9 -7
  31. package/src/pages/system/log/index.jsx +4 -5
  32. package/src/pages/system/manual/index.jsx +6 -4
  33. package/src/pages/system/org/index.jsx +4 -2
  34. package/src/pages/system/role/index.jsx +9 -7
  35. package/src/pages/system/role/perm.jsx +3 -4
  36. package/src/pages/system/user/index.jsx +8 -6
  37. package/src/pages/userCenter/index.jsx +1 -1
  38. package/src/pages/userCenter/message.jsx +4 -2
  39. package/src/pages/system/api/index.jsx +0 -279
@@ -19,7 +19,7 @@ if (process.env.NODE_ENV === 'development') {
19
19
  import React from 'react';
20
20
 
21
21
  export async function getRoutes() {
22
- const routes = {"404":{"path":"*","id":"404","parentId":"@@/global-layout"},"userCenter/ChangePassword":{"path":"userCenter/ChangePassword","id":"userCenter/ChangePassword","parentId":"@@/global-layout"},"system/user/UserPerm":{"path":"system/user/UserPerm","id":"system/user/UserPerm","parentId":"@@/global-layout"},"system/manual/index":{"path":"system/manual","id":"system/manual/index","parentId":"@@/global-layout"},"userCenter/message":{"path":"userCenter/message","id":"userCenter/message","parentId":"@@/global-layout"},"system/dict/index":{"path":"system/dict","id":"system/dict/index","parentId":"@@/global-layout"},"system/file/index":{"path":"system/file","id":"system/file/index","parentId":"@@/global-layout"},"system/role/index":{"path":"system/role","id":"system/role/index","parentId":"@@/global-layout"},"system/user/index":{"path":"system/user","id":"system/user/index","parentId":"@@/global-layout"},"userCenter/manual":{"path":"userCenter/manual","id":"userCenter/manual","parentId":"@@/global-layout"},"system/api/index":{"path":"system/api","id":"system/api/index","parentId":"@@/global-layout"},"system/job/index":{"path":"system/job","id":"system/job/index","parentId":"@@/global-layout"},"system/log/index":{"path":"system/log","id":"system/log/index","parentId":"@@/global-layout"},"system/org/index":{"path":"system/org","id":"system/org/index","parentId":"@@/global-layout"},"system/role/perm":{"path":"system/role/perm","id":"system/role/perm","parentId":"@@/global-layout"},"userCenter/index":{"path":"userCenter","id":"userCenter/index","parentId":"@@/global-layout"},"about":{"path":"about","id":"about","parentId":"@@/global-layout"},"index":{"path":"/","id":"index","parentId":"@@/global-layout"},"login":{"path":"login","id":"login","parentId":"@@/global-layout"},"@@/global-layout":{"id":"@@/global-layout","path":"/","isLayout":true}} as const;
22
+ const routes = {"404":{"path":"*","id":"404","parentId":"@@/global-layout"},"userCenter/ChangePassword":{"path":"userCenter/ChangePassword","id":"userCenter/ChangePassword","parentId":"@@/global-layout"},"system/user/UserPerm":{"path":"system/user/UserPerm","id":"system/user/UserPerm","parentId":"@@/global-layout"},"system/manual/index":{"path":"system/manual","id":"system/manual/index","parentId":"@@/global-layout"},"userCenter/message":{"path":"userCenter/message","id":"userCenter/message","parentId":"@@/global-layout"},"system/dict/index":{"path":"system/dict","id":"system/dict/index","parentId":"@@/global-layout"},"system/file/index":{"path":"system/file","id":"system/file/index","parentId":"@@/global-layout"},"system/role/index":{"path":"system/role","id":"system/role/index","parentId":"@@/global-layout"},"system/user/index":{"path":"system/user","id":"system/user/index","parentId":"@@/global-layout"},"userCenter/manual":{"path":"userCenter/manual","id":"userCenter/manual","parentId":"@@/global-layout"},"system/job/index":{"path":"system/job","id":"system/job/index","parentId":"@@/global-layout"},"system/log/index":{"path":"system/log","id":"system/log/index","parentId":"@@/global-layout"},"system/org/index":{"path":"system/org","id":"system/org/index","parentId":"@@/global-layout"},"system/role/perm":{"path":"system/role/perm","id":"system/role/perm","parentId":"@@/global-layout"},"userCenter/index":{"path":"userCenter","id":"userCenter/index","parentId":"@@/global-layout"},"about":{"path":"about","id":"about","parentId":"@@/global-layout"},"index":{"path":"/","id":"index","parentId":"@@/global-layout"},"login":{"path":"login","id":"login","parentId":"@@/global-layout"},"@@/global-layout":{"id":"@@/global-layout","path":"/","isLayout":true}} as const;
23
23
  return {
24
24
  routes,
25
25
  routeComponents: {
@@ -33,7 +33,6 @@ export async function getRoutes() {
33
33
  'system/role/index': React.lazy(() => import(/* webpackChunkName: "src__pages__system__role__index" */'../../../src/pages/system/role/index.jsx')),
34
34
  'system/user/index': React.lazy(() => import(/* webpackChunkName: "src__pages__system__user__index" */'../../../src/pages/system/user/index.jsx')),
35
35
  'userCenter/manual': React.lazy(() => import(/* webpackChunkName: "src__pages__userCenter__manual" */'../../../src/pages/userCenter/manual.jsx')),
36
- 'system/api/index': React.lazy(() => import(/* webpackChunkName: "src__pages__system__api__index" */'../../../src/pages/system/api/index.jsx')),
37
36
  'system/job/index': React.lazy(() => import(/* webpackChunkName: "src__pages__system__job__index" */'../../../src/pages/system/job/index.jsx')),
38
37
  'system/log/index': React.lazy(() => import(/* webpackChunkName: "src__pages__system__log__index" */'../../../src/pages/system/log/index.jsx')),
39
38
  'system/org/index': React.lazy(() => import(/* webpackChunkName: "src__pages__system__org__index" */'../../../src/pages/system/org/index.jsx')),
@@ -11,7 +11,7 @@ import Loading from '/home/runner/work/open-admin/open-admin/web/src/loading.jsx
11
11
  import { ApplyPluginsType } from 'umi';
12
12
  import {FormRegistryUtils} from '/home/runner/work/open-admin/open-admin/web/src/framework';
13
13
 
14
- const publicPath = "/";
14
+ const publicPath = "./";
15
15
  const runtimePublicPath = false;
16
16
 
17
17
  async function render() {
@@ -78,6 +78,6 @@ render();
78
78
 
79
79
  if (typeof window !== 'undefined') {
80
80
  window.g_umi = {
81
- version: '4.6.55',
81
+ version: '4.6.57',
82
82
  };
83
83
  }
@@ -1,46 +1,42 @@
1
1
  import React from "react";
2
2
 
3
+ const SizeMap = {
4
+ xs: 4,
5
+ sm: 8,
6
+ md: 16,
7
+ lg: 24,
8
+ xl: 32,
9
+ xxl: 40,
10
+ };
11
+
12
+ type GapProps = {
13
+ size?: keyof typeof SizeMap;
14
+ direction?: "horizontal" | "vertical";
15
+ } & React.HTMLAttributes<HTMLDivElement>;
16
+
3
17
  /**
4
18
  * 上下间隔
5
19
  */
6
- export class Gap extends React.Component {
7
-
8
- static defaultProps = {
9
- size: 'middle',
10
- direction: 'vertical',
11
- };
12
-
13
- render() {
14
- const {n = 0, size, direction} = this.props;
15
- if (n) {
16
- console.warn('参数 n 已经不被支持')
17
- return
18
- }
19
-
20
- const SizeMap = {
21
- x: 4,
22
- small: 8,
23
- middle: 16,
24
- large: 24,
25
- xLarge: 32,
26
- xxLarge: 40,
27
- };
28
-
29
-
30
- const sizePx = SizeMap[size];
31
- const isHorizontal = direction === 'horizontal';
32
-
33
-
34
- // 水平间隔:有宽度,无高度
35
- // 垂直间隔:有高度,无宽度
36
- const width = isHorizontal ? sizePx : 0;
37
- const height = isHorizontal ? 0 : sizePx;
38
-
39
- // 水平间隔用 inline-block(避免换行),垂直间隔用 block
40
- const display = isHorizontal ? 'inline-block' : 'block';
41
-
42
- const style = {display, height, width}
43
-
44
- return <div style={style}></div>
45
- }
46
- }
20
+ export const Gap: React.FC<GapProps> = ({
21
+ size = "md",
22
+ direction = "vertical",
23
+ ...rest
24
+ }) => {
25
+ if (size && !Object.hasOwn(SizeMap, size)) {
26
+ throw new Error(
27
+ `Gap: size 属性必须为 [${Object.keys(SizeMap).join(", ")}] 之一,当前传入:${size}`
28
+ );
29
+ }
30
+
31
+ const sizePx = SizeMap[size];
32
+ const isHorizontal = direction === "horizontal";
33
+
34
+ const style: React.CSSProperties = {
35
+ display: isHorizontal ? "inline-block" : "block",
36
+ width: isHorizontal ? sizePx : 0,
37
+ height: isHorizontal ? 0 : sizePx,
38
+ ...rest.style,
39
+ };
40
+
41
+ return <div style={style} {...rest} />;
42
+ };
@@ -2,7 +2,7 @@
2
2
  width: 100%;
3
3
 
4
4
  // header 48 footer 43, tab 36
5
- height: calc(100vh - 127px);
5
+ height: 100%;
6
6
 
7
7
  overflow: auto;
8
8
 
@@ -2,29 +2,26 @@ import React from "react";
2
2
  import './index.less'
3
3
  import {ThemeUtils} from "../../utils";
4
4
 
5
- /**
6
- * 上下间隔
7
- */
8
- export class Page extends React.Component {
5
+ interface PageProps {
6
+ padding?: boolean;
7
+ backgroundGray?: boolean;
8
+ debug?: boolean;
9
+ children?: React.ReactNode;
10
+ }
9
11
 
10
- static defaultProps = {
11
- padding: false,
12
- backgroundGray:false
12
+ export const Page: React.FC<PageProps> = ({ padding = true, backgroundGray = false, debug = false, children }) => {
13
+ const style: React.CSSProperties = {};
14
+ if (padding) {
15
+ style.padding = 16;
13
16
  }
14
-
15
- render() {
16
- const style = {}
17
- if(this.props.padding){
18
- style.padding = 16
19
- }
20
- if(this.props.backgroundGray){
21
- style.backgroundColor = ThemeUtils.getColor("background-color")
22
- }
23
-
24
-
25
- return <div className={'tmgg-page'} style={style}>
26
- {this.props.children}
27
- </div>
17
+ if (backgroundGray) {
18
+ style.backgroundColor = ThemeUtils.getColor("background-color");
19
+ }
20
+ if (debug) {
21
+ style.backgroundColor = 'rgba(255, 0, 0, 0.08)';
28
22
  }
29
23
 
30
- }
24
+ return <div className={'tmgg-page'} style={style}>
25
+ {children}
26
+ </div>
27
+ };
@@ -1,20 +1,15 @@
1
1
  import React from "react";
2
2
 
3
- export class ViewRange extends React.Component {
4
-
5
- static defaultProps = {
6
- min : '未知',max : '未知'
7
- }
8
-
9
- render() {
10
- let {min,max} = this.props
11
- if(min == null && max == null){
12
- return null;
13
- }
14
- min = min == null ? '未知': min;
15
- max = max == null ? '未知': max;
16
-
17
- return min + ' - ' + max;
18
-
19
- }
3
+ interface ViewRangeProps {
4
+ min?: string;
5
+ max?: string;
20
6
  }
7
+
8
+ export const ViewRange: React.FC<ViewRangeProps> = ({ min, max }) => {
9
+ if ((min == null || min === "") && (max == null || max === "")) {
10
+ return null;
11
+ }
12
+ const showMin = min ?? '未知';
13
+ const showMax = max ?? '未知';
14
+ return <>{showMin} - {showMax}</>;
15
+ };
@@ -1,42 +1,22 @@
1
1
  import React from 'react';
2
- import {Space} from 'antd';
3
- import {PermUtils} from "../../utils";
4
-
2
+ import { Space } from 'antd';
3
+ import { PermUtils } from '../../utils';
5
4
 
6
5
  /**
7
6
  * 带权限的按钮列表
8
7
  * @param maxNum: 显示子节点的个数, 超过的为收缩起来
9
- *
10
8
  */
11
- export class ButtonList extends React.Component {
12
-
13
-
14
- render() {
15
- const {children} = this.props;
16
-
17
- // 单节点的情况
18
- if (!Array.isArray(children)) {
19
- if (this.checkPerm(children)) {
20
- return children;
21
- }
22
- return null
23
- }
9
+ export function ButtonList(props) {
10
+ const { children } = props;
24
11
 
25
- const menus = [];
26
- for (let child of children) {
27
- if (child === null || child === undefined) {
28
- continue;
29
- }
30
- if (this.checkPerm(child)) {
31
- menus.push(child);
32
- }
33
- }
34
- return <Space>{menus}</Space>;
35
- }
12
+ const checkPerm = (element) => {
13
+ const _props = element?.props;
14
+ return !_props?.perm || PermUtils.hasPermission(_props.perm);
15
+ };
36
16
 
37
- checkPerm = element => {
38
- const props = element.props;
39
- return props == null || props.perm == null || PermUtils.hasPermission(props.perm);
17
+ const nodes = React.Children.toArray(children).filter(
18
+ (child) => child != null && checkPerm(child)
19
+ );
40
20
 
41
- };
21
+ return <Space>{nodes}</Space>;
42
22
  }
@@ -1,5 +1,6 @@
1
1
  import React from 'react';
2
2
  import {Editor as TinyMceEditor} from '@tinymce/tinymce-react';
3
+ import {SysUtils} from '../../utils';
3
4
 
4
5
  /**
5
6
  * 富文本编辑器
@@ -8,8 +9,8 @@ import {Editor as TinyMceEditor} from '@tinymce/tinymce-react';
8
9
  */
9
10
  export class FieldEditor extends React.Component {
10
11
  render() {
11
- const uploadUrl = 'admin/sysFile/upload';
12
- const jsUrl = 'admin/tinymce/tinymce.min.js';
12
+ const uploadUrl = SysUtils.contextPath('/admin/sysFile/upload');
13
+ const jsUrl = SysUtils.contextPath('/admin/tinymce/tinymce.min.js');
13
14
  const {value, onChange, height} = this.props;
14
15
 
15
16
  return (
@@ -1,9 +1,9 @@
1
1
  import React from "react";
2
2
  import ImgCrop from "antd-img-crop";
3
- import {Modal, Upload} from "antd";
3
+ import {Modal, Upload, message} from "antd";
4
4
  import { UploadOutlined } from "@ant-design/icons";
5
5
  import {ViewFile} from "../../views";
6
- import {ObjectUtils} from "../../utils";
6
+ import {ObjectUtils, SysUtils} from "../../utils";
7
7
 
8
8
  /**
9
9
  * 上传图片前裁切, 单张图片
@@ -33,7 +33,7 @@ export class FieldUploadFile extends React.Component {
33
33
  if (value && value.length > 0) {
34
34
  const arr = value.split(",");
35
35
  for (const id of arr) {
36
- const url = 'admin/sysFile/preview/' + id;
36
+ const url = SysUtils.contextPath('/admin/sysFile/preview/' + id);
37
37
  const file = {id, url, uid: id, name: id, status: 'done', fileName: id};
38
38
  list.push(file);
39
39
  }
@@ -73,6 +73,10 @@ export class FieldUploadFile extends React.Component {
73
73
  return;
74
74
  }
75
75
 
76
+ if (file.status === 'done' && rs?.success) {
77
+ message.success(`文件「${rs.data?.name || ''}」上传成功`);
78
+ }
79
+
76
80
  this.setState({fileList});
77
81
 
78
82
  const newIds = this.convertComponentValueToOutput(fileList);
@@ -109,7 +113,7 @@ export class FieldUploadFile extends React.Component {
109
113
  const {accept, fileList, maxCount} = this.state;
110
114
 
111
115
  return <Upload
112
- action={'admin/sysFile/upload'}
116
+ action={SysUtils.contextPath('/admin/sysFile/upload')}
113
117
  listType={this.props.listType || 'picture-card'}
114
118
  fileList={fileList}
115
119
  onChange={this.handleChange}
@@ -1,44 +1,29 @@
1
1
  import {Form, Input, InputNumber, message, Modal} from 'antd';
2
2
  import type {ModalFuncProps} from 'antd/es/modal/interface';
3
3
  import React from 'react';
4
- import {MessageInstance} from "antd/lib/message/interface";
5
- import {HookAPI} from "antd/lib/modal/useModal";
6
- import {Logger} from "./Logger";
7
-
8
-
9
4
 
10
5
  /**
11
- * 消息工具类 (MsgUtils)
12
- * 封装了 Ant Design 的 Modal, message, 和 notification 静态方法
6
+ * 消息工具类
7
+ * 直接使用 Ant Design 6 的静态方法,无需 hook 初始化
13
8
  */
14
9
  export class MessageUtils {
15
10
 
16
- /**
17
- * 弹出 Alert 提示框
18
- */
19
11
  static alert(content: any, config?: Omit<ModalFuncProps, 'content' | 'icon' | 'onOk' | 'onCancel'>) {
20
12
  return new Promise(resolve => {
21
- this.modalApi.info({
13
+ Modal.info({
22
14
  title: '提示',
23
15
  content,
24
16
  okText: '确定',
25
- onOk: (close)=>{
26
- close()
27
- resolve()
28
- },
17
+ onOk: () => resolve(),
29
18
  icon: null,
30
19
  ...config,
31
20
  });
32
21
  })
33
-
34
22
  }
35
23
 
36
- /**
37
- * 弹出 Confirm 确认框
38
- */
39
24
  static confirm(content: React.ReactNode, config?: Omit<ModalFuncProps, 'content' | 'icon' | 'onOk' | 'onCancel'>) {
40
25
  return new Promise((resolve) => {
41
- this.modalApi.confirm({
26
+ Modal.confirm({
42
27
  title: '确认操作',
43
28
  content,
44
29
  okText: '确定',
@@ -48,29 +33,25 @@ export class MessageUtils {
48
33
  ...config,
49
34
  });
50
35
  })
51
-
52
36
  }
53
37
 
54
- /**
55
- * 弹出 Prompt 输入框对话框, 如果默认值是数字, 则使用 InputNumber 输入框
56
- */
57
- static prompt(message: React.ReactNode, initialValue?: string|number, placeholder?: string, config?: Omit<ModalFuncProps, 'content' | 'title' | 'icon' | 'onOk'>) {
38
+ static prompt(msg: React.ReactNode, initialValue?: string | number, placeholder?: string, config?: Omit<ModalFuncProps, 'content' | 'title' | 'icon' | 'onOk'>) {
58
39
  const isNumber = typeof initialValue === 'number';
59
40
  return new Promise((resolve) => {
60
41
  const ref = React.createRef()
61
- let element:any = isNumber ? <InputNumber placeholder={placeholder}/> : <Input placeholder={placeholder}/>;
62
- const content:any = <div>
63
- <div style={{marginBottom: 4}}>{message}</div>
42
+ let element: any = isNumber ? <InputNumber placeholder={placeholder}/> : <Input placeholder={placeholder}/>;
43
+ const content: any = <div>
44
+ <div style={{marginBottom: 4}}>{msg}</div>
64
45
  <Form ref={ref}>
65
46
  <Form.Item name='inputValue' initialValue={initialValue}>
66
47
  {element}
67
48
  </Form.Item>
68
49
  </Form>
69
50
  </div>;
70
- this.modalApi.confirm({
51
+ Modal.confirm({
71
52
  icon: null,
72
53
  title: '提示',
73
- content:content,
54
+ content,
74
55
  okText: '确定',
75
56
  cancelText: '取消',
76
57
  onOk: () => {
@@ -86,83 +67,24 @@ export class MessageUtils {
86
67
  })
87
68
  }
88
69
 
89
- // --- Antd message 封装 (全局通知/Loading) ---
90
-
91
- /**
92
- * 成功消息
93
- */
94
- static success(content: String, duration: number = 3) {
95
- if(!this.messageApi){
96
- alert(content)
97
- return
98
- }
99
- this.messageApi.success(content, duration);
70
+ static success(content: string, duration: number = 3) {
71
+ message.success(content, duration);
100
72
  }
101
73
 
102
- /**
103
- * 错误消息
104
- */
105
- static error(content: String, duration: number = 3) {
106
- if(!this.messageApi){
107
- alert(content)
108
- return
109
- }
110
- this.messageApi.error(content, duration);
74
+ static error(content: string, duration: number = 3) {
75
+ message.error(content, duration);
111
76
  }
112
77
 
113
- /**
114
- * 警告消息
115
- */
116
- static warning(content: String, duration: number = 3) {
117
- if(!this.messageApi){
118
- alert(content)
119
- return
120
- }
121
- this.messageApi.warning(content, duration);
78
+ static warning(content: string, duration: number = 3) {
79
+ message.warning(content, duration);
122
80
  }
123
81
 
124
- /**
125
- * 通用消息
126
- */
127
82
  static info(content: React.ReactNode, duration: number = 3) {
128
- if(!this.messageApi){
129
- alert(content)
130
- return
131
- }
132
- this.messageApi.info(content, duration);
83
+ message.info(content, duration);
133
84
  }
134
85
 
135
- /**
136
- * 弹出 Loading 提示
137
- */
138
86
  static loading(content: string = '正在加载...', duration?: number) {
139
- duration = duration === undefined ? 0 : duration;
140
- return this.messageApi.loading(content, duration);
87
+ duration = duration === undefined ? 0 : duration;
88
+ return message.loading(content, duration);
141
89
  }
142
-
143
- static config(messageApi: MessageInstance, modalApi: HookAPI) {
144
- this.messageApi = messageApi;
145
- this.modalApi = modalApi;
146
- }
147
-
148
- private static modalApi:HookAPI = null;
149
- private static messageApi:MessageInstance = null;
150
- }
151
-
152
- /**
153
- * antd6 推荐使用这个hooks,这里统一设置, 供公共layout使用
154
- * @constructor
155
- */
156
- export function MessageHolder(props){
157
- const [modalApi, modalContextHolder] = Modal.useModal();
158
- const [messageApi, messageContextHolder] = message.useMessage();
159
-
160
- React.useEffect(()=>{
161
- Logger.getLogger("MessageHolder").debug('Rendered')
162
- MessageUtils.config(messageApi,modalApi);
163
- props.onFinish()
164
- },[])
165
- return <>
166
- {modalContextHolder} {messageContextHolder}
167
- </>
168
- }
90
+ }
@@ -6,6 +6,7 @@ import {MessageUtils} from "../MessageUtils";
6
6
 
7
7
 
8
8
  const axiosInstance = axios.create({
9
+ baseURL: (typeof SERVLET_CONTEXT !== 'undefined' && SERVLET_CONTEXT) || '',
9
10
  withCredentials: true,
10
11
  headers: {
11
12
  'Content-Type': 'application/json'
@@ -35,7 +36,7 @@ export class HttpUtils {
35
36
  config.url = url.startsWith('admin') ? '/' + url : url;
36
37
 
37
38
  return new Promise((resolve, reject) => {
38
- axios(config).then((response: AxiosResponse) => {
39
+ axiosInstance(config).then((response: AxiosResponse) => {
39
40
  const body = response.data;
40
41
  // 假设后端响应结构为 { success: boolean | null, message: string, data: any, code: number }
41
42
  let {success, message, data} = body;
@@ -89,6 +89,14 @@ export class SysUtils {
89
89
  public static getDictInfo(): DictInfo {
90
90
  return StorageUtils.get(DICT_INFO_KEY);
91
91
  }
92
+
93
+ /**
94
+ * 拼接 servlet context-path,例如 contextPath('/admin/auth/login') → '/open-admin/admin/auth/login'
95
+ */
96
+ public static contextPath(path: string): string {
97
+ const base = (typeof SERVLET_CONTEXT !== 'undefined' && SERVLET_CONTEXT) || '';
98
+ return base + path;
99
+ }
92
100
  }
93
101
 
94
102
  // 导出常量(保持不变,但通常将常量放在类内部作为 static readonly 属性更符合 class 模式,
@@ -1,22 +1,7 @@
1
- // @ts-ignore
2
1
  import React from "react";
3
2
 
4
3
  declare type PageRenderProps = {
5
-
6
- /**
7
- * 路径 如 /flowable/task/form
8
- */
9
- pathname: string;
10
- /***
11
- * 搜索参数 如 /?id=1
12
- */
13
- search?:string;
14
-
15
- /***
16
- * 是否把location信息透传到真正页面
17
- */
18
- passLocation?: boolean
4
+ pathname: string;
19
5
  };
20
6
 
21
- export class PageRender extends React.Component<PageRenderProps, any> {
22
- }
7
+ export declare function PageRender(props: PageRenderProps): React.JSX.Element;