@lingxiteam/assets 3.2.1-alpha.1 → 3.2.1-alpha.2
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/errorDisplay/Mobile/Drawer/Drawer.js +9 -3
- package/es/error/errorDisplay/Mobile/ErrorMsg/index.js +29 -26
- package/es/error/errorDisplay/Mobile/Modal/Modal.js +5 -3
- package/es/error/errorDisplay/Mobile/defaultGlobalConfig.js +9 -1
- package/es/error/errorDisplay/Web/Drawer/Drawer.js +8 -3
- package/es/error/errorDisplay/Web/ErrorMsg/index.js +62 -46
- package/es/error/errorDisplay/Web/defaultGlobalConfig.js +10 -2
- package/es/error/errorDisplay/const.js +29 -7
- package/es/rootConfig/mobile/MobileModal.d.ts +3 -0
- package/es/rootConfig/mobile/MobileModal.js +4 -1
- package/es/rootConfig/mobile/MobilePopover.d.ts +3 -0
- package/es/rootConfig/mobile/MobilePopover.js +4 -1
- package/es/rootConfig/mobile/page.d.ts +3 -0
- package/es/rootConfig/mobile/page.js +4 -1
- package/es/rootConfig/pc/Drawer.d.ts +3 -0
- package/es/rootConfig/pc/Drawer.js +4 -1
- package/es/rootConfig/pc/Modal.d.ts +3 -0
- package/es/rootConfig/pc/Modal.js +4 -1
- package/es/rootConfig/pc/Popover.d.ts +3 -0
- package/es/rootConfig/pc/Popover.js +4 -1
- package/es/rootConfig/pc/page.d.ts +3 -0
- package/es/rootConfig/pc/page.js +4 -1
- package/es/rootConfig/todoActionList.d.ts +251 -16
- package/es/rootConfig/todoActionList.js +345 -44
- package/es/rootConfig/todoOptionList.js +3 -3
- package/lib/error/errorDisplay/Mobile/Drawer/Drawer.js +9 -3
- package/lib/error/errorDisplay/Mobile/ErrorMsg/index.js +29 -26
- package/lib/error/errorDisplay/Mobile/Modal/Modal.js +5 -3
- package/lib/error/errorDisplay/Mobile/defaultGlobalConfig.js +9 -1
- package/lib/error/errorDisplay/Web/Drawer/Drawer.js +8 -3
- package/lib/error/errorDisplay/Web/ErrorMsg/index.js +62 -46
- package/lib/error/errorDisplay/Web/defaultGlobalConfig.js +10 -1
- package/lib/error/errorDisplay/const.js +33 -9
- package/lib/rootConfig/mobile/MobileModal.d.ts +3 -0
- package/lib/rootConfig/mobile/MobileModal.js +4 -1
- package/lib/rootConfig/mobile/MobilePopover.d.ts +3 -0
- package/lib/rootConfig/mobile/MobilePopover.js +4 -1
- package/lib/rootConfig/mobile/page.d.ts +3 -0
- package/lib/rootConfig/mobile/page.js +4 -1
- package/lib/rootConfig/pc/Drawer.d.ts +3 -0
- package/lib/rootConfig/pc/Drawer.js +4 -1
- package/lib/rootConfig/pc/Modal.d.ts +3 -0
- package/lib/rootConfig/pc/Modal.js +4 -1
- package/lib/rootConfig/pc/Popover.d.ts +3 -0
- package/lib/rootConfig/pc/Popover.js +4 -1
- package/lib/rootConfig/pc/page.d.ts +3 -0
- package/lib/rootConfig/pc/page.js +4 -1
- package/lib/rootConfig/todoActionList.d.ts +251 -16
- package/lib/rootConfig/todoActionList.js +345 -44
- package/lib/rootConfig/todoOptionList.js +3 -3
- package/package.json +1 -1
|
@@ -17,7 +17,8 @@ var Drawer = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
17
17
|
onCancel = props.onCancel,
|
|
18
18
|
onClickRecord = props.onClickRecord,
|
|
19
19
|
_props$mode = props.mode,
|
|
20
|
-
mode = _props$mode === void 0 ? 'content' : _props$mode
|
|
20
|
+
mode = _props$mode === void 0 ? 'content' : _props$mode,
|
|
21
|
+
getLocale = props.getLocale;
|
|
21
22
|
var renderItems = function renderItems() {
|
|
22
23
|
if (Array.isArray(dataSource) && dataSource.length > 0) {
|
|
23
24
|
return /*#__PURE__*/React.createElement("div", {
|
|
@@ -42,7 +43,7 @@ var Drawer = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
42
43
|
}
|
|
43
44
|
return /*#__PURE__*/React.createElement("div", {
|
|
44
45
|
className: "lxm-drawer-empty"
|
|
45
|
-
},
|
|
46
|
+
}, getLocale('noData', '暂无数据'));
|
|
46
47
|
};
|
|
47
48
|
var renderContent = function renderContent() {
|
|
48
49
|
if (dataSource && ((dataSource === null || dataSource === void 0 ? void 0 : dataSource.title) || (dataSource === null || dataSource === void 0 ? void 0 : dataSource.author) || (dataSource === null || dataSource === void 0 ? void 0 : dataSource.content))) {
|
|
@@ -65,7 +66,7 @@ var Drawer = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
65
66
|
}
|
|
66
67
|
return /*#__PURE__*/React.createElement("div", {
|
|
67
68
|
className: "lxm-drawer-empty"
|
|
68
|
-
}, emptyTxt);
|
|
69
|
+
}, getLocale('ErrorMsg.no-information', emptyTxt));
|
|
69
70
|
};
|
|
70
71
|
return visible ? /*#__PURE__*/React.createElement("div", {
|
|
71
72
|
ref: ref,
|
|
@@ -101,4 +102,9 @@ var Drawer = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
101
102
|
className: "lxm-drawer-main"
|
|
102
103
|
}, mode === 'list' ? renderItems() : renderContent()))) : '';
|
|
103
104
|
});
|
|
105
|
+
Drawer.defaultProps = {
|
|
106
|
+
getLocale: function getLocale(t, p) {
|
|
107
|
+
return p !== null && p !== void 0 ? p : '';
|
|
108
|
+
}
|
|
109
|
+
};
|
|
104
110
|
export default Drawer;
|
|
@@ -11,7 +11,7 @@ import { isValidElement } from 'react';
|
|
|
11
11
|
import Modal from '../Modal';
|
|
12
12
|
import Drawer from '../Drawer';
|
|
13
13
|
import http from '../../http';
|
|
14
|
-
import { statusClrMap
|
|
14
|
+
import { statusClrMap } from '../../const';
|
|
15
15
|
import { defaultGlobalConfig, setGlobalConfig } from '../defaultGlobalConfig';
|
|
16
16
|
var isElm = function isElm(val) {
|
|
17
17
|
return ['number', 'string'].includes(_typeof(val)) || /*#__PURE__*/isValidElement(val);
|
|
@@ -31,7 +31,8 @@ var renderErrList = function renderErrList(errList) {
|
|
|
31
31
|
}
|
|
32
32
|
return null;
|
|
33
33
|
};
|
|
34
|
-
var renderTitle = function renderTitle(msg) {
|
|
34
|
+
var renderTitle = function renderTitle(msg, opts) {
|
|
35
|
+
var errTypeTitMap = opts.errTypeTitMap;
|
|
35
36
|
if (isElm(msg === null || msg === void 0 ? void 0 : msg.title)) {
|
|
36
37
|
return msg.title;
|
|
37
38
|
}
|
|
@@ -47,7 +48,7 @@ var ErrorMsg = {
|
|
|
47
48
|
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
48
49
|
var opts = _objectSpread(_objectSpread({}, defaultGlobalConfig), options);
|
|
49
50
|
if (msg) {
|
|
50
|
-
var title = renderTitle(msg);
|
|
51
|
+
var title = renderTitle(msg, opts);
|
|
51
52
|
Modal.open(_objectSpread({
|
|
52
53
|
title: title,
|
|
53
54
|
subtitle: msg === null || msg === void 0 ? void 0 : msg.code,
|
|
@@ -55,7 +56,7 @@ var ErrorMsg = {
|
|
|
55
56
|
onOk: function () {
|
|
56
57
|
var _onOk = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
57
58
|
var _msg$resolve;
|
|
58
|
-
var resolve, _detRes, detRes, url, errMsg;
|
|
59
|
+
var resolve, _detRes, detRes, article, url, errMsg;
|
|
59
60
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
60
61
|
while (1) {
|
|
61
62
|
switch (_context.prev = _context.next) {
|
|
@@ -65,7 +66,7 @@ var ErrorMsg = {
|
|
|
65
66
|
case 2:
|
|
66
67
|
resolve = _context.sent;
|
|
67
68
|
if (!resolve) {
|
|
68
|
-
_context.next =
|
|
69
|
+
_context.next = 27;
|
|
69
70
|
break;
|
|
70
71
|
}
|
|
71
72
|
detRes = {};
|
|
@@ -76,18 +77,19 @@ var ErrorMsg = {
|
|
|
76
77
|
extend: resolve === null || resolve === void 0 ? void 0 : resolve.extend
|
|
77
78
|
};
|
|
78
79
|
}
|
|
79
|
-
|
|
80
|
-
|
|
80
|
+
article = opts.getArticle(msg.code, opts.getLocale);
|
|
81
|
+
if (!article) {
|
|
82
|
+
_context.next = 11;
|
|
81
83
|
break;
|
|
82
84
|
}
|
|
83
85
|
// 网络异常无法获取解决方案,使用内置的
|
|
84
86
|
detRes = {
|
|
85
|
-
article:
|
|
87
|
+
article: article,
|
|
86
88
|
extend: []
|
|
87
89
|
};
|
|
88
|
-
_context.next =
|
|
90
|
+
_context.next = 26;
|
|
89
91
|
break;
|
|
90
|
-
case
|
|
92
|
+
case 11:
|
|
91
93
|
// 请求后端获取解决方案
|
|
92
94
|
|
|
93
95
|
if (typeof resolve === 'string') {
|
|
@@ -96,45 +98,46 @@ var ErrorMsg = {
|
|
|
96
98
|
url = resolve.href;
|
|
97
99
|
}
|
|
98
100
|
if (!url) {
|
|
99
|
-
_context.next =
|
|
101
|
+
_context.next = 25;
|
|
100
102
|
break;
|
|
101
103
|
}
|
|
102
|
-
_context.prev =
|
|
103
|
-
_context.next =
|
|
104
|
+
_context.prev = 13;
|
|
105
|
+
_context.next = 16;
|
|
104
106
|
return http.get(url, {
|
|
105
107
|
params: {
|
|
106
108
|
errorCode: msg === null || msg === void 0 ? void 0 : msg.code,
|
|
107
109
|
errorMsg: msg === null || msg === void 0 ? void 0 : msg.msg
|
|
108
110
|
}
|
|
109
111
|
});
|
|
110
|
-
case
|
|
112
|
+
case 16:
|
|
111
113
|
errMsg = _context.sent;
|
|
112
114
|
detRes = {
|
|
113
115
|
article: errMsg === null || errMsg === void 0 ? void 0 : errMsg.guidance,
|
|
114
116
|
extend: errMsg === null || errMsg === void 0 ? void 0 : errMsg.errorInfos
|
|
115
117
|
};
|
|
116
|
-
_context.next =
|
|
118
|
+
_context.next = 23;
|
|
117
119
|
break;
|
|
118
|
-
case
|
|
119
|
-
_context.prev =
|
|
120
|
-
_context.t0 = _context["catch"](
|
|
120
|
+
case 20:
|
|
121
|
+
_context.prev = 20;
|
|
122
|
+
_context.t0 = _context["catch"](13);
|
|
121
123
|
// eslint-disable-next-line no-console
|
|
122
124
|
console.error(new Error("ErrorMsg\u7EC4\u4EF6: \u83B7\u53D6\u89E3\u51B3\u65B9\u6848\u5931\u8D25\uFF0C".concat(_context.t0)));
|
|
123
|
-
case
|
|
124
|
-
_context.next =
|
|
125
|
+
case 23:
|
|
126
|
+
_context.next = 26;
|
|
125
127
|
break;
|
|
126
|
-
case
|
|
128
|
+
case 25:
|
|
127
129
|
// eslint-disable-next-line no-console
|
|
128
130
|
console.error(new Error('ErrorMsg组件: 无效resolve'));
|
|
129
|
-
case
|
|
131
|
+
case 26:
|
|
130
132
|
Drawer.open({
|
|
133
|
+
getLocale: opts.getLocale,
|
|
131
134
|
title: title,
|
|
132
135
|
tabs: [{
|
|
133
136
|
key: 'article',
|
|
134
|
-
tab: '解决方案'
|
|
137
|
+
tab: opts.getLocale('ErrorMsg.solution', '解决方案')
|
|
135
138
|
}, {
|
|
136
139
|
key: 'extend',
|
|
137
|
-
tab: '错误信息匹配'
|
|
140
|
+
tab: opts.getLocale('ErrorMsg.errorMsgMatch', '错误信息匹配')
|
|
138
141
|
}],
|
|
139
142
|
activeTabsKey: 'article',
|
|
140
143
|
mode: 'content',
|
|
@@ -176,12 +179,12 @@ var ErrorMsg = {
|
|
|
176
179
|
}
|
|
177
180
|
}
|
|
178
181
|
});
|
|
179
|
-
case
|
|
182
|
+
case 27:
|
|
180
183
|
case "end":
|
|
181
184
|
return _context.stop();
|
|
182
185
|
}
|
|
183
186
|
}
|
|
184
|
-
}, _callee, null, [[
|
|
187
|
+
}, _callee, null, [[13, 20]]);
|
|
185
188
|
}));
|
|
186
189
|
function onOk() {
|
|
187
190
|
return _onOk.apply(this, arguments);
|
|
@@ -9,7 +9,9 @@ var Modal = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
9
9
|
content = props.content,
|
|
10
10
|
footer = props.footer,
|
|
11
11
|
onOk = props.onOk,
|
|
12
|
-
onCancel = props.onCancel
|
|
12
|
+
onCancel = props.onCancel,
|
|
13
|
+
okText = props.okText,
|
|
14
|
+
cancelText = props.cancelText;
|
|
13
15
|
return visible ? /*#__PURE__*/React.createElement("div", {
|
|
14
16
|
className: "lxm-modal-wraper",
|
|
15
17
|
ref: ref
|
|
@@ -35,9 +37,9 @@ var Modal = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
35
37
|
}, typeof footer === 'function' ? footer() : /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
36
38
|
className: "lxm-modal-btn lxm-modal-def-btn",
|
|
37
39
|
onClick: onCancel
|
|
38
|
-
},
|
|
40
|
+
}, cancelText), /*#__PURE__*/React.createElement("div", {
|
|
39
41
|
className: "lxm-modal-btn lxm-modal-prm-btn",
|
|
40
42
|
onClick: onOk
|
|
41
|
-
},
|
|
43
|
+
}, okText)))))) : '';
|
|
42
44
|
});
|
|
43
45
|
export default Modal;
|
|
@@ -1,11 +1,19 @@
|
|
|
1
1
|
import { resolveRequestPath } from '../compUtils';
|
|
2
|
+
import { articleMap, errTypeTitMap, getArticle } from '../const';
|
|
2
3
|
export var defaultGlobalConfig = {
|
|
3
4
|
duration: null,
|
|
4
5
|
maxLine: null,
|
|
5
6
|
maxLen: null,
|
|
6
7
|
showType: 'modal',
|
|
7
8
|
maxCount: null,
|
|
8
|
-
resolve: process.env.LingXi_ERROR_RESOLVE || resolveRequestPath('/lcdp/error/queryErrorInfoByCodeOrMsg')
|
|
9
|
+
resolve: process.env.LingXi_ERROR_RESOLVE || resolveRequestPath('/lcdp/error/queryErrorInfoByCodeOrMsg'),
|
|
10
|
+
okText: '查看详情',
|
|
11
|
+
cancelText: '知道了',
|
|
12
|
+
getLocale: function getLocale(k, p) {
|
|
13
|
+
return p !== null && p !== void 0 ? p : '';
|
|
14
|
+
},
|
|
15
|
+
errTypeTitMap: errTypeTitMap,
|
|
16
|
+
getArticle: getArticle
|
|
9
17
|
};
|
|
10
18
|
export var setGlobalConfig = function setGlobalConfig() {
|
|
11
19
|
var config = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
@@ -113,7 +113,7 @@ var Drawer = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
113
113
|
return [].concat(_toConsumableArray(cloneList), [item[contentRowKey]]);
|
|
114
114
|
});
|
|
115
115
|
}
|
|
116
|
-
}, extraConts.includes(item[contentRowKey]) ? '收起' : '展开') : null) : null);
|
|
116
|
+
}, extraConts.includes(item[contentRowKey]) ? getLocale('packUp', '收起') : getLocale('open', '展开')) : null) : null);
|
|
117
117
|
});
|
|
118
118
|
}
|
|
119
119
|
return null;
|
|
@@ -157,7 +157,7 @@ var Drawer = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
157
157
|
return _objectSpread(_objectSpread({}, pre), {}, _defineProperty({}, item[tabsRowKey], !errorCollapseMap[item[tabsRowKey]]));
|
|
158
158
|
});
|
|
159
159
|
}
|
|
160
|
-
}, errorCollapseMap[item[tabsRowKey]] ? '收起' : '展开', /*#__PURE__*/React.createElement("img", {
|
|
160
|
+
}, errorCollapseMap[item[tabsRowKey]] ? getLocale('packUp', '收起') : getLocale('open', '展开'), /*#__PURE__*/React.createElement("img", {
|
|
161
161
|
src: getSvgImageBase64(ArrowIcon),
|
|
162
162
|
alt: "",
|
|
163
163
|
className: classnames('lx-drawer-err-item-head-extra-arrow', {
|
|
@@ -177,7 +177,7 @@ var Drawer = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
177
177
|
href: item.url,
|
|
178
178
|
target: "_blank",
|
|
179
179
|
rel: "noreferrer"
|
|
180
|
-
},
|
|
180
|
+
}, getLocale('documentLink', '文档链接')))));
|
|
181
181
|
})));
|
|
182
182
|
}
|
|
183
183
|
return isDomEle(tabsCont) ? tabsCont : null;
|
|
@@ -265,4 +265,9 @@ var Drawer = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
265
265
|
className: "lx-drawer-footer"
|
|
266
266
|
}, footer) : null));
|
|
267
267
|
});
|
|
268
|
+
Drawer.defaultProps = {
|
|
269
|
+
getLocale: function getLocale(t, p) {
|
|
270
|
+
return p !== null && p !== void 0 ? p : '';
|
|
271
|
+
}
|
|
272
|
+
};
|
|
268
273
|
export default Drawer;
|
|
@@ -19,7 +19,7 @@ import Notification, { notificationInstance } from '../Notification';
|
|
|
19
19
|
import { resolveRequestPath, debounce } from '../../compUtils';
|
|
20
20
|
import { drawerHandel } from '../Drawer';
|
|
21
21
|
import http from '../../http';
|
|
22
|
-
import { statusClrMap, errTypeTitMap
|
|
22
|
+
import { statusClrMap, errTypeTitMap } from '../../const';
|
|
23
23
|
import { defaultGlobalConfig, setGlobalConfig } from '../defaultGlobalConfig';
|
|
24
24
|
var isElm = function isElm(val) {
|
|
25
25
|
return ['number', 'string'].includes(_typeof(val)) || /*#__PURE__*/isValidElement(val);
|
|
@@ -27,14 +27,27 @@ var isElm = function isElm(val) {
|
|
|
27
27
|
var emptyTxt = '暂无匹配信息,请联系平台管理员';
|
|
28
28
|
var defaultFeedbackUrl = process.env.LingXi_ERROR_FEEBACK_URL || resolveRequestPath('/portal/IssueFeedback/addUserIssueFeedback');
|
|
29
29
|
var feedbackPlacements = ['notification', 'drawer'];
|
|
30
|
-
var feedbackTxts = [
|
|
30
|
+
var feedbackTxts = [{
|
|
31
|
+
code: 'faultReport',
|
|
32
|
+
title: '故障上报'
|
|
33
|
+
}, {
|
|
34
|
+
code: 'hasReported',
|
|
35
|
+
title: '故障已上报'
|
|
36
|
+
}, {
|
|
37
|
+
code: 'reporting',
|
|
38
|
+
title: '故障上报中...'
|
|
39
|
+
}];
|
|
31
40
|
var targetTypes = ['request', 'dom', 'event'];
|
|
32
41
|
var btnDisableClass = ['lx-notification-btn-disabled', 'lx-drawer-btn-disabled'];
|
|
33
42
|
var getInstance = function getInstance(placement) {
|
|
34
43
|
return notificationInstance["lx-notification-root ".concat(placement)];
|
|
35
44
|
};
|
|
36
45
|
var renderErrList = function renderErrList(errList, opts) {
|
|
37
|
-
var erorrListShowType = opts.erorrListShowType
|
|
46
|
+
var erorrListShowType = opts.erorrListShowType,
|
|
47
|
+
_opts$getLocale = opts.getLocale,
|
|
48
|
+
getLocale = _opts$getLocale === void 0 ? function (k, p) {
|
|
49
|
+
return p;
|
|
50
|
+
} : _opts$getLocale;
|
|
38
51
|
if (Array.isArray(errList) && errList.length > 0) {
|
|
39
52
|
return errList.map(function (item) {
|
|
40
53
|
var _item$guidance, _item$guidance2;
|
|
@@ -61,15 +74,15 @@ var renderErrList = function renderErrList(errList, opts) {
|
|
|
61
74
|
})
|
|
62
75
|
});
|
|
63
76
|
}
|
|
64
|
-
},
|
|
77
|
+
}, getLocale('detail', ' 详情'))
|
|
65
78
|
};
|
|
66
79
|
});
|
|
67
80
|
}
|
|
68
81
|
return /*#__PURE__*/React.createElement("div", {
|
|
69
82
|
className: "lx-drawer-empty"
|
|
70
|
-
}, emptyTxt);
|
|
83
|
+
}, getLocale('ErrorMsg.no-information', emptyTxt));
|
|
71
84
|
};
|
|
72
|
-
var renderGuidance = function renderGuidance(guidance) {
|
|
85
|
+
var renderGuidance = function renderGuidance(guidance, opts) {
|
|
73
86
|
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", {
|
|
74
87
|
className: "lx-drawer-group-article lx-drawer-article"
|
|
75
88
|
// eslint-disable-next-line react/no-danger
|
|
@@ -81,11 +94,12 @@ var renderGuidance = function renderGuidance(guidance) {
|
|
|
81
94
|
onClick: function onClick() {
|
|
82
95
|
window.open(guidance === null || guidance === void 0 ? void 0 : guidance.guidanceUrl, '_blank');
|
|
83
96
|
}
|
|
84
|
-
},
|
|
97
|
+
}, opts.getLocale('documentLink', '文档链接'))) : null) : /*#__PURE__*/React.createElement("div", {
|
|
85
98
|
className: "lx-drawer-empty"
|
|
86
|
-
}, emptyTxt);
|
|
99
|
+
}, opts.getLocale('ErrorMsg.no-information', emptyTxt));
|
|
87
100
|
};
|
|
88
|
-
var renderTitle = function renderTitle(msg) {
|
|
101
|
+
var renderTitle = function renderTitle(msg, opts) {
|
|
102
|
+
var errTypeTitMap = opts.errTypeTitMap;
|
|
89
103
|
if (isElm(msg === null || msg === void 0 ? void 0 : msg.title)) {
|
|
90
104
|
return msg.title;
|
|
91
105
|
}
|
|
@@ -115,7 +129,7 @@ var ErrorMsg = {
|
|
|
115
129
|
}
|
|
116
130
|
// 打开错误提示
|
|
117
131
|
Notification.open(_objectSpread({
|
|
118
|
-
title: renderTitle(msg),
|
|
132
|
+
title: renderTitle(msg, opts),
|
|
119
133
|
code: msg === null || msg === void 0 ? void 0 : msg.code,
|
|
120
134
|
content: msg === null || msg === void 0 ? void 0 : msg.msg,
|
|
121
135
|
footer: function () {
|
|
@@ -135,14 +149,14 @@ var ErrorMsg = {
|
|
|
135
149
|
footerContent = [];
|
|
136
150
|
loadingStates = ['loading', 'finish'];
|
|
137
151
|
mapFeebackTxt = {
|
|
138
|
-
loading: feedbackTxts[2],
|
|
139
|
-
finish: feedbackTxts[1]
|
|
152
|
+
loading: opts.getLocale(feedbackTxts[2].code, feedbackTxts[2].title),
|
|
153
|
+
finish: opts.getLocale(feedbackTxts[1].code, feedbackTxts[1].title)
|
|
140
154
|
}; // 故障上报loading
|
|
141
155
|
feedbackLoading = ''; // 故障上报地址
|
|
142
156
|
feedbackUrl = defaultFeedbackUrl; // 是否显示故障上报
|
|
143
157
|
isShowFeedback = true; // 页面请求路径
|
|
144
158
|
pageUrl = window.location.href;
|
|
145
|
-
getDes = "<h3
|
|
159
|
+
getDes = "<h3>".concat(opts.getLocale('PageRequestPath', '页面请求路径'), "<h3><p>").concat(pageUrl, "</p><h3>").concat(opts.getLocale('PageRequestPath', '接口请求路径'), "<h3><p>").concat(target === null || target === void 0 ? void 0 : target.id, "</p><h3>").concat(opts.getLocale('PageRequestPath', '接口返回报文'), "<h3><p>").concat(resMsg, " ").concat(stack, "</p>"); // 故障上报数据
|
|
146
160
|
feedbackParams = {
|
|
147
161
|
feedbackType: '5000',
|
|
148
162
|
feedbackProductType: '5000',
|
|
@@ -186,10 +200,10 @@ var ErrorMsg = {
|
|
|
186
200
|
Notification.setOpenList(_toConsumableArray(getAllList));
|
|
187
201
|
var feedbackDrawerDom = document.getElementById("lx-feedback-drawer-".concat(_key));
|
|
188
202
|
if (feedbackDrawerDom) {
|
|
189
|
-
feedbackDrawerDom.innerHTML = _state ? feedbackTxts[2] : feedbackTxts[1];
|
|
203
|
+
feedbackDrawerDom.innerHTML = _state ? opts.getLocale(feedbackTxts[2].code, feedbackTxts[2].title) : opts.getLocale(feedbackTxts[1].code, feedbackTxts[1].title);
|
|
190
204
|
feedbackDrawerDom.classList.add(btnDisableClass[1]);
|
|
191
205
|
if (_error) {
|
|
192
|
-
feedbackDrawerDom.innerHTML = feedbackTxts[0];
|
|
206
|
+
feedbackDrawerDom.innerHTML = opts.getLocale(feedbackTxts[0].code, feedbackTxts[0].title);
|
|
193
207
|
feedbackDrawerDom.classList.remove(btnDisableClass[1]);
|
|
194
208
|
}
|
|
195
209
|
}
|
|
@@ -232,9 +246,9 @@ var ErrorMsg = {
|
|
|
232
246
|
}(), 400);
|
|
233
247
|
renderTxt = function renderTxt(_state) {
|
|
234
248
|
if (_state) {
|
|
235
|
-
return _state === loadingStates[0] ? feedbackTxts[2] : feedbackTxts[1];
|
|
249
|
+
return _state === loadingStates[0] ? opts.getLocale(feedbackTxts[2].code, feedbackTxts[2].title) : opts.getLocale(feedbackTxts[1].code, feedbackTxts[1].title);
|
|
236
250
|
}
|
|
237
|
-
return feedbackTxts[0];
|
|
251
|
+
return opts.getLocale(feedbackTxts[0].code, feedbackTxts[0].title);
|
|
238
252
|
};
|
|
239
253
|
renderDisabled = function renderDisabled(flag, _key) {
|
|
240
254
|
if (_param.feedbackState) {
|
|
@@ -260,7 +274,7 @@ var ErrorMsg = {
|
|
|
260
274
|
handleFeeback(feedbackPlacements[0], getKey);
|
|
261
275
|
}
|
|
262
276
|
}
|
|
263
|
-
}, mapFeebackTxt[_param === null || _param === void 0 ? void 0 : _param.feedbackState] || feedbackTxts[0]));
|
|
277
|
+
}, mapFeebackTxt[_param === null || _param === void 0 ? void 0 : _param.feedbackState] || opts.getLocale(feedbackTxts[0].code, feedbackTxts[0].title)));
|
|
264
278
|
}
|
|
265
279
|
if (opts.extendFooter) {
|
|
266
280
|
if (typeof opts.footer === 'function') {
|
|
@@ -273,7 +287,7 @@ var ErrorMsg = {
|
|
|
273
287
|
footerContent.push( /*#__PURE__*/React.createElement("a", {
|
|
274
288
|
onClick: /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
275
289
|
var _detRes;
|
|
276
|
-
var detRes, url, errMsg, renderSubTitle;
|
|
290
|
+
var detRes, article, url, errMsg, renderSubTitle;
|
|
277
291
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
278
292
|
while (1) {
|
|
279
293
|
switch (_context2.prev = _context2.next) {
|
|
@@ -286,18 +300,19 @@ var ErrorMsg = {
|
|
|
286
300
|
extend: resolve === null || resolve === void 0 ? void 0 : resolve.extend
|
|
287
301
|
};
|
|
288
302
|
}
|
|
289
|
-
|
|
290
|
-
|
|
303
|
+
article = opts.getArticle(msg.code, opts.getLocale);
|
|
304
|
+
if (!article) {
|
|
305
|
+
_context2.next = 7;
|
|
291
306
|
break;
|
|
292
307
|
}
|
|
293
308
|
// 网络异常无法获取解决方案,使用内置的
|
|
294
309
|
detRes = {
|
|
295
|
-
article:
|
|
310
|
+
article: article,
|
|
296
311
|
extend: []
|
|
297
312
|
};
|
|
298
|
-
_context2.next =
|
|
313
|
+
_context2.next = 22;
|
|
299
314
|
break;
|
|
300
|
-
case
|
|
315
|
+
case 7:
|
|
301
316
|
// 请求后端获取解决方案
|
|
302
317
|
|
|
303
318
|
if (typeof resolve === 'string') {
|
|
@@ -306,58 +321,59 @@ var ErrorMsg = {
|
|
|
306
321
|
url = resolve.href;
|
|
307
322
|
}
|
|
308
323
|
if (!url) {
|
|
309
|
-
_context2.next =
|
|
324
|
+
_context2.next = 21;
|
|
310
325
|
break;
|
|
311
326
|
}
|
|
312
|
-
_context2.prev =
|
|
313
|
-
_context2.next =
|
|
327
|
+
_context2.prev = 9;
|
|
328
|
+
_context2.next = 12;
|
|
314
329
|
return http.get(url, {
|
|
315
330
|
params: {
|
|
316
331
|
errorCode: msg === null || msg === void 0 ? void 0 : msg.code,
|
|
317
332
|
errorMsg: msg === null || msg === void 0 ? void 0 : msg.msg
|
|
318
333
|
}
|
|
319
334
|
});
|
|
320
|
-
case
|
|
335
|
+
case 12:
|
|
321
336
|
errMsg = _context2.sent;
|
|
322
337
|
detRes = {
|
|
323
338
|
article: errMsg === null || errMsg === void 0 ? void 0 : errMsg.guidance,
|
|
324
339
|
extend: errMsg === null || errMsg === void 0 ? void 0 : errMsg.errorInfos
|
|
325
340
|
};
|
|
326
|
-
_context2.next =
|
|
341
|
+
_context2.next = 19;
|
|
327
342
|
break;
|
|
328
|
-
case
|
|
329
|
-
_context2.prev =
|
|
330
|
-
_context2.t0 = _context2["catch"](
|
|
343
|
+
case 16:
|
|
344
|
+
_context2.prev = 16;
|
|
345
|
+
_context2.t0 = _context2["catch"](9);
|
|
331
346
|
// eslint-disable-next-line no-console
|
|
332
347
|
console.error(new Error("ErrorMsg\u7EC4\u4EF6: \u83B7\u53D6\u89E3\u51B3\u65B9\u6848\u5931\u8D25\uFF0C".concat(_context2.t0)));
|
|
333
|
-
case
|
|
334
|
-
_context2.next =
|
|
348
|
+
case 19:
|
|
349
|
+
_context2.next = 22;
|
|
335
350
|
break;
|
|
336
|
-
case
|
|
351
|
+
case 21:
|
|
337
352
|
// eslint-disable-next-line no-console
|
|
338
353
|
console.error(new Error('ErrorMsg组件: 无效resolve'));
|
|
339
|
-
case
|
|
354
|
+
case 22:
|
|
340
355
|
renderSubTitle = function renderSubTitle() {
|
|
341
356
|
if (target.type === targetTypes[0] && (target === null || target === void 0 ? void 0 : target.id)) {
|
|
342
|
-
return "\
|
|
357
|
+
return "".concat(getLocale('serviceURL', '服务地址'), "\uFF1A").concat(target === null || target === void 0 ? void 0 : target.id);
|
|
343
358
|
}
|
|
344
359
|
return null;
|
|
345
360
|
};
|
|
346
361
|
drawerHandel.open({
|
|
347
|
-
|
|
362
|
+
getLocale: opts.getLocale,
|
|
363
|
+
title: "".concat(renderTitle(msg, opts), "(").concat((msg === null || msg === void 0 ? void 0 : msg.code) || '', ")"),
|
|
348
364
|
status: 'error',
|
|
349
365
|
mode: 'errorInfo',
|
|
350
366
|
content: /*#__PURE__*/React.createElement(React.Fragment, null, (msg === null || msg === void 0 ? void 0 : msg.msg) ? /*#__PURE__*/React.createElement(React.Fragment, null, msg.msg, /*#__PURE__*/React.createElement("br", null)) : '', msg === null || msg === void 0 ? void 0 : msg.stack),
|
|
351
367
|
errorInfoProps: {
|
|
352
368
|
tabs: [{
|
|
353
369
|
key: 'article',
|
|
354
|
-
tab: '解决方案'
|
|
370
|
+
tab: opts.getLocale('ErrorMsg.solution', '解决方案')
|
|
355
371
|
}, {
|
|
356
372
|
key: 'extend',
|
|
357
|
-
tab: '错误信息匹配'
|
|
373
|
+
tab: opts.getLocale('ErrorMsg.errorMsgMatch', '错误信息匹配')
|
|
358
374
|
}],
|
|
359
375
|
tabsActiveKey: 'article',
|
|
360
|
-
tabsContent: renderGuidance((_detRes = detRes) === null || _detRes === void 0 ? void 0 : _detRes.article),
|
|
376
|
+
tabsContent: renderGuidance((_detRes = detRes) === null || _detRes === void 0 ? void 0 : _detRes.article, opts),
|
|
361
377
|
onTabsChange: function onTabsChange(record) {
|
|
362
378
|
var _detRes2, _detRes3;
|
|
363
379
|
switch (record === null || record === void 0 ? void 0 : record.key) {
|
|
@@ -365,7 +381,7 @@ var ErrorMsg = {
|
|
|
365
381
|
record.update({
|
|
366
382
|
errorInfoProps: {
|
|
367
383
|
tabsActiveKey: record === null || record === void 0 ? void 0 : record.key,
|
|
368
|
-
tabsContent: renderGuidance((_detRes2 = detRes) === null || _detRes2 === void 0 ? void 0 : _detRes2.article)
|
|
384
|
+
tabsContent: renderGuidance((_detRes2 = detRes) === null || _detRes2 === void 0 ? void 0 : _detRes2.article, opts)
|
|
369
385
|
}
|
|
370
386
|
});
|
|
371
387
|
break;
|
|
@@ -388,7 +404,7 @@ var ErrorMsg = {
|
|
|
388
404
|
onClick: function onClick() {
|
|
389
405
|
drawerHandel.close();
|
|
390
406
|
}
|
|
391
|
-
},
|
|
407
|
+
}, opts.cancelText), /*#__PURE__*/React.createElement("a", {
|
|
392
408
|
className: "lx-drawer-btn lx-drawer-btn-primary ".concat(renderDisabled(feedbackPlacements[1], _param.itemKey)),
|
|
393
409
|
id: "lx-feedback-drawer-".concat(_param.itemKey),
|
|
394
410
|
config: _param.itemKey,
|
|
@@ -401,14 +417,14 @@ var ErrorMsg = {
|
|
|
401
417
|
}
|
|
402
418
|
}, renderTxt(_param.feedbackState))) : null
|
|
403
419
|
});
|
|
404
|
-
case
|
|
420
|
+
case 24:
|
|
405
421
|
case "end":
|
|
406
422
|
return _context2.stop();
|
|
407
423
|
}
|
|
408
424
|
}
|
|
409
|
-
}, _callee2, null, [[
|
|
425
|
+
}, _callee2, null, [[9, 16]]);
|
|
410
426
|
}))
|
|
411
|
-
},
|
|
427
|
+
}, opts.okText));
|
|
412
428
|
}
|
|
413
429
|
return _context3.abrupt("return", footerContent);
|
|
414
430
|
case 29:
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { resolveRequestPath } from '../compUtils';
|
|
2
|
+
import { errTypeTitMap, getArticle } from '../const';
|
|
2
3
|
export var defaultGlobalConfig = {
|
|
3
4
|
duration: 3500,
|
|
4
5
|
maxLine: null,
|
|
@@ -14,9 +15,16 @@ export var defaultGlobalConfig = {
|
|
|
14
15
|
erorrListShowType: 'innerWindow',
|
|
15
16
|
// 'innerWindow' , 'openDrawer'
|
|
16
17
|
resolve: process.env.LingXi_ERROR_RESOLVE || resolveRequestPath('/lcdp/error/queryErrorInfoByCodeOrMsg'),
|
|
17
|
-
feebackAction: false
|
|
18
|
+
feebackAction: false,
|
|
19
|
+
// 故障上报地址,默认不展示故障上报
|
|
20
|
+
okText: '异常帮助',
|
|
21
|
+
cancelText: '取消',
|
|
22
|
+
getLocale: function getLocale(k, p) {
|
|
23
|
+
return p !== null && p !== void 0 ? p : '';
|
|
24
|
+
},
|
|
25
|
+
errTypeTitMap: errTypeTitMap,
|
|
26
|
+
getArticle: getArticle
|
|
18
27
|
};
|
|
19
|
-
|
|
20
28
|
export var setGlobalConfig = function setGlobalConfig() {
|
|
21
29
|
var config = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
22
30
|
Object.assign(defaultGlobalConfig, config);
|