@zgfe/business-lib 1.0.10 → 1.0.11

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.
@@ -57,13 +57,11 @@ var BizAddToPanel = function BizAddToPanel(props) {
57
57
  currentApp = _useContext.currentApp;
58
58
 
59
59
  useEffect(function () {
60
- queryGroups();
61
-
62
60
  if (props.defaultValue) {
63
61
  setFormData(props.defaultValue);
64
62
  }
65
63
 
66
- setReady(false);
64
+ queryGroups();
67
65
  }, []);
68
66
 
69
67
  function queryGroups() {
@@ -78,10 +76,14 @@ var BizAddToPanel = function BizAddToPanel(props) {
78
76
  notification.error({
79
77
  message: '获取看板列表失败'
80
78
  });
79
+ setReady(false);
81
80
  return;
82
81
  }
83
82
 
84
83
  setGroupList(res.panels);
84
+ setReady(false);
85
+ }).catch(function () {
86
+ setReady(false);
85
87
  });
86
88
  }
87
89
 
@@ -116,24 +118,42 @@ var BizAddToPanel = function BizAddToPanel(props) {
116
118
 
117
119
  searchParam.chartType = form.chartType;
118
120
  var data = {
119
- appId: currentApp === null || currentApp === void 0 ? void 0 : currentApp.appId,
121
+ app_id: currentApp === null || currentApp === void 0 ? void 0 : currentApp.appId,
120
122
  platform: (currentApp === null || currentApp === void 0 ? void 0 : currentApp.platform) || 0,
121
123
  name: form.name,
122
- panelId: form.panel.id,
123
- panelName: form.panel.name,
124
- openType: form.panel.open_type,
125
- webData: searchParam,
126
- mobileData: searchParam
124
+ panel_id: form.panel.id,
125
+ web_data: JSON.stringify(searchParam),
126
+ mobile_data: JSON.stringify(searchParam)
127
127
  };
128
+
129
+ if (form.panel.id === 0) {
130
+ data.panel_name = form.panel.name;
131
+ data.open_type = form.panel.open_type;
132
+ }
133
+
134
+ var msgType = props.type === 'edit' ? '保存' : '添加';
128
135
  request(Apis.addPanel, {
129
136
  method: 'post',
130
137
  data: data
131
- }).then(function () {
138
+ }).then(function (res) {
132
139
  setLoading(false);
133
- notification.success({
134
- message: props.type === 'edit' ? '保存' : '添加成功'
135
- });
136
- if (props.onOk) props.onOk();
140
+ var result = res;
141
+
142
+ if (result.code === 10001) {
143
+ notification.success({
144
+ message: "".concat(msgType, "\u6210\u529F")
145
+ });
146
+ if (props.onOk) props.onOk();
147
+ } else if (result.code === -10010) {
148
+ notification.error({
149
+ message: '添加失败',
150
+ description: data.groupId === 0 ? '场景分类已存在' : '场景名称已存在'
151
+ });
152
+ } else {
153
+ notification.error({
154
+ message: "".concat(msgType, "\u5931\u8D25")
155
+ });
156
+ }
137
157
  }).catch(function () {
138
158
  setLoading(false);
139
159
  });
@@ -143,6 +163,7 @@ var BizAddToPanel = function BizAddToPanel(props) {
143
163
  visible: true,
144
164
  title: props.type === 'edit' ? '修改当前看板指标' : '向看板添加指标',
145
165
  width: 520,
166
+ maskClosable: false,
146
167
  onCancel: props.onCancel,
147
168
  onOk: onAdd,
148
169
  confirmLoading: loading
@@ -193,7 +214,6 @@ var BizAddToPanel = function BizAddToPanel(props) {
193
214
  }]
194
215
  }, /*#__PURE__*/React.createElement(Input, {
195
216
  placeholder: "\u6307\u6807\u540D\u79F0",
196
- size: "large",
197
217
  allowClear: {
198
218
  clearIcon: /*#__PURE__*/React.createElement(IconFont, {
199
219
  type: 'qingchu'
@@ -1,6 +1,6 @@
1
1
  @import '../../assets/styles/inner.less';
2
2
  .biz-addtopanel {
3
- &-btn-add {
3
+ &-btn-add.ant-btn-ghost {
4
4
  .__text-btn();
5
5
  }
6
6
  }
@@ -34,8 +34,8 @@ declare namespace AddToPanel {
34
34
  platform: number;
35
35
  name: string;
36
36
  panelId: number;
37
- panelName: string;
38
- openType: number;
37
+ panelName?: string;
38
+ openType?: number;
39
39
  webData: Record<string, any>;
40
40
  mobileData: Record<string, any>;
41
41
  }
@@ -75,10 +75,14 @@ var BizAddToScene = function BizAddToScene(props) {
75
75
  appId: currentApp === null || currentApp === void 0 ? void 0 : currentApp.appId,
76
76
  platform: 0,
77
77
  groupId: form.group.groupId,
78
- groupName: form.group.groupName,
79
- json: params,
78
+ json: JSON.stringify(params),
80
79
  name: form.name
81
80
  };
81
+
82
+ if (form.group.groupId === 0) {
83
+ data.groupName = form.group.groupName;
84
+ }
85
+
82
86
  request(Apis.addScene, {
83
87
  method: 'post',
84
88
  data: data
@@ -131,6 +135,7 @@ var BizAddToScene = function BizAddToScene(props) {
131
135
  return /*#__PURE__*/React.createElement(BizDialog, {
132
136
  title: "\u6DFB\u52A0\u5230\u5E38\u7528\u573A\u666F",
133
137
  visible: true,
138
+ maskClosable: false,
134
139
  onOk: onSave,
135
140
  onCancel: onCancel,
136
141
  confirmLoading: loading
@@ -1,7 +1,7 @@
1
1
  @import '../../assets/styles/inner.less';
2
2
 
3
3
  .biz-addtoscene {
4
- &-btn-add {
4
+ &-btn-add.ant-btn-ghost {
5
5
  .__text-btn();
6
6
  }
7
7
 
@@ -23,7 +23,7 @@ declare namespace AddToScene {
23
23
  groupId: number;
24
24
  groupName?: string;
25
25
  name: string;
26
- json: Record<string, any>;
26
+ json: string;
27
27
  }
28
28
  }
29
29
  export default AddToScene;
@@ -1,3 +1,4 @@
1
+ import '@zgfe/business-lib/es/assets/styles/resetAntd.less';
1
2
  import './index.less';
2
3
  declare const _default: () => JSX.Element;
3
4
  export default _default;
@@ -1,6 +1,7 @@
1
1
  import React from 'react';
2
2
  import { BizAnalysisLayout } from '@zgfe/business-lib';
3
3
  import { Button } from 'antd';
4
+ import '@zgfe/business-lib/es/assets/styles/resetAntd.less';
4
5
  import './index.less';
5
6
 
6
7
  var LeftContent = function LeftContent() {
@@ -130,7 +130,7 @@ var BizAnalysisLayout = function BizAnalysisLayout(props) {
130
130
  })), /*#__PURE__*/React.createElement("div", {
131
131
  className: "biz-layout-right",
132
132
  style: {
133
- width: "calc(100% - ".concat(width, "px)")
133
+ width: "calc(100% - ".concat(width + 6, "px)")
134
134
  }
135
135
  }, /*#__PURE__*/React.createElement("div", {
136
136
  className: "biz-right-content"
@@ -21,9 +21,10 @@
21
21
  position: absolute;
22
22
  right: 0;
23
23
  bottom: 0;
24
- width: 1px;
24
+ width: 5px;
25
25
  height: 100%;
26
- background: #ecedf0;
26
+ background: transparent;
27
+ border-left: 1px solid #ecedf0;
27
28
  transform: matrix(-1, 0, 0, 1, 0, 0);
28
29
  cursor: ew-resize;
29
30
  }
@@ -10,6 +10,10 @@
10
10
  background: @primary-1;
11
11
  border-color: @primary-color;
12
12
  cursor: pointer;
13
+
14
+ .xiangxia {
15
+ color: @primary-color;
16
+ }
13
17
  }
14
18
 
15
19
  // focus 样式
@@ -64,7 +68,7 @@
64
68
  // 暂无数据样式,目前用于下拉框
65
69
  .__select-nodata {
66
70
  height: @option-height;
67
- padding: 0 16px;
71
+ padding: 0 @padding-sm;
68
72
  line-height: @option-height;
69
73
  border-radius: @border-radius-normal;
70
74
  }
@@ -5,6 +5,7 @@
5
5
  // 输入框(带icon)
6
6
  .ant-input-affix-wrapper {
7
7
  height: @height-lg;
8
+ padding: 0 @padding-xs;
8
9
  line-height: @height-lg;
9
10
  background-color: @background-color-base;
10
11
  border-color: #fff;
@@ -17,6 +18,11 @@
17
18
  &:hover {
18
19
  border-color: @primary-color;
19
20
  }
21
+
22
+ &.ant-input-affix-wrapper-status-error:not(.ant-input-affix-wrapper-disabled):not(.ant-input-affix-wrapper-borderless):not(.ant-input-affix-wrapper-focused).ant-input-affix-wrapper,
23
+ &.ant-input-affix-wrapper-status-error:not(.ant-input-affix-wrapper-disabled):not(.ant-input-affix-wrapper-borderless):not(.ant-input-affix-wrapper-focused).ant-input-affix-wrapper:hover {
24
+ background-color: @background-color-base;
25
+ }
20
26
  }
21
27
 
22
28
  .ant-input-affix-wrapper-focused {
@@ -42,28 +48,10 @@
42
48
  }
43
49
 
44
50
  .ant-input-group-addon {
51
+ color: @text-color-secondary;
45
52
  background-color: @background-color-base;
46
53
  }
47
54
 
48
- .ant-btn-default {
49
- border-radius: 4px;
50
-
51
- &:hover,
52
- &:active,
53
- &:focus {
54
- .__default-hover();
55
- }
56
- }
57
-
58
- .ant-btn-primary {
59
- border-radius: @border-radius-small;
60
- }
61
-
62
- .ant-btn-sm {
63
- padding: 0 5px;
64
- font-size: 12px;
65
- }
66
-
67
55
  .ant-select-dropdown {
68
56
  .__select-panel();
69
57
  }
@@ -71,7 +59,7 @@
71
59
  // 选择框下拉选项
72
60
  .ant-select-item {
73
61
  height: @height-lg;
74
- padding: 10px 8px;
62
+ padding: 0 @padding-sm;
75
63
  border-radius: @border-radius-normal;
76
64
 
77
65
  &:hover:not(.ant-select-item-option-disabled, .ant-select-item-option-selected) {
@@ -130,6 +118,14 @@
130
118
  .ant-picker {
131
119
  border-radius: @border-radius-small;
132
120
 
121
+ span {
122
+ color: @text-color-secondary;
123
+ }
124
+
125
+ .ant-picker-input > input {
126
+ color: @text-color;
127
+ }
128
+
133
129
  &:hover,
134
130
  &.ant-picker-focused {
135
131
  .__default-hover();
@@ -376,6 +372,10 @@
376
372
  }
377
373
  }
378
374
 
375
+ .ant-table-tbody {
376
+ color: @text-color-secondary;
377
+ }
378
+
379
379
  .ant-table-tbody > tr:not(:last-child) > td {
380
380
  border-bottom: 1px solid @border-color-base;
381
381
  }
@@ -396,3 +396,44 @@
396
396
  background: @primary-1;
397
397
  }
398
398
  }
399
+
400
+ /* 提示框 */
401
+ .ant-tooltip-inner {
402
+ padding: @padding-sm @padding-md;
403
+ border-radius: @border-radius-normal;
404
+ }
405
+
406
+ .ant-form-item-label > label {
407
+ color: @text-color-secondary;
408
+ }
409
+
410
+ .ant-btn {
411
+ border-radius: @border-radius-small;
412
+ }
413
+
414
+ .ant-btn-text {
415
+ background-color: @background-color-gray;
416
+ border: none;
417
+
418
+ &:hover {
419
+ color: @text-color;
420
+ background-color: @btn-text-hover-bg;
421
+ }
422
+
423
+ &:focus {
424
+ color: @text-color;
425
+ background-color: #94a6ce;
426
+ }
427
+ }
428
+
429
+ .ant-btn-primary {
430
+ color: #fff;
431
+ }
432
+
433
+ .ant-btn-ghost {
434
+ color: @text-color-secondary;
435
+ }
436
+
437
+ .ant-form-item-explain-error {
438
+ color: @error-color;
439
+ }
@@ -2,7 +2,7 @@
2
2
 
3
3
  @border-radius-sx: 2px;
4
4
  @border-radius-small: 4px;
5
- @border-radius-normal: 10px;
5
+ @border-radius-normal: 8px;
6
6
  @border-radius-large: 20px;
7
7
  @option-height: @height-lg;
8
8
  @background-color-base: #fafafb;
@@ -19,3 +19,10 @@
19
19
  @text-color: #021429;
20
20
  // 次要
21
21
  @text-color-secondary: #5f6085;
22
+ // 中性色/重要-文标题2
23
+ @tooltip-bg: #242541;
24
+ // 错误颜色
25
+ @error-color: #fb5547;
26
+
27
+ // text-btn hover背景色
28
+ @btn-text-hover-bg: #cacdd4;
@@ -1,5 +1,8 @@
1
1
  declare const _default: {
2
2
  'primary-color': string;
3
3
  'border-color-base': string;
4
+ 'primary-1': string;
5
+ 'text-color': string;
6
+ 'text-color-secondary': string;
4
7
  };
5
8
  export default _default;
@@ -1,4 +1,7 @@
1
1
  export default {
2
2
  'primary-color': '#165dff',
3
- 'border-color-base': '#ECEDF0'
3
+ 'border-color-base': '#ECEDF0',
4
+ 'primary-1': '#E8EFFF',
5
+ 'text-color': '#021429',
6
+ 'text-color-secondary': '#5f6085'
4
7
  };
@@ -101,6 +101,7 @@ var StringList = function StringList(props) {
101
101
 
102
102
  formData = transformRequest(requestData);
103
103
  request(Apis.esQuery, {
104
+ method: 'post',
104
105
  data: formData,
105
106
  headers: {
106
107
  'Content-Type': 'application/x-www-form-urlencoded'
@@ -12,9 +12,11 @@
12
12
  display: none;
13
13
  flex: none;
14
14
  width: @icon-width;
15
+ color: @text-color-secondary;
15
16
  line-height: 2em;
16
17
  text-align: center;
17
18
  border-radius: @border-radius-small;
19
+
18
20
  &:hover {
19
21
  .__error-hover();
20
22
  }
package/es/config.d.ts ADDED
@@ -0,0 +1,15 @@
1
+ import { RequestOptionsInit } from 'umi-request';
2
+ import { ApiResult } from './utils/ajax';
3
+ export interface RequestConfig {
4
+ optionsWrapper?: (url: string, options?: RequestOptionsInit) => {
5
+ url: string;
6
+ options?: RequestOptionsInit;
7
+ };
8
+ responseWrapper?: (url: string, apiResult: ApiResult<any>) => ApiResult<any>;
9
+ }
10
+ export interface GlobalConfig {
11
+ request?: RequestConfig;
12
+ }
13
+ export declare let globalConfig: GlobalConfig;
14
+ declare function setGlobalConfig(config: GlobalConfig): void;
15
+ export default setGlobalConfig;
package/es/config.js ADDED
@@ -0,0 +1,8 @@
1
+ import _ from 'lodash';
2
+ export var globalConfig = {};
3
+
4
+ function setGlobalConfig(config) {
5
+ globalConfig = _.assignIn(config, globalConfig);
6
+ }
7
+
8
+ export default setGlobalConfig;
@@ -2,7 +2,7 @@ var Apis = {
2
2
  querySceneGroup: '/scene/queryScenesOfGroup.jsp',
3
3
  addScene: '/scene/addScene.jsp',
4
4
  esQuery: '/data/queryEsData.jsp',
5
- addPanel: '/web/sdk/v2/panel/addPanelElement',
5
+ addPanel: '/apppanel/addPanelElement.jsp',
6
6
  queryPanelGroup: '/apppanel/panels.jsp'
7
7
  };
8
8
  export default Apis;
@@ -1,4 +1,5 @@
1
1
  @import '../../assets/styles/inner.less';
2
+
2
3
  .biz-date-picker {
3
4
  display: flex;
4
5
 
@@ -10,15 +11,18 @@
10
11
  display: flex;
11
12
  margin: 0 16px;
12
13
  }
14
+
13
15
  .biz-select-handle {
14
16
  padding: 0;
15
17
  }
18
+
16
19
  &-item {
17
20
  display: flex;
18
21
  align-items: center;
19
22
  justify-content: center;
20
23
  width: 58px;
21
24
  height: @height-base;
25
+ color: @text-color-secondary;
22
26
  border: 1px solid @border-color-base;
23
27
  cursor: pointer;
24
28
 
@@ -32,7 +32,8 @@ BizDialog.defaultProps = {
32
32
  size: 'large'
33
33
  },
34
34
  cancelButtonProps: {
35
- size: 'large'
35
+ size: 'large',
36
+ type: 'text'
36
37
  }
37
38
  };
38
39
  export default BizDialog;
@@ -134,6 +134,14 @@ var EventListPanel = function EventListPanel(props) {
134
134
  setCurrentGroup(currentValue === null || currentValue === void 0 ? void 0 : currentValue.group);
135
135
  }
136
136
 
137
+ if (!groupList || !groupList.length || !groupList[0].eventList || !groupList[0].eventList.length) {
138
+ return /*#__PURE__*/React.createElement("div", {
139
+ className: "".concat(classPrefix, "-nodata-panel")
140
+ }, /*#__PURE__*/React.createElement("div", {
141
+ className: "".concat(classPrefix, "-nodata")
142
+ }, "\u6682\u65E0\u6570\u636E"));
143
+ }
144
+
137
145
  return /*#__PURE__*/React.createElement("div", {
138
146
  className: "".concat(classPrefix, "-list-panel")
139
147
  }, /*#__PURE__*/React.createElement("div", {
@@ -10,13 +10,14 @@
10
10
  flex-direction: row;
11
11
  width: 477px;
12
12
  max-height: 400px;
13
+ padding: 0;
13
14
  .__select-panel();
14
15
  }
15
16
 
16
17
  &-left {
17
18
  flex: none;
18
19
  width: 192px;
19
- padding: 8px;
20
+ padding: @padding-xs;
20
21
  overflow-y: auto;
21
22
  border-right: 1px solid @border-color-base;
22
23
  }
@@ -25,21 +26,26 @@
25
26
  display: flex;
26
27
  flex: 1;
27
28
  flex-direction: column;
28
- padding: 8px;
29
+ padding: @padding-xs;
29
30
  }
30
31
 
31
32
  &-search {
32
33
  flex: none;
33
34
  margin-bottom: @margin-sm;
34
- &.ant-input-affix-wrapper {
35
- border-radius: @border-radius-normal;
36
- }
37
35
  }
38
36
 
39
37
  &-list {
40
38
  flex: 1;
41
39
  overflow-y: auto;
42
40
  }
41
+ &-nodata-panel {
42
+ width: 284px;
43
+ .__select-panel();
44
+ }
45
+
46
+ &-nodata {
47
+ .__select-nodata();
48
+ }
43
49
 
44
50
  &-option {
45
51
  .__select-option();
package/es/index.d.ts CHANGED
@@ -21,7 +21,8 @@ import BizUserCondition from './userCondition';
21
21
  import BizSearchInput from './searchInput';
22
22
  import BizAddToScene from './addToScene';
23
23
  import BizAddToPanel from './addToPanel';
24
- export { BizSearchInput, BizSelect, BizDialog, BizChart, BizTable, BizAnalysisLayout, BizUserGroup, IconFont, BizTargetSelector, BizEventSelector, BizAttributeSelector, BizGlobalDataContext, BizTargetCondition, BizDatePicker, BizConditionItem, BizConditionGroup, BizUserCondition, BizAddToScene, BizAddToPanel, ajax, util, theme, convertAttributeData, };
24
+ import setGlobalConfig from './config';
25
+ export { BizSearchInput, BizSelect, BizDialog, BizChart, BizTable, BizAnalysisLayout, BizUserGroup, IconFont, BizTargetSelector, BizEventSelector, BizAttributeSelector, BizGlobalDataContext, BizTargetCondition, BizDatePicker, BizConditionItem, BizConditionGroup, BizUserCondition, BizAddToScene, BizAddToPanel, ajax, util, theme, convertAttributeData, setGlobalConfig, };
25
26
  export type { UserGroupTypes } from './userGroup/types';
26
27
  export type { BizSelectTypes } from './select/types';
27
28
  export type { AttributeSelect } from './attributeSelector/types';
package/es/index.js CHANGED
@@ -20,4 +20,5 @@ import BizUserCondition from './userCondition';
20
20
  import BizSearchInput from './searchInput';
21
21
  import BizAddToScene from './addToScene';
22
22
  import BizAddToPanel from './addToPanel';
23
- export { BizSearchInput, BizSelect, BizDialog, BizChart, BizTable, BizAnalysisLayout, BizUserGroup, IconFont, BizTargetSelector, BizEventSelector, BizAttributeSelector, BizGlobalDataContext, BizTargetCondition, BizDatePicker, BizConditionItem, BizConditionGroup, BizUserCondition, BizAddToScene, BizAddToPanel, ajax, util, theme, convertAttributeData };
23
+ import setGlobalConfig from './config';
24
+ export { BizSearchInput, BizSelect, BizDialog, BizChart, BizTable, BizAnalysisLayout, BizUserGroup, IconFont, BizTargetSelector, BizEventSelector, BizAttributeSelector, BizGlobalDataContext, BizTargetCondition, BizDatePicker, BizConditionItem, BizConditionGroup, BizUserCondition, BizAddToScene, BizAddToPanel, ajax, util, theme, convertAttributeData, setGlobalConfig };
@@ -83,6 +83,7 @@
83
83
  top: 50%;
84
84
  right: 8px;
85
85
  flex: none;
86
+ color: @text-color-secondary;
86
87
  font-size: @font-size-lg;
87
88
  transform: translateY(-50%);
88
89
  }
@@ -21,9 +21,6 @@
21
21
  &-search {
22
22
  flex: none;
23
23
  margin-bottom: @margin-xs;
24
- &.ant-input-affix-wrapper {
25
- border-radius: @border-radius-normal;
26
- }
27
24
  }
28
25
 
29
26
  &-nodata {
@@ -29,6 +29,7 @@
29
29
  display: none;
30
30
  flex: none;
31
31
  width: @icon-width;
32
+ color: @text-color-secondary;
32
33
  line-height: 2em;
33
34
  text-align: center;
34
35
  border-radius: @border-radius-small;
@@ -67,7 +68,8 @@
67
68
  top: 45px;
68
69
  left: 0;
69
70
  z-index: 1000;
70
- width: 390px;
71
+ width: 100%;
72
+ min-width: 280px;
71
73
  .__select-panel();
72
74
  }
73
75
 
@@ -17,5 +17,17 @@ export interface InterfaceApiResult<T> {
17
17
  data?: T;
18
18
  msg?: string;
19
19
  }
20
- declare function request<T>(url: string, options?: RequestOptionsInit): Promise<InterfaceApiResult<T> | null>;
20
+ export declare class ApiResult<T> implements InterfaceApiResult<T> {
21
+ code: ResponseStatus;
22
+ data?: T;
23
+ msg?: string;
24
+ constructor(code: ResponseStatus, data: any, message?: string);
25
+ }
26
+ declare function request<T>(url: string, options?: RequestOptionsInit & {
27
+ optionsWrapper?: (url: string, options?: RequestOptionsInit) => {
28
+ url: string;
29
+ options?: RequestOptionsInit;
30
+ };
31
+ responseWrapper?: (url: string, apiResult: ApiResult<T>) => ApiResult<T>;
32
+ }): Promise<InterfaceApiResult<T> | null>;
21
33
  export default request;
package/es/utils/ajax.js CHANGED
@@ -10,6 +10,7 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
10
10
 
11
11
  import { extend } from 'umi-request';
12
12
  import { notification } from 'antd';
13
+ import { globalConfig } from '../config';
13
14
  var ResponseStatus;
14
15
 
15
16
  (function (ResponseStatus) {
@@ -26,7 +27,7 @@ var ResponseStatus;
26
27
  ResponseStatus[ResponseStatus["paramError3"] = 106003] = "paramError3";
27
28
  })(ResponseStatus || (ResponseStatus = {}));
28
29
 
29
- var ApiResult = /*#__PURE__*/_createClass(function ApiResult(code, data, message) {
30
+ export var ApiResult = /*#__PURE__*/_createClass(function ApiResult(code, data, message) {
30
31
  _classCallCheck(this, ApiResult);
31
32
 
32
33
  this.code = void 0;
@@ -36,7 +37,6 @@ var ApiResult = /*#__PURE__*/_createClass(function ApiResult(code, data, message
36
37
  this.data = data;
37
38
  this.msg = message;
38
39
  });
39
-
40
40
  var codeMessage = {
41
41
  200: '服务器成功返回请求的数据。',
42
42
  201: '新建或修改数据成功。',
@@ -85,7 +85,7 @@ function responseErrorHandler(url, apiResult) {
85
85
  notification.error({
86
86
  message: "\u63A5\u53E3\u54CD\u5E94\u7ED3\u6784\u5F02\u5E38"
87
87
  });
88
- throw new Error('接口响应结构异常,缺少status');
88
+ throw new Error('接口响应结构异常,缺少code');
89
89
  }
90
90
 
91
91
  var flag = false;
@@ -163,7 +163,8 @@ function request(_x, _x2) {
163
163
 
164
164
  function _request() {
165
165
  _request = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(url, options) {
166
- var err, option, list, res;
166
+ var _globalConfig$request, _globalConfig$request2, err, option, list, optionsWrapper, responseWrapper, params, res;
167
+
167
168
  return regeneratorRuntime.wrap(function _callee$(_context) {
168
169
  while (1) {
169
170
  switch (_context.prev = _context.next) {
@@ -193,24 +194,30 @@ function _request() {
193
194
  });
194
195
 
195
196
  case 8:
196
- _context.next = 10;
197
- return req(url, options);
198
-
199
- case 10:
197
+ optionsWrapper = (options === null || options === void 0 ? void 0 : options.optionsWrapper) || ((_globalConfig$request = globalConfig.request) === null || _globalConfig$request === void 0 ? void 0 : _globalConfig$request.optionsWrapper);
198
+ responseWrapper = (options === null || options === void 0 ? void 0 : options.responseWrapper) || ((_globalConfig$request2 = globalConfig.request) === null || _globalConfig$request2 === void 0 ? void 0 : _globalConfig$request2.responseWrapper);
199
+ params = optionsWrapper ? optionsWrapper(url, options) : {
200
+ url: url,
201
+ options: options
202
+ };
203
+ _context.next = 13;
204
+ return req(params.url, params.options);
205
+
206
+ case 13:
200
207
  res = _context.sent;
201
- return _context.abrupt("return", responseErrorHandler(url, res));
208
+ return _context.abrupt("return", responseWrapper ? responseWrapper(url, responseErrorHandler(url, res)) : responseErrorHandler(url, res));
202
209
 
203
- case 14:
204
- _context.prev = 14;
210
+ case 17:
211
+ _context.prev = 17;
205
212
  _context.t0 = _context["catch"](0);
206
213
  return _context.abrupt("return", null);
207
214
 
208
- case 17:
215
+ case 20:
209
216
  case "end":
210
217
  return _context.stop();
211
218
  }
212
219
  }
213
- }, _callee, null, [[0, 14]]);
220
+ }, _callee, null, [[0, 17]]);
214
221
  }));
215
222
  return _request.apply(this, arguments);
216
223
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zgfe/business-lib",
3
- "version": "1.0.10",
3
+ "version": "1.0.11",
4
4
  "scripts": {
5
5
  "start": "dumi dev",
6
6
  "docs:build": "dumi build",
@@ -36,7 +36,8 @@
36
36
  "echarts": "^5.3.2",
37
37
  "echarts-for-react": "^3.0.2",
38
38
  "lerna": "^4.0.0",
39
- "react-infinite-scroll-component": "^6.1.0"
39
+ "react-infinite-scroll-component": "^6.1.0",
40
+ "umi-request": "^1.4.0"
40
41
  },
41
42
  "peerDependencies": {
42
43
  "@types/lodash": "^4.14.182",
@@ -56,8 +57,7 @@
56
57
  "gh-pages": "^3.0.0",
57
58
  "lint-staged": "^10.0.7",
58
59
  "prettier": "^2.2.1",
59
- "umi-request": "^1.4.0",
60
60
  "yorkie": "^2.0.0"
61
61
  },
62
- "gitHead": "31f61ad6ee6757193c95445304205616b143193b"
62
+ "gitHead": "7b78a43e36641ad5c7a3bea015f4b0d5fd0e0fc4"
63
63
  }