ls-pro-common 1.0.75 → 1.0.77

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.
@@ -36,6 +36,7 @@ export declare type DtlLyaoutProps = Record<string, any> & {
36
36
  statusField?: string;
37
37
  /** 审核状态值 */
38
38
  auditStatus?: number;
39
+ isView?: boolean;
39
40
  };
40
41
  declare function DtlLayout(props: DtlLyaoutProps): JSX.Element;
41
42
  export default DtlLayout;
@@ -23,7 +23,9 @@ function DtlLayout(props) {
23
23
  btnExitText = _props$btnExitText === void 0 ? '返回' : _props$btnExitText,
24
24
  btnStatus = props.btnStatus,
25
25
  statusField = props.statusField,
26
- auditStatus = props.auditStatus;
26
+ auditStatus = props.auditStatus,
27
+ _props$isView = props.isView,
28
+ isView = _props$isView === void 0 ? false : _props$isView;
27
29
 
28
30
  var _usePermission = usePermission(),
29
31
  checkRight = _usePermission.checkRight;
@@ -43,7 +45,8 @@ function DtlLayout(props) {
43
45
  };
44
46
 
45
47
  var btnDisabled = function btnDisabled(btnKey) {
46
- // 优先处理自定义的状态
48
+ if (isView) return true; // 优先处理自定义的状态
49
+
47
50
  if (btnStatus && typeof btnStatus(btnKey) === 'boolean') {
48
51
  return btnStatus(btnKey) || false;
49
52
  }
@@ -62,7 +65,7 @@ function DtlLayout(props) {
62
65
  // ]
63
66
  var b = []; // 有新增或更改权限且未审核,开放出保存按钮
64
67
 
65
- if ((checkRight(2) || checkRight(4)) && !isAudit()) {
68
+ if ((checkRight(2) || checkRight(4)) && !isAudit() && !isView) {
66
69
  b.unshift( /*#__PURE__*/React.createElement(_Button, {
67
70
  key: "btnSave",
68
71
  onClick: function onClick() {
@@ -80,7 +83,7 @@ function DtlLayout(props) {
80
83
  } // 转入onAudit方法且有审核权限,数据未审核,开放出审核按钮
81
84
 
82
85
 
83
- if (props.onAudit && checkRight(64) && !isAudit()) {
86
+ if (props.onAudit && checkRight(64) && !isAudit() && !isView) {
84
87
  b.unshift( /*#__PURE__*/React.createElement(_Button, {
85
88
  key: "btnAudit",
86
89
  disabled: btnDisabled('btnAudit'),
@@ -81,13 +81,13 @@ 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;
85
85
  if (!el) return;
86
86
 
87
87
  if (icon) {
88
- el.classList.remove('ant-input-clear-icon-hidden');
88
+ el.classList.add('ant-input-has-value');
89
89
  } else {
90
- el.classList.add('ant-input-clear-icon-hidden');
90
+ el.classList.remove('ant-input-has-value');
91
91
  }
92
92
  } catch (e) {}
93
93
  }, [icon]);
@@ -241,13 +241,13 @@ 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;
245
245
  if (!el) return;
246
246
 
247
247
  if (imgUrl) {
248
- el.classList.remove('ant-input-clear-icon-hidden');
248
+ el.classList.add('ant-input-has-value');
249
249
  } else {
250
- el.classList.add('ant-input-clear-icon-hidden');
250
+ el.classList.remove('ant-input-has-value');
251
251
  }
252
252
  } catch (e) {}
253
253
  }, [imgUrl]);
@@ -186,6 +186,8 @@ var InputTable = /*#__PURE__*/React.forwardRef(function (prop, ref) {
186
186
  if (!textName && formValue[name]) {
187
187
  formValue[textNameProp] = formValue[name];
188
188
  formRef === null || formRef === void 0 ? void 0 : formRef.current.setFieldsValue(_objectSpread({}, formValue));
189
+ } else if (textName && formValue[textName]) {
190
+ setText(formValue[textName]);
189
191
  }
190
192
  }, []); // 处理返回数据
191
193
 
@@ -343,18 +345,19 @@ var InputTable = /*#__PURE__*/React.forwardRef(function (prop, ref) {
343
345
  }, "\u786E\u8BA4")];
344
346
  },
345
347
  headerTitle: "\u53CC\u51FB\u9009\u4E2D\u5F53\u524D\u884C\u6570\u636E"
346
- }, tableConfig));
348
+ }, tableConfig)); // 处理有值时,可清空
349
+
347
350
  useEffect(function () {
348
351
  if (rest.disabled || (fieldProps === null || fieldProps === void 0 ? void 0 : fieldProps.disabled)) return;
349
352
 
350
353
  try {
351
- var el = inputRef.current.clearableInput.containerRef.current.querySelector('.ant-input-clear-icon');
354
+ var el = inputRef.current.input.parentNode;
352
355
  if (!el) return;
353
356
 
354
357
  if (text) {
355
- el.classList.remove('ant-input-clear-icon-hidden');
358
+ el.classList.add('ant-input-has-value');
356
359
  } else {
357
- el.classList.add('ant-input-clear-icon-hidden');
360
+ el.classList.remove('ant-input-has-value');
358
361
  }
359
362
  } catch (e) {}
360
363
  }, [text, rest, fieldProps]);
@@ -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 {
@@ -305,6 +307,8 @@ a:hover {
305
307
  }
306
308
  }
307
309
 
308
-
309
-
310
-
310
+ .ant-input-has-value:hover{
311
+ .ant-input-clear-icon{
312
+ visibility: visible;
313
+ }
314
+ }
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, retCode, 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, _retCode, _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, retCode?: 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, retCode, faultCode, url) {
268
+ var msg = /*#__PURE__*/React.createElement(React.Fragment, null, "\u9519\u8BEF\u539F\u56E0:", /*#__PURE__*/React.createElement("b", null, retMsg), /*#__PURE__*/React.createElement("br", null), "\u9519\u8BEF\u7801:", /*#__PURE__*/React.createElement("b", null, retCode), /*#__PURE__*/React.createElement("br", null), "\u6545\u969C\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) {
@@ -36,6 +36,7 @@ export declare type DtlLyaoutProps = Record<string, any> & {
36
36
  statusField?: string;
37
37
  /** 审核状态值 */
38
38
  auditStatus?: number;
39
+ isView?: boolean;
39
40
  };
40
41
  declare function DtlLayout(props: DtlLyaoutProps): JSX.Element;
41
42
  export default DtlLayout;
@@ -40,7 +40,9 @@ function DtlLayout(props) {
40
40
  btnExitText = _props$btnExitText === void 0 ? '返回' : _props$btnExitText,
41
41
  btnStatus = props.btnStatus,
42
42
  statusField = props.statusField,
43
- auditStatus = props.auditStatus;
43
+ auditStatus = props.auditStatus,
44
+ _props$isView = props.isView,
45
+ isView = _props$isView === void 0 ? false : _props$isView;
44
46
 
45
47
  var _usePermission = (0, _usePermission2.default)(),
46
48
  checkRight = _usePermission.checkRight;
@@ -60,7 +62,8 @@ function DtlLayout(props) {
60
62
  };
61
63
 
62
64
  var btnDisabled = function btnDisabled(btnKey) {
63
- // 优先处理自定义的状态
65
+ if (isView) return true; // 优先处理自定义的状态
66
+
64
67
  if (btnStatus && typeof btnStatus(btnKey) === 'boolean') {
65
68
  return btnStatus(btnKey) || false;
66
69
  }
@@ -79,7 +82,7 @@ function DtlLayout(props) {
79
82
  // ]
80
83
  var b = []; // 有新增或更改权限且未审核,开放出保存按钮
81
84
 
82
- if ((checkRight(2) || checkRight(4)) && !isAudit()) {
85
+ if ((checkRight(2) || checkRight(4)) && !isAudit() && !isView) {
83
86
  b.unshift( /*#__PURE__*/_react.default.createElement(_button.default, {
84
87
  key: "btnSave",
85
88
  onClick: function onClick() {
@@ -97,7 +100,7 @@ function DtlLayout(props) {
97
100
  } // 转入onAudit方法且有审核权限,数据未审核,开放出审核按钮
98
101
 
99
102
 
100
- if (props.onAudit && checkRight(64) && !isAudit()) {
103
+ if (props.onAudit && checkRight(64) && !isAudit() && !isView) {
101
104
  b.unshift( /*#__PURE__*/_react.default.createElement(_button.default, {
102
105
  key: "btnAudit",
103
106
  disabled: btnDisabled('btnAudit'),
@@ -104,13 +104,13 @@ 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;
108
108
  if (!el) return;
109
109
 
110
110
  if (icon) {
111
- el.classList.remove('ant-input-clear-icon-hidden');
111
+ el.classList.add('ant-input-has-value');
112
112
  } else {
113
- el.classList.add('ant-input-clear-icon-hidden');
113
+ el.classList.remove('ant-input-has-value');
114
114
  }
115
115
  } catch (e) {}
116
116
  }, [icon]);
@@ -271,13 +271,13 @@ 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;
275
275
  if (!el) return;
276
276
 
277
277
  if (imgUrl) {
278
- el.classList.remove('ant-input-clear-icon-hidden');
278
+ el.classList.add('ant-input-has-value');
279
279
  } else {
280
- el.classList.add('ant-input-clear-icon-hidden');
280
+ el.classList.remove('ant-input-has-value');
281
281
  }
282
282
  } catch (e) {}
283
283
  }, [imgUrl]);
@@ -214,6 +214,8 @@ var InputTable = /*#__PURE__*/_react.default.forwardRef(function (prop, ref) {
214
214
  if (!textName && formValue[name]) {
215
215
  formValue[textNameProp] = formValue[name];
216
216
  formRef === null || formRef === void 0 ? void 0 : formRef.current.setFieldsValue((0, _objectSpread2.default)({}, formValue));
217
+ } else if (textName && formValue[textName]) {
218
+ setText(formValue[textName]);
217
219
  }
218
220
  }, []); // 处理返回数据
219
221
 
@@ -372,19 +374,20 @@ var InputTable = /*#__PURE__*/_react.default.forwardRef(function (prop, ref) {
372
374
  }, "\u786E\u8BA4")];
373
375
  },
374
376
  headerTitle: "\u53CC\u51FB\u9009\u4E2D\u5F53\u524D\u884C\u6570\u636E"
375
- }, tableConfig));
377
+ }, tableConfig)); // 处理有值时,可清空
378
+
376
379
 
377
380
  (0, _react.useEffect)(function () {
378
381
  if (rest.disabled || (fieldProps === null || fieldProps === void 0 ? void 0 : fieldProps.disabled)) return;
379
382
 
380
383
  try {
381
- var el = inputRef.current.clearableInput.containerRef.current.querySelector('.ant-input-clear-icon');
384
+ var el = inputRef.current.input.parentNode;
382
385
  if (!el) return;
383
386
 
384
387
  if (text) {
385
- el.classList.remove('ant-input-clear-icon-hidden');
388
+ el.classList.add('ant-input-has-value');
386
389
  } else {
387
- el.classList.add('ant-input-clear-icon-hidden');
390
+ el.classList.remove('ant-input-has-value');
388
391
  }
389
392
  } catch (e) {}
390
393
  }, [text, rest, fieldProps]);
@@ -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 {
@@ -305,6 +307,8 @@ a:hover {
305
307
  }
306
308
  }
307
309
 
308
-
309
-
310
-
310
+ .ant-input-has-value:hover{
311
+ .ant-input-clear-icon{
312
+ visibility: visible;
313
+ }
314
+ }
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, retCode, 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, _retCode, _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) {