ztxkutils 2.10.66-55 → 2.10.66-57

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.
Files changed (80) hide show
  1. package/dist/fileOperation.d.ts +25 -0
  2. package/dist/fileOperation.js +63 -2
  3. package/dist/hooks/useHistory.d.ts +3 -1
  4. package/dist/hooks.js +1 -1
  5. package/dist/index.js +3 -3
  6. package/dist/print.js +61 -12
  7. package/dist/{reqUrl-22b880a4.js → reqUrl-e44a69ed.js} +4 -3
  8. package/dist/reqUrl.js +1 -1
  9. package/dist/{request-d1972b41.js → request-2ae9cfae.js} +22 -23
  10. package/dist/request-34b75d7b.js +2994 -0
  11. package/dist/request-36ce2fed.js +3005 -0
  12. package/dist/{request-80d1ac80.js → request-3b358860.js} +19 -23
  13. package/dist/request-49900ec9.js +3010 -0
  14. package/dist/request-6df00145.js +3006 -0
  15. package/dist/request-6f0aa072.js +3008 -0
  16. package/dist/{request-1e442d5d.js → request-7bcf02f4.js} +8 -4
  17. package/dist/request-934324cc.js +3020 -0
  18. package/dist/{request-d8d72b87.js → request-e147d640.js} +10 -4
  19. package/dist/request.d.ts +8 -0
  20. package/dist/request.js +1 -1
  21. package/dist/stompClient.d.ts +13 -0
  22. package/dist/stompClient.js +97 -58
  23. package/dist/test1.d.ts +1 -0
  24. package/dist/tools-05479576.js +2502 -0
  25. package/dist/tools-38e8ca87.js +2503 -0
  26. package/dist/{tools-16a7fb45.js → tools-47b9bee7.js} +53 -1
  27. package/dist/tools.d.ts +3 -1
  28. package/dist/tools.js +1 -1
  29. package/dist/useFileIdToBase64.js +1 -1
  30. package/dist/useHistory.js +12 -6
  31. package/dist/workflow.js +5 -1
  32. package/package.json +1 -1
  33. package/zti18n-cli/bin/index.js +3 -3
  34. package/zti18n-cli/index.js +23 -23
  35. package/zti18n-cli/src/command/collect.js +353 -353
  36. package/zti18n-cli/src/command/convert.js +17 -17
  37. package/zti18n-cli/src/command/convert2.js +35 -35
  38. package/zti18n-cli/src/command/initFileConf.js +133 -133
  39. package/zti18n-cli/src/command/publish.js +24 -24
  40. package/zti18n-cli/src/conf/BaseConf.js +21 -21
  41. package/zti18n-cli/src/conf/FileConf.js +116 -116
  42. package/zti18n-cli/src/index.js +75 -75
  43. package/zti18n-cli/src/translate/google.js +87 -87
  44. package/zti18n-cli/src/utils/isChinese.js +3 -3
  45. package/zti18n-cli/src/utils/log.js +8 -8
  46. package/zti18n-cli/src/utils/mergeOptions.js +45 -45
  47. package/zti18n-cli/src/utils/reactOptions.js +73 -73
  48. package/zti18n-cli/src/utils/vueOptions.js +69 -69
  49. package/zti18n-core/index.js +1 -1
  50. package/zti18n-core/src/index.js +5 -5
  51. package/zti18n-core/src/plugin/reactIntlToReactIntlUniversal.js +224 -224
  52. package/zti18n-core/src/plugin/reactIntlUniversalToDi18n.js +64 -64
  53. package/zti18n-core/src/transform/defaultPkMap.js +79 -79
  54. package/zti18n-core/src/transform/transformHtml.js +271 -271
  55. package/zti18n-core/src/transform/transformJs.js +489 -489
  56. package/zti18n-core/src/transform/transformPug.js +272 -272
  57. package/zti18n-core/src/transform/transformReactIntlToReactIntlUniversal.js +96 -96
  58. package/zti18n-core/src/transform/transformReactIntlUniveralToDi18n.js +90 -90
  59. package/zti18n-core/src/transform/transformToDi18n.js +22 -22
  60. package/zti18n-core/src/transform/transformTs.js +41 -41
  61. package/zti18n-core/src/transform/transformVue.js +126 -126
  62. package/zti18n-core/src/transform/transformZeroToDi18n.js +105 -105
  63. package/zti18n-core/src/translate/google.js +6 -6
  64. package/zti18n-core/src/utils/constants.js +3 -3
  65. package/zti18n-core/src/utils/getIgnoreLines.js +14 -14
  66. package/zti18n-core/src/utils/isChinese.js +3 -3
  67. package/zti18n-core/src/utils/log.js +8 -8
  68. package/dist/dataModel-1fbaff40.js +0 -24
  69. package/dist/dataModel-6c68c88f.js +0 -26
  70. package/dist/dataModel-914b6226.js +0 -26
  71. package/dist/dataModel-b3629ef3.js +0 -26
  72. package/dist/request-4c29d6de.js +0 -2977
  73. package/dist/request-986d7090.js +0 -2923
  74. package/dist/request-c0970aae.js +0 -2917
  75. package/dist/request-f600ad7a.js +0 -2992
  76. package/dist/validate-18e52490.js +0 -249
  77. package/dist/validate-21164759.js +0 -260
  78. package/dist/validate-21b58a69.js +0 -260
  79. package/dist/validate-2de5a28f.js +0 -260
  80. package/dist/validate-ab47ebe9.js +0 -260
@@ -43,6 +43,18 @@ export declare function createDownloadUrlNoBase(fileId: string, authToken?: stri
43
43
  * @param {string} fileId 文件id
44
44
  */
45
45
  export declare function createPublicDownloadUrl(apiUrl: string, fileId: string): string;
46
+ /**
47
+ * @description 生成文件预览路径,不需要权限
48
+ * @param {string} fileUrl 文件服务器ip端口
49
+ * @param {string} otherOption.fileId 文件id
50
+ * @param {string} otherOption.fileName 文件名
51
+ * @param {boolean} otherOption.encodeNum encode次数
52
+ */
53
+ export declare function createPublicPreviewUrl(fileUrl: string, { fileId, fileName, encodeNum, }: {
54
+ fileId: string;
55
+ fileName: string;
56
+ encodeNum?: number;
57
+ }): string;
46
58
  /**
47
59
  * @description 文件预览方法
48
60
  * @param {string} fileUrl 文件服务器ip端口
@@ -51,6 +63,11 @@ export declare function createPublicDownloadUrl(apiUrl: string, fileId: string):
51
63
  * @param {string} fileName 文件名
52
64
  */
53
65
  export declare function previewFile(fileUrl: string, fileId: string, otherOption?: any): void;
66
+ export declare function previewPublicFile(fileUrl: string, { fileId, fileName, encodeNum, }: {
67
+ fileId: string;
68
+ fileName: string;
69
+ encodeNum?: number;
70
+ }): void;
54
71
  /**
55
72
  * @description 批量文件预览方法,只针对图片类型
56
73
  * @param {string} fileUrl 文件服务器ip端口
@@ -73,6 +90,14 @@ export declare function createOriginalUrl(fileUrl: string, fileId: string, other
73
90
  * @param {string} scale 缩略倍数
74
91
  */
75
92
  export declare function createThumbnailUrl(apiUrl: string, fileId: string, scale: number, otherOption?: any): string;
93
+ /**
94
+ * 附件id加密
95
+ */
96
+ export declare function encryptFileId(fileId: string): string;
97
+ /**
98
+ * 加密后的附件id encode次数
99
+ */
100
+ export declare function encodeEncryptedFileId(encryptedFileId: string, encodeNum?: number): string;
76
101
  /**
77
102
  * 附件预览的文件id加密
78
103
  * @param fileId
@@ -1,5 +1,5 @@
1
1
  import { g as getToken } from './authority-7a91cb9f.js';
2
- import { d as dangerouslySetXss } from './tools-390e3466.js';
2
+ import { d as dangerouslySetXss } from './tools-38e8ca87.js';
3
3
  import { a as crypto } from './crypto-c481f616.js';
4
4
  import './tslib.es6-35653116.js';
5
5
  import 'dayjs';
@@ -210,6 +210,31 @@ function createPublicDownloadUrl(apiUrl, fileId) {
210
210
  : apiUrl;
211
211
  return _apiUrl + "/api/zmdms-resource/oss/endpoint/public/download-file/" + fileId;
212
212
  }
213
+ /**
214
+ * @description 生成文件预览路径,不需要权限
215
+ * @param {string} fileUrl 文件服务器ip端口
216
+ * @param {string} otherOption.fileId 文件id
217
+ * @param {string} otherOption.fileName 文件名
218
+ * @param {boolean} otherOption.encodeNum encode次数
219
+ */
220
+ function createPublicPreviewUrl(fileUrl, _a) {
221
+ var fileId = _a.fileId, fileName = _a.fileName, _b = _a.encodeNum, encodeNum = _b === void 0 ? 0 : _b;
222
+ var preFileId = encryptFileId(fileId);
223
+ // 给附件id加密
224
+ preFileId = encodeEncryptedFileId(preFileId, encodeNum);
225
+ var titleName = dangerouslySetXss(fileName);
226
+ try {
227
+ titleName = titleName.replace(/[~!@#$%^&*{}|]/g, '');
228
+ }
229
+ catch (err) {
230
+ console.log(err);
231
+ }
232
+ titleName = encodeURIComponent(titleName);
233
+ var _fileUrl = fileUrl.endsWith('/')
234
+ ? fileUrl.slice(0, fileUrl.length - 1)
235
+ : fileUrl;
236
+ return _fileUrl + "/pubicAttchPreview?attachId=" + preFileId + "&titleName=" + titleName;
237
+ }
213
238
  /**
214
239
  * @description 文件预览方法
215
240
  * @param {string} fileUrl 文件服务器ip端口
@@ -251,6 +276,24 @@ function previewFile(fileUrl, fileId, otherOption) {
251
276
  window.open(fileUrl + "/attchPreview?attachId=" + fileId + "&Zmdms-Auth=bearer " + token + "&officePreviewType=pdf");
252
277
  }
253
278
  }
279
+ function previewPublicFile(fileUrl, _a) {
280
+ var fileId = _a.fileId, fileName = _a.fileName, _b = _a.encodeNum, encodeNum = _b === void 0 ? 0 : _b;
281
+ var preFileId = encryptFileId(fileId);
282
+ // 给附件id加密
283
+ preFileId = encodeEncryptedFileId(preFileId, encodeNum);
284
+ var titleName = dangerouslySetXss(fileName);
285
+ try {
286
+ titleName = titleName.replace(/[~!@#$%^&*{}|]/g, '');
287
+ }
288
+ catch (err) {
289
+ console.log(err);
290
+ }
291
+ titleName = encodeURIComponent(titleName);
292
+ var _fileUrl = fileUrl.endsWith('/')
293
+ ? fileUrl.slice(0, fileUrl.length - 1)
294
+ : fileUrl;
295
+ window.open(_fileUrl + "/pubicAttchPreview?attachId=" + preFileId + "&titleName=" + titleName);
296
+ }
254
297
  /**
255
298
  * @description 批量文件预览方法,只针对图片类型
256
299
  * @param {string} fileUrl 文件服务器ip端口
@@ -332,6 +375,24 @@ function createThumbnailUrl(apiUrl, fileId, scale, otherOption) {
332
375
  var token = getToken() || (otherOption === null || otherOption === void 0 ? void 0 : otherOption.authTOken);
333
376
  return _apiUrl + "/api/zmdms-resource/oss/endpoint/thumbnail/" + fileId + "?scale=" + scale + "&Zmdms-Auth=bearer " + token;
334
377
  }
378
+ /**
379
+ * 附件id加密
380
+ */
381
+ function encryptFileId(fileId) {
382
+ return crypto.encrypt(fileId);
383
+ }
384
+ /**
385
+ * 加密后的附件id encode次数
386
+ */
387
+ function encodeEncryptedFileId(encryptedFileId, encodeNum) {
388
+ if (encodeNum === void 0) { encodeNum = 0; }
389
+ var resultFileId = encryptedFileId;
390
+ while (!!encodeNum) {
391
+ encodeNum--;
392
+ resultFileId = encodeURIComponent(resultFileId);
393
+ }
394
+ return resultFileId;
395
+ }
335
396
  /**
336
397
  * 附件预览的文件id加密
337
398
  * @param fileId
@@ -358,4 +419,4 @@ function encodeOneFileIdByDownload(fileId) {
358
419
  return encodeURIComponent(crypto.encrypt(fileId));
359
420
  }
360
421
 
361
- export { batchDownloadFileCallBack, batchPreviewFile, createDownloadUrl, createDownloadUrlNoBase, createOriginalUrl, createPublicDownloadUrl, createThumbnailUrl, downloadFile, downloadFileCallBack, downloadPublicFile, encodeFileIdByDownload, encodeFileIdByPreview, encodeOneFileIdByDownload, previewFile };
422
+ export { batchDownloadFileCallBack, batchPreviewFile, createDownloadUrl, createDownloadUrlNoBase, createOriginalUrl, createPublicDownloadUrl, createPublicPreviewUrl, createThumbnailUrl, downloadFile, downloadFileCallBack, downloadPublicFile, encodeEncryptedFileId, encodeFileIdByDownload, encodeFileIdByPreview, encodeOneFileIdByDownload, encryptFileId, previewFile, previewPublicFile };
@@ -2,7 +2,9 @@
2
2
  * @author 陈亚雄
3
3
  * @description 代理路由的push方法,可以用window.open的方式跳转页面
4
4
  */
5
- export declare function useHistory(routeBasename?: string): any;
5
+ export declare function useHistory(routeBasename?: string, options?: {
6
+ pushCallback?: any;
7
+ }): any;
6
8
  /**
7
9
  * @author 陈亚雄
8
10
  * @description 设置浏览器标题信息
package/dist/hooks.js CHANGED
@@ -6,7 +6,7 @@ import { message } from 'ztxkui';
6
6
  import axios from 'axios';
7
7
  import './fileOperation.js';
8
8
  import './authority-7a91cb9f.js';
9
- import './tools-390e3466.js';
9
+ import './tools-38e8ca87.js';
10
10
  import 'dayjs';
11
11
  import './crypto-c481f616.js';
12
12
  import 'crypto';
package/dist/index.js CHANGED
@@ -1,9 +1,9 @@
1
1
  export { d as authority } from './authority-7a91cb9f.js';
2
2
  export { d as dataModel } from './dataModel-f1ef06bc.js';
3
- export { t as tools } from './tools-390e3466.js';
3
+ export { t as tools } from './tools-38e8ca87.js';
4
4
  export { v as validate } from './validate-2138d94a.js';
5
- export { r as request } from './request-40e9ca7b.js';
6
- export { r as reqUrl } from './reqUrl-ea7ef876.js';
5
+ export { r as request } from './request-934324cc.js';
6
+ export { r as reqUrl } from './reqUrl-e44a69ed.js';
7
7
  import './i18next.js';
8
8
  import './tslib.es6-35653116.js';
9
9
  import 'dayjs';
package/dist/print.js CHANGED
@@ -58,6 +58,40 @@ function printCurrentDom(_a) {
58
58
  document.head.appendChild(styleDom);
59
59
  window.print();
60
60
  }
61
+ function getTextDimensions(text, fontSize) {
62
+ var width, height;
63
+ try {
64
+ // 创建一个临时元素
65
+ var tempElement = document.createElement('div');
66
+ // 设置元素内容为传入的文本
67
+ tempElement.textContent = text;
68
+ // 设置样式使其不可见且不影响页面布局
69
+ tempElement.style.position = 'absolute';
70
+ tempElement.style.visibility = 'hidden'; // 元素不可见但仍占据空间
71
+ tempElement.style.opacity = '0'; // 完全透明
72
+ tempElement.style.pointerEvents = 'none'; // 不响应鼠标事件
73
+ tempElement.style.whiteSpace = 'nowrap'; // 防止文本换行影响宽度测量
74
+ tempElement.style.fontSize = fontSize;
75
+ tempElement.style.fontFamily = '微软雅黑';
76
+ tempElement.style.padding = '50px 10px';
77
+ // 插入到body中
78
+ document.body.appendChild(tempElement);
79
+ // 获取元素的宽高
80
+ width = tempElement.offsetWidth;
81
+ height = tempElement.offsetHeight;
82
+ // 从DOM中移除元素
83
+ document.body.removeChild(tempElement);
84
+ }
85
+ catch (err) {
86
+ width = text.length * 22;
87
+ height = text.length * 9;
88
+ }
89
+ // 返回测量结果
90
+ return {
91
+ width: width > 520 ? 520 : width < 240 ? 240 : width,
92
+ height: height > 200 ? 200 : height < 100 ? 100 : height,
93
+ };
94
+ }
61
95
  /**
62
96
  * 创建文本水印图片
63
97
  * @param waterText 水印文本
@@ -78,14 +112,18 @@ function createWaterHandle(obj) {
78
112
  var defaultWaterText = instance.t('浙商中拓');
79
113
  var _a = obj || {}, waterText = _a.waterText, opacity = _a.opacity, fontSize = _a.fontSize, cavansWidth = _a.cavansWidth, cavansHeight = _a.cavansHeight;
80
114
  var canvas = document.createElement('canvas');
115
+ // 如何计算水印的大小。创建一个元素插入到body中,获取到宽高后移除
116
+ var _b = getTextDimensions(waterText, fontSize || '18px'), textWidth = _b.width, textHeight = _b.height;
117
+ // 之前的宽度是文本长度 * 22
81
118
  var defaultCanvasWidth = waterText
82
119
  ? waterText.length > 10
83
- ? waterText.length * 22
120
+ ? textWidth
84
121
  : 240
85
122
  : 240;
123
+ // 之前的高度是文本长度 * 9
86
124
  var defaultCanvasHeight = waterText
87
125
  ? waterText.length > 10
88
- ? waterText.length * 9
126
+ ? textHeight
89
127
  : 100
90
128
  : 100;
91
129
  canvas.width = cavansWidth || defaultCanvasWidth;
@@ -393,14 +431,20 @@ function htmlToPdfNoCanvas(_a) {
393
431
  autoPaging: 'text',
394
432
  margin: [pageMarginY, pageMarginX, pageMarginY, pageMarginX],
395
433
  width: pageWidth,
396
- windowWidth: pageWidth,
434
+ // windowWidth: pageWidth,
435
+ windowWidth: 1050,
397
436
  callback: function (res) {
398
437
  // 添加呈现的HTML所需的页面(从第2页开始)
399
- for (var i_1 = 2, j = res.internal.getNumberOfPages(); i_1 <= j; i_1++) {
400
- pdf.addPage(pageFormat, pageOrient);
401
- }
402
- for (var i_2 = 1, j = res.internal.getNumberOfPages(); i_2 <= j; i_2++) {
403
- pdf.setPage(i_2);
438
+ // 注释掉这里导致多出一页空白页
439
+ // for (
440
+ // let i = 2, j = (res as any).internal.getNumberOfPages();
441
+ // i <= j;
442
+ // i++
443
+ // ) {
444
+ // pdf.addPage(pageFormat, pageOrient);
445
+ // }
446
+ for (var i_1 = 1, j = res.internal.getNumberOfPages(); i_1 <= j; i_1++) {
447
+ pdf.setPage(i_1);
404
448
  // 添加水印
405
449
  if (isAddWater) {
406
450
  setPdfWater(pdf, waterBase64, imgWidth, imgHeight);
@@ -495,12 +539,17 @@ function htmlToPdfNoCanvas(_a) {
495
539
  autoPaging: 'text',
496
540
  margin: [pageMarginY, pageMarginX, pageMarginY, pageMarginX],
497
541
  width: pageWidth_1,
498
- windowWidth: pageWidth_1,
542
+ // windowWidth: pageWidth,
543
+ windowWidth: 1050,
499
544
  callback: function (res) {
500
545
  // 添加呈现的HTML所需的页面(从第2页开始)
501
- for (var i = 2, j = res.internal.getNumberOfPages(); i <= j; i++) {
502
- pdf_3.addPage(pageFormat, pageOrient);
503
- }
546
+ // for (
547
+ // let i = 2, j = (res as any).internal.getNumberOfPages();
548
+ // i <= j;
549
+ // i++
550
+ // ) {
551
+ // pdf.addPage(pageFormat, pageOrient);
552
+ // }
504
553
  for (var i = 1, j = res.internal.getNumberOfPages(); i <= j; i++) {
505
554
  pdf_3.setPage(i);
506
555
  // 添加水印
@@ -13,10 +13,11 @@ function getReqUrl(processObj) {
13
13
  var ZT_API_PUBLIC_PRODUCT = processObj.REACT_APP_ZT_API_PUBLIC_PRODUCT ||
14
14
  'https://nportal.zmd.com.cn:18998'; // 生产环境外网api地址 https://m-portal.zmd.com.cn:18998 http://dz.zmd.com.cn:48000
15
15
  // 文件服务器
16
- var ZT_FILE_PREVIEW_DEV = processObj.REACT_APP_ZT_FILE_PREVIEW_DEV || 'http://192.168.0.83:88'; // 开发环境
17
- var ZT_FILE_PREVIEW_TEST = processObj.REACT_APP_ZT_FILE_PREVIEW_TEST || 'http://172.55.5.101:33013'; // 测试环境 https://192.168.0.135:18012
16
+ var ZT_FILE_PREVIEW_DEV = processObj.REACT_APP_ZT_FILE_PREVIEW_DEV || 'http://172.28.105.84:8012'; // 开发环境
17
+ var ZT_FILE_PREVIEW_TEST = processObj.REACT_APP_ZT_FILE_PREVIEW_TEST ||
18
+ 'http://preview-test.zmdms.com.cn:30079'; // 测试环境 http://172.55.5.101:33013
18
19
  var ZT_FILE_PREVIEW_STAGE = processObj.REACT_APP_ZT_FILE_PREVIEW_STAGE ||
19
- 'https://dzfile-prod.zmd.com.cn/'; // 阶段性环境 http://192.168.0.134:8012
20
+ 'http://preview-stage.zmdms.com.cn:30079'; // 阶段性环境 https://dzfile-prod.zmd.com.cn/
20
21
  var ZT_FILE_PREVIEW_SIM = processObj.REACT_APP_ZT_FILE_PREVIEW_SIM ||
21
22
  'https://dzfile-data.zmd.com.cn/'; // 阶段性环境 http://192.168.0.134:8012
22
23
  var ZT_FILE_PREVIEW_PRODUCT = processObj.REACT_APP_ZT_FILE_PREVIEW_PRODUCT ||
package/dist/reqUrl.js CHANGED
@@ -1 +1 @@
1
- export { g as getReqUrl } from './reqUrl-ea7ef876.js';
1
+ export { g as getReqUrl } from './reqUrl-e44a69ed.js';
@@ -2471,7 +2471,7 @@ var AxiosCancel = /** @class */ (function () {
2471
2471
  }());
2472
2472
  var axiosCancel = new AxiosCancel();
2473
2473
 
2474
- var timeoutNum = 60000 * 5;
2474
+ var timeoutNum = 60000;
2475
2475
  var isRefreshing = true; // 是否需要刷新
2476
2476
  var subscribers = []; // 缓存需要帮助请求的接口
2477
2477
  var requestTokenEndTime = 0; // token调用结束时间
@@ -2506,11 +2506,13 @@ function loginRequest(params, InnerAuthorization) {
2506
2506
  });
2507
2507
  }
2508
2508
  function checkStatus(response, jumpCallback, otherOptions) {
2509
- var InnerAuthorization = (otherOptions || {}).InnerAuthorization;
2509
+ var _a = otherOptions || {}, InnerAuthorization = _a.InnerAuthorization, refreshTokenCallback = _a.refreshTokenCallback;
2510
2510
  if ((response === null || response === void 0 ? void 0 : response.status) === 401) {
2511
2511
  if (isRefreshing) {
2512
2512
  if (Date.now() - requestTokenEndTime > reqTokenTimeInterval) {
2513
- refreshTokenRequst(jumpCallback, InnerAuthorization);
2513
+ refreshTokenRequst(jumpCallback, InnerAuthorization, {
2514
+ refreshTokenCallback: refreshTokenCallback,
2515
+ });
2514
2516
  }
2515
2517
  else {
2516
2518
  message.info(instance.t('刷新token遭到频繁调用,请联系管理员查看是否接口权限出现问题,可能是{{slot0}}接口出现问题', { slot0: response === null || response === void 0 ? void 0 : response.config.url }), 5);
@@ -2547,7 +2549,8 @@ function checkStatus(response, jumpCallback, otherOptions) {
2547
2549
  // return retryOriginalRequest;
2548
2550
  }
2549
2551
  }
2550
- function refreshTokenRequst(jumpCallback, Authorization) {
2552
+ function refreshTokenRequst(jumpCallback, Authorization, otherOptions) {
2553
+ var refreshTokenCallback = (otherOptions || {}).refreshTokenCallback;
2551
2554
  loginRequest({
2552
2555
  tenantId: '000000',
2553
2556
  grant_type: 'refresh_token',
@@ -2562,7 +2565,10 @@ function refreshTokenRequst(jumpCallback, Authorization) {
2562
2565
  setToken(data === null || data === void 0 ? void 0 : data.access_token);
2563
2566
  setRefreshToken(data === null || data === void 0 ? void 0 : data.refresh_token);
2564
2567
  message.info(instance.t('token已经刷新成功,请重新提交!', {}));
2568
+ // 设置一个本地存储,用来告知这是刷新token 而不是被挤下线。
2569
+ localStorage.setItem('__unWsNeedReconnect__', 'true');
2565
2570
  onAccessTokenFetched();
2571
+ refreshTokenCallback === null || refreshTokenCallback === void 0 ? void 0 : refreshTokenCallback();
2566
2572
  isRefreshing = true;
2567
2573
  }
2568
2574
  else {
@@ -2608,7 +2614,7 @@ function onAccessTokenFetched() {
2608
2614
  }
2609
2615
  function setInterceptorsResponse(jumpCallback, otherOptions) {
2610
2616
  // 拦截器,拦截响应头信息
2611
- var isRefreshToken = (otherOptions || {}).isRefreshToken;
2617
+ var _a = otherOptions || {}, isRefreshToken = _a.isRefreshToken; _a.refreshTokenCallback;
2612
2618
  axios.interceptors.response.use(function (response) {
2613
2619
  var _a, _b, _c;
2614
2620
  // catchPromiseObj = [];
@@ -2636,7 +2642,7 @@ function setInterceptorsResponse(jumpCallback, otherOptions) {
2636
2642
  return Promise.reject(response);
2637
2643
  }
2638
2644
  }, function (error) {
2639
- var _a, _b, _c, _d, _e, _f;
2645
+ var _a, _b, _c, _d, _e, _f, _g, _h;
2640
2646
  // catchPromiseObj = [];
2641
2647
  console.error(error);
2642
2648
  var errRes = error === null || error === void 0 ? void 0 : error.response;
@@ -2710,7 +2716,10 @@ function setInterceptorsResponse(jumpCallback, otherOptions) {
2710
2716
  return Promise.reject(error);
2711
2717
  }
2712
2718
  // 接口401处理,401状态后不需要重新刷新token,直接退出登录
2713
- if ((errRes === null || errRes === void 0 ? void 0 : errRes.status) === 401 && !isRefreshToken) {
2719
+ var resultRefreshToken = typeof ((_g = error === null || error === void 0 ? void 0 : error.config) === null || _g === void 0 ? void 0 : _g.isRefreshToken) === 'boolean'
2720
+ ? (_h = error === null || error === void 0 ? void 0 : error.config) === null || _h === void 0 ? void 0 : _h.isRefreshToken
2721
+ : isRefreshToken;
2722
+ if ((errRes === null || errRes === void 0 ? void 0 : errRes.status) === 401 && !resultRefreshToken) {
2714
2723
  if (!isExpiration) {
2715
2724
  isExpiration = true;
2716
2725
  removeToken();
@@ -2778,14 +2787,14 @@ function transformObj(obj) {
2778
2787
  return obj;
2779
2788
  }
2780
2789
  function request(myOptions, jumpCallback, otherOptions) {
2781
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
2790
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
2782
2791
  var InnerAuthorization = (otherOptions || {}).InnerAuthorization;
2783
2792
  if (!isFirstSet) {
2784
2793
  setInterceptorsRequest();
2785
2794
  setInterceptorsResponse(jumpCallback, otherOptions);
2786
2795
  isFirstSet = true;
2787
2796
  }
2788
- var encryptionType = myOptions.encryptionType, isTimeoutMessage = myOptions.isTimeoutMessage, isForceRequest = myOptions.isForceRequest, _q = myOptions.noCatchUrl, noCatchUrl = _q === void 0 ? [] : _q, isCatch = myOptions.isCatch, mustCatch = myOptions.mustCatch, isAutonomousCatch = myOptions.isAutonomousCatch, _r = myOptions.autonomousCount, autonomousCount = _r === void 0 ? 1 : _r, autonomousKey = myOptions.autonomousKey, options = __rest(myOptions, ["encryptionType", "isTimeoutMessage", "isForceRequest", "noCatchUrl", "isCatch", "mustCatch", "isAutonomousCatch", "autonomousCount", "autonomousKey"]);
2797
+ var encryptionType = myOptions.encryptionType, isTimeoutMessage = myOptions.isTimeoutMessage, isForceRequest = myOptions.isForceRequest, _m = myOptions.noCatchUrl, noCatchUrl = _m === void 0 ? [] : _m, isCatch = myOptions.isCatch, mustCatch = myOptions.mustCatch, isAutonomousCatch = myOptions.isAutonomousCatch, _o = myOptions.autonomousCount, autonomousCount = _o === void 0 ? 1 : _o, autonomousKey = myOptions.autonomousKey, options = __rest(myOptions, ["encryptionType", "isTimeoutMessage", "isForceRequest", "noCatchUrl", "isCatch", "mustCatch", "isAutonomousCatch", "autonomousCount", "autonomousKey"]);
2789
2798
  timeoutNum =
2790
2799
  typeof myOptions.timeout === 'number' ? myOptions.timeout : timeoutNum;
2791
2800
  __isTimeoutMessage = isTimeoutMessage;
@@ -2820,10 +2829,6 @@ function request(myOptions, jumpCallback, otherOptions) {
2820
2829
  }
2821
2830
  // 将传入配置与默认配置混合
2822
2831
  var newOptions = __assign(__assign(__assign({}, defaultOptions), options), { autonomousKey: autonomousKey, headers: __assign(__assign({}, defaultOptions.headers), options.headers) });
2823
- // 湘钢国贸项目 除了登录接口外 去掉 Authorization认证头部
2824
- if (newOptions.url !== '/api/zmdms-auth/oauth/token' && !InnerAuthorization) {
2825
- delete newOptions.headers.Authorization;
2826
- }
2827
2832
  // 特殊请求处理
2828
2833
  if (((_e = newOptions.method) === null || _e === void 0 ? void 0 : _e.toUpperCase()) === 'POST' ||
2829
2834
  ((_f = newOptions.method) === null || _f === void 0 ? void 0 : _f.toUpperCase()) === 'PUT' ||
@@ -2846,12 +2851,6 @@ function request(myOptions, jumpCallback, otherOptions) {
2846
2851
  newOptions.headers = __assign({ 'Content-Type': 'application/json' }, newOptions.headers);
2847
2852
  }
2848
2853
  }
2849
- // 对Zmdms-Auth特殊处理
2850
- if (((_h = newOptions.headers) === null || _h === void 0 ? void 0 : _h['Zmdms-Auth']) &&
2851
- !((_j = newOptions.headers) === null || _j === void 0 ? void 0 : _j['Zmdms-Auth'].includes('bearer'))) {
2852
- newOptions.headers['Zmdms-Auth'] =
2853
- 'bearer ' + ((_k = newOptions.headers) === null || _k === void 0 ? void 0 : _k['Zmdms-Auth']);
2854
- }
2855
2854
  // 将参数进行aes加密
2856
2855
  if (newOptions.data) {
2857
2856
  if (encryptionType === true || encryptionType === 'aes') {
@@ -2884,7 +2883,7 @@ function request(myOptions, jumpCallback, otherOptions) {
2884
2883
  {
2885
2884
  params: newOptions.params,
2886
2885
  promiseObj: result,
2887
- method: (_l = newOptions.method) === null || _l === void 0 ? void 0 : _l.toUpperCase(),
2886
+ method: (_h = newOptions.method) === null || _h === void 0 ? void 0 : _h.toUpperCase(),
2888
2887
  },
2889
2888
  ];
2890
2889
  return result;
@@ -2918,15 +2917,15 @@ function request(myOptions, jumpCallback, otherOptions) {
2918
2917
  item.push({
2919
2918
  params: newOptions.params,
2920
2919
  promiseObj: result,
2921
- method: (_m = newOptions.method) === null || _m === void 0 ? void 0 : _m.toUpperCase(),
2920
+ method: (_j = newOptions.method) === null || _j === void 0 ? void 0 : _j.toUpperCase(),
2922
2921
  });
2923
2922
  return result;
2924
2923
  }
2925
2924
  }
2926
2925
  // 缓存本次宏任务下的GET请求,并且不是以/page结尾的列表分页接口
2927
2926
  // 并且不是强制请求,强制请求需要
2928
- if (((((_o = newOptions.method) === null || _o === void 0 ? void 0 : _o.toUpperCase()) === 'GET' &&
2929
- !((_p = newOptions.url) === null || _p === void 0 ? void 0 : _p.endsWith('/page')) &&
2927
+ if (((((_k = newOptions.method) === null || _k === void 0 ? void 0 : _k.toUpperCase()) === 'GET' &&
2928
+ !((_l = newOptions.url) === null || _l === void 0 ? void 0 : _l.endsWith('/page')) &&
2930
2929
  !noCatchUrl.find(function (item) { var _a; return (_a = newOptions.url) === null || _a === void 0 ? void 0 : _a.endsWith(item); }) &&
2931
2930
  isCatch) ||
2932
2931
  mustCatch) &&