ydb-components-material 0.1.139 → 0.1.141

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.
Files changed (36) hide show
  1. package/build/docs/404.html +3 -3
  2. package/build/docs/_demos/:uuid +3 -3
  3. package/build/docs/colorful-button.html +3 -3
  4. package/build/docs/colorful-input.html +3 -3
  5. package/build/docs/index.html +3 -3
  6. package/build/docs/{umi.e7fd5197.js → umi.cd30b05c.js} +1 -1
  7. package/build/docs/~demos/:uuid.html +3 -3
  8. package/build/docs/~demos/colorful-button-demo.html +3 -3
  9. package/build/docs/~demos/colorful-input-demo.html +3 -3
  10. package/build/lowcode/assets-daily.json +11 -11
  11. package/build/lowcode/assets-dev.json +2 -2
  12. package/build/lowcode/assets-prod.json +11 -11
  13. package/build/lowcode/index.js +1 -1
  14. package/build/lowcode/meta.js +1 -1
  15. package/build/lowcode/render/default/view.js +1 -1
  16. package/build/lowcode/view.js +1 -1
  17. package/dist/BizComps.js +1 -1
  18. package/dist/BizComps.js.map +1 -1
  19. package/es/components/file-list/index.d.ts +2 -0
  20. package/es/components/file-list/index.js +39 -15
  21. package/es/components/file-list/item.d.ts +3 -0
  22. package/es/components/file-list/item.js +200 -117
  23. package/es/components/file-list/sign.js +13 -87
  24. package/es/components/file-list/signUtil.js +20 -4
  25. package/lib/components/file-list/index.d.ts +2 -0
  26. package/lib/components/file-list/index.js +38 -13
  27. package/lib/components/file-list/item.d.ts +3 -0
  28. package/lib/components/file-list/item.js +199 -116
  29. package/lib/components/file-list/sign.js +11 -85
  30. package/lib/components/file-list/signUtil.js +20 -4
  31. package/lowcode/file-list/meta.ts +29 -0
  32. package/lowcode_es/file-list/meta.js +27 -0
  33. package/lowcode_es/meta.js +1 -1
  34. package/lowcode_lib/file-list/meta.js +27 -0
  35. package/lowcode_lib/meta.js +1 -1
  36. package/package.json +3 -3
@@ -1,10 +1,10 @@
1
1
  import _Dialog from "@alifd/next/es/dialog";
2
- import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
3
- import _extends from "@babel/runtime/helpers/extends";
4
2
  import _Message from "@alifd/next/es/message";
3
+ import _extends from "@babel/runtime/helpers/extends";
4
+ import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
5
5
  import _Radio from "@alifd/next/es/radio";
6
6
  import _regeneratorRuntime from "@babel/runtime/regenerator";
7
- import React, { useEffect, useState } from 'react';
7
+ import React, { useEffect, useRef, useState } from 'react';
8
8
  import CheckedIcon from "./icon/checked.svg";
9
9
  import delIcon from "./icon/del.svg";
10
10
  import previewIcon from "./icon/preview.svg";
@@ -20,6 +20,7 @@ import SignPage from "./sign";
20
20
  import SealPage from "./seal";
21
21
  import { getMaterialLib, getGuideImg, getUrlById, onlinePreview } from "../../api";
22
22
  import { initFormat, getFileExtension } from "./file.js";
23
+ import { getSignRes } from "./signUtil";
23
24
  import { querySeal } from "./sealUtil";
24
25
  import CheckPoint from "./checkPoint";
25
26
  import SignerInfo from "./signerInfo";
@@ -33,6 +34,7 @@ var FileItem = function FileItem(_ref) {
33
34
  fileIndex = _ref.fileIndex,
34
35
  file = _ref.file,
35
36
  fileConfig = _ref.fileConfig,
37
+ fileList = _ref.fileList,
36
38
  maxFileSize = _ref.maxFileSize,
37
39
  spec = _ref.spec,
38
40
  userInfo = _ref.userInfo,
@@ -51,7 +53,9 @@ var FileItem = function FileItem(_ref) {
51
53
  closeLoading = _ref.closeLoading,
52
54
  saveSignerInfo = _ref.saveSignerInfo,
53
55
  signInfoMap = _ref.signInfoMap,
54
- applySeal = _ref.applySeal;
56
+ applySeal = _ref.applySeal,
57
+ parentPageUrl = _ref.parentPageUrl,
58
+ toSign = _ref.toSign;
55
59
  console.log('fileItem', file, maxFileSize);
56
60
  var fileName = file.fileName,
57
61
  fileUrl = file.fileUrl,
@@ -116,7 +120,7 @@ var FileItem = function FileItem(_ref) {
116
120
  // 大前提: signatureEnable 或签章能力开启
117
121
  // signerInfo 不为空 → 代办场景 → signatureAgentRole/signAgentRole 含 OTHER 则不展示
118
122
  // signerInfo 为空 → 本人场景 → signatureSelfRole/signSelfRole 含 OTHER 则不展示
119
- var _React$useState6 = React.useState(true),
123
+ var _React$useState6 = React.useState(false),
120
124
  showSignBtn = _React$useState6[0],
121
125
  setShowSignBtn = _React$useState6[1];
122
126
  React.useEffect(function () {
@@ -126,14 +130,15 @@ var FileItem = function FileItem(_ref) {
126
130
  setShowSignBtn(false);
127
131
  return;
128
132
  }
129
- // if (Object.keys(signerInfo).length) {
130
- // // 代办场景
131
- // setShowSignBtn(!((signatureAgentRole ?? []).includes(OTHER) || (signAgentRole ?? []).includes(OTHER)));
132
- // } else {
133
- // console.log('signatureSelfRole---', signatureSelfRole)
134
- // // 本人场景
135
- // setShowSignBtn(!((signatureSelfRole ?? []).includes(OTHER) || (signSelfRole ?? []).includes(OTHER)));
136
- // }
133
+ // 会签暂时不上线
134
+ if (Object.keys(signerInfo).length) {
135
+ // 代办场景
136
+ setShowSignBtn(!((signatureAgentRole !== null && signatureAgentRole !== void 0 ? signatureAgentRole : []).includes(OTHER) || (signAgentRole !== null && signAgentRole !== void 0 ? signAgentRole : []).includes(OTHER)));
137
+ } else {
138
+ console.log('signatureSelfRole---', signatureSelfRole);
139
+ // 本人场景
140
+ setShowSignBtn(!((signatureSelfRole !== null && signatureSelfRole !== void 0 ? signatureSelfRole : []).includes(OTHER) || (signSelfRole !== null && signSelfRole !== void 0 ? signSelfRole : []).includes(OTHER)));
141
+ }
137
142
  }, [signatureEnable, signEnable, userInfo, signerInfo, signatureAgentRole, signAgentRole, signatureSelfRole, signSelfRole]);
138
143
  var _useState = useState(false),
139
144
  isShowMaterialLib = _useState[0],
@@ -192,6 +197,52 @@ var FileItem = function FileItem(_ref) {
192
197
  var _useState17 = useState(true),
193
198
  showSignPageClose = _useState17[0],
194
199
  setShowSignPageClose = _useState17[1];
200
+ var timerRef = useRef(null);
201
+ var originalUrlRef = useRef('');
202
+ var getSignedFile = /*#__PURE__*/function () {
203
+ var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(documentIdVal, contractIdVal, nameVal) {
204
+ var newFile;
205
+ return _regeneratorRuntime.wrap(function (_context) {
206
+ while (1) switch (_context.prev = _context.next) {
207
+ case 0:
208
+ console.log('params---', documentIdVal, contractIdVal, nameVal, file);
209
+ _context.next = 1;
210
+ return getSignRes(documentIdVal, contractIdVal, nameVal, true, {
211
+ token: token,
212
+ tokenTY: tokenTY,
213
+ baseUrl: baseUrl,
214
+ env: env,
215
+ isPC: isPC
216
+ });
217
+ case 1:
218
+ newFile = _context.sent;
219
+ if (newFile) {
220
+ closeLoading();
221
+ sessionStorage.removeItem(tokenTY);
222
+ clearInterval(timerRef.current);
223
+ timerRef.current = null;
224
+ getRes(_extends({}, file, {
225
+ fileId: newFile.fileId,
226
+ fileName: nameVal,
227
+ fileUrl: newFile.fileUrlList[2],
228
+ originalUrl: originalUrlRef.current,
229
+ isSigned: true
230
+ }));
231
+ }
232
+ case 2:
233
+ case "end":
234
+ return _context.stop();
235
+ }
236
+ }, _callee);
237
+ }));
238
+ return function getSignedFile(_x, _x2, _x3) {
239
+ return _ref2.apply(this, arguments);
240
+ };
241
+ }();
242
+ var handleClearInterval = function handleClearInterval() {
243
+ clearInterval(timerRef.current);
244
+ timerRef.current = null;
245
+ };
195
246
  var upload = function upload() {
196
247
  if (disabled) return;
197
248
  var inputEl = document.createElement('input');
@@ -249,22 +300,22 @@ var FileItem = function FileItem(_ref) {
249
300
 
250
301
  // 预览材料
251
302
  var preview = /*#__PURE__*/function () {
252
- var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
303
+ var _ref3 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
253
304
  var urlRes, res;
254
- return _regeneratorRuntime.wrap(function (_context) {
255
- while (1) switch (_context.prev = _context.next) {
305
+ return _regeneratorRuntime.wrap(function (_context2) {
306
+ while (1) switch (_context2.prev = _context2.next) {
256
307
  case 0:
257
308
  if (fileUrl) {
258
- _context.next = 1;
309
+ _context2.next = 1;
259
310
  break;
260
311
  }
261
- return _context.abrupt("return");
312
+ return _context2.abrupt("return");
262
313
  case 1:
263
314
  console.log('fileUrl', fileUrl, fileId);
264
315
  setPreviewIframeUrl(fileUrl);
265
316
  setIsShowPreview(true);
266
317
  // if (!fileId) return;
267
- _context.next = 2;
318
+ _context2.next = 2;
268
319
  return getUrlById({
269
320
  id: fileId,
270
321
  effectiveTime: 3600000
@@ -277,12 +328,12 @@ var FileItem = function FileItem(_ref) {
277
328
  accessToken: accessToken
278
329
  });
279
330
  case 2:
280
- urlRes = _context.sent;
331
+ urlRes = _context2.sent;
281
332
  if (!(urlRes.presignedUrlList && urlRes.presignedUrlList.length > 0)) {
282
- _context.next = 4;
333
+ _context2.next = 4;
283
334
  break;
284
335
  }
285
- _context.next = 3;
336
+ _context2.next = 3;
286
337
  return onlinePreview({
287
338
  url: urlRes.presignedUrlList[2]
288
339
  }, {
@@ -294,41 +345,41 @@ var FileItem = function FileItem(_ref) {
294
345
  accessToken: accessToken
295
346
  });
296
347
  case 3:
297
- res = _context.sent;
348
+ res = _context2.sent;
298
349
  setPreviewIframeUrl(res.url);
299
350
  setIsShowPreview(true);
300
351
  case 4:
301
352
  case "end":
302
- return _context.stop();
353
+ return _context2.stop();
303
354
  }
304
- }, _callee);
355
+ }, _callee2);
305
356
  }));
306
357
  return function preview() {
307
- return _ref2.apply(this, arguments);
358
+ return _ref3.apply(this, arguments);
308
359
  };
309
360
  }();
310
361
 
311
362
  // 预览材料库中的材料
312
363
  var previewMaterial = /*#__PURE__*/function () {
313
- var _ref3 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2(id, url) {
364
+ var _ref4 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee3(id, url) {
314
365
  var materialUrl, urlRes;
315
- return _regeneratorRuntime.wrap(function (_context2) {
316
- while (1) switch (_context2.prev = _context2.next) {
366
+ return _regeneratorRuntime.wrap(function (_context3) {
367
+ while (1) switch (_context3.prev = _context3.next) {
317
368
  case 0:
318
369
  if (!materialUrlMap[id]) {
319
- _context2.next = 1;
370
+ _context3.next = 1;
320
371
  break;
321
372
  }
322
373
  setIsShowMaterialPreview(true);
323
374
  setMaterialPreviewUrl(materialUrlMap[id]);
324
- return _context2.abrupt("return");
375
+ return _context3.abrupt("return");
325
376
  case 1:
326
377
  materialUrl = url;
327
378
  if (materialUrl) {
328
- _context2.next = 3;
379
+ _context3.next = 3;
329
380
  break;
330
381
  }
331
- _context2.next = 2;
382
+ _context3.next = 2;
332
383
  return getUrlById({
333
384
  id: id,
334
385
  effectiveTime: 3600000
@@ -341,7 +392,7 @@ var FileItem = function FileItem(_ref) {
341
392
  accessToken: accessToken
342
393
  });
343
394
  case 2:
344
- urlRes = _context2.sent;
395
+ urlRes = _context3.sent;
345
396
  if (urlRes.presignedUrlList && urlRes.presignedUrlList.length > 0) {
346
397
  materialUrl = urlRes.presignedUrlList[2];
347
398
  }
@@ -361,12 +412,12 @@ var FileItem = function FileItem(_ref) {
361
412
  });
362
413
  case 4:
363
414
  case "end":
364
- return _context2.stop();
415
+ return _context3.stop();
365
416
  }
366
- }, _callee2);
417
+ }, _callee3);
367
418
  }));
368
- return function previewMaterial(_x, _x2) {
369
- return _ref3.apply(this, arguments);
419
+ return function previewMaterial(_x4, _x5) {
420
+ return _ref4.apply(this, arguments);
370
421
  };
371
422
  }();
372
423
 
@@ -383,22 +434,22 @@ var FileItem = function FileItem(_ref) {
383
434
 
384
435
  // 签章
385
436
  var seal = /*#__PURE__*/function () {
386
- var _ref4 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee3() {
437
+ var _ref5 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee4() {
387
438
  var type, sealList;
388
- return _regeneratorRuntime.wrap(function (_context3) {
389
- while (1) switch (_context3.prev = _context3.next) {
439
+ return _regeneratorRuntime.wrap(function (_context4) {
440
+ while (1) switch (_context4.prev = _context4.next) {
390
441
  case 0:
391
442
  type = getFileExtension(fileName);
392
443
  if (!(type !== 'pdf')) {
393
- _context3.next = 1;
444
+ _context4.next = 1;
394
445
  break;
395
446
  }
396
447
  _Message.notice('只有pdf文件才能使用电子签章');
397
- return _context3.abrupt("return");
448
+ return _context4.abrupt("return");
398
449
  case 1:
399
450
  openLoading();
400
451
  // 查询当前用户是否有电子签章
401
- _context3.next = 2;
452
+ _context4.next = 2;
402
453
  return querySeal(userInfo, {
403
454
  token: token,
404
455
  tokenTY: tokenTY,
@@ -408,9 +459,9 @@ var FileItem = function FileItem(_ref) {
408
459
  accessToken: accessToken
409
460
  });
410
461
  case 2:
411
- sealList = _context3.sent;
462
+ sealList = _context4.sent;
412
463
  if (!(userInfo.corpType === 'C04')) {
413
- _context3.next = 3;
464
+ _context4.next = 3;
414
465
  break;
415
466
  }
416
467
  if (sealList.length) {
@@ -458,25 +509,25 @@ var FileItem = function FileItem(_ref) {
458
509
  }
459
510
  });
460
511
  }
461
- return _context3.abrupt("return");
512
+ return _context4.abrupt("return");
462
513
  case 3:
463
514
  if (sealList.length) {
464
- _context3.next = 4;
515
+ _context4.next = 4;
465
516
  break;
466
517
  }
467
518
  _Message.error('该单位下暂无印章,请前往"山西政务服务网"或"三晋通"小程序申领印章');
468
519
  closeLoading();
469
- return _context3.abrupt("return");
520
+ return _context4.abrupt("return");
470
521
  case 4:
471
522
  setIsShowSealPage(true);
472
523
  case 5:
473
524
  case "end":
474
- return _context3.stop();
525
+ return _context4.stop();
475
526
  }
476
- }, _callee3);
527
+ }, _callee4);
477
528
  }));
478
529
  return function seal() {
479
- return _ref4.apply(this, arguments);
530
+ return _ref5.apply(this, arguments);
480
531
  };
481
532
  }();
482
533
  var signAndSeal = function signAndSeal() {
@@ -506,12 +557,13 @@ var FileItem = function FileItem(_ref) {
506
557
  // 获取签pi结果
507
558
  var getRes = function getRes(val) {
508
559
  console.log('val---', val);
560
+ localStorage.removeItem(tokenTY);
509
561
  if (val.signId) {
510
562
  delete val.signId;
511
563
  }
512
564
  valChange(val, fileIndex, index, subIndex);
513
565
  // invalidHandle()
514
- needOtherSign && setShowSignerInfo(true);
566
+ // needOtherSign && setShowSignerInfo(true)
515
567
  };
516
568
 
517
569
  // 获取签章结果
@@ -528,7 +580,7 @@ var FileItem = function FileItem(_ref) {
528
580
  }
529
581
  valChange(val, fileIndex, index, subIndex);
530
582
  // invalidHandle()
531
- needOtherSign && setShowSignerInfo(true);
583
+ // needOtherSign && setShowSignerInfo(true)
532
584
  }
533
585
  };
534
586
  var queryFileLibs = function queryFileLibs() {
@@ -568,18 +620,18 @@ var FileItem = function FileItem(_ref) {
568
620
  queryFileLibs();
569
621
  };
570
622
  var showGuide = /*#__PURE__*/function () {
571
- var _ref5 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee4() {
623
+ var _ref6 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee5() {
572
624
  var guideImgRes;
573
- return _regeneratorRuntime.wrap(function (_context4) {
574
- while (1) switch (_context4.prev = _context4.next) {
625
+ return _regeneratorRuntime.wrap(function (_context5) {
626
+ while (1) switch (_context5.prev = _context5.next) {
575
627
  case 0:
576
628
  if (signGuidFileId) {
577
- _context4.next = 1;
629
+ _context5.next = 1;
578
630
  break;
579
631
  }
580
- return _context4.abrupt("return");
632
+ return _context5.abrupt("return");
581
633
  case 1:
582
- _context4.next = 2;
634
+ _context5.next = 2;
583
635
  return getGuideImg({
584
636
  id: signGuidFileId,
585
637
  effectiveTime: 3600000
@@ -592,26 +644,26 @@ var FileItem = function FileItem(_ref) {
592
644
  accessToken: accessToken
593
645
  });
594
646
  case 2:
595
- guideImgRes = _context4.sent;
647
+ guideImgRes = _context5.sent;
596
648
  if (guideImgRes.presignedUrlList.length && guideImgRes.presignedUrlList[2]) {
597
649
  setGuideurl(guideImgRes.presignedUrlList[2]);
598
650
  setIsShowGuide(true);
599
651
  }
600
652
  case 3:
601
653
  case "end":
602
- return _context4.stop();
654
+ return _context5.stop();
603
655
  }
604
- }, _callee4);
656
+ }, _callee5);
605
657
  }));
606
658
  return function showGuide() {
607
- return _ref5.apply(this, arguments);
659
+ return _ref6.apply(this, arguments);
608
660
  };
609
661
  }();
610
662
  var selectMaterialOk = /*#__PURE__*/function () {
611
- var _ref6 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee5() {
663
+ var _ref7 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee6() {
612
664
  var selectedMaterial, arr, fileFormat, formatFinal, urlRes, m;
613
- return _regeneratorRuntime.wrap(function (_context5) {
614
- while (1) switch (_context5.prev = _context5.next) {
665
+ return _regeneratorRuntime.wrap(function (_context6) {
666
+ while (1) switch (_context6.prev = _context6.next) {
615
667
  case 0:
616
668
  console.log('val', materialId);
617
669
  console.log('materialLib==', materialLib);
@@ -620,7 +672,7 @@ var FileItem = function FileItem(_ref) {
620
672
  });
621
673
  console.log('selectedMaterial', selectedMaterial);
622
674
  if (!spec) {
623
- _context5.next = 1;
675
+ _context6.next = 1;
624
676
  break;
625
677
  }
626
678
  arr = selectedMaterial.fileName.split('.'); //
@@ -629,24 +681,24 @@ var FileItem = function FileItem(_ref) {
629
681
  formatFinal = initFormat(spec); // 限制的文件类型
630
682
  console.log(formatFinal, '限制的格式最后');
631
683
  if (formatFinal.includes(fileFormat)) {
632
- _context5.next = 1;
684
+ _context6.next = 1;
633
685
  break;
634
686
  }
635
687
  _Message.notice("\u8BE5\u6750\u6599\u4E0D\u652F\u6301\u4E0A\u4F20\u3010" + fileFormat + "\u3011\u683C\u5F0F\u7684\u6587\u4EF6");
636
- return _context5.abrupt("return");
688
+ return _context6.abrupt("return");
637
689
  case 1:
638
690
  if (!(selectedMaterial.type === 1)) {
639
- _context5.next = 2;
691
+ _context6.next = 2;
640
692
  break;
641
693
  }
642
694
  _Message.notice('该文件为旧文件, 请先下载后手动上传');
643
- return _context5.abrupt("return");
695
+ return _context6.abrupt("return");
644
696
  case 2:
645
697
  if (selectedMaterial.innerFileUrl) {
646
- _context5.next = 4;
698
+ _context6.next = 4;
647
699
  break;
648
700
  }
649
- _context5.next = 3;
701
+ _context6.next = 3;
650
702
  return getUrlById({
651
703
  id: selectedMaterial.fileId,
652
704
  effectiveTime: 3600000
@@ -659,7 +711,7 @@ var FileItem = function FileItem(_ref) {
659
711
  accessToken: accessToken
660
712
  });
661
713
  case 3:
662
- urlRes = _context5.sent;
714
+ urlRes = _context6.sent;
663
715
  if (urlRes.presignedUrlList && urlRes.presignedUrlList.length > 0) {
664
716
  selectedMaterial.innerFileUrl = urlRes.presignedUrlList[2];
665
717
  }
@@ -672,12 +724,12 @@ var FileItem = function FileItem(_ref) {
672
724
  setIsShowMaterialLib(false);
673
725
  case 5:
674
726
  case "end":
675
- return _context5.stop();
727
+ return _context6.stop();
676
728
  }
677
- }, _callee5);
729
+ }, _callee6);
678
730
  }));
679
731
  return function selectMaterialOk() {
680
- return _ref6.apply(this, arguments);
732
+ return _ref7.apply(this, arguments);
681
733
  };
682
734
  }();
683
735
  var onDownload = function onDownload() {
@@ -698,26 +750,26 @@ var FileItem = function FileItem(_ref) {
698
750
  }
699
751
  };
700
752
  var handleDel = /*#__PURE__*/function () {
701
- var _ref7 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee6() {
702
- return _regeneratorRuntime.wrap(function (_context6) {
703
- while (1) switch (_context6.prev = _context6.next) {
753
+ var _ref8 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee7() {
754
+ return _regeneratorRuntime.wrap(function (_context7) {
755
+ while (1) switch (_context7.prev = _context7.next) {
704
756
  case 0:
705
757
  if (!disabled) {
706
- _context6.next = 1;
758
+ _context7.next = 1;
707
759
  break;
708
760
  }
709
- return _context6.abrupt("return");
761
+ return _context7.abrupt("return");
710
762
  case 1:
711
763
  // invalidHandle()
712
764
  valChange(undefined, fileIndex, index, subIndex);
713
765
  case 2:
714
766
  case "end":
715
- return _context6.stop();
767
+ return _context7.stop();
716
768
  }
717
- }, _callee6);
769
+ }, _callee7);
718
770
  }));
719
771
  return function handleDel() {
720
- return _ref7.apply(this, arguments);
772
+ return _ref8.apply(this, arguments);
721
773
  };
722
774
  }();
723
775
  useEffect(function () {
@@ -735,58 +787,58 @@ var FileItem = function FileItem(_ref) {
735
787
 
736
788
  // 获取缩略图
737
789
  var extractImageUrls = /*#__PURE__*/function () {
738
- var _ref8 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee7(previewUrl) {
790
+ var _ref9 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee8(previewUrl) {
739
791
  var response, htmlText, parser, doc, imgElements, srcList;
740
- return _regeneratorRuntime.wrap(function (_context7) {
741
- while (1) switch (_context7.prev = _context7.next) {
792
+ return _regeneratorRuntime.wrap(function (_context8) {
793
+ while (1) switch (_context8.prev = _context8.next) {
742
794
  case 0:
743
- _context7.next = 1;
795
+ _context8.next = 1;
744
796
  return fetch(previewUrl);
745
797
  case 1:
746
- response = _context7.sent;
747
- _context7.next = 2;
798
+ response = _context8.sent;
799
+ _context8.next = 2;
748
800
  return response.text();
749
801
  case 2:
750
- htmlText = _context7.sent;
802
+ htmlText = _context8.sent;
751
803
  parser = new DOMParser();
752
804
  doc = parser.parseFromString(htmlText, 'text/html');
753
805
  imgElements = doc.querySelectorAll('img');
754
806
  srcList = Array.from(imgElements).map(function (img) {
755
807
  return img.getAttribute('data-src');
756
808
  });
757
- return _context7.abrupt("return", srcList);
809
+ return _context8.abrupt("return", srcList);
758
810
  case 3:
759
811
  case "end":
760
- return _context7.stop();
812
+ return _context8.stop();
761
813
  }
762
- }, _callee7);
814
+ }, _callee8);
763
815
  }));
764
- return function extractImageUrls(_x3) {
765
- return _ref8.apply(this, arguments);
816
+ return function extractImageUrls(_x6) {
817
+ return _ref9.apply(this, arguments);
766
818
  };
767
819
  }();
768
820
 
769
821
  // 获取预览图片
770
822
  var getViewUrl = /*#__PURE__*/function () {
771
- var _ref9 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee8(id) {
823
+ var _ref0 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee9(id) {
772
824
  var type, urlRes, res, list;
773
- return _regeneratorRuntime.wrap(function (_context8) {
774
- while (1) switch (_context8.prev = _context8.next) {
825
+ return _regeneratorRuntime.wrap(function (_context9) {
826
+ while (1) switch (_context9.prev = _context9.next) {
775
827
  case 0:
776
828
  type = getFileExtension(fileName);
777
829
  if (!['png', 'jpg', 'jpeg'].includes(type)) {
778
- _context8.next = 1;
830
+ _context9.next = 1;
779
831
  break;
780
832
  }
781
- return _context8.abrupt("return", fileUrl);
833
+ return _context9.abrupt("return", fileUrl);
782
834
  case 1:
783
835
  if (!(type !== 'pdf')) {
784
- _context8.next = 2;
836
+ _context9.next = 2;
785
837
  break;
786
838
  }
787
- return _context8.abrupt("return", '');
839
+ return _context9.abrupt("return", '');
788
840
  case 2:
789
- _context8.next = 3;
841
+ _context9.next = 3;
790
842
  return getUrlById({
791
843
  id: id,
792
844
  effectiveTime: 3600000
@@ -799,13 +851,13 @@ var FileItem = function FileItem(_ref) {
799
851
  accessToken: accessToken
800
852
  });
801
853
  case 3:
802
- urlRes = _context8.sent;
854
+ urlRes = _context9.sent;
803
855
  if (!(urlRes.presignedUrlList && urlRes.presignedUrlList.length > 0)) {
804
- _context8.next = 6;
856
+ _context9.next = 6;
805
857
  break;
806
858
  }
807
859
  console.log('urlRes', urlRes);
808
- _context8.next = 4;
860
+ _context9.next = 4;
809
861
  return onlinePreview({
810
862
  url: urlRes.presignedUrlList[2]
811
863
  }, {
@@ -817,21 +869,21 @@ var FileItem = function FileItem(_ref) {
817
869
  accessToken: accessToken
818
870
  });
819
871
  case 4:
820
- res = _context8.sent;
821
- _context8.next = 5;
872
+ res = _context9.sent;
873
+ _context9.next = 5;
822
874
  return extractImageUrls(res.url);
823
875
  case 5:
824
- list = _context8.sent;
876
+ list = _context9.sent;
825
877
  console.log('list---111111', list);
826
- return _context8.abrupt("return", list[0]);
878
+ return _context9.abrupt("return", list[0]);
827
879
  case 6:
828
880
  case "end":
829
- return _context8.stop();
881
+ return _context9.stop();
830
882
  }
831
- }, _callee8);
883
+ }, _callee9);
832
884
  }));
833
- return function getViewUrl(_x4) {
834
- return _ref9.apply(this, arguments);
885
+ return function getViewUrl(_x7) {
886
+ return _ref0.apply(this, arguments);
835
887
  };
836
888
  }();
837
889
  useEffect(function () {
@@ -842,6 +894,34 @@ var FileItem = function FileItem(_ref) {
842
894
  });
843
895
  }
844
896
  }, [fileId]);
897
+ useEffect(function () {
898
+ try {
899
+ var stored = sessionStorage.getItem(tokenTY);
900
+ if (stored) {
901
+ console.log('stored---', stored);
902
+ var _JSON$parse = JSON.parse(stored),
903
+ contrId = _JSON$parse.contractId,
904
+ docId = _JSON$parse.documentId,
905
+ nameVal = _JSON$parse.fileName,
906
+ storedFileId = _JSON$parse.fileId,
907
+ originalUrl = _JSON$parse.fileUrl;
908
+ console.log('docId', docId, contrId, nameVal);
909
+ if (storedFileId !== fileId) return;
910
+ originalUrlRef.current = originalUrl || '';
911
+ if (docId && contrId && nameVal && !timerRef.current) {
912
+ handleClearInterval();
913
+ openLoading();
914
+ timerRef.current = setInterval(function () {
915
+ console.log('docId---', docId, contrId, nameVal);
916
+ getSignedFile(docId, contrId, nameVal);
917
+ }, 3000);
918
+ }
919
+ }
920
+ } catch (e) {}
921
+ return function () {
922
+ handleClearInterval();
923
+ };
924
+ }, []);
845
925
  return /*#__PURE__*/React.createElement("div", {
846
926
  className: "file_item",
847
927
  style: style
@@ -1034,6 +1114,9 @@ var FileItem = function FileItem(_ref) {
1034
1114
  isShowSignPage: isShowSignPage,
1035
1115
  userInfo: userInfo,
1036
1116
  file: sealedFile || file,
1117
+ fileList: fileList,
1118
+ parentPageUrl: parentPageUrl,
1119
+ toSign: toSign,
1037
1120
  token: token,
1038
1121
  tokenTY: tokenTY,
1039
1122
  baseUrl: baseUrl,