ls-pro-common 3.0.83 → 3.0.84
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 +8 -0
- package/dist/common.js +1 -1
- package/dist/common.min.css +8 -0
- package/dist/common.min.js +1 -1
- package/es/http/index.js +14 -11
- package/lib/http/index.js +14 -11
- package/package.json +1 -1
package/es/http/index.js
CHANGED
|
@@ -64,7 +64,7 @@ request.interceptors.request.use(function (url, options) {
|
|
|
64
64
|
request.interceptors.response.use( /*#__PURE__*/function () {
|
|
65
65
|
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(response, options) {
|
|
66
66
|
var _navigator, _navigator$userAgent;
|
|
67
|
-
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;
|
|
67
|
+
var noMsg, userAgent, isMobile, _data$flag, _data$flag2, _data$flag3, data, retCode, retMsg, faultCode, text, _text, _text2, _data$flag4, _data$flag5, _data$flag6, _data$flag7, _data, _retCode, _retMsg, status, requestId, _faultCode;
|
|
68
68
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
69
69
|
while (1) switch (_context.prev = _context.next) {
|
|
70
70
|
case 0:
|
|
@@ -83,7 +83,7 @@ request.interceptors.response.use( /*#__PURE__*/function () {
|
|
|
83
83
|
retCode = (_data$flag = data.flag) === null || _data$flag === void 0 ? void 0 : _data$flag.retCode;
|
|
84
84
|
retMsg = (_data$flag2 = data.flag) === null || _data$flag2 === void 0 ? void 0 : _data$flag2.retMsg;
|
|
85
85
|
faultCode = (_data$flag3 = data.flag) === null || _data$flag3 === void 0 ? void 0 : _data$flag3.faultCode;
|
|
86
|
-
if ((retCode === 'timeout' || retCode === '4011') && !isMobile) {
|
|
86
|
+
if ((retCode === 'timeout' || retCode === '4011' || retCode === '4013') && !isMobile) {
|
|
87
87
|
if (!getCookie('token')) {
|
|
88
88
|
(window.top || window).location.href = location.pathname === '/' ? '/login' : '/login?redirect=' + encodeURIComponent(location.href);
|
|
89
89
|
} else {
|
|
@@ -91,15 +91,18 @@ request.interceptors.response.use( /*#__PURE__*/function () {
|
|
|
91
91
|
}
|
|
92
92
|
} else if (noMsg !== '1') {
|
|
93
93
|
if (faultCode) {
|
|
94
|
-
|
|
94
|
+
if (retCode === '4012') {
|
|
95
|
+
text = '用户已禁用,无权限进行操作';
|
|
96
|
+
}
|
|
97
|
+
httpError(text || retMsg, retCode, faultCode, options.url);
|
|
95
98
|
} else {
|
|
96
|
-
|
|
99
|
+
_text = httpStatus[response.status];
|
|
97
100
|
if (response.status === 503 && response.statusText === 'no healthy upstream') {
|
|
98
|
-
|
|
101
|
+
_text = '请求的服务未启动';
|
|
99
102
|
} else if (response.status === 503 && response.statusText === 'reached concurrency limit') {
|
|
100
|
-
|
|
103
|
+
_text = '请求的服务被限流';
|
|
101
104
|
}
|
|
102
|
-
showError(
|
|
105
|
+
showError(_text || retMsg);
|
|
103
106
|
}
|
|
104
107
|
}
|
|
105
108
|
_context.next = 19;
|
|
@@ -107,13 +110,13 @@ request.interceptors.response.use( /*#__PURE__*/function () {
|
|
|
107
110
|
case 14:
|
|
108
111
|
_context.prev = 14;
|
|
109
112
|
_context.t0 = _context["catch"](4);
|
|
110
|
-
|
|
113
|
+
_text2 = httpStatus[response.status];
|
|
111
114
|
if (response.status === 503 && response.statusText === 'no healthy upstream') {
|
|
112
|
-
|
|
115
|
+
_text2 = '请求的服务未启动';
|
|
113
116
|
} else if (response.status === 503 && response.statusText === 'reached concurrency limit') {
|
|
114
|
-
|
|
117
|
+
_text2 = '请求的服务被限流';
|
|
115
118
|
}
|
|
116
|
-
showError(
|
|
119
|
+
showError(_text2 || _context.t0.message || response.statusText);
|
|
117
120
|
case 19:
|
|
118
121
|
_context.next = 31;
|
|
119
122
|
break;
|
package/lib/http/index.js
CHANGED
|
@@ -64,7 +64,7 @@ request.interceptors.request.use(function (url, options) {
|
|
|
64
64
|
request.interceptors.response.use( /*#__PURE__*/function () {
|
|
65
65
|
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(response, options) {
|
|
66
66
|
var _navigator, _navigator$userAgent;
|
|
67
|
-
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;
|
|
67
|
+
var noMsg, userAgent, isMobile, _data$flag, _data$flag2, _data$flag3, data, retCode, retMsg, faultCode, text, _text, _text2, _data$flag4, _data$flag5, _data$flag6, _data$flag7, _data, _retCode, _retMsg, status, requestId, _faultCode;
|
|
68
68
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
69
69
|
while (1) switch (_context.prev = _context.next) {
|
|
70
70
|
case 0:
|
|
@@ -83,7 +83,7 @@ request.interceptors.response.use( /*#__PURE__*/function () {
|
|
|
83
83
|
retCode = (_data$flag = data.flag) === null || _data$flag === void 0 ? void 0 : _data$flag.retCode;
|
|
84
84
|
retMsg = (_data$flag2 = data.flag) === null || _data$flag2 === void 0 ? void 0 : _data$flag2.retMsg;
|
|
85
85
|
faultCode = (_data$flag3 = data.flag) === null || _data$flag3 === void 0 ? void 0 : _data$flag3.faultCode;
|
|
86
|
-
if ((retCode === 'timeout' || retCode === '4011') && !isMobile) {
|
|
86
|
+
if ((retCode === 'timeout' || retCode === '4011' || retCode === '4013') && !isMobile) {
|
|
87
87
|
if (!getCookie('token')) {
|
|
88
88
|
(window.top || window).location.href = location.pathname === '/' ? '/login' : '/login?redirect=' + encodeURIComponent(location.href);
|
|
89
89
|
} else {
|
|
@@ -91,15 +91,18 @@ request.interceptors.response.use( /*#__PURE__*/function () {
|
|
|
91
91
|
}
|
|
92
92
|
} else if (noMsg !== '1') {
|
|
93
93
|
if (faultCode) {
|
|
94
|
-
|
|
94
|
+
if (retCode === '4012') {
|
|
95
|
+
text = '用户已禁用,无权限进行操作';
|
|
96
|
+
}
|
|
97
|
+
httpError(text || retMsg, retCode, faultCode, options.url);
|
|
95
98
|
} else {
|
|
96
|
-
|
|
99
|
+
_text = httpStatus[response.status];
|
|
97
100
|
if (response.status === 503 && response.statusText === 'no healthy upstream') {
|
|
98
|
-
|
|
101
|
+
_text = '请求的服务未启动';
|
|
99
102
|
} else if (response.status === 503 && response.statusText === 'reached concurrency limit') {
|
|
100
|
-
|
|
103
|
+
_text = '请求的服务被限流';
|
|
101
104
|
}
|
|
102
|
-
showError(
|
|
105
|
+
showError(_text || retMsg);
|
|
103
106
|
}
|
|
104
107
|
}
|
|
105
108
|
_context.next = 19;
|
|
@@ -107,13 +110,13 @@ request.interceptors.response.use( /*#__PURE__*/function () {
|
|
|
107
110
|
case 14:
|
|
108
111
|
_context.prev = 14;
|
|
109
112
|
_context.t0 = _context["catch"](4);
|
|
110
|
-
|
|
113
|
+
_text2 = httpStatus[response.status];
|
|
111
114
|
if (response.status === 503 && response.statusText === 'no healthy upstream') {
|
|
112
|
-
|
|
115
|
+
_text2 = '请求的服务未启动';
|
|
113
116
|
} else if (response.status === 503 && response.statusText === 'reached concurrency limit') {
|
|
114
|
-
|
|
117
|
+
_text2 = '请求的服务被限流';
|
|
115
118
|
}
|
|
116
|
-
showError(
|
|
119
|
+
showError(_text2 || _context.t0.message || response.statusText);
|
|
117
120
|
case 19:
|
|
118
121
|
_context.next = 31;
|
|
119
122
|
break;
|