ls-pro-common 1.0.75 → 1.0.76

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.
@@ -81,7 +81,7 @@ function IconSelector(prop) {
81
81
 
82
82
  try {
83
83
  if (!inputRef.current) return;
84
- var el = inputRef.current.clearableInput.containerRef.current.querySelector('.ant-input-clear-icon');
84
+ var el = inputRef.current.input.parentNode.querySelector('.ant-input-clear-icon');
85
85
  if (!el) return;
86
86
 
87
87
  if (icon) {
@@ -241,7 +241,7 @@ function ImageSelector(prop) {
241
241
 
242
242
  try {
243
243
  if (!inputRef.current) return;
244
- var el = inputRef.current.clearableInput.containerRef.current.querySelector('.ant-input-clear-icon');
244
+ var el = inputRef.current.input.parentNode.querySelector('.ant-input-clear-icon');
245
245
  if (!el) return;
246
246
 
247
247
  if (imgUrl) {
@@ -348,7 +348,7 @@ var InputTable = /*#__PURE__*/React.forwardRef(function (prop, ref) {
348
348
  if (rest.disabled || (fieldProps === null || fieldProps === void 0 ? void 0 : fieldProps.disabled)) return;
349
349
 
350
350
  try {
351
- var el = inputRef.current.clearableInput.containerRef.current.querySelector('.ant-input-clear-icon');
351
+ var el = inputRef.current.input.parentNode.querySelector('.ant-input-clear-icon');
352
352
  if (!el) return;
353
353
 
354
354
  if (text) {
@@ -186,11 +186,13 @@ body {
186
186
  }
187
187
 
188
188
  .loading {
189
- height : 100%;
190
- width : 100%;
191
- text-align : center;
192
- padding-top: 20%;
193
- background : #fff;
189
+ height : 100%;
190
+ width : 100%;
191
+ position : absolute;
192
+ display : flex;
193
+ align-items : center;
194
+ justify-content: center;
195
+ background : #fff;
194
196
  }
195
197
 
196
198
  #myloading {
@@ -216,9 +218,9 @@ body {
216
218
  border-radius: 4px;
217
219
  border-color : var(--ant-primary-color);
218
220
  color : var(--ant-primary-color);
219
- height : 28px;
220
- line-height: 1.2;
221
- padding : 2px 15px;
221
+ height : 28px;
222
+ line-height : 1.2;
223
+ padding : 2px 15px;
222
224
 
223
225
  &:active {
224
226
  border-color: var(--ant-primary-color-hover);
@@ -226,8 +228,8 @@ body {
226
228
  }
227
229
  }
228
230
 
229
- .ant-btn-icon-only{
230
- padding : 2px 0;
231
+ .ant-btn-icon-only {
232
+ padding: 2px 0;
231
233
  }
232
234
 
233
235
  .ant-btn-primary {
@@ -303,8 +305,4 @@ a:hover {
303
305
  max-height: calc(100vh - 180px);
304
306
  overflow-y: auto;
305
307
  }
306
- }
307
-
308
-
309
-
310
-
308
+ }
package/es/http/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import _regeneratorRuntime from "@babel/runtime/regenerator";
2
2
  import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
3
3
  import { extend } from 'umi-request';
4
- import { getCache, getUrlQuery, setUrlQuery, getCookie, getResourceProps, showError, toGatewayUrl, reLogin, showLoading, exitLoading } from '../utils'; //默认超时时间为1分钟
4
+ import { getCache, getUrlQuery, setUrlQuery, getCookie, getResourceProps, showError, httpError, toGatewayUrl, reLogin, showLoading, exitLoading } from '../utils'; //默认超时时间为1分钟
5
5
 
6
6
  var request = extend({
7
7
  timeout: 60000
@@ -63,7 +63,7 @@ request.interceptors.request.use(function (url, options) {
63
63
 
64
64
  request.interceptors.response.use( /*#__PURE__*/function () {
65
65
  var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(response, options) {
66
- var noMsg, _data$flag, _data$flag2, data, _data$flag3, _data$flag4, _data$flag5, _data, retCode, retMsg, status;
66
+ var noMsg, _data$flag, _data$flag2, _data$flag3, _data$flag4, data, retCode, retMsg, requestId, faultCode, _data$flag5, _data$flag6, _data$flag7, _data$flag8, _data, _retCode, _retMsg, status, _requestId, _faultCode;
67
67
 
68
68
  return _regeneratorRuntime.wrap(function _callee$(_context) {
69
69
  while (1) {
@@ -72,7 +72,7 @@ request.interceptors.response.use( /*#__PURE__*/function () {
72
72
  noMsg = getUrlQuery('noMsg', options.url); // http 状态码错误
73
73
 
74
74
  if (!(response.status < 200 || response.status >= 300)) {
75
- _context.next = 14;
75
+ _context.next = 18;
76
76
  break;
77
77
  }
78
78
 
@@ -82,57 +82,71 @@ request.interceptors.response.use( /*#__PURE__*/function () {
82
82
 
83
83
  case 5:
84
84
  data = _context.sent;
85
+ retCode = (_data$flag = data.flag) === null || _data$flag === void 0 ? void 0 : _data$flag.retCode;
86
+ retMsg = (_data$flag2 = data.flag) === null || _data$flag2 === void 0 ? void 0 : _data$flag2.retMsg;
87
+ requestId = (_data$flag3 = data.flag) === null || _data$flag3 === void 0 ? void 0 : _data$flag3.requestId;
88
+ faultCode = (_data$flag4 = data.flag) === null || _data$flag4 === void 0 ? void 0 : _data$flag4.faultCode;
85
89
 
86
- if (((_data$flag = data.flag) === null || _data$flag === void 0 ? void 0 : _data$flag.retCode) === 'timeout' || ((_data$flag2 = data.flag) === null || _data$flag2 === void 0 ? void 0 : _data$flag2.retCode) === '4011') {
90
+ if (retCode === 'timeout' || retCode === '4011') {
87
91
  reLogin();
88
92
  } else if (noMsg !== '1') {
89
- showError(options.url + ((_data$flag3 = data.flag) === null || _data$flag3 === void 0 ? void 0 : _data$flag3.retMsg));
93
+ if (faultCode) {
94
+ httpError(retMsg, requestId, faultCode, options.url);
95
+ } else {
96
+ showError(retMsg + options.url);
97
+ }
90
98
  }
91
99
 
92
- _context.next = 12;
100
+ _context.next = 16;
93
101
  break;
94
102
 
95
- case 9:
96
- _context.prev = 9;
103
+ case 13:
104
+ _context.prev = 13;
97
105
  _context.t0 = _context["catch"](2);
98
- showError(options.url + response.statusText);
106
+ showError(options.url + (_context.t0.message || response.statusText));
99
107
 
100
- case 12:
101
- _context.next = 22;
108
+ case 16:
109
+ _context.next = 28;
102
110
  break;
103
111
 
104
- case 14:
112
+ case 18:
105
113
  if (!(noMsg !== '1')) {
106
- _context.next = 22;
114
+ _context.next = 28;
107
115
  break;
108
116
  }
109
117
 
110
- _context.next = 17;
118
+ _context.next = 21;
111
119
  return response.clone().json();
112
120
 
113
- case 17:
121
+ case 21:
114
122
  _data = _context.sent;
115
- retCode = (_data === null || _data === void 0 ? void 0 : (_data$flag4 = _data.flag) === null || _data$flag4 === void 0 ? void 0 : _data$flag4.retCode) || '0';
116
- retMsg = ((_data$flag5 = _data.flag) === null || _data$flag5 === void 0 ? void 0 : _data$flag5.retMsg) || '访问接口出错';
123
+ _retCode = (_data === null || _data === void 0 ? void 0 : (_data$flag5 = _data.flag) === null || _data$flag5 === void 0 ? void 0 : _data$flag5.retCode) || '0';
124
+ _retMsg = ((_data$flag6 = _data.flag) === null || _data$flag6 === void 0 ? void 0 : _data$flag6.retMsg) || '访问接口出错';
117
125
  status = (getUrlQuery('apiStatus') || '0').split(',');
126
+ _requestId = (_data$flag7 = _data.flag) === null || _data$flag7 === void 0 ? void 0 : _data$flag7.requestId;
127
+ _faultCode = (_data$flag8 = _data.flag) === null || _data$flag8 === void 0 ? void 0 : _data$flag8.faultCode;
118
128
 
119
- if (retCode && !status.includes(retCode)) {
120
- if (retCode === 'timeout' || retCode === '4011') {
129
+ if (_retCode && !status.includes(_retCode)) {
130
+ if (_retCode === 'timeout' || _retCode === '4011') {
121
131
  reLogin();
122
132
  } else {
123
- showError(retMsg);
133
+ if (_faultCode) {
134
+ httpError(_retMsg, _requestId, _faultCode, options.url);
135
+ } else {
136
+ showError(_retMsg);
137
+ }
124
138
  }
125
139
  }
126
140
 
127
- case 22:
141
+ case 28:
128
142
  return _context.abrupt("return", response);
129
143
 
130
- case 23:
144
+ case 29:
131
145
  case "end":
132
146
  return _context.stop();
133
147
  }
134
148
  }
135
- }, _callee, null, [[2, 9]]);
149
+ }, _callee, null, [[2, 13]]);
136
150
  }));
137
151
 
138
152
  return function (_x, _x2) {
package/es/typing.d.ts CHANGED
@@ -4,6 +4,8 @@ export declare type ApiResponse = Record<string, any> & {
4
4
  retCode?: string;
5
5
  retMsg?: string;
6
6
  retDetail?: string;
7
+ faultCode?: string;
8
+ requestId?: string;
7
9
  };
8
10
  rows?: [];
9
11
  data?: any;
@@ -1,3 +1,5 @@
1
+ import ReactDOM from 'react-dom';
2
+ import React from 'react';
1
3
  export { getUrlQuery, setUrlQuery, toGatewayUrl, dateFormat, getResourceProps } from 'ls-pro-table';
2
4
  /**
3
5
  * 设置文档title
@@ -98,6 +100,12 @@ export declare const showError: (text: string) => void;
98
100
  export declare const showWarn: (text: string) => void;
99
101
  /** @name 显示成功 */
100
102
  export declare const showSuccess: (text: string) => void;
103
+ export declare const showAlert: (text: React.ReactDOM, title?: string, type?: 'error' | 'info' | 'success' | 'warn') => {
104
+ destroy: () => void;
105
+ update: (configUpdate: import("antd").ModalFuncProps | ((prevConfig: import("antd").ModalFuncProps) => import("antd").ModalFuncProps)) => void;
106
+ };
107
+ export declare const httpError: (retMsg?: string | undefined, requestId?: string | undefined, faultCode?: string | undefined, url?: string | undefined) => void;
108
+ export declare const exitAlert: () => void;
101
109
  /** @name 显示确认 */
102
110
  export declare const showConfirm: (text: string, title?: string) => Promise<unknown>;
103
111
  /**
package/es/utils/index.js CHANGED
@@ -6,11 +6,11 @@ import _Modal from "antd/es/modal";
6
6
  import "antd/es/message/style";
7
7
  import _message from "antd/es/message";
8
8
  import _typeof from "@babel/runtime/helpers/esm/typeof";
9
- import React from "react";
10
9
  import ReactDOM from 'react-dom';
11
10
  import { QuestionCircleOutlined } from '@ant-design/icons';
12
11
  import { dateFormat, toGatewayUrl } from 'ls-pro-table';
13
12
  import { httpPost } from '../http';
13
+ import React from 'react';
14
14
  export { getUrlQuery, setUrlQuery, toGatewayUrl, dateFormat, getResourceProps } from 'ls-pro-table';
15
15
  /**
16
16
  * 设置文档title
@@ -238,6 +238,39 @@ export var showWarn = function showWarn(text) {
238
238
  export var showSuccess = function showSuccess(text) {
239
239
  _message.success(text);
240
240
  };
241
+ export var showAlert = function showAlert(text) {
242
+ var title = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '系统提示';
243
+ var type = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'error';
244
+
245
+ if (type === 'success') {
246
+ return _Modal.success({
247
+ title: title,
248
+ content: text
249
+ });
250
+ } else if (type === 'error') {
251
+ return _Modal.error({
252
+ title: title,
253
+ content: text
254
+ });
255
+ } else if (type === 'warn') {
256
+ return _Modal.warn({
257
+ title: title,
258
+ content: text
259
+ });
260
+ }
261
+
262
+ return _Modal.info({
263
+ title: title,
264
+ content: text
265
+ });
266
+ };
267
+ export var httpError = function httpError(retMsg, requestId, faultCode, url) {
268
+ var msg = /*#__PURE__*/React.createElement(React.Fragment, null, retMsg, /*#__PURE__*/React.createElement("br", null), "\u9519\u8BEF\u7801:", /*#__PURE__*/React.createElement("b", null, faultCode));
269
+ showAlert(msg, '请求接口出错', 'error');
270
+ };
271
+ export var exitAlert = function exitAlert() {
272
+ _Modal.destroyAll();
273
+ };
241
274
  /** @name 显示确认 */
242
275
 
243
276
  export var showConfirm = function showConfirm(text) {
@@ -104,7 +104,7 @@ function IconSelector(prop) {
104
104
 
105
105
  try {
106
106
  if (!inputRef.current) return;
107
- var el = inputRef.current.clearableInput.containerRef.current.querySelector('.ant-input-clear-icon');
107
+ var el = inputRef.current.input.parentNode.querySelector('.ant-input-clear-icon');
108
108
  if (!el) return;
109
109
 
110
110
  if (icon) {
@@ -271,7 +271,7 @@ function ImageSelector(prop) {
271
271
 
272
272
  try {
273
273
  if (!inputRef.current) return;
274
- var el = inputRef.current.clearableInput.containerRef.current.querySelector('.ant-input-clear-icon');
274
+ var el = inputRef.current.input.parentNode.querySelector('.ant-input-clear-icon');
275
275
  if (!el) return;
276
276
 
277
277
  if (imgUrl) {
@@ -378,7 +378,7 @@ var InputTable = /*#__PURE__*/_react.default.forwardRef(function (prop, ref) {
378
378
  if (rest.disabled || (fieldProps === null || fieldProps === void 0 ? void 0 : fieldProps.disabled)) return;
379
379
 
380
380
  try {
381
- var el = inputRef.current.clearableInput.containerRef.current.querySelector('.ant-input-clear-icon');
381
+ var el = inputRef.current.input.parentNode.querySelector('.ant-input-clear-icon');
382
382
  if (!el) return;
383
383
 
384
384
  if (text) {
@@ -186,11 +186,13 @@ body {
186
186
  }
187
187
 
188
188
  .loading {
189
- height : 100%;
190
- width : 100%;
191
- text-align : center;
192
- padding-top: 20%;
193
- background : #fff;
189
+ height : 100%;
190
+ width : 100%;
191
+ position : absolute;
192
+ display : flex;
193
+ align-items : center;
194
+ justify-content: center;
195
+ background : #fff;
194
196
  }
195
197
 
196
198
  #myloading {
@@ -216,9 +218,9 @@ body {
216
218
  border-radius: 4px;
217
219
  border-color : var(--ant-primary-color);
218
220
  color : var(--ant-primary-color);
219
- height : 28px;
220
- line-height: 1.2;
221
- padding : 2px 15px;
221
+ height : 28px;
222
+ line-height : 1.2;
223
+ padding : 2px 15px;
222
224
 
223
225
  &:active {
224
226
  border-color: var(--ant-primary-color-hover);
@@ -226,8 +228,8 @@ body {
226
228
  }
227
229
  }
228
230
 
229
- .ant-btn-icon-only{
230
- padding : 2px 0;
231
+ .ant-btn-icon-only {
232
+ padding: 2px 0;
231
233
  }
232
234
 
233
235
  .ant-btn-primary {
@@ -303,8 +305,4 @@ a:hover {
303
305
  max-height: calc(100vh - 180px);
304
306
  overflow-y: auto;
305
307
  }
306
- }
307
-
308
-
309
-
310
-
308
+ }
package/lib/http/index.js CHANGED
@@ -82,7 +82,7 @@ request.interceptors.request.use(function (url, options) {
82
82
 
83
83
  request.interceptors.response.use( /*#__PURE__*/function () {
84
84
  var _ref = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(response, options) {
85
- var noMsg, _data$flag, _data$flag2, data, _data$flag3, _data$flag4, _data$flag5, _data, retCode, retMsg, status;
85
+ var noMsg, _data$flag, _data$flag2, _data$flag3, _data$flag4, data, retCode, retMsg, requestId, faultCode, _data$flag5, _data$flag6, _data$flag7, _data$flag8, _data, _retCode, _retMsg, status, _requestId, _faultCode;
86
86
 
87
87
  return _regenerator.default.wrap(function _callee$(_context) {
88
88
  while (1) {
@@ -91,7 +91,7 @@ request.interceptors.response.use( /*#__PURE__*/function () {
91
91
  noMsg = (0, _utils.getUrlQuery)('noMsg', options.url); // http 状态码错误
92
92
 
93
93
  if (!(response.status < 200 || response.status >= 300)) {
94
- _context.next = 14;
94
+ _context.next = 18;
95
95
  break;
96
96
  }
97
97
 
@@ -101,57 +101,71 @@ request.interceptors.response.use( /*#__PURE__*/function () {
101
101
 
102
102
  case 5:
103
103
  data = _context.sent;
104
+ retCode = (_data$flag = data.flag) === null || _data$flag === void 0 ? void 0 : _data$flag.retCode;
105
+ retMsg = (_data$flag2 = data.flag) === null || _data$flag2 === void 0 ? void 0 : _data$flag2.retMsg;
106
+ requestId = (_data$flag3 = data.flag) === null || _data$flag3 === void 0 ? void 0 : _data$flag3.requestId;
107
+ faultCode = (_data$flag4 = data.flag) === null || _data$flag4 === void 0 ? void 0 : _data$flag4.faultCode;
104
108
 
105
- if (((_data$flag = data.flag) === null || _data$flag === void 0 ? void 0 : _data$flag.retCode) === 'timeout' || ((_data$flag2 = data.flag) === null || _data$flag2 === void 0 ? void 0 : _data$flag2.retCode) === '4011') {
109
+ if (retCode === 'timeout' || retCode === '4011') {
106
110
  (0, _utils.reLogin)();
107
111
  } else if (noMsg !== '1') {
108
- (0, _utils.showError)(options.url + ((_data$flag3 = data.flag) === null || _data$flag3 === void 0 ? void 0 : _data$flag3.retMsg));
112
+ if (faultCode) {
113
+ (0, _utils.httpError)(retMsg, requestId, faultCode, options.url);
114
+ } else {
115
+ (0, _utils.showError)(retMsg + options.url);
116
+ }
109
117
  }
110
118
 
111
- _context.next = 12;
119
+ _context.next = 16;
112
120
  break;
113
121
 
114
- case 9:
115
- _context.prev = 9;
122
+ case 13:
123
+ _context.prev = 13;
116
124
  _context.t0 = _context["catch"](2);
117
- (0, _utils.showError)(options.url + response.statusText);
125
+ (0, _utils.showError)(options.url + (_context.t0.message || response.statusText));
118
126
 
119
- case 12:
120
- _context.next = 22;
127
+ case 16:
128
+ _context.next = 28;
121
129
  break;
122
130
 
123
- case 14:
131
+ case 18:
124
132
  if (!(noMsg !== '1')) {
125
- _context.next = 22;
133
+ _context.next = 28;
126
134
  break;
127
135
  }
128
136
 
129
- _context.next = 17;
137
+ _context.next = 21;
130
138
  return response.clone().json();
131
139
 
132
- case 17:
140
+ case 21:
133
141
  _data = _context.sent;
134
- retCode = (_data === null || _data === void 0 ? void 0 : (_data$flag4 = _data.flag) === null || _data$flag4 === void 0 ? void 0 : _data$flag4.retCode) || '0';
135
- retMsg = ((_data$flag5 = _data.flag) === null || _data$flag5 === void 0 ? void 0 : _data$flag5.retMsg) || '访问接口出错';
142
+ _retCode = (_data === null || _data === void 0 ? void 0 : (_data$flag5 = _data.flag) === null || _data$flag5 === void 0 ? void 0 : _data$flag5.retCode) || '0';
143
+ _retMsg = ((_data$flag6 = _data.flag) === null || _data$flag6 === void 0 ? void 0 : _data$flag6.retMsg) || '访问接口出错';
136
144
  status = ((0, _utils.getUrlQuery)('apiStatus') || '0').split(',');
145
+ _requestId = (_data$flag7 = _data.flag) === null || _data$flag7 === void 0 ? void 0 : _data$flag7.requestId;
146
+ _faultCode = (_data$flag8 = _data.flag) === null || _data$flag8 === void 0 ? void 0 : _data$flag8.faultCode;
137
147
 
138
- if (retCode && !status.includes(retCode)) {
139
- if (retCode === 'timeout' || retCode === '4011') {
148
+ if (_retCode && !status.includes(_retCode)) {
149
+ if (_retCode === 'timeout' || _retCode === '4011') {
140
150
  (0, _utils.reLogin)();
141
151
  } else {
142
- (0, _utils.showError)(retMsg);
152
+ if (_faultCode) {
153
+ (0, _utils.httpError)(_retMsg, _requestId, _faultCode, options.url);
154
+ } else {
155
+ (0, _utils.showError)(_retMsg);
156
+ }
143
157
  }
144
158
  }
145
159
 
146
- case 22:
160
+ case 28:
147
161
  return _context.abrupt("return", response);
148
162
 
149
- case 23:
163
+ case 29:
150
164
  case "end":
151
165
  return _context.stop();
152
166
  }
153
167
  }
154
- }, _callee, null, [[2, 9]]);
168
+ }, _callee, null, [[2, 13]]);
155
169
  }));
156
170
 
157
171
  return function (_x, _x2) {
package/lib/typing.d.ts CHANGED
@@ -4,6 +4,8 @@ export declare type ApiResponse = Record<string, any> & {
4
4
  retCode?: string;
5
5
  retMsg?: string;
6
6
  retDetail?: string;
7
+ faultCode?: string;
8
+ requestId?: string;
7
9
  };
8
10
  rows?: [];
9
11
  data?: any;
@@ -1,3 +1,5 @@
1
+ import ReactDOM from 'react-dom';
2
+ import React from 'react';
1
3
  export { getUrlQuery, setUrlQuery, toGatewayUrl, dateFormat, getResourceProps } from 'ls-pro-table';
2
4
  /**
3
5
  * 设置文档title
@@ -98,6 +100,12 @@ export declare const showError: (text: string) => void;
98
100
  export declare const showWarn: (text: string) => void;
99
101
  /** @name 显示成功 */
100
102
  export declare const showSuccess: (text: string) => void;
103
+ export declare const showAlert: (text: React.ReactDOM, title?: string, type?: 'error' | 'info' | 'success' | 'warn') => {
104
+ destroy: () => void;
105
+ update: (configUpdate: import("antd").ModalFuncProps | ((prevConfig: import("antd").ModalFuncProps) => import("antd").ModalFuncProps)) => void;
106
+ };
107
+ export declare const httpError: (retMsg?: string | undefined, requestId?: string | undefined, faultCode?: string | undefined, url?: string | undefined) => void;
108
+ export declare const exitAlert: () => void;
101
109
  /** @name 显示确认 */
102
110
  export declare const showConfirm: (text: string, title?: string) => Promise<unknown>;
103
111
  /**
@@ -12,7 +12,7 @@ Object.defineProperty(exports, "dateFormat", {
12
12
  return _lsProTable.dateFormat;
13
13
  }
14
14
  });
15
- exports.getLoginName = exports.getCookie = exports.getCompanyId = exports.getCache = exports.formatMoney = exports.formatDate = exports.exitLoading = exports.deepClone = exports.debounce = void 0;
15
+ exports.getLoginName = exports.getCookie = exports.getCompanyId = exports.getCache = exports.formatMoney = exports.formatDate = exports.exitLoading = exports.exitAlert = exports.deepClone = exports.debounce = void 0;
16
16
  Object.defineProperty(exports, "getResourceProps", {
17
17
  enumerable: true,
18
18
  get: function get() {
@@ -25,14 +25,14 @@ Object.defineProperty(exports, "getUrlQuery", {
25
25
  return _lsProTable.getUrlQuery;
26
26
  }
27
27
  });
28
- exports.setTitle = exports.setCookie = exports.setCache = exports.reLogin = exports.rangeToSearch = exports.printView = exports.printAsync = exports.openPageInMain = exports.on = exports.off = exports.nowAdd = exports.now = exports.isLogin = exports.isDev = exports.handleSizeCols = exports.getUserName = exports.getUserInfo = void 0;
28
+ exports.setTitle = exports.setCookie = exports.setCache = exports.reLogin = exports.rangeToSearch = exports.printView = exports.printAsync = exports.openPageInMain = exports.on = exports.off = exports.nowAdd = exports.now = exports.isLogin = exports.isDev = exports.httpError = exports.handleSizeCols = exports.getUserName = exports.getUserInfo = void 0;
29
29
  Object.defineProperty(exports, "setUrlQuery", {
30
30
  enumerable: true,
31
31
  get: function get() {
32
32
  return _lsProTable.setUrlQuery;
33
33
  }
34
34
  });
35
- exports.throttle = exports.statusList = exports.showWarn = exports.showSuccess = exports.showLoading = exports.showError = exports.showConfirm = void 0;
35
+ exports.throttle = exports.statusList = exports.showWarn = exports.showSuccess = exports.showLoading = exports.showError = exports.showConfirm = exports.showAlert = void 0;
36
36
  Object.defineProperty(exports, "toGatewayUrl", {
37
37
  enumerable: true,
38
38
  get: function get() {
@@ -57,8 +57,6 @@ var _message2 = _interopRequireDefault(require("antd/es/message"));
57
57
 
58
58
  var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
59
59
 
60
- var _react = _interopRequireDefault(require("react"));
61
-
62
60
  var _reactDom = _interopRequireDefault(require("react-dom"));
63
61
 
64
62
  var _icons = require("@ant-design/icons");
@@ -67,6 +65,8 @@ var _lsProTable = require("ls-pro-table");
67
65
 
68
66
  var _http = require("../http");
69
67
 
68
+ var _react = _interopRequireDefault(require("react"));
69
+
70
70
  /**
71
71
  * 设置文档title
72
72
  * @param {*} title
@@ -338,10 +338,53 @@ exports.showWarn = showWarn;
338
338
  var showSuccess = function showSuccess(text) {
339
339
  _message2.default.success(text);
340
340
  };
341
+
342
+ exports.showSuccess = showSuccess;
343
+
344
+ var showAlert = function showAlert(text) {
345
+ var title = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '系统提示';
346
+ var type = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'error';
347
+
348
+ if (type === 'success') {
349
+ return _modal.default.success({
350
+ title: title,
351
+ content: text
352
+ });
353
+ } else if (type === 'error') {
354
+ return _modal.default.error({
355
+ title: title,
356
+ content: text
357
+ });
358
+ } else if (type === 'warn') {
359
+ return _modal.default.warn({
360
+ title: title,
361
+ content: text
362
+ });
363
+ }
364
+
365
+ return _modal.default.info({
366
+ title: title,
367
+ content: text
368
+ });
369
+ };
370
+
371
+ exports.showAlert = showAlert;
372
+
373
+ var httpError = function httpError(retMsg, requestId, faultCode, url) {
374
+ var msg = /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, retMsg, /*#__PURE__*/_react.default.createElement("br", null), "\u9519\u8BEF\u7801:", /*#__PURE__*/_react.default.createElement("b", null, faultCode));
375
+
376
+ showAlert(msg, '请求接口出错', 'error');
377
+ };
378
+
379
+ exports.httpError = httpError;
380
+
381
+ var exitAlert = function exitAlert() {
382
+ _modal.default.destroyAll();
383
+ };
341
384
  /** @name 显示确认 */
342
385
 
343
386
 
344
- exports.showSuccess = showSuccess;
387
+ exports.exitAlert = exitAlert;
345
388
 
346
389
  var showConfirm = function showConfirm(text) {
347
390
  var title = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '系统提示';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ls-pro-common",
3
- "version": "1.0.75",
3
+ "version": "1.0.76",
4
4
  "description": "ls-pro-common",
5
5
  "keywords": [
6
6
  "antd",
@@ -27,7 +27,7 @@
27
27
  ],
28
28
  "dependencies": {
29
29
  "@ant-design/icons": "^4.3.0",
30
- "ls-pro-table": "2.62.55",
30
+ "ls-pro-table": "2.62.56",
31
31
  "ls-pro-form": "1.52.33",
32
32
  "@babel/runtime": "^7.16.3",
33
33
  "classnames": "^2.2.6",