@jiangood/admin-spring-boot-starter 0.2.5 → 0.2.7
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
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
// logger.js
|
|
2
|
+
export class Logger {
|
|
3
|
+
|
|
4
|
+
private readonly module: string;
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
constructor(module) {
|
|
8
|
+
this.module = module;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
public static getLogger(module) {
|
|
12
|
+
return new Logger(module);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
debug(...args) {
|
|
16
|
+
this._log( console.log, args);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
info(...args) {
|
|
20
|
+
this._log( console.info, args);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
warn(...args) {
|
|
24
|
+
this._log(console.warn, args);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
error(...args) {
|
|
28
|
+
this._log(console.error, args);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
private _log( consoleMethod, args) {
|
|
32
|
+
const time = new Date().toLocaleTimeString();
|
|
33
|
+
consoleMethod(`[${time}] [${this.module}] `, ...args);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
|
|
@@ -3,6 +3,7 @@ import type {ModalFuncProps} from 'antd/es/modal/interface';
|
|
|
3
3
|
import React from 'react';
|
|
4
4
|
import {MessageInstance} from "antd/lib/message/interface";
|
|
5
5
|
import {HookAPI} from "antd/lib/modal/useModal";
|
|
6
|
+
import {Logger} from "./Logger";
|
|
6
7
|
|
|
7
8
|
|
|
8
9
|
|
|
@@ -102,7 +103,7 @@ export class MessageUtils {
|
|
|
102
103
|
* 错误消息
|
|
103
104
|
*/
|
|
104
105
|
static error(content: String, duration: number = 3) {
|
|
105
|
-
console.
|
|
106
|
+
console.log('调用 MessageUtils.error',content)
|
|
106
107
|
if(!this.messageApi){
|
|
107
108
|
alert(content)
|
|
108
109
|
return
|
|
@@ -159,7 +160,7 @@ export function MessageHolder(props){
|
|
|
159
160
|
const [messageApi, messageContextHolder] = message.useMessage();
|
|
160
161
|
|
|
161
162
|
React.useEffect(()=>{
|
|
162
|
-
|
|
163
|
+
Logger.getLogger("MessageHolder").debug('Rendered')
|
|
163
164
|
MessageUtils.config(messageApi,modalApi);
|
|
164
165
|
props.onFinish()
|
|
165
166
|
},[])
|
package/src/layouts/index.jsx
CHANGED
|
@@ -19,6 +19,7 @@ import 'dayjs/locale/zh-cn';
|
|
|
19
19
|
|
|
20
20
|
import '../style/global.less'
|
|
21
21
|
import './index.less'
|
|
22
|
+
import {Logger} from "../framework/utils/Logger";
|
|
22
23
|
|
|
23
24
|
dayjs.locale('zh-cn');
|
|
24
25
|
|
|
@@ -27,6 +28,7 @@ const SIMPLE_URLS = ['/login', '/test']
|
|
|
27
28
|
|
|
28
29
|
class _Layouts extends React.Component {
|
|
29
30
|
|
|
31
|
+
log = Logger.getLogger('Layouts')
|
|
30
32
|
|
|
31
33
|
state = {
|
|
32
34
|
messageHolderInit:false,
|
|
@@ -126,6 +128,7 @@ class _Layouts extends React.Component {
|
|
|
126
128
|
}
|
|
127
129
|
}}>
|
|
128
130
|
|
|
131
|
+
<MessageHolder onFinish={this.onMessageHolderFinish} />
|
|
129
132
|
{this.renderContent()}
|
|
130
133
|
</ConfigProvider>
|
|
131
134
|
}
|
|
@@ -133,8 +136,8 @@ class _Layouts extends React.Component {
|
|
|
133
136
|
|
|
134
137
|
renderContent = () => {
|
|
135
138
|
if(!this.state.messageHolderInit) {
|
|
136
|
-
|
|
137
|
-
return <
|
|
139
|
+
this.log.info('加载message holder...')
|
|
140
|
+
return <PageLoading message='加载消息组件...'/>
|
|
138
141
|
}
|
|
139
142
|
|
|
140
143
|
if (this.state.siteInfoLoading) {
|