ls-pro-common 3.0.83 → 3.0.85
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/hooks/useDtl/index.js +2 -2
- package/es/hooks/useSingle/index.js +2 -2
- package/es/http/index.js +14 -11
- package/es/utils/index.js +5 -0
- package/lib/hooks/useDtl/index.js +2 -2
- package/lib/hooks/useSingle/index.js +2 -2
- package/lib/http/index.js +14 -11
- package/lib/utils/index.js +5 -0
- package/package.json +1 -1
package/es/hooks/useDtl/index.js
CHANGED
|
@@ -9,7 +9,7 @@ import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
|
9
9
|
import React from "react";
|
|
10
10
|
import { useState, useRef, useCallback, useMemo } from 'react';
|
|
11
11
|
import { PlusCircleOutlined, EditOutlined, DeleteOutlined, ImportOutlined, ExportOutlined } from '@ant-design/icons';
|
|
12
|
-
import { showConfirm, showWarn, showError, showSuccess } from '../../utils';
|
|
12
|
+
import { showConfirm, showWarn, showError, showSuccess, downloadFile } from '../../utils';
|
|
13
13
|
import { httpPost } from '../../http';
|
|
14
14
|
import usePermission from '../usePermission';
|
|
15
15
|
import exportProcess from '../../utils/exportProcess';
|
|
@@ -796,7 +796,7 @@ function useDtl(dtlParam) {
|
|
|
796
796
|
_context9.next = 14;
|
|
797
797
|
break;
|
|
798
798
|
}
|
|
799
|
-
|
|
799
|
+
downloadFile(result.data);
|
|
800
800
|
return _context9.abrupt("return", true);
|
|
801
801
|
case 14:
|
|
802
802
|
if (!(((_result$flag6 = result.flag) === null || _result$flag6 === void 0 ? void 0 : _result$flag6.retCode) === '0')) {
|
|
@@ -9,7 +9,7 @@ import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
|
9
9
|
import React from "react";
|
|
10
10
|
import { useState, useRef, useMemo, useCallback } from 'react';
|
|
11
11
|
import { PlusCircleOutlined, EditOutlined, DeleteOutlined, ImportOutlined, ExportOutlined, AuditOutlined } from '@ant-design/icons';
|
|
12
|
-
import { showConfirm, showWarn, showSuccess, showError } from '../../utils';
|
|
12
|
+
import { showConfirm, showWarn, showSuccess, showError, downloadFile } from '../../utils';
|
|
13
13
|
import exportProcess from '../../utils/exportProcess';
|
|
14
14
|
import { httpPost } from '../../http';
|
|
15
15
|
import usePermission from '../usePermission';
|
|
@@ -594,7 +594,7 @@ function useSingle(inParam) {
|
|
|
594
594
|
_context7.next = 14;
|
|
595
595
|
break;
|
|
596
596
|
}
|
|
597
|
-
|
|
597
|
+
downloadFile(result.data);
|
|
598
598
|
return _context7.abrupt("return", true);
|
|
599
599
|
case 14:
|
|
600
600
|
if (!(((_result$flag4 = result.flag) === null || _result$flag4 === void 0 ? void 0 : _result$flag4.retCode) === '0')) {
|
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/es/utils/index.js
CHANGED
|
@@ -900,6 +900,11 @@ export var sleep = function sleep(secord) {
|
|
|
900
900
|
export var downloadFile = function downloadFile(url, fileName) {
|
|
901
901
|
var a = document.createElement('a');
|
|
902
902
|
a.href = url;
|
|
903
|
+
// 如果导出域名有配置,则优先使用导出域名
|
|
904
|
+
var baseExportUrl = getCache('exportUrl') || '';
|
|
905
|
+
if (baseExportUrl && !url.startsWith('http')) {
|
|
906
|
+
a.href = baseExportUrl + url;
|
|
907
|
+
}
|
|
903
908
|
// a.target = '_blank'; // 新开屏有闪烁
|
|
904
909
|
if (fileName) {
|
|
905
910
|
a.setAttribute('download', fileName);
|
|
@@ -9,7 +9,7 @@ import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
|
9
9
|
import React from "react";
|
|
10
10
|
import { useState, useRef, useCallback, useMemo } from 'react';
|
|
11
11
|
import { PlusCircleOutlined, EditOutlined, DeleteOutlined, ImportOutlined, ExportOutlined } from '@ant-design/icons';
|
|
12
|
-
import { showConfirm, showWarn, showError, showSuccess } from '../../utils';
|
|
12
|
+
import { showConfirm, showWarn, showError, showSuccess, downloadFile } from '../../utils';
|
|
13
13
|
import { httpPost } from '../../http';
|
|
14
14
|
import usePermission from '../usePermission';
|
|
15
15
|
import exportProcess from '../../utils/exportProcess';
|
|
@@ -796,7 +796,7 @@ function useDtl(dtlParam) {
|
|
|
796
796
|
_context9.next = 14;
|
|
797
797
|
break;
|
|
798
798
|
}
|
|
799
|
-
|
|
799
|
+
downloadFile(result.data);
|
|
800
800
|
return _context9.abrupt("return", true);
|
|
801
801
|
case 14:
|
|
802
802
|
if (!(((_result$flag6 = result.flag) === null || _result$flag6 === void 0 ? void 0 : _result$flag6.retCode) === '0')) {
|
|
@@ -9,7 +9,7 @@ import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
|
9
9
|
import React from "react";
|
|
10
10
|
import { useState, useRef, useMemo, useCallback } from 'react';
|
|
11
11
|
import { PlusCircleOutlined, EditOutlined, DeleteOutlined, ImportOutlined, ExportOutlined, AuditOutlined } from '@ant-design/icons';
|
|
12
|
-
import { showConfirm, showWarn, showSuccess, showError } from '../../utils';
|
|
12
|
+
import { showConfirm, showWarn, showSuccess, showError, downloadFile } from '../../utils';
|
|
13
13
|
import exportProcess from '../../utils/exportProcess';
|
|
14
14
|
import { httpPost } from '../../http';
|
|
15
15
|
import usePermission from '../usePermission';
|
|
@@ -594,7 +594,7 @@ function useSingle(inParam) {
|
|
|
594
594
|
_context7.next = 14;
|
|
595
595
|
break;
|
|
596
596
|
}
|
|
597
|
-
|
|
597
|
+
downloadFile(result.data);
|
|
598
598
|
return _context7.abrupt("return", true);
|
|
599
599
|
case 14:
|
|
600
600
|
if (!(((_result$flag4 = result.flag) === null || _result$flag4 === void 0 ? void 0 : _result$flag4.retCode) === '0')) {
|
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;
|
package/lib/utils/index.js
CHANGED
|
@@ -900,6 +900,11 @@ export var sleep = function sleep(secord) {
|
|
|
900
900
|
export var downloadFile = function downloadFile(url, fileName) {
|
|
901
901
|
var a = document.createElement('a');
|
|
902
902
|
a.href = url;
|
|
903
|
+
// 如果导出域名有配置,则优先使用导出域名
|
|
904
|
+
var baseExportUrl = getCache('exportUrl') || '';
|
|
905
|
+
if (baseExportUrl && !url.startsWith('http')) {
|
|
906
|
+
a.href = baseExportUrl + url;
|
|
907
|
+
}
|
|
903
908
|
// a.target = '_blank'; // 新开屏有闪烁
|
|
904
909
|
if (fileName) {
|
|
905
910
|
a.setAttribute('download', fileName);
|