ls-pro-common 3.1.42 → 3.1.44

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.
@@ -29,7 +29,7 @@ var ViewDocment = function ViewDocment(props) {
29
29
  setVisible = _useState2[1];
30
30
  var src = useMemo(function () {
31
31
  var token = getCookie('token');
32
- var filename = getUrlQuery(url, 'fileName'); //文件名,上传的文件名为xxx?fileName=xxx.pdf
32
+ var filename = getUrlQuery('fileName', url); //文件名,上传的文件名为xxx?fileName=xxx.pdf
33
33
  if (!filename) {
34
34
  //外部文件比如,xxx/ddd.docx,兜底直接给个临时的,但好像有问题,因为后端不知道文件类型
35
35
  filename = url.split('/').pop() || Date.now().toString(32);
@@ -42,10 +42,11 @@ var ViewDocment = function ViewDocment(props) {
42
42
  href = href + (href.includes('?') ? '&' : '?') + 'fullfilename=' + filename;
43
43
  }
44
44
  var doc = base64Encode(href);
45
+ var exportUrl = getCache('exportUrl');
45
46
  // 如果是生产环境,走下载域名,其它环境走原来域名
46
47
  var domain = '';
47
- if (location.href.includes('.cloud/') && getCache('exportUrl')) {
48
- domain = getCache('exportUrl');
48
+ if (exportUrl && exportUrl.includes('//')) {
49
+ domain = exportUrl;
49
50
  }
50
51
  return domain + '/lesoon/lesoon-kkfileview-api/onlinePreview?url=' + doc;
51
52
  }, [url]);
package/es/http/index.js CHANGED
@@ -154,7 +154,7 @@ request.interceptors.response.use( /*#__PURE__*/function () {
154
154
  ifExpireWarn = true;
155
155
  setCache('expireWarnFlag', '1', true);
156
156
  case 18:
157
- if ((retCode === 'timeout' || retCode === '4011' || retCode === '4013') && !isMobile) {
157
+ if ((retCode === 'timeout' || retCode === '4011' || retCode === '4013' || retCode === '9009' && retMsg === '令牌不能为空') && !isMobile) {
158
158
  if (!getCookie('token')) {
159
159
  (window.top || window).location.href = location.pathname === '/' ? '/login' : '/login?redirect=' + encodeURIComponent(location.href);
160
160
  } else {
@@ -223,7 +223,7 @@ request.interceptors.response.use( /*#__PURE__*/function () {
223
223
  setCache('expireWarnFlag', '1', true);
224
224
  case 44:
225
225
  if (_retCode && !status.includes(_retCode)) {
226
- if ((_retCode === 'timeout' || _retCode === '4011') && !isMobile) {
226
+ if ((_retCode === 'timeout' || _retCode === '4011' || _retCode === '9009' && _retMsg === '令牌不能为空') && !isMobile) {
227
227
  if (!getCookie('token')) {
228
228
  (window.top || window).location.href = location.pathname === '/' ? '/login' : '/login?redirect=' + encodeURIComponent(location.href);
229
229
  } else {
@@ -29,7 +29,7 @@ var ViewDocment = function ViewDocment(props) {
29
29
  setVisible = _useState2[1];
30
30
  var src = useMemo(function () {
31
31
  var token = getCookie('token');
32
- var filename = getUrlQuery(url, 'fileName'); //文件名,上传的文件名为xxx?fileName=xxx.pdf
32
+ var filename = getUrlQuery('fileName', url); //文件名,上传的文件名为xxx?fileName=xxx.pdf
33
33
  if (!filename) {
34
34
  //外部文件比如,xxx/ddd.docx,兜底直接给个临时的,但好像有问题,因为后端不知道文件类型
35
35
  filename = url.split('/').pop() || Date.now().toString(32);
@@ -42,10 +42,11 @@ var ViewDocment = function ViewDocment(props) {
42
42
  href = href + (href.includes('?') ? '&' : '?') + 'fullfilename=' + filename;
43
43
  }
44
44
  var doc = base64Encode(href);
45
+ var exportUrl = getCache('exportUrl');
45
46
  // 如果是生产环境,走下载域名,其它环境走原来域名
46
47
  var domain = '';
47
- if (location.href.includes('.cloud/') && getCache('exportUrl')) {
48
- domain = getCache('exportUrl');
48
+ if (exportUrl && exportUrl.includes('//')) {
49
+ domain = exportUrl;
49
50
  }
50
51
  return domain + '/lesoon/lesoon-kkfileview-api/onlinePreview?url=' + doc;
51
52
  }, [url]);
package/lib/http/index.js CHANGED
@@ -154,7 +154,7 @@ request.interceptors.response.use( /*#__PURE__*/function () {
154
154
  ifExpireWarn = true;
155
155
  setCache('expireWarnFlag', '1', true);
156
156
  case 18:
157
- if ((retCode === 'timeout' || retCode === '4011' || retCode === '4013') && !isMobile) {
157
+ if ((retCode === 'timeout' || retCode === '4011' || retCode === '4013' || retCode === '9009' && retMsg === '令牌不能为空') && !isMobile) {
158
158
  if (!getCookie('token')) {
159
159
  (window.top || window).location.href = location.pathname === '/' ? '/login' : '/login?redirect=' + encodeURIComponent(location.href);
160
160
  } else {
@@ -223,7 +223,7 @@ request.interceptors.response.use( /*#__PURE__*/function () {
223
223
  setCache('expireWarnFlag', '1', true);
224
224
  case 44:
225
225
  if (_retCode && !status.includes(_retCode)) {
226
- if ((_retCode === 'timeout' || _retCode === '4011') && !isMobile) {
226
+ if ((_retCode === 'timeout' || _retCode === '4011' || _retCode === '9009' && _retMsg === '令牌不能为空') && !isMobile) {
227
227
  if (!getCookie('token')) {
228
228
  (window.top || window).location.href = location.pathname === '/' ? '/login' : '/login?redirect=' + encodeURIComponent(location.href);
229
229
  } else {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ls-pro-common",
3
- "version": "3.1.42",
3
+ "version": "3.1.44",
4
4
  "description": "ls-pro-common",
5
5
  "license": "MIT",
6
6
  "sideEffects": [