ztxkutils 2.10.66-2 → 2.10.66-4
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.
- package/dist/fileOperation.js +13 -9
- package/package.json +1 -1
package/dist/fileOperation.js
CHANGED
@@ -11,7 +11,7 @@ import 'crypto';
|
|
11
11
|
*/
|
12
12
|
function downloadFile(apiUrl, fileId, fileName, otherOption) {
|
13
13
|
// 给附件id加密
|
14
|
-
fileId = encodeURIComponent(crypto.encrypt(fileId));
|
14
|
+
fileId = encodeURIComponent(encodeURIComponent(crypto.encrypt(fileId)));
|
15
15
|
var xhr = new XMLHttpRequest();
|
16
16
|
var token = '';
|
17
17
|
var addWaterMark = 'true';
|
@@ -47,7 +47,7 @@ function downloadFile(apiUrl, fileId, fileName, otherOption) {
|
|
47
47
|
}
|
48
48
|
function downloadFileCallBack(apiUrl, fileId, fileName, otherOption) {
|
49
49
|
// 给附件id加密
|
50
|
-
fileId = encodeURIComponent(crypto.encrypt(fileId));
|
50
|
+
fileId = encodeURIComponent(encodeURIComponent(crypto.encrypt(fileId)));
|
51
51
|
var _a = otherOption || {}, authToken = _a.authToken, callbackAfter = _a.callbackAfter, callbackError = _a.callbackError, _b = _a.addWaterMark, addWaterMark = _b === void 0 ? true : _b;
|
52
52
|
var xhr = new XMLHttpRequest();
|
53
53
|
var token = getToken() || authToken;
|
@@ -84,7 +84,7 @@ function downloadFileCallBack(apiUrl, fileId, fileName, otherOption) {
|
|
84
84
|
*/
|
85
85
|
function batchDownloadFileCallBack(apiUrl, fileIds, fileNames, otherOption) {
|
86
86
|
// 给附件id加密
|
87
|
-
fileIds = encodeURIComponent(crypto.encrypt(fileIds));
|
87
|
+
fileIds = encodeURIComponent(encodeURIComponent(crypto.encrypt(fileIds)));
|
88
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;
|
89
89
|
var xhr = new XMLHttpRequest();
|
90
90
|
var token = getToken() || authToken;
|
@@ -126,7 +126,7 @@ function batchDownloadFileCallBack(apiUrl, fileIds, fileNames, otherOption) {
|
|
126
126
|
*/
|
127
127
|
function downloadPublicFile(apiUrl, fileId, fileName, otherOption) {
|
128
128
|
// 给附件id加密
|
129
|
-
fileId = encodeURIComponent(crypto.encrypt(fileId));
|
129
|
+
// fileId = encodeURIComponent(crypto.encrypt(fileId));
|
130
130
|
var _a = otherOption || {}, callbackAfter = _a.callbackAfter, callbackError = _a.callbackError;
|
131
131
|
var xhr = new XMLHttpRequest();
|
132
132
|
var _apiUrl = apiUrl.endsWith('/')
|
@@ -164,7 +164,8 @@ function downloadPublicFile(apiUrl, fileId, fileName, otherOption) {
|
|
164
164
|
*/
|
165
165
|
function createDownloadUrl(apiUrl, fileId, authToken) {
|
166
166
|
// 给附件id加密
|
167
|
-
fileId = encodeURIComponent(crypto.encrypt(fileId));
|
167
|
+
// fileId = encodeURIComponent(crypto.encrypt(fileId));
|
168
|
+
fileId = encodeURIComponent(encodeURIComponent(crypto.encrypt(fileId)));
|
168
169
|
var token = getToken() || authToken;
|
169
170
|
var _apiUrl = apiUrl.endsWith('/')
|
170
171
|
? apiUrl.slice(0, apiUrl.length - 1)
|
@@ -178,7 +179,8 @@ function createDownloadUrl(apiUrl, fileId, authToken) {
|
|
178
179
|
*/
|
179
180
|
function createDownloadUrlNoBase(fileId, authToken) {
|
180
181
|
// 给附件id加密
|
181
|
-
fileId = encodeURIComponent(crypto.encrypt(fileId));
|
182
|
+
// fileId = encodeURIComponent(crypto.encrypt(fileId));
|
183
|
+
fileId = encodeURIComponent(encodeURIComponent(crypto.encrypt(fileId)));
|
182
184
|
var token = getToken() || authToken;
|
183
185
|
return "/api/zmdms-resource/oss/endpoint/download-file/" + fileId + "?Zmdms-Auth=bearer " + token;
|
184
186
|
}
|
@@ -189,7 +191,7 @@ function createDownloadUrlNoBase(fileId, authToken) {
|
|
189
191
|
*/
|
190
192
|
function createPublicDownloadUrl(apiUrl, fileId) {
|
191
193
|
// 给附件id加密
|
192
|
-
fileId = encodeURIComponent(crypto.encrypt(fileId));
|
194
|
+
// fileId = encodeURIComponent(crypto.encrypt(fileId));
|
193
195
|
var _apiUrl = apiUrl.endsWith('/')
|
194
196
|
? apiUrl.slice(0, apiUrl.length - 1)
|
195
197
|
: apiUrl;
|
@@ -203,6 +205,7 @@ function createPublicDownloadUrl(apiUrl, fileId) {
|
|
203
205
|
* @param {string} fileName 文件名
|
204
206
|
*/
|
205
207
|
function previewFile(fileUrl, fileId, otherOption) {
|
208
|
+
var preFileId = fileId;
|
206
209
|
// 给附件id加密
|
207
210
|
fileId = encodeURIComponent(crypto.encrypt(fileId));
|
208
211
|
var token = '';
|
@@ -224,7 +227,7 @@ function previewFile(fileUrl, fileId, otherOption) {
|
|
224
227
|
: fileUrl;
|
225
228
|
if (titleName) {
|
226
229
|
var lastPointIndex = titleName.lastIndexOf('.');
|
227
|
-
var preTitleName = titleName.substring(0, lastPointIndex) + ("-" +
|
230
|
+
var preTitleName = titleName.substring(0, lastPointIndex) + ("-" + preFileId);
|
228
231
|
var suffixTitleName = titleName.substring(lastPointIndex + 1);
|
229
232
|
titleName = suffixTitleName
|
230
233
|
? preTitleName + "." + suffixTitleName
|
@@ -276,6 +279,7 @@ function batchPreviewFile(fileUrl, fileId, otherOption) {
|
|
276
279
|
* @param {string} fileType 文件类型
|
277
280
|
*/
|
278
281
|
function createOriginalUrl(fileUrl, fileId, otherOption) {
|
282
|
+
var preFileId = fileId;
|
279
283
|
// 给附件id加密
|
280
284
|
fileId = encodeURIComponent(crypto.encrypt(fileId));
|
281
285
|
var token = getToken() || (otherOption === null || otherOption === void 0 ? void 0 : otherOption.authTOken);
|
@@ -291,7 +295,7 @@ function createOriginalUrl(fileUrl, fileId, otherOption) {
|
|
291
295
|
: fileUrl;
|
292
296
|
if (titleName) {
|
293
297
|
var lastPointIndex = titleName.lastIndexOf('.');
|
294
|
-
var preTitleName = titleName.substring(0, lastPointIndex) + ("-" +
|
298
|
+
var preTitleName = titleName.substring(0, lastPointIndex) + ("-" + preFileId);
|
295
299
|
var suffixTitleName = titleName.substring(lastPointIndex + 1);
|
296
300
|
titleName = suffixTitleName
|
297
301
|
? preTitleName + "." + suffixTitleName
|