@jiangood/admin-spring-boot-starter 0.2.3 → 0.2.5

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 CHANGED
@@ -7,7 +7,7 @@
7
7
  "typescript": "^5.0.0"
8
8
  },
9
9
  "peerDependencies": {
10
- "@ant-design/icons": "^5.4.0",
10
+ "@ant-design/icons": "^6.0.0",
11
11
  "@bpmn-io/properties-panel": "^3.34.0",
12
12
  "@tinymce/tinymce-react": "^6.0.0",
13
13
  "@umijs/types": "^3.5.43",
@@ -33,7 +33,7 @@
33
33
  "!src/.umi"
34
34
  ],
35
35
  "main": "src/index.ts",
36
- "version": "0.2.3",
36
+ "version": "0.2.5",
37
37
  "scripts": {
38
38
  "dev": "umi dev",
39
39
  "build": "tsc --outDir config/dist --skipLibCheck --noEmitOnError false config/index.ts"
@@ -8,6 +8,7 @@ export class LoginPageUtils {
8
8
 
9
9
  static postLogin(values) {
10
10
  return new Promise((resolve, reject) => {
11
+ console.log('开始登录')
11
12
  HttpUtils.postForm('/admin/auth/login', values).then(rs => {
12
13
  console.log('登录结果', rs)
13
14
  EventBusUtils.emit('loginSuccess')
@@ -57,22 +57,24 @@ export class MessageUtils {
57
57
  const isNumber = typeof initialValue === 'number';
58
58
  return new Promise((resolve) => {
59
59
  const ref = React.createRef()
60
+ let element:any = isNumber ? <InputNumber placeholder={placeholder}/> : <Input placeholder={placeholder}/>;
61
+ const content:any = <div>
62
+ <div style={{marginBottom: 4}}>{message}</div>
63
+ <Form ref={ref}>
64
+ <Form.Item name='inputValue' initialValue={initialValue}>
65
+ {element}
66
+ </Form.Item>
67
+ </Form>
68
+ </div>;
60
69
  this.modalApi.confirm({
61
70
  icon: null,
62
71
  title: '提示',
63
- content: <div>
64
- <div style={{marginBottom: 4}}>{message}</div>
65
- <Form ref={ref}>
66
- <Form.Item name='inputValue' initialValue={initialValue}>
67
- {isNumber ? <InputNumber placeholder={placeholder}/> : <Input placeholder={placeholder}/>}
68
- </Form.Item>
69
- </Form>
70
- </div>,
72
+ content:content,
71
73
  okText: '确定',
72
74
  cancelText: '取消',
73
75
  onOk: () => {
74
76
  const form = ref.current;
75
- const values= form.getFieldsValue()
77
+ const values = form.getFieldsValue()
76
78
  resolve(values.inputValue)
77
79
  },
78
80
  onCancel: () => {
@@ -89,6 +91,10 @@ export class MessageUtils {
89
91
  * 成功消息
90
92
  */
91
93
  static success(content: String, duration: number = 3) {
94
+ if(!this.messageApi){
95
+ alert(content)
96
+ return
97
+ }
92
98
  this.messageApi.success(content, duration);
93
99
  }
94
100
 
@@ -96,6 +102,11 @@ export class MessageUtils {
96
102
  * 错误消息
97
103
  */
98
104
  static error(content: String, duration: number = 3) {
105
+ console.error('调用 MessageUtils.error',content)
106
+ if(!this.messageApi){
107
+ alert(content)
108
+ return
109
+ }
99
110
  this.messageApi.error(content, duration);
100
111
  }
101
112
 
@@ -103,6 +114,10 @@ export class MessageUtils {
103
114
  * 警告消息
104
115
  */
105
116
  static warning(content: String, duration: number = 3) {
117
+ if(!this.messageApi){
118
+ alert(content)
119
+ return
120
+ }
106
121
  this.messageApi.warning(content, duration);
107
122
  }
108
123
 
@@ -110,6 +125,10 @@ export class MessageUtils {
110
125
  * 通用消息
111
126
  */
112
127
  static info(content: React.ReactNode, duration: number = 3) {
128
+ if(!this.messageApi){
129
+ alert(content)
130
+ return
131
+ }
113
132
  this.messageApi.info(content, duration);
114
133
  }
115
134
 
@@ -135,10 +154,15 @@ export class MessageUtils {
135
154
  * antd6 推荐使用这个hooks,这里统一设置, 供公共layout使用
136
155
  * @constructor
137
156
  */
138
- export function MessageHolder(){
157
+ export function MessageHolder(props){
139
158
  const [modalApi, modalContextHolder] = Modal.useModal();
140
159
  const [messageApi, messageContextHolder] = message.useMessage();
141
- MessageUtils.config(messageApi,modalApi);
160
+
161
+ React.useEffect(()=>{
162
+ console.log('MessageHolder Rendered')
163
+ MessageUtils.config(messageApi,modalApi);
164
+ props.onFinish()
165
+ },[])
142
166
  return <>
143
167
  {modalContextHolder} {messageContextHolder}
144
168
  </>
@@ -5,7 +5,15 @@ import {ConfigProvider} from "antd";
5
5
 
6
6
  import {Outlet, withRouter} from "umi";
7
7
  import zhCN from 'antd/locale/zh_CN';
8
- import {ArrUtils, HttpUtils, MessageHolder, PageLoading, PageUtils, SysUtils, ThemeUtils,} from "../framework";
8
+ import {
9
+ ArrUtils,
10
+ HttpUtils,
11
+ MessageHolder,
12
+ PageLoading,
13
+ PageUtils,
14
+ SysUtils,
15
+ ThemeUtils,
16
+ } from "../framework";
9
17
  import dayjs from 'dayjs';
10
18
  import 'dayjs/locale/zh-cn';
11
19
 
@@ -21,24 +29,28 @@ class _Layouts extends React.Component {
21
29
 
22
30
 
23
31
  state = {
32
+ messageHolderInit:false,
24
33
  siteInfoLoading: true,
25
34
  loginInfoFinish: false
26
35
  }
27
36
 
37
+ onMessageHolderFinish = () => {
38
+ this.loadSiteInfo()
39
+ this.setState({messageHolderInit:true});
40
+ }
41
+
28
42
 
29
- componentDidMount() {
43
+ loadSiteInfo = () => {
30
44
  HttpUtils.get("/admin/public/site-info").then(rs => {
31
45
  SysUtils.setSiteInfo(rs)
32
46
  this.setState({siteInfoLoading: false})
33
-
34
47
  this.loadLoginInfo()
35
48
  })
36
- }
49
+ };
37
50
 
38
51
  componentDidUpdate(prevProps, prevState, snapshot) {
39
52
  const pre = prevProps.location.pathname
40
53
  const cur = this.props.location.pathname
41
-
42
54
  if (pre !== cur) {
43
55
  this.loadLoginInfo()
44
56
  }
@@ -46,7 +58,10 @@ class _Layouts extends React.Component {
46
58
 
47
59
  isSimplePage() {
48
60
  let {pathname} = this.props.location;
49
- return ArrUtils.contains(SIMPLE_URLS, pathname)
61
+ let isSimplePage = ArrUtils.contains(SIMPLE_URLS, pathname);
62
+ console.log('简单页面列表定义', SIMPLE_URLS)
63
+ console.log('当前页面是否简单页面',pathname,isSimplePage)
64
+ return isSimplePage
50
65
  }
51
66
 
52
67
  loadLoginInfo = () => {
@@ -74,11 +89,6 @@ class _Layouts extends React.Component {
74
89
  })
75
90
  }
76
91
 
77
-
78
-
79
-
80
-
81
-
82
92
  render() {
83
93
  return <ConfigProvider
84
94
  input={{autoComplete: 'off'}}
@@ -112,23 +122,25 @@ class _Layouts extends React.Component {
112
122
  triggerBg: ThemeUtils.getColor("primary-color-click"),
113
123
  headerBg: 'white',
114
124
  triggerHeight: 32
115
- },
116
-
117
-
125
+ }
118
126
  }
119
127
  }}>
120
128
 
121
129
  {this.renderContent()}
122
-
123
- <MessageHolder />
124
-
125
130
  </ConfigProvider>
126
131
  }
127
132
 
133
+
128
134
  renderContent = () => {
135
+ if(!this.state.messageHolderInit) {
136
+ console.log('先加载message holder')
137
+ return <MessageHolder onFinish={this.onMessageHolderFinish} />
138
+ }
139
+
129
140
  if (this.state.siteInfoLoading) {
130
141
  return <PageLoading message='加载站点信息...'/>
131
142
  }
143
+
132
144
  let {params = {}} = this.props.location;
133
145
  console.log('layout: params', params)
134
146
  let simple = this.isSimplePage();
@@ -140,14 +152,11 @@ class _Layouts extends React.Component {
140
152
  return <PageLoading message='加载登录信息...'/>
141
153
  }
142
154
 
143
-
144
155
  return <AdminLayout path={this.state.path} logo={this.props.logo}/>
145
156
  };
146
-
147
-
148
-
149
157
  }
150
158
 
159
+
151
160
  export const Layouts = withRouter(_Layouts);
152
161
  export default Layouts
153
162
  export * from './PageRender'