ztxkutils 2.10.54 → 4.0.0

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.
@@ -56,3 +56,5 @@ export declare const IMPORT_IFRAME_PARENT_ORIGIN = "iframeParentOrigin";
56
56
  * @description 流程实例ID
57
57
  */
58
58
  export declare const WORKFLOW_PROCESS_INST_ID = "workflowProcessInstId";
59
+ export declare const TOKEN_KEY = "Cicoms-Auth";
60
+ export declare const BASIC_KEY = "cicoms";
package/dist/constants.js CHANGED
@@ -58,6 +58,8 @@ var IMPORT_IFRAME_PARENT_ORIGIN = 'iframeParentOrigin';
58
58
  /**
59
59
  * @description 流程实例ID
60
60
  */
61
- var WORKFLOW_PROCESS_INST_ID = 'workflowProcessInstId';
61
+ var WORKFLOW_PROCESS_INST_ID = 'workflowProcessInstId';
62
+ var TOKEN_KEY = 'Cicoms-Auth';
63
+ var BASIC_KEY = 'cicoms';
62
64
 
63
- export { IFRAME_LOADED, IMPORT_IFRAME_PARENT_ORIGIN, WORKFLOW_EDIT, WORKFLOW_GET_HEIGHT, WORKFLOW_HIDEFRAME_KEY, WORKFLOW_PROCESS_INST_ID, WORKFLOW_RETURN_HEIGHT, WORKFLOW_RETURN_INSTID, WORKFLOW_REVIEW, WORKFLOW_SAVE_HANDLE, WORKFLOW_SAVE_INSTID, WORKFLOW_TOKEN, WORKFLOW_TRANSMIT_HANDLE, clientType, microPortalRoute };
65
+ export { BASIC_KEY, IFRAME_LOADED, IMPORT_IFRAME_PARENT_ORIGIN, TOKEN_KEY, WORKFLOW_EDIT, WORKFLOW_GET_HEIGHT, WORKFLOW_HIDEFRAME_KEY, WORKFLOW_PROCESS_INST_ID, WORKFLOW_RETURN_HEIGHT, WORKFLOW_RETURN_INSTID, WORKFLOW_REVIEW, WORKFLOW_SAVE_HANDLE, WORKFLOW_SAVE_INSTID, WORKFLOW_TOKEN, WORKFLOW_TRANSMIT_HANDLE, clientType, microPortalRoute };
@@ -1,5 +1,6 @@
1
1
  import { g as getToken } from './authority-7a91cb9f.js';
2
2
  import { d as dangerouslySetXss } from './tools-09a4d620.js';
3
+ import { BASIC_KEY, TOKEN_KEY } from './constants.js';
3
4
  import './tslib.es6-35653116.js';
4
5
  import 'dayjs';
5
6
 
@@ -23,7 +24,7 @@ function downloadFile(apiUrl, fileId, fileName, otherOption) {
23
24
  var _apiUrl = apiUrl.endsWith('/')
24
25
  ? apiUrl.slice(0, apiUrl.length - 1)
25
26
  : apiUrl;
26
- xhr.open('GET', _apiUrl + "/api/zmdms-resource/oss/endpoint/download-file/" + fileId + "?Zmdms-Auth=bearer " + token + "&addWaterMark=" + addWaterMark, true);
27
+ xhr.open('GET', _apiUrl + "/api/" + BASIC_KEY + "-resource/oss/endpoint/download-file/" + fileId + "?" + TOKEN_KEY + "=bearer " + token + "&addWaterMark=" + addWaterMark, true);
27
28
  xhr.responseType = 'blob';
28
29
  xhr.onload = function () {
29
30
  if (xhr.status === 200 || xhr.status === 201) {
@@ -48,7 +49,7 @@ function downloadFileCallBack(apiUrl, fileId, fileName, otherOption) {
48
49
  var _apiUrl = apiUrl.endsWith('/')
49
50
  ? apiUrl.slice(0, apiUrl.length - 1)
50
51
  : apiUrl;
51
- xhr.open('GET', _apiUrl + "/api/zmdms-resource/oss/endpoint/download-file/" + fileId + "?Zmdms-Auth=bearer " + token + "&addWaterMark=" + addWaterMark, true);
52
+ xhr.open('GET', _apiUrl + "/api/" + BASIC_KEY + "-resource/oss/endpoint/download-file/" + fileId + "?" + TOKEN_KEY + "=bearer " + token + "&addWaterMark=" + addWaterMark, true);
52
53
  xhr.responseType = 'blob';
53
54
  xhr.onload = function () {
54
55
  if (xhr.status === 200 || xhr.status === 201) {
@@ -83,7 +84,7 @@ function batchDownloadFileCallBack(apiUrl, fileIds, fileNames, otherOption) {
83
84
  var _apiUrl = apiUrl.endsWith('/')
84
85
  ? apiUrl.slice(0, apiUrl.length - 1)
85
86
  : apiUrl;
86
- xhr.open('POST', _apiUrl + "/api/zmdms-resource/oss/endpoint/batch-download-file", true);
87
+ xhr.open('POST', _apiUrl + "/api/" + BASIC_KEY + "-resource/oss/endpoint/batch-download-file", true);
87
88
  xhr.responseType = 'blob';
88
89
  xhr.onload = function () {
89
90
  if (xhr.status === 200 || xhr.status === 201) {
@@ -106,7 +107,7 @@ function batchDownloadFileCallBack(apiUrl, fileIds, fileNames, otherOption) {
106
107
  xhr.onerror = function (err) {
107
108
  callbackError && callbackError();
108
109
  };
109
- xhr.setRequestHeader('Zmdms-Auth', token || '');
110
+ xhr.setRequestHeader(TOKEN_KEY, token || '');
110
111
  xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
111
112
  xhr.send("attachIds=" + fileIds + "&fileNames=" + fileNames + "&zipName=" + zipName + "&addWaterMark=" + addWaterMark);
112
113
  }
@@ -122,7 +123,7 @@ function downloadPublicFile(apiUrl, fileId, fileName, otherOption) {
122
123
  var _apiUrl = apiUrl.endsWith('/')
123
124
  ? apiUrl.slice(0, apiUrl.length - 1)
124
125
  : apiUrl;
125
- xhr.open('GET', _apiUrl + "/api/zmdms-resource/oss/endpoint/public/download-file/" + fileId, true);
126
+ xhr.open('GET', _apiUrl + "/api/" + BASIC_KEY + "-resource/oss/endpoint/public/download-file/" + fileId, true);
126
127
  xhr.responseType = 'blob';
127
128
  xhr.onload = function () {
128
129
  if (xhr.status === 200 || xhr.status === 201) {
@@ -157,7 +158,7 @@ function createDownloadUrl(apiUrl, fileId, authToken) {
157
158
  var _apiUrl = apiUrl.endsWith('/')
158
159
  ? apiUrl.slice(0, apiUrl.length - 1)
159
160
  : apiUrl;
160
- return _apiUrl + "/api/zmdms-resource/oss/endpoint/download-file/" + fileId + "?Zmdms-Auth=bearer " + token;
161
+ return _apiUrl + "/api/" + BASIC_KEY + "-resource/oss/endpoint/download-file/" + fileId + "?" + TOKEN_KEY + "=bearer " + token;
161
162
  }
162
163
  /**
163
164
  * @description 生成文件下载路径
@@ -166,7 +167,7 @@ function createDownloadUrl(apiUrl, fileId, authToken) {
166
167
  */
167
168
  function createDownloadUrlNoBase(fileId, authToken) {
168
169
  var token = getToken() || authToken;
169
- return "/api/zmdms-resource/oss/endpoint/download-file/" + fileId + "?Zmdms-Auth=bearer " + token;
170
+ return "/api/" + BASIC_KEY + "-resource/oss/endpoint/download-file/" + fileId + "?" + TOKEN_KEY + "=bearer " + token;
170
171
  }
171
172
  /**
172
173
  * @description 生成公共文件下载路径
@@ -177,7 +178,7 @@ function createPublicDownloadUrl(apiUrl, fileId) {
177
178
  var _apiUrl = apiUrl.endsWith('/')
178
179
  ? apiUrl.slice(0, apiUrl.length - 1)
179
180
  : apiUrl;
180
- return _apiUrl + "/api/zmdms-resource/oss/endpoint/public/download-file/" + fileId;
181
+ return _apiUrl + "/api/" + BASIC_KEY + "-resource/oss/endpoint/public/download-file/" + fileId;
181
182
  }
182
183
  /**
183
184
  * @description 文件预览方法
@@ -211,10 +212,10 @@ function previewFile(fileUrl, fileId, otherOption) {
211
212
  titleName = suffixTitleName
212
213
  ? preTitleName + "." + suffixTitleName
213
214
  : preTitleName;
214
- window.open(_fileUrl + "/attchPreview?attachId=" + fileId + "&Zmdms-Auth=bearer " + token + "&titleName=" + encodeURIComponent(titleName) + "&officePreviewType=pdf");
215
+ window.open(_fileUrl + "/attchPreview?attachId=" + fileId + "&" + TOKEN_KEY + "=bearer " + token + "&titleName=" + encodeURIComponent(titleName) + "&officePreviewType=pdf");
215
216
  }
216
217
  else {
217
- window.open(fileUrl + "/attchPreview?attachId=" + fileId + "&Zmdms-Auth=bearer " + token + "&officePreviewType=pdf");
218
+ window.open(fileUrl + "/attchPreview?attachId=" + fileId + "&" + TOKEN_KEY + "=bearer " + token + "&officePreviewType=pdf");
218
219
  }
219
220
  }
220
221
  /**
@@ -243,10 +244,10 @@ function batchPreviewFile(fileUrl, fileId, otherOption) {
243
244
  ? fileUrl.slice(0, fileUrl.length - 1)
244
245
  : fileUrl;
245
246
  if (titleName) {
246
- window.open(_fileUrl + "/picturesAttchPreview?attachIds=" + fileId + "&Zmdms-Auth=bearer " + token + "&titleName=" + encodeURIComponent(titleName));
247
+ window.open(_fileUrl + "/picturesAttchPreview?attachIds=" + fileId + "&" + TOKEN_KEY + "=bearer " + token + "&titleName=" + encodeURIComponent(titleName));
247
248
  }
248
249
  else {
249
- window.open(fileUrl + "/picturesAttchPreview?attachIds=" + fileId + "&Zmdms-Auth=bearer " + token);
250
+ window.open(fileUrl + "/picturesAttchPreview?attachIds=" + fileId + "&" + TOKEN_KEY + "=bearer " + token);
250
251
  }
251
252
  }
252
253
  /**
@@ -274,10 +275,10 @@ function createOriginalUrl(fileUrl, fileId, otherOption) {
274
275
  titleName = suffixTitleName
275
276
  ? preTitleName + "." + suffixTitleName
276
277
  : preTitleName;
277
- return _fileUrl + "/attchPreview?attachId=" + fileId + "&Zmdms-Auth=bearer " + token + "&titleName=" + encodeURIComponent(titleName) + "&officePreviewType=pdf";
278
+ return _fileUrl + "/attchPreview?attachId=" + fileId + "&" + TOKEN_KEY + "=bearer " + token + "&titleName=" + encodeURIComponent(titleName) + "&officePreviewType=pdf";
278
279
  }
279
280
  else {
280
- return _fileUrl + "/attchPreview?attachId=" + fileId + "&Zmdms-Auth=bearer " + token + "&officePreviewType=pdf";
281
+ return _fileUrl + "/attchPreview?attachId=" + fileId + "&" + TOKEN_KEY + "=bearer " + token + "&officePreviewType=pdf";
281
282
  }
282
283
  }
283
284
  /**
@@ -291,7 +292,7 @@ function createThumbnailUrl(apiUrl, fileId, scale, otherOption) {
291
292
  ? apiUrl.slice(0, apiUrl.length - 1)
292
293
  : apiUrl;
293
294
  var token = getToken() || (otherOption === null || otherOption === void 0 ? void 0 : otherOption.authTOken);
294
- return _apiUrl + "/api/zmdms-resource/oss/endpoint/thumbnail/" + fileId + "?scale=" + scale + "&Zmdms-Auth=bearer " + token;
295
+ return _apiUrl + "/api/" + BASIC_KEY + "-resource/oss/endpoint/thumbnail/" + fileId + "?scale=" + scale + "&" + TOKEN_KEY + "=bearer " + token;
295
296
  }
296
297
 
297
298
  export { batchDownloadFileCallBack, batchPreviewFile, createDownloadUrl, createDownloadUrlNoBase, createOriginalUrl, createPublicDownloadUrl, createThumbnailUrl, downloadFile, downloadFileCallBack, downloadPublicFile, previewFile };
package/dist/hooks.js CHANGED
@@ -7,6 +7,7 @@ import './fileOperation.js';
7
7
  import './authority-7a91cb9f.js';
8
8
  import './tools-09a4d620.js';
9
9
  import 'dayjs';
10
+ import './constants.js';
10
11
 
11
12
  function useTableLinkage(_a) {
12
13
  var records = _a.records, callbackPromise = _a.callbackPromise, dependencies = _a.dependencies, devDependencies = _a.devDependencies;
package/dist/index.js CHANGED
@@ -2,7 +2,7 @@ export { d as authority } from './authority-7a91cb9f.js';
2
2
  export { d as dataModel } from './dataModel-1fbaff40.js';
3
3
  export { t as tools } from './tools-09a4d620.js';
4
4
  export { v as validate } from './validate-18e52490.js';
5
- export { r as request } from './request-1ac889d2.js';
5
+ export { r as request } from './request-a6274f1b.js';
6
6
  export { r as reqUrl } from './reqUrl-3792afcd.js';
7
7
  import './tslib.es6-35653116.js';
8
8
  import 'dayjs';
@@ -10,3 +10,4 @@ import 'axios';
10
10
  import 'ztxkui';
11
11
  import './crypto-c481f616.js';
12
12
  import 'crypto';
13
+ import './constants.js';