@lingxiteam/assets 0.11.30-alpha-2 → 0.11.30-alpha.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/error/errorCatch/index.js +39 -0
- package/es/error/errorDisplay/Mobile/Drawer/Drawer.less +24 -0
- package/es/error/errorDisplay/Mobile/defaultGlobalConfig.js +2 -1
- package/es/error/errorDisplay/Web/Drawer/Drawer.js +55 -23
- package/es/error/errorDisplay/Web/Drawer/Drawer.less +41 -14
- package/es/error/errorDisplay/Web/ErrorMsg/index.js +150 -122
- package/es/error/errorDisplay/Web/Notification/Notice.js +1 -1
- package/es/error/errorDisplay/Web/Notification/Notification.js +12 -2
- package/es/error/errorDisplay/Web/Notification/Notification.less +3 -0
- package/es/error/errorDisplay/Web/Notification/index.js +1 -0
- package/es/error/errorDisplay/Web/defaultGlobalConfig.js +11 -2
- package/es/error/errorDisplay/compUtils.js +29 -1
- package/es/error/errorDisplay/const.js +32 -3
- package/es/error/errorDisplay/http.js +24 -31
- package/es/error/index.js +3 -1
- package/es/index.d.ts +2 -2
- package/es/index.js +2 -2
- package/es/security/index.d.ts +6 -0
- package/es/security/index.js +10 -1
- package/lib/index.js +12 -0
- package/package.json +1 -1
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
// TODO
|
|
2
|
+
import ErrorMsg from '../errorDisplay/Web/ErrorMsg';
|
|
3
|
+
var errorDisplayComp = ErrorMsg;
|
|
4
|
+
var info = {};
|
|
5
|
+
// eslint-disable-next-line
|
|
6
|
+
var errorHandler = function errorHandler(msg, url, row, col, error) {
|
|
7
|
+
errorDisplayComp.open({
|
|
8
|
+
code: "02-".concat(info.code, "-1-000-00000"),
|
|
9
|
+
msg: "\u7A0B\u5E8F\u53D1\u751F\u5F02\u5E38: ".concat(msg),
|
|
10
|
+
stack: error
|
|
11
|
+
});
|
|
12
|
+
return true;
|
|
13
|
+
};
|
|
14
|
+
var rejectHandler = function rejectHandler(e) {
|
|
15
|
+
e.preventDefault();
|
|
16
|
+
// errorDisplayComp.open({
|
|
17
|
+
// code: `02-${info.code}-1-000-00000`,
|
|
18
|
+
// msg: `程序发生异常: ${msg}`,
|
|
19
|
+
// stack: error,
|
|
20
|
+
// });
|
|
21
|
+
return true;
|
|
22
|
+
};
|
|
23
|
+
var start = function start(_ref) {
|
|
24
|
+
var errorDisplay = _ref.errorDisplay,
|
|
25
|
+
_ref$projectInfo = _ref.projectInfo,
|
|
26
|
+
projectInfo = _ref$projectInfo === void 0 ? {} : _ref$projectInfo;
|
|
27
|
+
if (errorDisplay) errorDisplayComp = errorDisplay;
|
|
28
|
+
info = projectInfo;
|
|
29
|
+
window.addEventListener('error', errorHandler, true);
|
|
30
|
+
window.addEventListener('unhandledrejection', rejectHandler);
|
|
31
|
+
};
|
|
32
|
+
var stop = function stop() {
|
|
33
|
+
window.removeEventListener('error', errorHandler);
|
|
34
|
+
window.removeEventListener('unhandledrejection', rejectHandler);
|
|
35
|
+
};
|
|
36
|
+
export default {
|
|
37
|
+
start: start,
|
|
38
|
+
stop: stop
|
|
39
|
+
};
|
|
@@ -115,6 +115,30 @@
|
|
|
115
115
|
&-body {
|
|
116
116
|
font-size: 15* @hd;
|
|
117
117
|
color: rgba(28, 36, 46, 0.75);
|
|
118
|
+
|
|
119
|
+
// 内置文章样式
|
|
120
|
+
dt {
|
|
121
|
+
font-size: 17* @hd;
|
|
122
|
+
font-weight: 500;
|
|
123
|
+
margin-top: 30* @hd;
|
|
124
|
+
}
|
|
125
|
+
dd {
|
|
126
|
+
padding: 8* @hd 0;
|
|
127
|
+
margin: 0;
|
|
128
|
+
font-size: 15* @hd;
|
|
129
|
+
}
|
|
130
|
+
ol, ul {
|
|
131
|
+
padding: 0;
|
|
132
|
+
margin: 0;
|
|
133
|
+
}
|
|
134
|
+
ol, ul {
|
|
135
|
+
list-style: inside inside;
|
|
136
|
+
}
|
|
137
|
+
li, p {
|
|
138
|
+
line-height: 24* @hd;
|
|
139
|
+
letter-spacing: 1px;
|
|
140
|
+
margin: 4* @hd 0;
|
|
141
|
+
}
|
|
118
142
|
}
|
|
119
143
|
}
|
|
120
144
|
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
+
import { resolveRequestPath } from '../compUtils';
|
|
1
2
|
export var defaultGlobalConfig = {
|
|
2
3
|
duration: null,
|
|
3
4
|
maxLine: null,
|
|
4
5
|
maxLen: null,
|
|
5
6
|
showType: 'modal',
|
|
6
7
|
maxCount: null,
|
|
7
|
-
resolve: process.env.
|
|
8
|
+
resolve: process.env.LingXi_ERROR_RESOLVE || resolveRequestPath('/lcdp/error/queryErrorInfoByCodeOrMsg')
|
|
8
9
|
};
|
|
9
10
|
export var setGlobalConfig = function setGlobalConfig() {
|
|
10
11
|
var config = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
@@ -51,10 +51,14 @@ var Drawer = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
51
51
|
_useState2 = _slicedToArray(_useState, 2),
|
|
52
52
|
extraConts = _useState2[0],
|
|
53
53
|
setExtraConts = _useState2[1]; // 展开内容的keys
|
|
54
|
-
var _useState3 = useState(
|
|
54
|
+
var _useState3 = useState({}),
|
|
55
55
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
56
|
-
|
|
57
|
-
|
|
56
|
+
errorCollapseMap = _useState4[0],
|
|
57
|
+
setErrorCollapseMap = _useState4[1]; // 错误列表展开keys
|
|
58
|
+
var _useState5 = useState(true),
|
|
59
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
60
|
+
isFull = _useState6[0],
|
|
61
|
+
setIsFull = _useState6[1];
|
|
58
62
|
useEffect(function () {
|
|
59
63
|
if (onVisibleChange instanceof Function) {
|
|
60
64
|
onVisibleChange(visible);
|
|
@@ -88,9 +92,9 @@ var Drawer = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
88
92
|
key: item[contentRowKey]
|
|
89
93
|
}, isDomEle(item === null || item === void 0 ? void 0 : item.title) ? /*#__PURE__*/React.createElement("div", {
|
|
90
94
|
className: "lx-drawer-group-article-title"
|
|
91
|
-
}, item === null || item === void 0 ? void 0 : item.title) :
|
|
95
|
+
}, item === null || item === void 0 ? void 0 : item.title) : null, isDomEle(item === null || item === void 0 ? void 0 : item.author) ? /*#__PURE__*/React.createElement("div", {
|
|
92
96
|
className: "lx-drawer-group-article-author"
|
|
93
|
-
}, item === null || item === void 0 ? void 0 : item.author) :
|
|
97
|
+
}, item === null || item === void 0 ? void 0 : item.author) : null, isDomEle(item === null || item === void 0 ? void 0 : item.content) ? /*#__PURE__*/React.createElement("div", {
|
|
94
98
|
className: "lx-drawer-group-article-content"
|
|
95
99
|
}, renderItemÇont(item === null || item === void 0 ? void 0 : item.content, item[contentRowKey]), typeof (item === null || item === void 0 ? void 0 : item.content) === 'string' && (item === null || item === void 0 ? void 0 : item.content.length) > contentMaxLen ? /*#__PURE__*/React.createElement("a", {
|
|
96
100
|
className: "lx-drawer-group-article-extra",
|
|
@@ -108,10 +112,10 @@ var Drawer = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
108
112
|
return [].concat(_toConsumableArray(cloneList), [item[contentRowKey]]);
|
|
109
113
|
});
|
|
110
114
|
}
|
|
111
|
-
}, extraConts.includes(item[contentRowKey]) ? '收起' : '展开') :
|
|
115
|
+
}, extraConts.includes(item[contentRowKey]) ? '收起' : '展开') : null) : null);
|
|
112
116
|
});
|
|
113
117
|
}
|
|
114
|
-
return
|
|
118
|
+
return null;
|
|
115
119
|
};
|
|
116
120
|
if (Array.isArray(dataSource) && dataSource.length > 0) {
|
|
117
121
|
return dataSource.map(function (item, index) {
|
|
@@ -125,7 +129,7 @@ var Drawer = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
125
129
|
}, isDomEle(item === null || item === void 0 ? void 0 : item.content) ? item === null || item === void 0 ? void 0 : item.content : '', renderList(item === null || item === void 0 ? void 0 : item.content)));
|
|
126
130
|
});
|
|
127
131
|
}
|
|
128
|
-
return
|
|
132
|
+
return null;
|
|
129
133
|
};
|
|
130
134
|
var renderTabsList = function renderTabsList(tabsCont) {
|
|
131
135
|
var tabsRowRender = errorInfoProps.tabsRowRender,
|
|
@@ -144,18 +148,42 @@ var Drawer = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
144
148
|
className: "lx-drawer-err-item-head-cell"
|
|
145
149
|
}, /*#__PURE__*/React.createElement("span", {
|
|
146
150
|
className: "lx-drawer-err-item-head-title"
|
|
147
|
-
}, item === null || item === void 0 ? void 0 : item.title, ' '), item === null || item === void 0 ? void 0 : item.code),
|
|
151
|
+
}, item === null || item === void 0 ? void 0 : item.title, ' '), item === null || item === void 0 ? void 0 : item.code), /*#__PURE__*/React.createElement("div", {
|
|
148
152
|
className: "lx-drawer-err-item-head-extra"
|
|
149
|
-
}, ' ', item === null || item === void 0 ? void 0 : item.extra) :
|
|
153
|
+
}, ' ', isDomEle(item === null || item === void 0 ? void 0 : item.extra) ? item === null || item === void 0 ? void 0 : item.extra : null, item.subContent && /*#__PURE__*/React.createElement("a", {
|
|
154
|
+
onClick: function onClick() {
|
|
155
|
+
return setErrorCollapseMap(function (pre) {
|
|
156
|
+
return _objectSpread(_objectSpread({}, pre), {}, _defineProperty({}, item[tabsRowKey], !errorCollapseMap[item[tabsRowKey]]));
|
|
157
|
+
});
|
|
158
|
+
}
|
|
159
|
+
}, errorCollapseMap[item[tabsRowKey]] ? '收起' : '展开', /*#__PURE__*/React.createElement("img", {
|
|
160
|
+
src: getSvgImageBase64(ArrowIcon),
|
|
161
|
+
alt: "",
|
|
162
|
+
className: classnames('lx-drawer-err-item-head-extra-arrow', {
|
|
163
|
+
'lx-icon-up': errorCollapseMap[item[tabsRowKey]]
|
|
164
|
+
})
|
|
165
|
+
})))), /*#__PURE__*/React.createElement("div", {
|
|
150
166
|
className: "lx-drawer-err-item-body"
|
|
151
|
-
}, item === null || item === void 0 ? void 0 : item.content
|
|
167
|
+
}, item === null || item === void 0 ? void 0 : item.content, errorCollapseMap[item[tabsRowKey]] && item.subContent && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
168
|
+
className: "lx-drawer-err-item-body-subcontent lx-drawer-article"
|
|
169
|
+
// eslint-disable-next-line react/no-danger
|
|
170
|
+
,
|
|
171
|
+
dangerouslySetInnerHTML: {
|
|
172
|
+
__html: item === null || item === void 0 ? void 0 : item.subContent
|
|
173
|
+
}
|
|
174
|
+
}), item.url && /*#__PURE__*/React.createElement("a", {
|
|
175
|
+
className: "lx-drawer-err-item-body-jump",
|
|
176
|
+
href: item.url,
|
|
177
|
+
target: "_blank",
|
|
178
|
+
rel: "noreferrer"
|
|
179
|
+
}, "\u6587\u6863\u94FE\u63A5"))));
|
|
152
180
|
})));
|
|
153
181
|
}
|
|
154
|
-
return isDomEle(tabsCont) ? tabsCont :
|
|
182
|
+
return isDomEle(tabsCont) ? tabsCont : null;
|
|
155
183
|
};
|
|
156
184
|
var renderContent = function renderContent() {
|
|
157
185
|
if (!mode || mode === 'default') {
|
|
158
|
-
return isDomEle(content) ? content :
|
|
186
|
+
return isDomEle(content) ? content : null;
|
|
159
187
|
}
|
|
160
188
|
if (mode === 'errorInfo') {
|
|
161
189
|
var tabs = errorInfoProps.tabs,
|
|
@@ -165,8 +193,10 @@ var Drawer = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
165
193
|
onTabsChange = errorInfoProps.onTabsChange;
|
|
166
194
|
return /*#__PURE__*/React.createElement(React.Fragment, null, isDomEle(content) ? /*#__PURE__*/React.createElement("div", {
|
|
167
195
|
className: "lx-drawer-code-desc"
|
|
168
|
-
}, content) :
|
|
169
|
-
className: classnames('lx-drawer-code-tabs',
|
|
196
|
+
}, content) : null, /*#__PURE__*/React.createElement("div", {
|
|
197
|
+
className: classnames('lx-drawer-code-tabs', {
|
|
198
|
+
full: isFull
|
|
199
|
+
})
|
|
170
200
|
}, Array.isArray(tabs) && tabs.length > 0 ? /*#__PURE__*/React.createElement("div", {
|
|
171
201
|
className: "lx-drawer-code-tabs-head"
|
|
172
202
|
}, isDomEle(content) ? /*#__PURE__*/React.createElement("div", {
|
|
@@ -178,9 +208,11 @@ var Drawer = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
178
208
|
src: getSvgImageBase64(ArrowIcon),
|
|
179
209
|
alt: "",
|
|
180
210
|
className: classnames('lx-drawer-code-tabs-control-icon', isFull ? '' : 'flip')
|
|
181
|
-
})) :
|
|
211
|
+
})) : null, tabs.map(function (item) {
|
|
182
212
|
return /*#__PURE__*/React.createElement("div", {
|
|
183
|
-
className: classnames(
|
|
213
|
+
className: classnames({
|
|
214
|
+
active: tabsActiveKey === item.key
|
|
215
|
+
}, 'lx-drawer-code-tabs-head-item'),
|
|
184
216
|
key: item.key,
|
|
185
217
|
onClick: function onClick(ev) {
|
|
186
218
|
onTabsChange(_objectSpread(_objectSpread({}, item), {}, {
|
|
@@ -188,14 +220,14 @@ var Drawer = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
188
220
|
}), ev);
|
|
189
221
|
}
|
|
190
222
|
}, item.tab);
|
|
191
|
-
})) :
|
|
223
|
+
})) : null, /*#__PURE__*/React.createElement("div", {
|
|
192
224
|
className: "lx-drawer-code-tabs-body"
|
|
193
|
-
}, renderTabsList(tabsContent), isDomEle(tabsFooter) ? tabsFooter :
|
|
225
|
+
}, renderTabsList(tabsContent), isDomEle(tabsFooter) ? tabsFooter : null)));
|
|
194
226
|
}
|
|
195
227
|
if (mode === 'groupList') {
|
|
196
228
|
return /*#__PURE__*/React.createElement("div", null, renderGroups());
|
|
197
229
|
}
|
|
198
|
-
return isDomEle(content) ? content :
|
|
230
|
+
return isDomEle(content) ? content : null;
|
|
199
231
|
};
|
|
200
232
|
return /*#__PURE__*/React.createElement("div", {
|
|
201
233
|
className: classnames('lx-drawer', {
|
|
@@ -206,7 +238,7 @@ var Drawer = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
206
238
|
}, mask ? /*#__PURE__*/React.createElement("div", {
|
|
207
239
|
className: "lx-drawer-mask",
|
|
208
240
|
onClick: onClose
|
|
209
|
-
}) :
|
|
241
|
+
}) : null, /*#__PURE__*/React.createElement("div", {
|
|
210
242
|
className: classnames('lx-drawer-container', status),
|
|
211
243
|
style: {
|
|
212
244
|
width: "".concat(width, "px"),
|
|
@@ -216,7 +248,7 @@ var Drawer = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
216
248
|
className: "lx-drawer-head"
|
|
217
249
|
}, /*#__PURE__*/React.createElement("div", {
|
|
218
250
|
className: "lx-drawer-head-title"
|
|
219
|
-
}, isDomEle(title) ? title :
|
|
251
|
+
}, isDomEle(title) ? title : null), /*#__PURE__*/React.createElement("div", {
|
|
220
252
|
className: "lx-drawer-head-extra",
|
|
221
253
|
onClick: onClose
|
|
222
254
|
}, /*#__PURE__*/React.createElement("img", {
|
|
@@ -227,6 +259,6 @@ var Drawer = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
227
259
|
className: "lx-drawer-body"
|
|
228
260
|
}, renderContent()), isDomEle(footer) ? /*#__PURE__*/React.createElement("div", {
|
|
229
261
|
className: "lx-drawer-footer"
|
|
230
|
-
}, footer) :
|
|
262
|
+
}, footer) : null));
|
|
231
263
|
});
|
|
232
264
|
export default Drawer;
|
|
@@ -120,6 +120,7 @@
|
|
|
120
120
|
color: rgba(28, 36, 46, 0.75);
|
|
121
121
|
flex: 1;
|
|
122
122
|
overflow-y: auto;
|
|
123
|
+
cursor: default;
|
|
123
124
|
}
|
|
124
125
|
|
|
125
126
|
&-group {
|
|
@@ -180,20 +181,6 @@
|
|
|
180
181
|
&-extra {
|
|
181
182
|
float: right;
|
|
182
183
|
}
|
|
183
|
-
|
|
184
|
-
// 内置文章样式
|
|
185
|
-
dt {
|
|
186
|
-
margin-bottom: 6px;
|
|
187
|
-
font-weight: 600;
|
|
188
|
-
}
|
|
189
|
-
li {
|
|
190
|
-
line-height: 30px;
|
|
191
|
-
}
|
|
192
|
-
section {
|
|
193
|
-
padding: 6px;
|
|
194
|
-
background-color: rgba(161, 161, 161, 0.15);
|
|
195
|
-
border-radius: 4px;
|
|
196
|
-
}
|
|
197
184
|
}
|
|
198
185
|
}
|
|
199
186
|
|
|
@@ -296,6 +283,18 @@
|
|
|
296
283
|
|
|
297
284
|
&-extra {
|
|
298
285
|
margin-left: 8px;
|
|
286
|
+
user-select: none;
|
|
287
|
+
&-arrow {
|
|
288
|
+
height: 12px;
|
|
289
|
+
width: 12px;
|
|
290
|
+
position: relative;
|
|
291
|
+
top: -1px;
|
|
292
|
+
left: 2px;
|
|
293
|
+
transition: transform 0.3s;
|
|
294
|
+
&.lx-icon-up {
|
|
295
|
+
transform: rotate(-180deg);
|
|
296
|
+
}
|
|
297
|
+
}
|
|
299
298
|
}
|
|
300
299
|
}
|
|
301
300
|
|
|
@@ -339,6 +338,16 @@
|
|
|
339
338
|
|
|
340
339
|
&-body {
|
|
341
340
|
color: rgba(28, 36, 46, 0.75);
|
|
341
|
+
&-subcontent {
|
|
342
|
+
border-top: 1px solid #f0f0f0;
|
|
343
|
+
margin-top: 6px;
|
|
344
|
+
padding: 4px 0;
|
|
345
|
+
animation: lxFadeIn .3s;
|
|
346
|
+
}
|
|
347
|
+
&-jump {
|
|
348
|
+
font-size: 12px;
|
|
349
|
+
animation: lxFadeIn .3s;
|
|
350
|
+
}
|
|
342
351
|
}
|
|
343
352
|
}
|
|
344
353
|
|
|
@@ -351,4 +360,22 @@
|
|
|
351
360
|
text-align: center;
|
|
352
361
|
color: rgba(28, 36, 46, 0.45);
|
|
353
362
|
}
|
|
363
|
+
|
|
364
|
+
&-article {
|
|
365
|
+
// 内置文章样式
|
|
366
|
+
dt {
|
|
367
|
+
margin-bottom: 6px;
|
|
368
|
+
font-weight: 600;
|
|
369
|
+
}
|
|
370
|
+
li, p {
|
|
371
|
+
line-height: 30px;
|
|
372
|
+
padding: 2px 0;
|
|
373
|
+
margin: 0;
|
|
374
|
+
}
|
|
375
|
+
section {
|
|
376
|
+
padding: 6px;
|
|
377
|
+
background-color: rgba(161, 161, 161, 0.15);
|
|
378
|
+
border-radius: 4px;
|
|
379
|
+
}
|
|
380
|
+
}
|
|
354
381
|
}
|
|
@@ -8,7 +8,7 @@ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _ty
|
|
|
8
8
|
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
9
9
|
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
10
10
|
import React, { isValidElement } from 'react';
|
|
11
|
-
import Notification from '../Notification';
|
|
11
|
+
import Notification, { notificationInstance } from '../Notification';
|
|
12
12
|
import { drawerHandel } from '../Drawer';
|
|
13
13
|
import http from '../../http';
|
|
14
14
|
import { statusClrMap, errTypeTitMap, articleMap } from '../../const';
|
|
@@ -17,18 +17,25 @@ var isElm = function isElm(val) {
|
|
|
17
17
|
return ['number', 'string'].includes(_typeof(val)) || /*#__PURE__*/isValidElement(val);
|
|
18
18
|
};
|
|
19
19
|
var emptyTxt = '暂无匹配信息,请联系平台管理员';
|
|
20
|
-
var
|
|
20
|
+
var getInstance = function getInstance(placement) {
|
|
21
|
+
return notificationInstance["lx-notification-root ".concat(placement)];
|
|
22
|
+
};
|
|
23
|
+
var renderErrList = function renderErrList(errList, opts) {
|
|
24
|
+
var erorrListShowType = opts.erorrListShowType;
|
|
21
25
|
if (Array.isArray(errList) && errList.length > 0) {
|
|
22
26
|
return errList.map(function (item) {
|
|
27
|
+
var _item$guidance, _item$guidance2;
|
|
23
28
|
return {
|
|
24
29
|
key: item === null || item === void 0 ? void 0 : item.errorInfoId,
|
|
25
30
|
title: item === null || item === void 0 ? void 0 : item.errorTypeName,
|
|
26
31
|
code: item === null || item === void 0 ? void 0 : item.errorCode,
|
|
27
32
|
content: item === null || item === void 0 ? void 0 : item.errorMsg,
|
|
28
33
|
status: statusClrMap[item === null || item === void 0 ? void 0 : item.errorType],
|
|
29
|
-
|
|
34
|
+
subContent: erorrListShowType === 'innerWindow' && (item === null || item === void 0 ? void 0 : (_item$guidance = item.guidance) === null || _item$guidance === void 0 ? void 0 : _item$guidance.content),
|
|
35
|
+
url: item === null || item === void 0 ? void 0 : (_item$guidance2 = item.guidance) === null || _item$guidance2 === void 0 ? void 0 : _item$guidance2.guidanceUrl,
|
|
36
|
+
extra: (item === null || item === void 0 ? void 0 : item.guidance) && erorrListShowType === 'openDrawer' && /*#__PURE__*/React.createElement("a", {
|
|
30
37
|
onClick: function onClick() {
|
|
31
|
-
var _item$
|
|
38
|
+
var _item$guidance3;
|
|
32
39
|
drawerHandel.open({
|
|
33
40
|
title: item === null || item === void 0 ? void 0 : item.errorTypeName,
|
|
34
41
|
status: statusClrMap[item === null || item === void 0 ? void 0 : item.errorType],
|
|
@@ -36,12 +43,12 @@ var renderErrList = function renderErrList(errList) {
|
|
|
36
43
|
content: /*#__PURE__*/React.createElement("div", {
|
|
37
44
|
// eslint-disable-next-line react/no-danger
|
|
38
45
|
dangerouslySetInnerHTML: {
|
|
39
|
-
__html: item === null || item === void 0 ? void 0 : (_item$
|
|
46
|
+
__html: item === null || item === void 0 ? void 0 : (_item$guidance3 = item.guidance) === null || _item$guidance3 === void 0 ? void 0 : _item$guidance3.content
|
|
40
47
|
}
|
|
41
48
|
})
|
|
42
49
|
});
|
|
43
50
|
}
|
|
44
|
-
}, "\u8BE6\u60C5")
|
|
51
|
+
}, "\u8BE6\u60C5")
|
|
45
52
|
};
|
|
46
53
|
});
|
|
47
54
|
}
|
|
@@ -51,7 +58,7 @@ var renderErrList = function renderErrList(errList) {
|
|
|
51
58
|
};
|
|
52
59
|
var renderGuidance = function renderGuidance(guidance) {
|
|
53
60
|
return (guidance === null || guidance === void 0 ? void 0 : guidance.title) || (guidance === null || guidance === void 0 ? void 0 : guidance.content) ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
54
|
-
className: "lx-drawer-group-article"
|
|
61
|
+
className: "lx-drawer-group-article lx-drawer-article"
|
|
55
62
|
// eslint-disable-next-line react/no-danger
|
|
56
63
|
,
|
|
57
64
|
dangerouslySetInnerHTML: {
|
|
@@ -61,7 +68,7 @@ var renderGuidance = function renderGuidance(guidance) {
|
|
|
61
68
|
onClick: function onClick() {
|
|
62
69
|
window.open(guidance === null || guidance === void 0 ? void 0 : guidance.guidanceUrl, '_blank');
|
|
63
70
|
}
|
|
64
|
-
}, "\u6587\u6863\u94FE\u63A5")) :
|
|
71
|
+
}, "\u6587\u6863\u94FE\u63A5")) : null) : /*#__PURE__*/React.createElement("div", {
|
|
65
72
|
className: "lx-drawer-empty"
|
|
66
73
|
}, emptyTxt);
|
|
67
74
|
};
|
|
@@ -81,6 +88,20 @@ var ErrorMsg = {
|
|
|
81
88
|
var option = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
82
89
|
var opts = _objectSpread(_objectSpread({}, defaultGlobalConfig), option);
|
|
83
90
|
if (msg) {
|
|
91
|
+
// 展示个数控制
|
|
92
|
+
if (defaultGlobalConfig.maxCount) {
|
|
93
|
+
var ins = getInstance(opts.placement);
|
|
94
|
+
if (ins) {
|
|
95
|
+
var openList = ins.getOpenList();
|
|
96
|
+
if (openList.length > defaultGlobalConfig.maxCount) {
|
|
97
|
+
openList.slice(0, openList.length - defaultGlobalConfig.maxCount + 1).forEach(function (item) {
|
|
98
|
+
item.close();
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
// 打开错误提示
|
|
84
105
|
Notification.open(_objectSpread({
|
|
85
106
|
title: renderTitle(msg),
|
|
86
107
|
code: msg === null || msg === void 0 ? void 0 : msg.code,
|
|
@@ -88,7 +109,7 @@ var ErrorMsg = {
|
|
|
88
109
|
footer: function () {
|
|
89
110
|
var _footer = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
90
111
|
var _msg$resolve;
|
|
91
|
-
var resolve;
|
|
112
|
+
var resolve, footerContent;
|
|
92
113
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
93
114
|
while (1) {
|
|
94
115
|
switch (_context2.prev = _context2.next) {
|
|
@@ -97,128 +118,133 @@ var ErrorMsg = {
|
|
|
97
118
|
return (_msg$resolve = msg === null || msg === void 0 ? void 0 : msg.resolve) !== null && _msg$resolve !== void 0 ? _msg$resolve : opts.resolve;
|
|
98
119
|
case 2:
|
|
99
120
|
resolve = _context2.sent;
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
121
|
+
footerContent = [];
|
|
122
|
+
if (opts.extendFooter) {
|
|
123
|
+
if (typeof opts.footer === 'function') {
|
|
124
|
+
footerContent.push(opts.extendFooter());
|
|
125
|
+
} else {
|
|
126
|
+
footerContent.push(opts.extendFooter);
|
|
127
|
+
}
|
|
103
128
|
}
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
129
|
+
if (resolve) {
|
|
130
|
+
footerContent.push( /*#__PURE__*/React.createElement("a", {
|
|
131
|
+
onClick: /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
132
|
+
var _detRes;
|
|
133
|
+
var detRes, url, errMsg;
|
|
134
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
135
|
+
while (1) {
|
|
136
|
+
switch (_context.prev = _context.next) {
|
|
137
|
+
case 0:
|
|
138
|
+
detRes = {};
|
|
139
|
+
if ((resolve === null || resolve === void 0 ? void 0 : resolve.article) || (resolve === null || resolve === void 0 ? void 0 : resolve.extend)) {
|
|
140
|
+
// 已预设解决方案
|
|
141
|
+
detRes = {
|
|
142
|
+
article: resolve === null || resolve === void 0 ? void 0 : resolve.article,
|
|
143
|
+
extend: resolve === null || resolve === void 0 ? void 0 : resolve.extend
|
|
144
|
+
};
|
|
145
|
+
}
|
|
146
|
+
if (!articleMap[msg.code]) {
|
|
147
|
+
_context.next = 6;
|
|
148
|
+
break;
|
|
149
|
+
}
|
|
150
|
+
// 网络异常无法获取解决方案,使用内置的
|
|
115
151
|
detRes = {
|
|
116
|
-
article:
|
|
117
|
-
extend:
|
|
152
|
+
article: articleMap[msg.code],
|
|
153
|
+
extend: []
|
|
118
154
|
};
|
|
119
|
-
|
|
120
|
-
if (!articleMap[msg.code]) {
|
|
121
|
-
_context.next = 6;
|
|
155
|
+
_context.next = 21;
|
|
122
156
|
break;
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
detRes = {
|
|
126
|
-
article: articleMap[msg.code],
|
|
127
|
-
extend: []
|
|
128
|
-
};
|
|
129
|
-
_context.next = 21;
|
|
130
|
-
break;
|
|
131
|
-
case 6:
|
|
132
|
-
// 请求后端获取解决方案
|
|
157
|
+
case 6:
|
|
158
|
+
// 请求后端获取解决方案
|
|
133
159
|
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
}
|
|
143
|
-
_context.prev = 8;
|
|
144
|
-
_context.next = 11;
|
|
145
|
-
return http.get(url, {
|
|
146
|
-
params: {
|
|
147
|
-
errorCode: msg === null || msg === void 0 ? void 0 : msg.code,
|
|
148
|
-
errorMsg: msg === null || msg === void 0 ? void 0 : msg.msg
|
|
160
|
+
if (typeof resolve === 'string') {
|
|
161
|
+
url = resolve;
|
|
162
|
+
} else if (_typeof(resolve) === 'object') {
|
|
163
|
+
url = resolve.href;
|
|
164
|
+
}
|
|
165
|
+
if (!url) {
|
|
166
|
+
_context.next = 20;
|
|
167
|
+
break;
|
|
149
168
|
}
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
169
|
+
_context.prev = 8;
|
|
170
|
+
_context.next = 11;
|
|
171
|
+
return http.get(url, {
|
|
172
|
+
params: {
|
|
173
|
+
errorCode: msg === null || msg === void 0 ? void 0 : msg.code,
|
|
174
|
+
errorMsg: msg === null || msg === void 0 ? void 0 : msg.msg
|
|
175
|
+
}
|
|
176
|
+
});
|
|
177
|
+
case 11:
|
|
178
|
+
errMsg = _context.sent;
|
|
179
|
+
detRes = {
|
|
180
|
+
article: errMsg === null || errMsg === void 0 ? void 0 : errMsg.guidance,
|
|
181
|
+
extend: errMsg === null || errMsg === void 0 ? void 0 : errMsg.errorInfos
|
|
182
|
+
};
|
|
183
|
+
_context.next = 18;
|
|
184
|
+
break;
|
|
185
|
+
case 15:
|
|
186
|
+
_context.prev = 15;
|
|
187
|
+
_context.t0 = _context["catch"](8);
|
|
188
|
+
// eslint-disable-next-line no-console
|
|
189
|
+
console.error(new Error("ErrorMsg\u7EC4\u4EF6: \u83B7\u53D6\u89E3\u51B3\u65B9\u6848\u5931\u8D25\uFF0C".concat(_context.t0)));
|
|
190
|
+
case 18:
|
|
191
|
+
_context.next = 21;
|
|
192
|
+
break;
|
|
193
|
+
case 20:
|
|
194
|
+
// eslint-disable-next-line no-console
|
|
195
|
+
console.error(new Error('ErrorMsg组件: 无效resolve'));
|
|
196
|
+
case 21:
|
|
197
|
+
drawerHandel.open({
|
|
198
|
+
title: "".concat(renderTitle(msg), "(").concat((msg === null || msg === void 0 ? void 0 : msg.code) || '', ")"),
|
|
199
|
+
status: 'error',
|
|
200
|
+
mode: 'errorInfo',
|
|
201
|
+
content: msg === null || msg === void 0 ? void 0 : msg.stack,
|
|
202
|
+
errorInfoProps: {
|
|
203
|
+
tabs: [{
|
|
204
|
+
key: 'article',
|
|
205
|
+
tab: '解决方案'
|
|
206
|
+
}, {
|
|
207
|
+
key: 'extend',
|
|
208
|
+
tab: '错误信息匹配'
|
|
209
|
+
}],
|
|
210
|
+
tabsActiveKey: 'article',
|
|
211
|
+
tabsContent: renderGuidance((_detRes = detRes) === null || _detRes === void 0 ? void 0 : _detRes.article),
|
|
212
|
+
onTabsChange: function onTabsChange(record) {
|
|
213
|
+
var _detRes2, _detRes3;
|
|
214
|
+
switch (record === null || record === void 0 ? void 0 : record.key) {
|
|
215
|
+
case 'article':
|
|
216
|
+
record.update({
|
|
217
|
+
errorInfoProps: {
|
|
218
|
+
tabsActiveKey: record === null || record === void 0 ? void 0 : record.key,
|
|
219
|
+
tabsContent: renderGuidance((_detRes2 = detRes) === null || _detRes2 === void 0 ? void 0 : _detRes2.article)
|
|
220
|
+
}
|
|
221
|
+
});
|
|
222
|
+
break;
|
|
223
|
+
case 'extend':
|
|
224
|
+
record.update({
|
|
225
|
+
errorInfoProps: {
|
|
226
|
+
tabsActiveKey: record === null || record === void 0 ? void 0 : record.key,
|
|
227
|
+
tabsContent: renderErrList((_detRes3 = detRes) === null || _detRes3 === void 0 ? void 0 : _detRes3.extend, opts)
|
|
228
|
+
}
|
|
229
|
+
});
|
|
230
|
+
break;
|
|
231
|
+
default:
|
|
232
|
+
break;
|
|
233
|
+
}
|
|
207
234
|
}
|
|
208
235
|
}
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
236
|
+
});
|
|
237
|
+
case 22:
|
|
238
|
+
case "end":
|
|
239
|
+
return _context.stop();
|
|
240
|
+
}
|
|
214
241
|
}
|
|
215
|
-
}
|
|
216
|
-
}
|
|
217
|
-
}))
|
|
218
|
-
}
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
case 6:
|
|
242
|
+
}, _callee, null, [[8, 15]]);
|
|
243
|
+
}))
|
|
244
|
+
}, "\u67E5\u770B\u8BE6\u60C5"));
|
|
245
|
+
}
|
|
246
|
+
return _context2.abrupt("return", footerContent);
|
|
247
|
+
case 7:
|
|
222
248
|
case "end":
|
|
223
249
|
return _context2.stop();
|
|
224
250
|
}
|
|
@@ -237,5 +263,7 @@ var ErrorMsg = {
|
|
|
237
263
|
var option = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
238
264
|
setGlobalConfig(option);
|
|
239
265
|
}
|
|
266
|
+
// getInstance,
|
|
240
267
|
};
|
|
268
|
+
|
|
241
269
|
export default ErrorMsg;
|
|
@@ -144,7 +144,7 @@ var Notice = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
144
144
|
style: maxLine ? {
|
|
145
145
|
WebkitLineClamp: maxLine
|
|
146
146
|
} : {}
|
|
147
|
-
}, maxLen && typeof content === 'string' && content.length > maxLen ? "".concat(content.slice(0, maxLen), "...") : content) : null,
|
|
147
|
+
}, maxLen && typeof content === 'string' && content.length > maxLen ? "".concat(content.slice(0, maxLen), "...") : content) : null, footerContent ? /*#__PURE__*/React.createElement("div", {
|
|
148
148
|
className: "lx-notification-notice-footer"
|
|
149
149
|
}, footerContent) : null));
|
|
150
150
|
});
|
|
@@ -18,7 +18,7 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
|
|
|
18
18
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
19
19
|
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0) { ; } } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
20
20
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
21
|
-
import React, { forwardRef, useImperativeHandle, useState } from 'react';
|
|
21
|
+
import React, { forwardRef, useImperativeHandle, useMemo, useState, useRef } from 'react';
|
|
22
22
|
import { render } from 'react-dom';
|
|
23
23
|
import { getChildren } from '../../compUtils';
|
|
24
24
|
import Notice from './Notice';
|
|
@@ -31,6 +31,10 @@ var Notification = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
31
31
|
_useState2 = _slicedToArray(_useState, 2),
|
|
32
32
|
configList = _useState2[0],
|
|
33
33
|
setConfigList = _useState2[1];
|
|
34
|
+
var openListRef = useRef([]);
|
|
35
|
+
useMemo(function () {
|
|
36
|
+
openListRef.current = configList;
|
|
37
|
+
}, [configList]);
|
|
34
38
|
var onNoticeClose = function onNoticeClose(key) {
|
|
35
39
|
var _config$onClose;
|
|
36
40
|
var config = configList.find(function (item) {
|
|
@@ -78,6 +82,9 @@ var Notification = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
78
82
|
},
|
|
79
83
|
destroy: function destroy() {
|
|
80
84
|
setConfigList([]);
|
|
85
|
+
},
|
|
86
|
+
getOpenList: function getOpenList() {
|
|
87
|
+
return _toConsumableArray(openListRef.current);
|
|
81
88
|
}
|
|
82
89
|
};
|
|
83
90
|
});
|
|
@@ -119,7 +126,10 @@ Notification.insert = function () {
|
|
|
119
126
|
}
|
|
120
127
|
called = true;
|
|
121
128
|
callback({
|
|
122
|
-
open: notification.open
|
|
129
|
+
open: notification.open,
|
|
130
|
+
close: notification.close,
|
|
131
|
+
destroy: notification.destroy,
|
|
132
|
+
getOpenList: notification.getOpenList
|
|
123
133
|
});
|
|
124
134
|
};
|
|
125
135
|
render( /*#__PURE__*/React.createElement(Notification, _extends({}, props, {
|
|
@@ -1,10 +1,19 @@
|
|
|
1
|
+
import { resolveRequestPath } from '../compUtils';
|
|
1
2
|
export var defaultGlobalConfig = {
|
|
2
|
-
duration:
|
|
3
|
+
duration: 3500,
|
|
3
4
|
maxLine: null,
|
|
5
|
+
// 最多行数
|
|
4
6
|
maxLen: null,
|
|
7
|
+
// 最多字数
|
|
5
8
|
showType: 'notification',
|
|
6
9
|
maxCount: null,
|
|
7
|
-
|
|
10
|
+
// 最大错误显示数据
|
|
11
|
+
placement: 'topRight',
|
|
12
|
+
// 'topRight', 'topLeft', 'bottomRight', 'bottomLeft'
|
|
13
|
+
extendFooter: null,
|
|
14
|
+
erorrListShowType: 'innerWindow',
|
|
15
|
+
// 'innerWindow' , 'openDrawer'
|
|
16
|
+
resolve: process.env.LingXi_ERROR_RESOLVE || resolveRequestPath('/lcdp/error/queryErrorInfoByCodeOrMsg')
|
|
8
17
|
};
|
|
9
18
|
export var setGlobalConfig = function setGlobalConfig() {
|
|
10
19
|
var config = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
2
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
3
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
4
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
5
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
6
|
+
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
7
|
+
import { httpErrorMap } from './const';
|
|
1
8
|
function getChildren(obj) {
|
|
2
9
|
var objChild = [];
|
|
3
10
|
var objs = obj.getElementsByTagName('*');
|
|
@@ -13,4 +20,25 @@ function getChildren(obj) {
|
|
|
13
20
|
}
|
|
14
21
|
return objChild;
|
|
15
22
|
}
|
|
16
|
-
|
|
23
|
+
var resolveRequestPath = function resolveRequestPath(path) {
|
|
24
|
+
if (path) {
|
|
25
|
+
var prefix = process.env.REACT_APP_REQUEST_PREFIX || process.env.REACT_APP_REQ_PREFIX || process.env.UMI_APP_REQ_PREFIX || process.env.LINGXI_APP_REQ_PREFIX || process.env.REQ_PREFIX || '';
|
|
26
|
+
return "".concat(prefix.replace(/\/$/, ''), "/").concat(path.replace(/^\//, ''));
|
|
27
|
+
}
|
|
28
|
+
return '';
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
// eslint-disable-next-line
|
|
32
|
+
var getHttpErrorByCode = function getHttpErrorByCode(code, url, params, response) {
|
|
33
|
+
if (httpErrorMap[code]) {
|
|
34
|
+
var _err$msg;
|
|
35
|
+
var err = _objectSpread({}, httpErrorMap[code]);
|
|
36
|
+
// eslint-disable-next-line
|
|
37
|
+
err.msg = (_err$msg = err.msg) === null || _err$msg === void 0 ? void 0 : _err$msg.replace(/\$\{[\w.]+\}/g, function (varPath) {
|
|
38
|
+
return eval(varPath.slice(2, -1));
|
|
39
|
+
});
|
|
40
|
+
return err;
|
|
41
|
+
}
|
|
42
|
+
return null;
|
|
43
|
+
};
|
|
44
|
+
export { getChildren, resolveRequestPath, getHttpErrorByCode };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
export var errTypeTitMap = {
|
|
2
2
|
'01': '网络请求异常',
|
|
3
3
|
'02': '程序处理异常',
|
|
4
|
-
'03': '
|
|
5
|
-
'04': '
|
|
4
|
+
'03': '业务数据异常常',
|
|
5
|
+
'04': '服务数据异常',
|
|
6
6
|
'05': '配置数据异常',
|
|
7
7
|
'06': '客户端请求异常',
|
|
8
8
|
'07': '业务处理异常',
|
|
@@ -12,6 +12,25 @@ export var statusClrMap = {
|
|
|
12
12
|
config: 'purple',
|
|
13
13
|
platform: 'blue'
|
|
14
14
|
};
|
|
15
|
+
export var httpErrorMap = {
|
|
16
|
+
404: {
|
|
17
|
+
code: '01-00-2-000-000404',
|
|
18
|
+
msg: '服务请求失败,请求资源不存在(404): ${url}'
|
|
19
|
+
},
|
|
20
|
+
// eslint-disable-line
|
|
21
|
+
413: {
|
|
22
|
+
code: '01-00-2-000-000413',
|
|
23
|
+
msg: '服务请求失败,请求报文体超过网关限制'
|
|
24
|
+
},
|
|
25
|
+
502: {
|
|
26
|
+
code: '06-00-3-000-000502',
|
|
27
|
+
msg: '服务请求失败,请稍后再试或者联系系统管理员'
|
|
28
|
+
},
|
|
29
|
+
504: {
|
|
30
|
+
code: '06-00-3-000-000504',
|
|
31
|
+
msg: '服务请求失败,请稍后再试或者联系系统管理员'
|
|
32
|
+
}
|
|
33
|
+
};
|
|
15
34
|
|
|
16
35
|
// 预留更新‘解决方案’
|
|
17
36
|
var localArticles = {};
|
|
@@ -31,10 +50,20 @@ export var articleMap = {
|
|
|
31
50
|
title: '服务请求失败,请求超时',
|
|
32
51
|
content: "<dl>\n <dt>\u8BF7\u6C42\u5931\u8D25\u53EF\u80FD\u539F\u56E0\uFF1A</dt>\n <dd>\n <ol>\n <li>\u5F53\u524D\u7CFB\u7EDF\u5904\u4E8E\u4F7F\u7528\u9AD8\u5CF0\u671F\uFF0C\u54CD\u5E94\u8F83\u6162\uFF1B</li>\n <li>\u7F51\u7EDC\u4E0A\u884C\u4E0B\u884C\u901F\u7387\u6162\uFF1B</li>\n <li>\u8BF7\u6C42\u62A5\u6587\u8FC7\u5927\uFF0C\u4E0A\u4F20\u9700\u8981\u8F83\u591A\u65F6\u95F4\uFF1B</li>\n <li>\u6587\u4EF6\u4E0B\u8F7D\uFF0C\u6587\u4EF6\u5927\u5C0F\u8FC7\u5927\uFF0C\u9700\u8981\u8F83\u591A\u65F6\u95F4\uFF1B</li>\n </ol>\n </dd>\n </dl>\n <dt>\u89E3\u51B3\u65B9\u6CD5\uFF1A</dt>\n <dd>\n <ol>\n <li>\u8BF7\u7A0D\u540E\u518D\u8BD5\uFF1B</li>\n <li>\u68C0\u67E5\u7F51\u7EDC\uFF0C\u6D4B\u8BD5\u7F51\u7EDC\u901F\u5EA6\uFF0C\u5E76\u4F18\u5316\uFF1B</li>\n <li>\u5982\u5185\u5BB9\u8FC7\u5927\uFF0C\u8054\u7CFB\u7BA1\u7406\u5458\u8C03\u6574\u8D85\u65F6\u65F6\u957F\uFF1B</li>\n </ol>\n </dd>\n </dl>\n "
|
|
33
52
|
},
|
|
53
|
+
// 请求404
|
|
54
|
+
'01-00-2-000-000404': localArticles['01-00-2-000-000404'] || {
|
|
55
|
+
title: '服务请求失败,请求资源不存在(404)',
|
|
56
|
+
content: "<dl>\n <dt>\u8BF7\u6C42\u5931\u8D25\u53EF\u80FD\u539F\u56E0\uFF1A</dt>\n <dd>\n <ol>\n <li>\u8D44\u6E90\u5730\u5740\u4E0D\u6B63\u786E\uFF1B</li>\n <li>\u8D44\u6E90\u5DF2\u88AB\u5220\u9664\uFF0C\u6D4F\u89C8\u5668\u7F13\u5B58\u5BFC\u81F4\u8D44\u6E90\u5730\u5740\u6CA1\u66F4\u65B0\uFF1B</li>\n <li>\u9875\u9762\u7248\u672C\u8DDF\u670D\u52A1\u7248\u672C\u4E0D\u4E00\u81F4\uFF1B</li>\n </ol>\n </dd>\n </dl>\n <dt>\u89E3\u51B3\u65B9\u6CD5\uFF1A</dt>\n <dd>\n <ol>\n <li>\u6E05\u9664\u6D4F\u89C8\u5668\u7F13\u5B58\u518D\u91CD\u8BD5\uFF1B</li>\n <li>\u8054\u7CFB\u7CFB\u7EDF\u7BA1\u7406\u5458\u6392\u67E5\u8D44\u6E90\u5730\u5740\u548C\u7248\u672C\u4FE1\u606F\uFF1B</li>\n </ol>\n </dd>\n </dl>\n "
|
|
57
|
+
},
|
|
58
|
+
// 请求413
|
|
59
|
+
'01-00-2-000-000413': localArticles['01-00-2-000-000413'] || {
|
|
60
|
+
title: '服务请求失败,请求报文体超过网关限制',
|
|
61
|
+
content: "<dl>\n <dt>\u8BF7\u6C42\u5931\u8D25\u539F\u56E0\uFF1A</dt>\n <dd>\n <ol>\n <li>\u8BF7\u6C42\u62A5\u6587\u4F53\u8FC7\u5927\u5F15\u8D77\u7684\uFF0C\u8BF7\u6C42\u957F\u5EA6\u8D85\u8FC7\u4E86\u7F51\u5173\u9ED8\u8BA4\u7684\u7F13\u5B58\u5927\u5C0F\u548C\u6700\u5927\u5BA2\u6237\u7AEF\u6700\u5927\u8BF7\u6C42\u5927\u5C0F\uFF1B</li>\n </ol>\n </dd>\n </dl>\n <dt>\u89E3\u51B3\u65B9\u6CD5\uFF1A</dt>\n <dd>\n <ol>\n <li>\u8BF7\u8054\u7CFB\u7CFB\u7EDF\u7BA1\u7406\u5458\uFF0C\u8C03\u6574\u7F51\u5173\u914D\u7F6E</li>\n </ol>\n </dd>\n </dl>\n "
|
|
62
|
+
},
|
|
34
63
|
// 网关错误
|
|
35
64
|
'06-00-3-000-000502': localArticles['06-00-3-000-000502'] || {
|
|
36
65
|
title: '服务请求失败,请稍后再试或者联系系统管理员',
|
|
37
|
-
content: "<dl>\n <dt>\u8BF7\u6C42\u5931\u8D25\u53EF\u80FD\u539F\u56E0\uFF1A</dt>\n <dd>\n <ol>\n <li>\u5F53\u524D\u7CFB\u7EDF\u5904\u4E8E\u4F7F\u7528\u9AD8\u5CF0\u671F\uFF0C\u54CD\u5E94\u8F83\u6162\uFF1B</li>\n <li>\u7CFB\u7EDF\u5B58\u5728\u5185\u90E8\u9519\u8BEF\uFF1B</li>\n
|
|
66
|
+
content: "<dl>\n <dt>\u8BF7\u6C42\u5931\u8D25\u53EF\u80FD\u539F\u56E0\uFF1A</dt>\n <dd>\n <ol>\n <li>\u7CFB\u7EDF\u6B63\u5728\u53D1\u7248\uFF1B</li>\n <li>\u5F53\u524D\u7CFB\u7EDF\u5904\u4E8E\u4F7F\u7528\u9AD8\u5CF0\u671F\uFF0C\u54CD\u5E94\u8F83\u6162\uFF1B</li>\n <li>\u7CFB\u7EDF\u5B58\u5728\u5185\u90E8\u9519\u8BEF\uFF1B</li>\n </ol>\n </dd>\n </dl>\n <dt>\u89E3\u51B3\u65B9\u6CD5\uFF1A</dt>\n <dd>\n <ol>\n <li>\u8BF7\u7A0D\u540E\u518D\u8BD5\uFF1B</li>\n <li>\u8BF7\u8054\u7CFB\u7CFB\u7EDF\u7BA1\u7406\u5458\uFF0C\u6838\u67E5\uFF1A<br />\n - \u4ECE\u670D\u52A1\u7AEF\u541E\u5410\u91CF\u627F\u8F7D\u8003\u8651\uFF0C\u662F\u5426\u9700\u8981\u8FDB\u884C\u7CFB\u7EDF\u6269\u5BB9\uFF1B<br />\n - \u4ECE\u670D\u52A1\u7AEF\u7A0B\u5E8F\u95EE\u9898\u65B9\u9762\u8003\u8651\uFF0C\u662F\u5426\u9700\u8981\u8FDB\u884C\u7A0B\u5E8F\u4F18\u5316\uFF1B<br />\n - \u4ECE\u7F51\u7EDC\u95EE\u9898\u65B9\u9762\u8003\u8651\uFF0C\u662F\u5426\u9700\u8981\u68C0\u67E5\u7F51\u7EDC\u6D88\u8017\u3001\u8D1F\u8F7D\u5747\u8861\u914D\u7F6E\u662F\u5426\u6B63\u786E\u3002\n </li>\n </ol>\n </dd>\n </dl>\n "
|
|
38
67
|
},
|
|
39
68
|
// 网关超时
|
|
40
69
|
'06-00-3-000-000504': localArticles['06-00-3-000-000504'] || {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
2
1
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
3
2
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
4
3
|
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
5
4
|
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
6
5
|
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
6
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
7
7
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
8
8
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
9
9
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
@@ -31,36 +31,29 @@ function getSearchObj() {
|
|
|
31
31
|
var request = function request(url, config) {
|
|
32
32
|
return new Promise(function (resolve, rejects) {
|
|
33
33
|
fetch(url, config).then(function (response) {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
});
|
|
50
|
-
}
|
|
51
|
-
push();
|
|
52
|
-
}
|
|
53
|
-
});
|
|
54
|
-
}).then(function (stream) {
|
|
55
|
-
return new Response(stream, {
|
|
56
|
-
headers: {
|
|
57
|
-
'Content-Type': 'application/json'
|
|
34
|
+
var contentType = response.headers.get('content-type');
|
|
35
|
+
if (/application\/octet-stream/.test(contentType) || /application\/zip/.test(contentType) || /application\/vnd\.ms-excel/.test(contentType)) {
|
|
36
|
+
return response.blob();
|
|
37
|
+
}
|
|
38
|
+
if (/application\/json/.test(contentType)) {
|
|
39
|
+
return response.json();
|
|
40
|
+
}
|
|
41
|
+
if (/text\/html/.test(contentType)) {
|
|
42
|
+
return response.text();
|
|
43
|
+
}
|
|
44
|
+
return response;
|
|
45
|
+
}).then(function (data) {
|
|
46
|
+
if (Object.prototype.toString.call(data) === '[object Blob]') {
|
|
47
|
+
if (_typeof(data) === 'object' && Object.hasOwnProperty.call(data, 'resultCode') && String(data.resultCode) !== '0') {
|
|
48
|
+
return Promise.reject(data);
|
|
58
49
|
}
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
if (
|
|
62
|
-
|
|
50
|
+
return data;
|
|
51
|
+
}
|
|
52
|
+
if (Array.isArray(data)) return data;
|
|
53
|
+
if (String(data === null || data === void 0 ? void 0 : data.resultCode) === '0') {
|
|
54
|
+
resolve(data === null || data === void 0 ? void 0 : data.resultObject);
|
|
63
55
|
}
|
|
56
|
+
return data;
|
|
64
57
|
}).catch(function (err) {
|
|
65
58
|
rejects(err);
|
|
66
59
|
});
|
|
@@ -77,8 +70,8 @@ var http = {
|
|
|
77
70
|
get: function get() {
|
|
78
71
|
var url = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
|
79
72
|
var cfg = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
80
|
-
var
|
|
81
|
-
params =
|
|
73
|
+
var _ref = cfg || {},
|
|
74
|
+
params = _ref.params;
|
|
82
75
|
var paramsArr = '';
|
|
83
76
|
if (params && Object.keys(params).length > 0) {
|
|
84
77
|
paramsArr = Object.keys(params).map(function (item) {
|
package/es/error/index.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
1
|
import ErrorMsg from './errorDisplay/Web/ErrorMsg';
|
|
2
2
|
import MobileErrorMsg from './errorDisplay/Mobile/ErrorMsg';
|
|
3
|
-
|
|
3
|
+
import { getHttpErrorByCode } from './errorDisplay/compUtils';
|
|
4
|
+
import errorCatch from './errorCatch';
|
|
5
|
+
export { ErrorMsg, MobileErrorMsg, getHttpErrorByCode, errorCatch };
|
package/es/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import security from './security';
|
|
2
|
-
import { ErrorMsg, MobileErrorMsg } from './error';
|
|
2
|
+
import { ErrorMsg, MobileErrorMsg, getHttpErrorByCode, errorCatch } from './error';
|
|
3
3
|
export declare const IconCheckSvg: string;
|
|
4
4
|
export declare const IconNormalCheckSvg: string;
|
|
5
|
-
export { security, ErrorMsg, MobileErrorMsg };
|
|
5
|
+
export { security, ErrorMsg, MobileErrorMsg, getHttpErrorByCode, errorCatch };
|
package/es/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { getSvgImageBase64 } from './utils/img';
|
|
2
2
|
import security from './security';
|
|
3
|
-
import { ErrorMsg, MobileErrorMsg } from './error';
|
|
3
|
+
import { ErrorMsg, MobileErrorMsg, getHttpErrorByCode, errorCatch } from './error';
|
|
4
4
|
export var IconCheckSvg = getSvgImageBase64("<?xml version=\"1.0\" encoding=\"UTF-8\"?><svg width=\"22px\" height=\"22px\" viewBox=\"0 0 22 22\" version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\"><title>\u5168\u5C40\u6837\u5F0F:20/\u539F\u5B50\u7EA7\u63A7\u4EF6/\u590D\u9009/\u72B6\u6001:#\u9009\u4E2D</title><g id=\"\u63A7\u4EF6\" stroke=\"none\" stroke-width=\"1\" fill=\"none\" fill-rule=\"evenodd\"><g id=\"system-complete\"><path d=\"M11,0 C17.075904,0 22,4.92409598 22,11 C22,17.075904 17.0734732,22 11,22 C4.92652679,22 0,17.0734732 0,11 C0,4.92652679 4.92409598,0 11,0 Z\" id=\"Shape\" fill=\"#1890FF\"></path><path d=\"M9.42871875,12.9681652 L7.2069029,10.7463493 C6.90006126,10.4395077 6.40257267,10.4395077 6.09573103,10.7463493 C5.78889035,11.05319 5.78889035,11.550677 6.09573103,11.8575177 C6.09573161,11.8575183 6.0957322,11.8575189 6.09573278,11.8575195 L8.72212536,14.4838955 C9.11265701,14.8744045 9.74581424,14.874407 10.136349,14.483901 L10.5404063,14.0798527 L10.5404063,14.0798527 L16.2813591,8.33795955 C16.588183,8.03108543 16.5881626,7.53359119 16.2813136,7.22674219 C15.974472,6.91990055 15.4769834,6.91990055 15.1701417,7.22674219 L9.42871875,12.9681652 L9.42871875,12.9681652 Z\" id=\"Path\" fill=\"#FFFFFF\"></path></g></g></svg>");
|
|
5
5
|
export var IconNormalCheckSvg = getSvgImageBase64("<?xml version=\"1.0\" encoding=\"UTF-8\"?><svg width=\"22px\" height=\"22px\" viewBox=\"0 0 22 22\" version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\"><title>\u5168\u5C40\u6837\u5F0F:20/\u539F\u5B50\u7EA7\u63A7\u4EF6/\u590D\u9009/\u72B6\u6001:\u672A\u9009\u4E2D</title><g id=\"\u63A7\u4EF6\" stroke=\"none\" stroke-width=\"1\" fill=\"none\" fill-rule=\"evenodd\"><g id=\"\u5143\u7D20/\u9009\u62E9/\u672A\u9009\u4E2D\"><path d=\"M11,22 C4.93492502,22 0,17.0653546 0,10.999496 C0,4.9337633 4.93492502,0 11,0 C17.065075,0 22,4.93464539 22,10.999496 C22,17.0644725 17.0660846,22 11,22\" id=\"Fill\" fill=\"#FFFFFF\"></path><path d=\"M11,0.5 C13.8998633,0.5 16.5248731,1.67505184 18.4249106,3.57508938 C20.3249482,5.47512693 21.5,8.10013672 21.5,11 C21.5,13.8995696 20.3245821,16.5243277 18.4245965,18.4243132 C16.5242275,20.3246822 13.8989967,21.5 11,21.5 C8.10129687,21.5 5.47631792,20.324316 3.57600094,18.4239991 C1.67568396,16.5236821 0.5,13.8987031 0.5,11 C0.5,8.10100334 1.67531776,5.47577251 3.57568679,3.57540349 C5.47567234,1.67541793 8.10043037,0.5 11,0.5 Z\" id=\"Shape\" stroke=\"#CCCCCC\"></path></g></g></svg>");
|
|
6
|
-
export { security, ErrorMsg, MobileErrorMsg };
|
|
6
|
+
export { security, ErrorMsg, MobileErrorMsg, getHttpErrorByCode, errorCatch };
|
package/es/security/index.d.ts
CHANGED
|
@@ -22,5 +22,11 @@ declare const _default: {
|
|
|
22
22
|
createHttpSignStr: (url: string, options: any) => string;
|
|
23
23
|
getApiPath: (url: string) => any;
|
|
24
24
|
};
|
|
25
|
+
RSAEncrypt: (value: string, publicKey: string, handle?: any) => any;
|
|
26
|
+
RSADecrypt: (value: string, privKey: string, handle?: any) => any;
|
|
27
|
+
AESEncrypt: (value: any, aesKey: string, handle?: any) => any;
|
|
28
|
+
AESDecrypt: (value: string, aesKey: string, handle?: any) => any;
|
|
29
|
+
DESEncrypt: (value: string, aesKey: string, handle?: any) => any;
|
|
30
|
+
DESDecrypt: (value: string, aesKey: string, handle?: any) => any;
|
|
25
31
|
};
|
|
26
32
|
export default _default;
|
package/es/security/index.js
CHANGED
|
@@ -1,10 +1,19 @@
|
|
|
1
1
|
import httpEncryption from './httpEncryption';
|
|
2
2
|
import sign from './encipher/sign';
|
|
3
|
+
import { RSAEncrypt, RSADecrypt } from '../security/encipher/rsa';
|
|
4
|
+
import { AESEncrypt, AESDecrypt } from '../security/encipher/aes';
|
|
5
|
+
import { DESEncrypt, DESDecrypt } from '../security/encipher/des';
|
|
3
6
|
window.lingxiSecurity = {
|
|
4
7
|
httpEncryption: httpEncryption,
|
|
5
8
|
sign: sign
|
|
6
9
|
};
|
|
7
10
|
export default {
|
|
8
11
|
httpEncryption: httpEncryption,
|
|
9
|
-
sign: sign
|
|
12
|
+
sign: sign,
|
|
13
|
+
RSAEncrypt: RSAEncrypt,
|
|
14
|
+
RSADecrypt: RSADecrypt,
|
|
15
|
+
AESEncrypt: AESEncrypt,
|
|
16
|
+
AESDecrypt: AESDecrypt,
|
|
17
|
+
DESEncrypt: DESEncrypt,
|
|
18
|
+
DESDecrypt: DESDecrypt
|
|
10
19
|
};
|
package/lib/index.js
CHANGED
|
@@ -16,6 +16,18 @@ Object.defineProperty(exports, "MobileErrorMsg", {
|
|
|
16
16
|
return _error.MobileErrorMsg;
|
|
17
17
|
}
|
|
18
18
|
});
|
|
19
|
+
Object.defineProperty(exports, "errorCatch", {
|
|
20
|
+
enumerable: true,
|
|
21
|
+
get: function get() {
|
|
22
|
+
return _error.errorCatch;
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
Object.defineProperty(exports, "getHttpErrorByCode", {
|
|
26
|
+
enumerable: true,
|
|
27
|
+
get: function get() {
|
|
28
|
+
return _error.getHttpErrorByCode;
|
|
29
|
+
}
|
|
30
|
+
});
|
|
19
31
|
Object.defineProperty(exports, "security", {
|
|
20
32
|
enumerable: true,
|
|
21
33
|
get: function get() {
|