xydata-tools 1.1.19 → 1.1.21

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.
@@ -14,12 +14,11 @@ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e
14
14
  function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
15
15
  function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
16
16
  import { addApi, queryApi, removeApi, updateApi } from "./service.js";
17
- import { PlusOutlined } from "@ant-design/icons";
18
- import ProTable from "@ant-design/pro-table";
19
- ;
20
- import { ROOT_ID, toTree } from "@zhengxs/js.tree";
21
- import { Button, Divider, Popconfirm, message } from "antd";
22
- import React, { useRef, useState } from "react";
17
+ import { PlusOutlined } from '@ant-design/icons';
18
+ import ProTable from '@ant-design/pro-table';
19
+ import { ROOT_ID, toTree } from '@zhengxs/js.tree';
20
+ import { Button, Divider, Popconfirm, message } from 'antd';
21
+ import React, { useRef, useState } from 'react';
23
22
  import UpdateForm from "./components/UpdateForm";
24
23
 
25
24
  /**
@@ -32,8 +31,8 @@ var handleAdd = /*#__PURE__*/function () {
32
31
  return _regeneratorRuntime().wrap(function _callee$(_context) {
33
32
  while (1) switch (_context.prev = _context.next) {
34
33
  case 0:
35
- hide = message.loading("正在添加");
36
- if (!(type === "C")) {
34
+ hide = message.loading('正在添加');
35
+ if (!(type === 'C')) {
37
36
  _context.next = 7;
38
37
  break;
39
38
  }
@@ -55,7 +54,7 @@ var handleAdd = /*#__PURE__*/function () {
55
54
  _context.next = 15;
56
55
  break;
57
56
  }
58
- message.success("操作成功!");
57
+ message.success('操作成功!');
59
58
  return _context.abrupt("return", true);
60
59
  case 15:
61
60
  case "end":
@@ -80,17 +79,17 @@ var handleRemove = /*#__PURE__*/function () {
80
79
  while (1) switch (_context2.prev = _context2.next) {
81
80
  case 0:
82
81
  isSuccess = false;
83
- hide = message.loading("正在删除");
82
+ hide = message.loading('正在删除');
84
83
  _context2.next = 4;
85
84
  return removeApi(record);
86
85
  case 4:
87
86
  res = _context2.sent;
88
- if (res.rspCode === "000000") {
87
+ if (res.rspCode === '000000') {
89
88
  hide();
90
- message.success("删除成功,正在刷新");
89
+ message.success('删除成功,正在刷新');
91
90
  isSuccess = true;
92
91
  } else {
93
- message.error(res.rspMsg);
92
+ console.error(res.rspMsg);
94
93
  isSuccess = false;
95
94
  }
96
95
  return _context2.abrupt("return", isSuccess);
@@ -159,7 +158,7 @@ var DictionaryList = function DictionaryList() {
159
158
  _useState8 = _slicedToArray(_useState7, 2),
160
159
  treeData = _useState8[0],
161
160
  setTreeData = _useState8[1];
162
- var _useState9 = useState("C"),
161
+ var _useState9 = useState('C'),
163
162
  _useState10 = _slicedToArray(_useState9, 2),
164
163
  modalType = _useState10[0],
165
164
  setModalType = _useState10[1];
@@ -170,12 +169,12 @@ var DictionaryList = function DictionaryList() {
170
169
  return _regeneratorRuntime().wrap(function _callee4$(_context4) {
171
170
  while (1) switch (_context4.prev = _context4.next) {
172
171
  case 0:
173
- if (!(type === "U")) {
172
+ if (!(type === 'U')) {
174
173
  _context4.next = 11;
175
174
  break;
176
175
  }
177
176
  //本级及下级所有子节点均不可选择
178
- hide = message.loading("正在加载");
177
+ hide = message.loading('正在加载');
179
178
  _context4.next = 4;
180
179
  return getData({
181
180
  dictCode: record.dictCode,
@@ -218,14 +217,14 @@ var DictionaryList = function DictionaryList() {
218
217
  var rowTotree = function rowTotree(dataList) {
219
218
  return toTree(dataList, {
220
219
  root: ROOT_ID,
221
- idKey: "id",
222
- parentKey: "parentId",
223
- childrenKey: "children",
220
+ idKey: 'id',
221
+ parentKey: 'parentId',
222
+ childrenKey: 'children',
224
223
  transform: function transform(data) {
225
224
  var isTop = dataList.some(function (x) {
226
- return x.id === "-1";
225
+ return x.id === '-1';
227
226
  });
228
- !isTop && data.parentId === "-1" && (data.parentId = null);
227
+ !isTop && data.parentId === '-1' && (data.parentId = null);
229
228
  return _objectSpread(_objectSpread({}, data), {}, {
230
229
  title: data.dictName,
231
230
  value: data.id
@@ -234,25 +233,25 @@ var DictionaryList = function DictionaryList() {
234
233
  });
235
234
  };
236
235
  var columns = [{
237
- title: "字典名称",
238
- dataIndex: "dictName",
236
+ title: '字典名称',
237
+ dataIndex: 'dictName',
239
238
  search: true
240
239
  }, {
241
- title: "字典编码",
242
- dataIndex: "dictCode",
240
+ title: '字典编码',
241
+ dataIndex: 'dictCode',
243
242
  search: false
244
243
  }, {
245
- title: "备注",
246
- dataIndex: "remark",
244
+ title: '备注',
245
+ dataIndex: 'remark',
247
246
  search: false
248
247
  }, {
249
- title: "操作",
250
- dataIndex: "option",
251
- valueType: "option",
248
+ title: '操作',
249
+ dataIndex: 'option',
250
+ valueType: 'option',
252
251
  render: function render(_, record) {
253
- return record.dictCode !== "BASE_DICT_ROOT" && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("a", {
252
+ return record.dictCode !== 'BASE_DICT_ROOT' && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("a", {
254
253
  onClick: function onClick() {
255
- return createAndUpdate("U", record);
254
+ return createAndUpdate('U', record);
256
255
  }
257
256
  }, "\u7F16\u8F91"), /*#__PURE__*/React.createElement(Divider, {
258
257
  type: "vertical"
@@ -292,19 +291,19 @@ var DictionaryList = function DictionaryList() {
292
291
  headerTitle: "\u5217\u8868",
293
292
  actionRef: actionRef,
294
293
  rowKey: "id",
295
- defaultExpandedRowKeys: ["-1"],
294
+ defaultExpandedRowKeys: ['-1'],
296
295
  toolBarRender: function toolBarRender() {
297
296
  return [/*#__PURE__*/React.createElement(Button, {
298
297
  type: "primary",
299
298
  onClick: function onClick() {
300
- return createAndUpdate("C", {});
299
+ return createAndUpdate('C', {});
301
300
  }
302
301
  }, /*#__PURE__*/React.createElement(PlusOutlined, null), " \u65B0\u5EFA")];
303
302
  },
304
303
  beforeSearchSubmit: function beforeSearchSubmit(params) {
305
304
  var dictName = params.dictName;
306
305
  var obj = {
307
- dictName: dictName || "",
306
+ dictName: dictName || '',
308
307
  include: true
309
308
  };
310
309
  return obj;
@@ -75,8 +75,6 @@ var PaymentDetailModal = function PaymentDetailModal(_ref) {
75
75
  res = _context.sent;
76
76
  if ((res === null || res === void 0 ? void 0 : res.rspCode) === '000000') {
77
77
  setFlowList(res.data || []);
78
- } else {
79
- message.error((res === null || res === void 0 ? void 0 : res.rspMsg) || '获取流程列表失败');
80
78
  }
81
79
  _context.next = 14;
82
80
  break;
@@ -135,8 +133,6 @@ var PaymentDetailModal = function PaymentDetailModal(_ref) {
135
133
  setCurrentFlow(_objectSpread(_objectSpread({}, res.data), {}, {
136
134
  params: params
137
135
  }));
138
- } else {
139
- message.error((res === null || res === void 0 ? void 0 : res.rspMsg) || '获取流程详情失败');
140
136
  }
141
137
  _context2.next = 13;
142
138
  break;
@@ -54,8 +54,6 @@ var RefundModal = function RefundModal(_ref) {
54
54
  form.setFieldsValue({
55
55
  refundMoney: data.refundableMoney
56
56
  });
57
- } else {
58
- message.error((res === null || res === void 0 ? void 0 : res.rspMsg) || '获取订单详情失败');
59
57
  }
60
58
  _context.next = 13;
61
59
  break;
@@ -46,8 +46,6 @@ var SMSConfig = function SMSConfig() {
46
46
  res = _context.sent;
47
47
  if (res && res.rspCode === '000000') {
48
48
  setDataSource(res.data || []);
49
- } else {
50
- message.error((res === null || res === void 0 ? void 0 : res.rspMsg) || '查询配置失败');
51
49
  }
52
50
  _context.next = 11;
53
51
  break;
@@ -87,8 +85,6 @@ var SMSConfig = function SMSConfig() {
87
85
  setModalVisible(false);
88
86
  setEditingRecord(null);
89
87
  fetchData();
90
- } else {
91
- message.error((res === null || res === void 0 ? void 0 : res.rspMsg) || '保存失败');
92
88
  }
93
89
  case 4:
94
90
  case "end":
@@ -67,7 +67,7 @@ var SMSGateway = function SMSGateway() {
67
67
  // 处理新增/编辑提交
68
68
  var handleSubmit = /*#__PURE__*/function () {
69
69
  var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(values) {
70
- var res, _actionRef$current, _res;
70
+ var res, _actionRef$current;
71
71
  return _regeneratorRuntime().wrap(function _callee2$(_context2) {
72
72
  while (1) switch (_context2.prev = _context2.next) {
73
73
  case 0:
@@ -94,8 +94,6 @@ var SMSGateway = function SMSGateway() {
94
94
  setModalVisible(false);
95
95
  setEditingRecord(null);
96
96
  (_actionRef$current = actionRef.current) === null || _actionRef$current === void 0 || _actionRef$current.reload();
97
- } else {
98
- message.error(((_res = res) === null || _res === void 0 ? void 0 : _res.rspMsg) || '操作失败');
99
97
  }
100
98
  case 10:
101
99
  case "end":
@@ -124,8 +122,6 @@ var SMSGateway = function SMSGateway() {
124
122
  if (res && res.rspCode === '000000') {
125
123
  message.success(successMsg);
126
124
  (_actionRef$current2 = actionRef.current) === null || _actionRef$current2 === void 0 || _actionRef$current2.reload();
127
- } else {
128
- message.error((res === null || res === void 0 ? void 0 : res.rspMsg) || '操作失败');
129
125
  }
130
126
  case 4:
131
127
  case "end":
@@ -49,8 +49,6 @@ var SMSLogDetailModal = function SMSLogDetailModal(_ref) {
49
49
  res = _context.sent;
50
50
  if (res && res.rspCode === '000000') {
51
51
  setDetail(res.data);
52
- } else {
53
- message.error((res === null || res === void 0 ? void 0 : res.rspMsg) || '获取详情失败');
54
52
  }
55
53
  _context.next = 11;
56
54
  break;
@@ -47,8 +47,6 @@ var SMSTemplateDetailModal = function SMSTemplateDetailModal(_ref) {
47
47
  res = _context.sent;
48
48
  if (res && res.rspCode === '000000') {
49
49
  setDetail(res.data);
50
- } else {
51
- message.error((res === null || res === void 0 ? void 0 : res.rspMsg) || '获取详情失败');
52
50
  }
53
51
  _context.next = 11;
54
52
  break;
@@ -77,7 +77,7 @@ var SMSTemplate = function SMSTemplate() {
77
77
  // 处理提交
78
78
  var handleSubmit = /*#__PURE__*/function () {
79
79
  var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(values) {
80
- var res, _actionRef$current, _res;
80
+ var res, _actionRef$current;
81
81
  return _regeneratorRuntime().wrap(function _callee2$(_context2) {
82
82
  while (1) switch (_context2.prev = _context2.next) {
83
83
  case 0:
@@ -104,8 +104,6 @@ var SMSTemplate = function SMSTemplate() {
104
104
  setModalVisible(false);
105
105
  setEditingRecord(null);
106
106
  (_actionRef$current = actionRef.current) === null || _actionRef$current === void 0 || _actionRef$current.reload();
107
- } else {
108
- message.error(((_res = res) === null || _res === void 0 ? void 0 : _res.rspMsg) || '操作失败');
109
107
  }
110
108
  case 10:
111
109
  case "end":
@@ -134,8 +132,6 @@ var SMSTemplate = function SMSTemplate() {
134
132
  if (res && res.rspCode === '000000') {
135
133
  message.success(successMsg);
136
134
  (_actionRef$current2 = actionRef.current) === null || _actionRef$current2 === void 0 || _actionRef$current2.reload();
137
- } else {
138
- message.error((res === null || res === void 0 ? void 0 : res.rspMsg) || '操作失败');
139
135
  }
140
136
  case 4:
141
137
  case "end":
@@ -1,8 +1,4 @@
1
1
  export default doRequest;
2
- /**
3
- * 配置request请求时的默认参数
4
- */
5
- export const xyRequest: import("umi-request").RequestMethod<false>;
6
2
  /**
7
3
  * 封装后的 doRequest 函数,保持与原有项目的参数兼容性
8
4
  * @param {string} url - 请求地址
@@ -10,4 +6,4 @@ export const xyRequest: import("umi-request").RequestMethod<false>;
10
6
  * @param {Object} data - 请求体数据
11
7
  * @param {Object} options - 额外配置
12
8
  */
13
- export function doRequest(url: string, method: string, data?: any, options?: any): Promise<import("umi-request").RequestResponse<any>>;
9
+ declare function doRequest(url: string, method: string, data?: any, options?: any): Promise<any>;
@@ -9,9 +9,7 @@ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try
9
9
  function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
10
10
  /**
11
11
  * request 网络请求工具
12
- * api 文档: https://github.com/umijs/umi-request/blob/master/README_zh-CN.md
13
12
  */
14
- import { extend } from 'umi-request';
15
13
  import { notification, message } from 'antd';
16
14
  import { getSessionStorage } from "./token.js";
17
15
  import { handleUnauthorized } from "../components";
@@ -51,139 +49,72 @@ var CODE_MESSAGE = {
51
49
 
52
50
  // 请求异常处理程序。进入错误回调的,只会返回false。
53
51
  var errorHandler = /*#__PURE__*/function () {
54
- var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(error) {
55
- var response, errorText, status, url, errorData, rspMsg;
52
+ var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(response) {
53
+ var errorText, status, url, errorData, rspMsg;
56
54
  return _regeneratorRuntime().wrap(function _callee$(_context) {
57
55
  while (1) switch (_context.prev = _context.next) {
58
56
  case 0:
59
- response = error.response;
60
57
  if (!(response && response.status)) {
61
- _context.next = 23;
58
+ _context.next = 22;
62
59
  break;
63
60
  }
64
61
  errorText = CODE_MESSAGE[response.status] || response.statusText;
65
62
  status = response.status, url = response.url;
66
- _context.prev = 4;
67
- _context.next = 7;
63
+ _context.prev = 3;
64
+ _context.next = 6;
68
65
  return response.json();
69
- case 7:
66
+ case 6:
70
67
  errorData = _context.sent;
71
68
  rspMsg = errorData.rspMsg;
72
69
  if (rspMsg) {
73
70
  message.error(rspMsg);
74
71
  }
75
72
  if (!(status == 401)) {
76
- _context.next = 14;
73
+ _context.next = 13;
77
74
  break;
78
75
  }
79
76
  handleUnauthorized(ENV_DATA);
80
- _context.next = 16;
77
+ _context.next = 15;
81
78
  break;
82
- case 14:
79
+ case 13:
83
80
  if (!(status !== 200)) {
84
- _context.next = 16;
81
+ _context.next = 15;
85
82
  break;
86
83
  }
87
84
  throw new Error();
88
- case 16:
89
- _context.next = 21;
85
+ case 15:
86
+ _context.next = 20;
90
87
  break;
91
- case 18:
92
- _context.prev = 18;
93
- _context.t0 = _context["catch"](4);
88
+ case 17:
89
+ _context.prev = 17;
90
+ _context.t0 = _context["catch"](3);
94
91
  notification.error({
95
92
  message: "\u8BF7\u6C42\u9519\u8BEF ".concat(status, ": ").concat(url),
96
93
  description: errorText
97
94
  });
98
- case 21:
99
- _context.next = 24;
95
+ case 20:
96
+ _context.next = 23;
100
97
  break;
101
- case 23:
98
+ case 22:
102
99
  if (!response) {
103
- console.error(error);
104
100
  notification.error({
105
101
  message: '网络异常',
106
102
  description: '您的网络发生异常,无法连接服务器'
107
103
  });
108
104
  }
109
- case 24:
105
+ case 23:
110
106
  return _context.abrupt("return", false);
111
- case 25:
107
+ case 24:
112
108
  case "end":
113
109
  return _context.stop();
114
110
  }
115
- }, _callee, null, [[4, 18]]);
111
+ }, _callee, null, [[3, 17]]);
116
112
  }));
117
113
  return function errorHandler(_x) {
118
114
  return _ref.apply(this, arguments);
119
115
  };
120
116
  }();
121
117
 
122
- /**
123
- * 配置request请求时的默认参数
124
- */
125
- var xyRequest = extend({
126
- errorHandler: errorHandler
127
- });
128
-
129
- // request拦截器
130
- xyRequest.interceptors.request.use(function (url, options) {
131
- options.headers = {
132
- 'Content-Type': 'application/json; charset=utf-8',
133
- Accept: 'application/json',
134
- UserId: getSessionStorage('userId'),
135
- OrgId: getSessionStorage('orgId'),
136
- service: getSessionStorage('service') || 'unknown',
137
- SID: SID
138
- };
139
- // 过滤不需要TOKEN的请求,统一加上Authorization
140
- if (!NO_TOKEN_URLS.includes(url)) {
141
- // TOKEN在每次调用的时候获取最新值
142
- var token = getSessionStorage('Token');
143
- options.headers.Authorization = token ? "Bearer ".concat(token) : '';
144
- }
145
- return {
146
- url: url,
147
- options: options
148
- };
149
- });
150
-
151
- // response拦截器
152
- xyRequest.interceptors.response.use( /*#__PURE__*/function () {
153
- var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(response, options) {
154
- var data, rspCode;
155
- return _regeneratorRuntime().wrap(function _callee2$(_context2) {
156
- while (1) switch (_context2.prev = _context2.next) {
157
- case 0:
158
- if (!response.ok) {
159
- _context2.next = 7;
160
- break;
161
- }
162
- _context2.next = 3;
163
- return response.clone().json();
164
- case 3:
165
- data = _context2.sent;
166
- rspCode = data.rspCode; // 状态编码只有在已定义的,需要处理的编码里才会返回响应,否则会进入错误回调
167
- if (!(rspCode && PROCESS_RESPONSE_CODES.includes(rspCode))) {
168
- _context2.next = 7;
169
- break;
170
- }
171
- return _context2.abrupt("return", data);
172
- case 7:
173
- throw {
174
- response: response
175
- };
176
- case 8:
177
- case "end":
178
- return _context2.stop();
179
- }
180
- }, _callee2);
181
- }));
182
- return function (_x2, _x3) {
183
- return _ref2.apply(this, arguments);
184
- };
185
- }());
186
-
187
118
  /**
188
119
  * 封装后的 doRequest 函数,保持与原有项目的参数兼容性
189
120
  * @param {string} url - 请求地址
@@ -191,30 +122,92 @@ xyRequest.interceptors.response.use( /*#__PURE__*/function () {
191
122
  * @param {Object} data - 请求体数据
192
123
  * @param {Object} options - 额外配置
193
124
  */
194
- function doRequest(_x4, _x5) {
125
+ function doRequest(_x2, _x3) {
195
126
  return _doRequest.apply(this, arguments);
196
127
  }
197
128
  function _doRequest() {
198
- _doRequest = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(url, method) {
129
+ _doRequest = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(url, method) {
199
130
  var data,
200
131
  options,
201
- _args3 = arguments;
202
- return _regeneratorRuntime().wrap(function _callee3$(_context3) {
203
- while (1) switch (_context3.prev = _context3.next) {
132
+ headers,
133
+ token,
134
+ response,
135
+ fetchOptions,
136
+ result,
137
+ rspCode,
138
+ _args2 = arguments;
139
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
140
+ while (1) switch (_context2.prev = _context2.next) {
204
141
  case 0:
205
- data = _args3.length > 2 && _args3[2] !== undefined ? _args3[2] : {};
206
- options = _args3.length > 3 && _args3[3] !== undefined ? _args3[3] : {};
207
- return _context3.abrupt("return", xyRequest(url, _objectSpread({
142
+ data = _args2.length > 2 && _args2[2] !== undefined ? _args2[2] : {};
143
+ options = _args2.length > 3 && _args2[3] !== undefined ? _args2[3] : {};
144
+ // 构建请求头(原 request 拦截器逻辑)
145
+ headers = {
146
+ 'Content-Type': 'application/json; charset=utf-8',
147
+ Accept: 'application/json',
148
+ UserId: getSessionStorage('userId'),
149
+ OrgId: getSessionStorage('orgId'),
150
+ service: getSessionStorage('service') || 'unknown',
151
+ SID: SID
152
+ }; // 过滤不需要TOKEN的请求,统一加上Authorization
153
+ if (!NO_TOKEN_URLS.includes(url)) {
154
+ // TOKEN在每次调用的时候获取最新值
155
+ token = getSessionStorage('Token');
156
+ headers.Authorization = token ? "Bearer ".concat(token) : '';
157
+ }
158
+ _context2.prev = 4;
159
+ fetchOptions = {
208
160
  method: method,
209
- data: data
210
- }, options)));
211
- case 3:
161
+ headers: _objectSpread(_objectSpread({}, headers), options.headers)
162
+ }; // GET 请求不携带 body
163
+ if (method.toUpperCase() !== 'GET') {
164
+ fetchOptions.body = JSON.stringify(data);
165
+ }
166
+ _context2.next = 9;
167
+ return fetch(url, fetchOptions);
168
+ case 9:
169
+ response = _context2.sent;
170
+ _context2.next = 16;
171
+ break;
172
+ case 12:
173
+ _context2.prev = 12;
174
+ _context2.t0 = _context2["catch"](4);
175
+ // 网络异常,无法连接服务器
176
+ console.error(_context2.t0);
177
+ return _context2.abrupt("return", errorHandler(null));
178
+ case 16:
179
+ if (!response.ok) {
180
+ _context2.next = 30;
181
+ break;
182
+ }
183
+ _context2.prev = 17;
184
+ _context2.next = 20;
185
+ return response.clone().json();
186
+ case 20:
187
+ result = _context2.sent;
188
+ rspCode = result.rspCode; // 状态编码只有在已定义的,需要处理的编码里才会返回响应,否则会进入错误回调
189
+ if (!(rspCode && PROCESS_RESPONSE_CODES.includes(rspCode))) {
190
+ _context2.next = 24;
191
+ break;
192
+ }
193
+ return _context2.abrupt("return", result);
194
+ case 24:
195
+ _context2.next = 30;
196
+ break;
197
+ case 26:
198
+ _context2.prev = 26;
199
+ _context2.t1 = _context2["catch"](17);
200
+ // JSON 解析失败,按网络异常处理
201
+ console.error(_context2.t1);
202
+ return _context2.abrupt("return", errorHandler(null));
203
+ case 30:
204
+ return _context2.abrupt("return", errorHandler(response));
205
+ case 31:
212
206
  case "end":
213
- return _context3.stop();
207
+ return _context2.stop();
214
208
  }
215
- }, _callee3);
209
+ }, _callee2, null, [[4, 12], [17, 26]]);
216
210
  }));
217
211
  return _doRequest.apply(this, arguments);
218
212
  }
219
- export { xyRequest, doRequest };
220
213
  export default doRequest;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "xydata-tools",
3
- "version": "1.1.19",
3
+ "version": "1.1.21",
4
4
  "description": "xydata tools",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.js",
@@ -65,7 +65,6 @@
65
65
  "compressorjs": "1.2.1",
66
66
  "querystring": "0.2.1",
67
67
  "react-json-view": "^1.21.3",
68
- "styled-components": "4.4.1",
69
- "umi-request": "1.4.0"
68
+ "styled-components": "4.4.1"
70
69
  }
71
70
  }