ztxkutils 2.10.66-50 → 2.10.66-52

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.
@@ -63,6 +63,11 @@ export declare function createPublicPreviewUrl(fileUrl: string, { fileId, fileNa
63
63
  * @param {string} fileName 文件名
64
64
  */
65
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;
66
71
  /**
67
72
  * @description 批量文件预览方法,只针对图片类型
68
73
  * @param {string} fileUrl 文件服务器ip端口
@@ -276,6 +276,24 @@ function previewFile(fileUrl, fileId, otherOption) {
276
276
  window.open(fileUrl + "/attchPreview?attachId=" + fileId + "&Zmdms-Auth=bearer " + token + "&officePreviewType=pdf");
277
277
  }
278
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
+ }
279
297
  /**
280
298
  * @description 批量文件预览方法,只针对图片类型
281
299
  * @param {string} fileUrl 文件服务器ip端口
@@ -401,4 +419,4 @@ function encodeOneFileIdByDownload(fileId) {
401
419
  return encodeURIComponent(crypto.encrypt(fileId));
402
420
  }
403
421
 
404
- export { batchDownloadFileCallBack, batchPreviewFile, createDownloadUrl, createDownloadUrlNoBase, createOriginalUrl, createPublicDownloadUrl, createPublicPreviewUrl, createThumbnailUrl, downloadFile, downloadFileCallBack, downloadPublicFile, encodeEncryptedFileId, encodeFileIdByDownload, encodeFileIdByPreview, encodeOneFileIdByDownload, encryptFileId, previewFile };
422
+ export { batchDownloadFileCallBack, batchPreviewFile, createDownloadUrl, createDownloadUrlNoBase, createOriginalUrl, createPublicDownloadUrl, createPublicPreviewUrl, createThumbnailUrl, downloadFile, downloadFileCallBack, downloadPublicFile, encodeEncryptedFileId, encodeFileIdByDownload, encodeFileIdByPreview, encodeOneFileIdByDownload, encryptFileId, previewFile, previewPublicFile };
package/dist/print.js CHANGED
@@ -431,7 +431,8 @@ function htmlToPdfNoCanvas(_a) {
431
431
  autoPaging: 'text',
432
432
  margin: [pageMarginY, pageMarginX, pageMarginY, pageMarginX],
433
433
  width: pageWidth,
434
- windowWidth: pageWidth,
434
+ // windowWidth: pageWidth,
435
+ windowWidth: 1050,
435
436
  callback: function (res) {
436
437
  // 添加呈现的HTML所需的页面(从第2页开始)
437
438
  // 注释掉这里导致多出一页空白页
@@ -538,7 +539,8 @@ function htmlToPdfNoCanvas(_a) {
538
539
  autoPaging: 'text',
539
540
  margin: [pageMarginY, pageMarginX, pageMarginY, pageMarginX],
540
541
  width: pageWidth_1,
541
- windowWidth: pageWidth_1,
542
+ // windowWidth: pageWidth,
543
+ windowWidth: 1050,
542
544
  callback: function (res) {
543
545
  // 添加呈现的HTML所需的页面(从第2页开始)
544
546
  // for (
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ztxkutils",
3
- "version": "2.10.66-50",
3
+ "version": "2.10.66-52",
4
4
  "description": "",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",