ls-pro-common 3.0.45 → 3.0.47
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/dist/common.css +55 -3
- package/dist/common.js +1 -1
- package/dist/common.min.css +55 -3
- package/dist/common.min.js +1 -1
- package/es/components/antd-custom.less +4 -0
- package/es/components/common.less +2 -4
- package/es/http/index.js +29 -27
- package/lib/components/antd-custom.less +4 -0
- package/lib/components/common.less +2 -4
- package/lib/http/index.js +29 -27
- package/package.json +2 -2
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
body {
|
|
2
2
|
|
|
3
3
|
--bg-color: #F9FAFB;
|
|
4
|
-
|
|
5
|
-
|
|
6
4
|
--ant-primary-color: #1869ED;
|
|
7
5
|
--ant-primary-color-hover: #418efa;
|
|
8
6
|
--ant-primary-color-active: #0a4cc7;
|
|
@@ -47,11 +45,11 @@ body {
|
|
|
47
45
|
}
|
|
48
46
|
|
|
49
47
|
* ::-webkit-scrollbar-thumb {
|
|
50
|
-
background-color: #
|
|
48
|
+
background-color: #bdbcbc;
|
|
51
49
|
border-radius: 6px;
|
|
52
50
|
|
|
53
51
|
&:hover {
|
|
54
|
-
background-color: #
|
|
52
|
+
background-color: #908f8f;
|
|
55
53
|
border-radius: 6px;
|
|
56
54
|
}
|
|
57
55
|
}
|
package/es/http/index.js
CHANGED
|
@@ -57,25 +57,27 @@ request.interceptors.request.use(function (url, options) {
|
|
|
57
57
|
/** 请求返回拦截器,统一处理业务异常 */
|
|
58
58
|
request.interceptors.response.use( /*#__PURE__*/function () {
|
|
59
59
|
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(response, options) {
|
|
60
|
-
var
|
|
60
|
+
var _navigator, _navigator$userAgent;
|
|
61
|
+
var noMsg, userAgent, isMobile, _data$flag, _data$flag2, _data$flag3, data, retCode, retMsg, faultCode, text, _text, _data$flag4, _data$flag5, _data$flag6, _data$flag7, _data, _retCode, _retMsg, status, requestId, _faultCode;
|
|
61
62
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
62
63
|
while (1) switch (_context.prev = _context.next) {
|
|
63
64
|
case 0:
|
|
64
|
-
noMsg = getUrlQuery('noMsg', options.url);
|
|
65
|
+
noMsg = getUrlQuery('noMsg', options.url);
|
|
66
|
+
userAgent = (_navigator = navigator) === null || _navigator === void 0 ? void 0 : (_navigator$userAgent = _navigator.userAgent) === null || _navigator$userAgent === void 0 ? void 0 : _navigator$userAgent.toLowerCase();
|
|
67
|
+
isMobile = /mobile/i.test(userAgent); // http 状态码错误
|
|
65
68
|
if (!(response.status < 200 || response.status >= 300)) {
|
|
66
|
-
_context.next =
|
|
69
|
+
_context.next = 21;
|
|
67
70
|
break;
|
|
68
71
|
}
|
|
69
|
-
_context.prev =
|
|
70
|
-
_context.next =
|
|
72
|
+
_context.prev = 4;
|
|
73
|
+
_context.next = 7;
|
|
71
74
|
return response.clone().json();
|
|
72
|
-
case
|
|
75
|
+
case 7:
|
|
73
76
|
data = _context.sent;
|
|
74
77
|
retCode = (_data$flag = data.flag) === null || _data$flag === void 0 ? void 0 : _data$flag.retCode;
|
|
75
78
|
retMsg = (_data$flag2 = data.flag) === null || _data$flag2 === void 0 ? void 0 : _data$flag2.retMsg;
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
if (retCode === 'timeout' || retCode === '4011') {
|
|
79
|
+
faultCode = (_data$flag3 = data.flag) === null || _data$flag3 === void 0 ? void 0 : _data$flag3.faultCode;
|
|
80
|
+
if ((retCode === 'timeout' || retCode === '4011') && !isMobile) {
|
|
79
81
|
if (!getCookie("token")) {
|
|
80
82
|
(window.top || window).location.href = location.pathname === '/' ? '/login' : '/login?redirect=' + encodeURIComponent(location.href);
|
|
81
83
|
} else {
|
|
@@ -94,11 +96,11 @@ request.interceptors.response.use( /*#__PURE__*/function () {
|
|
|
94
96
|
showError(text || retMsg);
|
|
95
97
|
}
|
|
96
98
|
}
|
|
97
|
-
_context.next =
|
|
99
|
+
_context.next = 19;
|
|
98
100
|
break;
|
|
99
|
-
case
|
|
100
|
-
_context.prev =
|
|
101
|
-
_context.t0 = _context["catch"](
|
|
101
|
+
case 14:
|
|
102
|
+
_context.prev = 14;
|
|
103
|
+
_context.t0 = _context["catch"](4);
|
|
102
104
|
_text = httpStatus[response.status];
|
|
103
105
|
if (response.status === 503 && response.statusText === 'no healthy upstream') {
|
|
104
106
|
_text = '请求的服务未启动';
|
|
@@ -106,25 +108,25 @@ request.interceptors.response.use( /*#__PURE__*/function () {
|
|
|
106
108
|
_text = '请求的服务被限流';
|
|
107
109
|
}
|
|
108
110
|
showError(_text || _context.t0.message || response.statusText);
|
|
109
|
-
case
|
|
110
|
-
_context.next =
|
|
111
|
+
case 19:
|
|
112
|
+
_context.next = 31;
|
|
111
113
|
break;
|
|
112
|
-
case
|
|
114
|
+
case 21:
|
|
113
115
|
if (!(noMsg !== '1')) {
|
|
114
|
-
_context.next =
|
|
116
|
+
_context.next = 31;
|
|
115
117
|
break;
|
|
116
118
|
}
|
|
117
|
-
_context.next =
|
|
119
|
+
_context.next = 24;
|
|
118
120
|
return response.clone().json();
|
|
119
|
-
case
|
|
121
|
+
case 24:
|
|
120
122
|
_data = _context.sent;
|
|
121
|
-
_retCode = (_data === null || _data === void 0 ? void 0 : (_data$
|
|
122
|
-
_retMsg = ((_data$
|
|
123
|
+
_retCode = (_data === null || _data === void 0 ? void 0 : (_data$flag4 = _data.flag) === null || _data$flag4 === void 0 ? void 0 : _data$flag4.retCode) || '0';
|
|
124
|
+
_retMsg = ((_data$flag5 = _data.flag) === null || _data$flag5 === void 0 ? void 0 : _data$flag5.retMsg) || '请求的服务出错';
|
|
123
125
|
status = (getUrlQuery('apiStatus') || '0').split(',');
|
|
124
|
-
|
|
125
|
-
_faultCode = (_data$
|
|
126
|
+
requestId = (_data$flag6 = _data.flag) === null || _data$flag6 === void 0 ? void 0 : _data$flag6.requestId;
|
|
127
|
+
_faultCode = (_data$flag7 = _data.flag) === null || _data$flag7 === void 0 ? void 0 : _data$flag7.faultCode;
|
|
126
128
|
if (_retCode && !status.includes(_retCode)) {
|
|
127
|
-
if (_retCode === 'timeout' || _retCode === '4011') {
|
|
129
|
+
if ((_retCode === 'timeout' || _retCode === '4011') && !isMobile) {
|
|
128
130
|
if (!getCookie("token")) {
|
|
129
131
|
(window.top || window).location.href = location.pathname === '/' ? '/login' : '/login?redirect=' + encodeURIComponent(location.href);
|
|
130
132
|
} else {
|
|
@@ -138,13 +140,13 @@ request.interceptors.response.use( /*#__PURE__*/function () {
|
|
|
138
140
|
}
|
|
139
141
|
}
|
|
140
142
|
}
|
|
141
|
-
case 30:
|
|
142
|
-
return _context.abrupt("return", response);
|
|
143
143
|
case 31:
|
|
144
|
+
return _context.abrupt("return", response);
|
|
145
|
+
case 32:
|
|
144
146
|
case "end":
|
|
145
147
|
return _context.stop();
|
|
146
148
|
}
|
|
147
|
-
}, _callee, null, [[
|
|
149
|
+
}, _callee, null, [[4, 14]]);
|
|
148
150
|
}));
|
|
149
151
|
return function (_x, _x2) {
|
|
150
152
|
return _ref.apply(this, arguments);
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
body {
|
|
2
2
|
|
|
3
3
|
--bg-color: #F9FAFB;
|
|
4
|
-
|
|
5
|
-
|
|
6
4
|
--ant-primary-color: #1869ED;
|
|
7
5
|
--ant-primary-color-hover: #418efa;
|
|
8
6
|
--ant-primary-color-active: #0a4cc7;
|
|
@@ -47,11 +45,11 @@ body {
|
|
|
47
45
|
}
|
|
48
46
|
|
|
49
47
|
* ::-webkit-scrollbar-thumb {
|
|
50
|
-
background-color: #
|
|
48
|
+
background-color: #bdbcbc;
|
|
51
49
|
border-radius: 6px;
|
|
52
50
|
|
|
53
51
|
&:hover {
|
|
54
|
-
background-color: #
|
|
52
|
+
background-color: #908f8f;
|
|
55
53
|
border-radius: 6px;
|
|
56
54
|
}
|
|
57
55
|
}
|
package/lib/http/index.js
CHANGED
|
@@ -57,25 +57,27 @@ request.interceptors.request.use(function (url, options) {
|
|
|
57
57
|
/** 请求返回拦截器,统一处理业务异常 */
|
|
58
58
|
request.interceptors.response.use( /*#__PURE__*/function () {
|
|
59
59
|
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(response, options) {
|
|
60
|
-
var
|
|
60
|
+
var _navigator, _navigator$userAgent;
|
|
61
|
+
var noMsg, userAgent, isMobile, _data$flag, _data$flag2, _data$flag3, data, retCode, retMsg, faultCode, text, _text, _data$flag4, _data$flag5, _data$flag6, _data$flag7, _data, _retCode, _retMsg, status, requestId, _faultCode;
|
|
61
62
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
62
63
|
while (1) switch (_context.prev = _context.next) {
|
|
63
64
|
case 0:
|
|
64
|
-
noMsg = getUrlQuery('noMsg', options.url);
|
|
65
|
+
noMsg = getUrlQuery('noMsg', options.url);
|
|
66
|
+
userAgent = (_navigator = navigator) === null || _navigator === void 0 ? void 0 : (_navigator$userAgent = _navigator.userAgent) === null || _navigator$userAgent === void 0 ? void 0 : _navigator$userAgent.toLowerCase();
|
|
67
|
+
isMobile = /mobile/i.test(userAgent); // http 状态码错误
|
|
65
68
|
if (!(response.status < 200 || response.status >= 300)) {
|
|
66
|
-
_context.next =
|
|
69
|
+
_context.next = 21;
|
|
67
70
|
break;
|
|
68
71
|
}
|
|
69
|
-
_context.prev =
|
|
70
|
-
_context.next =
|
|
72
|
+
_context.prev = 4;
|
|
73
|
+
_context.next = 7;
|
|
71
74
|
return response.clone().json();
|
|
72
|
-
case
|
|
75
|
+
case 7:
|
|
73
76
|
data = _context.sent;
|
|
74
77
|
retCode = (_data$flag = data.flag) === null || _data$flag === void 0 ? void 0 : _data$flag.retCode;
|
|
75
78
|
retMsg = (_data$flag2 = data.flag) === null || _data$flag2 === void 0 ? void 0 : _data$flag2.retMsg;
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
if (retCode === 'timeout' || retCode === '4011') {
|
|
79
|
+
faultCode = (_data$flag3 = data.flag) === null || _data$flag3 === void 0 ? void 0 : _data$flag3.faultCode;
|
|
80
|
+
if ((retCode === 'timeout' || retCode === '4011') && !isMobile) {
|
|
79
81
|
if (!getCookie("token")) {
|
|
80
82
|
(window.top || window).location.href = location.pathname === '/' ? '/login' : '/login?redirect=' + encodeURIComponent(location.href);
|
|
81
83
|
} else {
|
|
@@ -94,11 +96,11 @@ request.interceptors.response.use( /*#__PURE__*/function () {
|
|
|
94
96
|
showError(text || retMsg);
|
|
95
97
|
}
|
|
96
98
|
}
|
|
97
|
-
_context.next =
|
|
99
|
+
_context.next = 19;
|
|
98
100
|
break;
|
|
99
|
-
case
|
|
100
|
-
_context.prev =
|
|
101
|
-
_context.t0 = _context["catch"](
|
|
101
|
+
case 14:
|
|
102
|
+
_context.prev = 14;
|
|
103
|
+
_context.t0 = _context["catch"](4);
|
|
102
104
|
_text = httpStatus[response.status];
|
|
103
105
|
if (response.status === 503 && response.statusText === 'no healthy upstream') {
|
|
104
106
|
_text = '请求的服务未启动';
|
|
@@ -106,25 +108,25 @@ request.interceptors.response.use( /*#__PURE__*/function () {
|
|
|
106
108
|
_text = '请求的服务被限流';
|
|
107
109
|
}
|
|
108
110
|
showError(_text || _context.t0.message || response.statusText);
|
|
109
|
-
case
|
|
110
|
-
_context.next =
|
|
111
|
+
case 19:
|
|
112
|
+
_context.next = 31;
|
|
111
113
|
break;
|
|
112
|
-
case
|
|
114
|
+
case 21:
|
|
113
115
|
if (!(noMsg !== '1')) {
|
|
114
|
-
_context.next =
|
|
116
|
+
_context.next = 31;
|
|
115
117
|
break;
|
|
116
118
|
}
|
|
117
|
-
_context.next =
|
|
119
|
+
_context.next = 24;
|
|
118
120
|
return response.clone().json();
|
|
119
|
-
case
|
|
121
|
+
case 24:
|
|
120
122
|
_data = _context.sent;
|
|
121
|
-
_retCode = (_data === null || _data === void 0 ? void 0 : (_data$
|
|
122
|
-
_retMsg = ((_data$
|
|
123
|
+
_retCode = (_data === null || _data === void 0 ? void 0 : (_data$flag4 = _data.flag) === null || _data$flag4 === void 0 ? void 0 : _data$flag4.retCode) || '0';
|
|
124
|
+
_retMsg = ((_data$flag5 = _data.flag) === null || _data$flag5 === void 0 ? void 0 : _data$flag5.retMsg) || '请求的服务出错';
|
|
123
125
|
status = (getUrlQuery('apiStatus') || '0').split(',');
|
|
124
|
-
|
|
125
|
-
_faultCode = (_data$
|
|
126
|
+
requestId = (_data$flag6 = _data.flag) === null || _data$flag6 === void 0 ? void 0 : _data$flag6.requestId;
|
|
127
|
+
_faultCode = (_data$flag7 = _data.flag) === null || _data$flag7 === void 0 ? void 0 : _data$flag7.faultCode;
|
|
126
128
|
if (_retCode && !status.includes(_retCode)) {
|
|
127
|
-
if (_retCode === 'timeout' || _retCode === '4011') {
|
|
129
|
+
if ((_retCode === 'timeout' || _retCode === '4011') && !isMobile) {
|
|
128
130
|
if (!getCookie("token")) {
|
|
129
131
|
(window.top || window).location.href = location.pathname === '/' ? '/login' : '/login?redirect=' + encodeURIComponent(location.href);
|
|
130
132
|
} else {
|
|
@@ -138,13 +140,13 @@ request.interceptors.response.use( /*#__PURE__*/function () {
|
|
|
138
140
|
}
|
|
139
141
|
}
|
|
140
142
|
}
|
|
141
|
-
case 30:
|
|
142
|
-
return _context.abrupt("return", response);
|
|
143
143
|
case 31:
|
|
144
|
+
return _context.abrupt("return", response);
|
|
145
|
+
case 32:
|
|
144
146
|
case "end":
|
|
145
147
|
return _context.stop();
|
|
146
148
|
}
|
|
147
|
-
}, _callee, null, [[
|
|
149
|
+
}, _callee, null, [[4, 14]]);
|
|
148
150
|
}));
|
|
149
151
|
return function (_x, _x2) {
|
|
150
152
|
return _ref.apply(this, arguments);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ls-pro-common",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.47",
|
|
4
4
|
"description": "ls-pro-common",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"sideEffects": [
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
],
|
|
22
22
|
"dependencies": {
|
|
23
23
|
"@ant-design/icons": "^4.3.0",
|
|
24
|
-
"ls-pro-table": "^3.0.
|
|
24
|
+
"ls-pro-table": "^3.0.31",
|
|
25
25
|
"ls-pro-form": "^3.0.9",
|
|
26
26
|
"ls-pro-field": "^3.0.6",
|
|
27
27
|
"ls-pro-descriptions": "^3.0.1",
|