ztxkutils 2.10.65 → 2.10.66-2

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.
@@ -10,6 +10,8 @@ import 'crypto';
10
10
  * @description 文件操作相关
11
11
  */
12
12
  function downloadFile(apiUrl, fileId, fileName, otherOption) {
13
+ // 给附件id加密
14
+ fileId = encodeURIComponent(crypto.encrypt(fileId));
13
15
  var xhr = new XMLHttpRequest();
14
16
  var token = '';
15
17
  var addWaterMark = 'true';
@@ -44,6 +46,8 @@ function downloadFile(apiUrl, fileId, fileName, otherOption) {
44
46
  xhr.send();
45
47
  }
46
48
  function downloadFileCallBack(apiUrl, fileId, fileName, otherOption) {
49
+ // 给附件id加密
50
+ fileId = encodeURIComponent(crypto.encrypt(fileId));
47
51
  var _a = otherOption || {}, authToken = _a.authToken, callbackAfter = _a.callbackAfter, callbackError = _a.callbackError, _b = _a.addWaterMark, addWaterMark = _b === void 0 ? true : _b;
48
52
  var xhr = new XMLHttpRequest();
49
53
  var token = getToken() || authToken;
@@ -79,6 +83,8 @@ function downloadFileCallBack(apiUrl, fileId, fileName, otherOption) {
79
83
  * 批量下载
80
84
  */
81
85
  function batchDownloadFileCallBack(apiUrl, fileIds, fileNames, otherOption) {
86
+ // 给附件id加密
87
+ fileIds = encodeURIComponent(crypto.encrypt(fileIds));
82
88
  var _a = otherOption || {}, authToken = _a.authToken, zipName = _a.zipName, _b = _a.addWaterMark, addWaterMark = _b === void 0 ? true : _b, callbackAfter = _a.callbackAfter, callbackError = _a.callbackError;
83
89
  var xhr = new XMLHttpRequest();
84
90
  var token = getToken() || authToken;
@@ -119,6 +125,8 @@ function batchDownloadFileCallBack(apiUrl, fileIds, fileNames, otherOption) {
119
125
  * @param {string} fileName 文件名
120
126
  */
121
127
  function downloadPublicFile(apiUrl, fileId, fileName, otherOption) {
128
+ // 给附件id加密
129
+ fileId = encodeURIComponent(crypto.encrypt(fileId));
122
130
  var _a = otherOption || {}, callbackAfter = _a.callbackAfter, callbackError = _a.callbackError;
123
131
  var xhr = new XMLHttpRequest();
124
132
  var _apiUrl = apiUrl.endsWith('/')
@@ -155,6 +163,8 @@ function downloadPublicFile(apiUrl, fileId, fileName, otherOption) {
155
163
  * @param {string} fileId 文件id
156
164
  */
157
165
  function createDownloadUrl(apiUrl, fileId, authToken) {
166
+ // 给附件id加密
167
+ fileId = encodeURIComponent(crypto.encrypt(fileId));
158
168
  var token = getToken() || authToken;
159
169
  var _apiUrl = apiUrl.endsWith('/')
160
170
  ? apiUrl.slice(0, apiUrl.length - 1)
@@ -167,6 +177,8 @@ function createDownloadUrl(apiUrl, fileId, authToken) {
167
177
  * @param {string} fileId 文件id
168
178
  */
169
179
  function createDownloadUrlNoBase(fileId, authToken) {
180
+ // 给附件id加密
181
+ fileId = encodeURIComponent(crypto.encrypt(fileId));
170
182
  var token = getToken() || authToken;
171
183
  return "/api/zmdms-resource/oss/endpoint/download-file/" + fileId + "?Zmdms-Auth=bearer " + token;
172
184
  }
@@ -176,6 +188,8 @@ function createDownloadUrlNoBase(fileId, authToken) {
176
188
  * @param {string} fileId 文件id
177
189
  */
178
190
  function createPublicDownloadUrl(apiUrl, fileId) {
191
+ // 给附件id加密
192
+ fileId = encodeURIComponent(crypto.encrypt(fileId));
179
193
  var _apiUrl = apiUrl.endsWith('/')
180
194
  ? apiUrl.slice(0, apiUrl.length - 1)
181
195
  : apiUrl;
@@ -190,7 +204,7 @@ function createPublicDownloadUrl(apiUrl, fileId) {
190
204
  */
191
205
  function previewFile(fileUrl, fileId, otherOption) {
192
206
  // 给附件id加密
193
- fileId = crypto.encrypt_des(fileId);
207
+ fileId = encodeURIComponent(crypto.encrypt(fileId));
194
208
  var token = '';
195
209
  if (typeof otherOption === 'object') {
196
210
  token = getToken() || (otherOption === null || otherOption === void 0 ? void 0 : otherOption.authToken);
@@ -230,7 +244,7 @@ function previewFile(fileUrl, fileId, otherOption) {
230
244
  */
231
245
  function batchPreviewFile(fileUrl, fileId, otherOption) {
232
246
  // 给附件id加密
233
- fileId = crypto.encrypt_des(fileId);
247
+ fileId = encodeURIComponent(crypto.encrypt(fileId));
234
248
  var token = '';
235
249
  if (typeof otherOption === 'object') {
236
250
  token = getToken() || (otherOption === null || otherOption === void 0 ? void 0 : otherOption.authToken);
@@ -262,6 +276,8 @@ function batchPreviewFile(fileUrl, fileId, otherOption) {
262
276
  * @param {string} fileType 文件类型
263
277
  */
264
278
  function createOriginalUrl(fileUrl, fileId, otherOption) {
279
+ // 给附件id加密
280
+ fileId = encodeURIComponent(crypto.encrypt(fileId));
265
281
  var token = getToken() || (otherOption === null || otherOption === void 0 ? void 0 : otherOption.authTOken);
266
282
  var titleName = dangerouslySetXss(otherOption === null || otherOption === void 0 ? void 0 : otherOption.titleName);
267
283
  try {
package/dist/test.d.ts ADDED
@@ -0,0 +1 @@
1
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ztxkutils",
3
- "version": "2.10.65",
3
+ "version": "2.10.66-2",
4
4
  "description": "",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",