ztxkutils 2.10.66-16 → 2.10.66-18

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.
@@ -27,7 +27,10 @@ function downloadFile(apiUrl, fileId, fileName, otherOption) {
27
27
  var _apiUrl = apiUrl.endsWith('/')
28
28
  ? apiUrl.slice(0, apiUrl.length - 1)
29
29
  : apiUrl;
30
- xhr.open('GET', _apiUrl + "/api/zmdms-resource/oss/endpoint/download-file/" + fileId + "?Zmdms-Auth=bearer " + token + "&addWaterMark=" + addWaterMark, true);
30
+ var isLegalWaterMark = typeof addWaterMark === 'boolean' ||
31
+ addWaterMark === 'true' ||
32
+ addWaterMark === 'false';
33
+ xhr.open('GET', _apiUrl + "/api/zmdms-resource/oss/endpoint/download-file/" + fileId + "?Zmdms-Auth=bearer " + token + "&addWaterMark=" + (isLegalWaterMark ? addWaterMark : true), true);
31
34
  xhr.responseType = 'blob';
32
35
  xhr.onload = function () {
33
36
  if (xhr.status === 200 || xhr.status === 201) {
@@ -54,7 +57,10 @@ function downloadFileCallBack(apiUrl, fileId, fileName, otherOption) {
54
57
  var _apiUrl = apiUrl.endsWith('/')
55
58
  ? apiUrl.slice(0, apiUrl.length - 1)
56
59
  : apiUrl;
57
- xhr.open('GET', _apiUrl + "/api/zmdms-resource/oss/endpoint/download-file/" + fileId + "?Zmdms-Auth=bearer " + token + "&addWaterMark=" + addWaterMark, true);
60
+ var isLegalWaterMark = typeof addWaterMark === 'boolean' ||
61
+ addWaterMark === 'true' ||
62
+ addWaterMark === 'false';
63
+ xhr.open('GET', _apiUrl + "/api/zmdms-resource/oss/endpoint/download-file/" + fileId + "?Zmdms-Auth=bearer " + token + "&addWaterMark=" + (isLegalWaterMark ? addWaterMark : true), true);
58
64
  xhr.responseType = 'blob';
59
65
  xhr.onload = function () {
60
66
  if (xhr.status === 200 || xhr.status === 201) {
@@ -116,7 +122,14 @@ function batchDownloadFileCallBack(apiUrl, fileIds, fileNames, otherOption) {
116
122
  };
117
123
  xhr.setRequestHeader('Zmdms-Auth', token || '');
118
124
  xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
119
- xhr.send("attachIds=" + fileIds + "&fileNames=" + fileNames + "&zipName=" + zipName + "&addWaterMark=" + addWaterMark);
125
+ var isLegalWaterMark = typeof addWaterMark === 'boolean' ||
126
+ addWaterMark === 'true' ||
127
+ addWaterMark === 'false';
128
+ // 不传附件名
129
+ xhr.send("attachIds=" + fileIds + "&zipName=" + zipName + "&addWaterMark=" + (isLegalWaterMark ? addWaterMark : true));
130
+ // xhr.send(
131
+ // `attachIds=${fileIds}&fileNames=${fileNames}&zipName=${zipName}&addWaterMark=${addWaterMark}`
132
+ // );
120
133
  }
121
134
  /**
122
135
  * @description 公共文件下载,并重命名
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ztxkutils",
3
- "version": "2.10.66-16",
3
+ "version": "2.10.66-18",
4
4
  "description": "",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",