ls-pro-common 3.0.82 → 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/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
- httpError(retMsg, retCode, faultCode, options.url);
94
+ if (retCode === '4012') {
95
+ text = '用户已禁用,无权限进行操作';
96
+ }
97
+ httpError(text || retMsg, retCode, faultCode, options.url);
95
98
  } else {
96
- text = httpStatus[response.status];
99
+ _text = httpStatus[response.status];
97
100
  if (response.status === 503 && response.statusText === 'no healthy upstream') {
98
- text = '请求的服务未启动';
101
+ _text = '请求的服务未启动';
99
102
  } else if (response.status === 503 && response.statusText === 'reached concurrency limit') {
100
- text = '请求的服务被限流';
103
+ _text = '请求的服务被限流';
101
104
  }
102
- showError(text || retMsg);
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
- _text = httpStatus[response.status];
113
+ _text2 = httpStatus[response.status];
111
114
  if (response.status === 503 && response.statusText === 'no healthy upstream') {
112
- _text = '请求的服务未启动';
115
+ _text2 = '请求的服务未启动';
113
116
  } else if (response.status === 503 && response.statusText === 'reached concurrency limit') {
114
- _text = '请求的服务被限流';
117
+ _text2 = '请求的服务被限流';
115
118
  }
116
- showError(_text || _context.t0.message || response.statusText);
119
+ showError(_text2 || _context.t0.message || response.statusText);
117
120
  case 19:
118
121
  _context.next = 31;
119
122
  break;
@@ -127,6 +127,7 @@ var exportProcess = function exportProcess(apiResult) {
127
127
  } else {
128
128
  //导出成功
129
129
  if (status === 30 && downloadUrl) {
130
+ loading(100);
130
131
  downloadFile(downloadUrl);
131
132
  } else {
132
133
  //导出失败
@@ -135,7 +136,9 @@ var exportProcess = function exportProcess(apiResult) {
135
136
  type: 'exportError'
136
137
  });
137
138
  }
138
- _notification.close(key);
139
+ sleep(1.5).then(function () {
140
+ _notification.close(key);
141
+ });
139
142
  }
140
143
  }
141
144
  }).catch(function () {
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
- httpError(retMsg, retCode, faultCode, options.url);
94
+ if (retCode === '4012') {
95
+ text = '用户已禁用,无权限进行操作';
96
+ }
97
+ httpError(text || retMsg, retCode, faultCode, options.url);
95
98
  } else {
96
- text = httpStatus[response.status];
99
+ _text = httpStatus[response.status];
97
100
  if (response.status === 503 && response.statusText === 'no healthy upstream') {
98
- text = '请求的服务未启动';
101
+ _text = '请求的服务未启动';
99
102
  } else if (response.status === 503 && response.statusText === 'reached concurrency limit') {
100
- text = '请求的服务被限流';
103
+ _text = '请求的服务被限流';
101
104
  }
102
- showError(text || retMsg);
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
- _text = httpStatus[response.status];
113
+ _text2 = httpStatus[response.status];
111
114
  if (response.status === 503 && response.statusText === 'no healthy upstream') {
112
- _text = '请求的服务未启动';
115
+ _text2 = '请求的服务未启动';
113
116
  } else if (response.status === 503 && response.statusText === 'reached concurrency limit') {
114
- _text = '请求的服务被限流';
117
+ _text2 = '请求的服务被限流';
115
118
  }
116
- showError(_text || _context.t0.message || response.statusText);
119
+ showError(_text2 || _context.t0.message || response.statusText);
117
120
  case 19:
118
121
  _context.next = 31;
119
122
  break;
@@ -127,6 +127,7 @@ var exportProcess = function exportProcess(apiResult) {
127
127
  } else {
128
128
  //导出成功
129
129
  if (status === 30 && downloadUrl) {
130
+ loading(100);
130
131
  downloadFile(downloadUrl);
131
132
  } else {
132
133
  //导出失败
@@ -135,7 +136,9 @@ var exportProcess = function exportProcess(apiResult) {
135
136
  type: 'exportError'
136
137
  });
137
138
  }
138
- _notification.close(key);
139
+ sleep(1.5).then(function () {
140
+ _notification.close(key);
141
+ });
139
142
  }
140
143
  }
141
144
  }).catch(function () {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ls-pro-common",
3
- "version": "3.0.82",
3
+ "version": "3.0.84",
4
4
  "description": "ls-pro-common",
5
5
  "license": "MIT",
6
6
  "sideEffects": [