jrs-react 1.1.30 → 1.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/build/index.es.js +41357 -234
- package/build/index.js +41357 -234
- package/package.json +1 -1
- package/src/components/JRSubmit.jsx +3 -3
- package/src/components/Message.js +53 -0
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@ import React from 'react'
|
|
|
2
2
|
import axios from 'axios'
|
|
3
3
|
import { colonValueString, flexType, po } from './JRUtils'
|
|
4
4
|
import { displaySpinner } from './LoadingBar'
|
|
5
|
-
|
|
5
|
+
import msg from './Message'
|
|
6
6
|
import styled from 'styled-components'
|
|
7
7
|
|
|
8
8
|
|
|
@@ -274,11 +274,11 @@ export default class JRSubmit extends React.Component {
|
|
|
274
274
|
this.setRes(isSuccess,response,config)
|
|
275
275
|
if (isSuccess) {
|
|
276
276
|
if (config.successMessage) {
|
|
277
|
-
|
|
277
|
+
msg.success({ message:config.successMessage })
|
|
278
278
|
}
|
|
279
279
|
} else {
|
|
280
280
|
if (config.failedMessage) {
|
|
281
|
-
|
|
281
|
+
msg.error({ message:config.failedMessage })
|
|
282
282
|
}
|
|
283
283
|
}
|
|
284
284
|
config.callback?.bind(this)(isSuccess,response,payload)
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { message } from "antd";
|
|
2
|
+
import { CloseOutlined } from "@ant-design/icons";
|
|
3
|
+
|
|
4
|
+
message.config({ duration: 3 });
|
|
5
|
+
|
|
6
|
+
const info = (props) => {
|
|
7
|
+
const key = Date.now();
|
|
8
|
+
message.info({
|
|
9
|
+
content: props.message,
|
|
10
|
+
className: "info",
|
|
11
|
+
key,
|
|
12
|
+
...props
|
|
13
|
+
});
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
const success = (props) => {
|
|
17
|
+
const key = Date.now();
|
|
18
|
+
message.success({
|
|
19
|
+
content: props.message,
|
|
20
|
+
className: "success",
|
|
21
|
+
key,
|
|
22
|
+
...props
|
|
23
|
+
});
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
const warning = (props) => {
|
|
27
|
+
const key = Date.now();
|
|
28
|
+
message.warning({
|
|
29
|
+
content:props.message,
|
|
30
|
+
className: "warning",
|
|
31
|
+
key,
|
|
32
|
+
...props
|
|
33
|
+
});
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
const error = (props) => {
|
|
37
|
+
const key = Date.now();
|
|
38
|
+
message.error({
|
|
39
|
+
content: props.message,
|
|
40
|
+
className: "error",
|
|
41
|
+
key,
|
|
42
|
+
...props
|
|
43
|
+
});
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
const msg = {
|
|
47
|
+
info,
|
|
48
|
+
success,
|
|
49
|
+
warning,
|
|
50
|
+
error
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
export default msg;
|