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