ydb-components-material 0.1.115 → 0.1.117

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 (41) 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.4643e826.js → umi.43c50c6a.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/meta.js +1 -1
  14. package/build/lowcode/render/default/view.js +1 -1
  15. package/build/lowcode/view.js +1 -1
  16. package/dist/BizComps.js +10 -10
  17. package/dist/BizComps.js.map +1 -1
  18. package/es/components/file-list/index.d.ts +1 -0
  19. package/es/components/file-list/index.js +3 -0
  20. package/es/components/file-list/item.d.ts +1 -0
  21. package/es/components/file-list/item.js +174 -66
  22. package/es/components/file-list/seal.js +3 -1
  23. package/es/components/file-list/sealUtil.js +51 -37
  24. package/es/components/file-list/signerInfo.js +64 -5
  25. package/es/components/sign-file/index.js +10 -1
  26. package/es/style.js +1 -1
  27. package/lib/components/file-list/index.d.ts +1 -0
  28. package/lib/components/file-list/index.js +3 -0
  29. package/lib/components/file-list/item.d.ts +1 -0
  30. package/lib/components/file-list/item.js +174 -66
  31. package/lib/components/file-list/seal.js +3 -1
  32. package/lib/components/file-list/sealUtil.js +53 -36
  33. package/lib/components/file-list/signerInfo.js +64 -5
  34. package/lib/components/sign-file/index.js +10 -1
  35. package/lib/style.js +1 -1
  36. package/lowcode/file-list/meta.ts +14 -0
  37. package/lowcode_es/file-list/meta.js +13 -0
  38. package/lowcode_es/meta.js +1 -1
  39. package/lowcode_lib/file-list/meta.js +13 -0
  40. package/lowcode_lib/meta.js +1 -1
  41. package/package.json +3 -3
@@ -18,6 +18,7 @@ export interface FileListProps {
18
18
  download: (value: any) => void;
19
19
  openLoading: () => void;
20
20
  closeLoading: () => void;
21
+ applySeal: () => void;
21
22
  valChange: (value: any) => void;
22
23
  saveSignerInfo: (value: any) => boolean;
23
24
  signInfoMap?: object;
@@ -48,6 +48,7 @@ var FileList = function FileList(_ref) {
48
48
  closeLoading = _ref.closeLoading,
49
49
  valChange = _ref.valChange,
50
50
  saveSignerInfo = _ref.saveSignerInfo,
51
+ applySeal = _ref.applySeal,
51
52
  signInfoMap = _ref.signInfoMap;
52
53
  var _useState = useState(false),
53
54
  showMerge = _useState[0],
@@ -295,6 +296,7 @@ var FileList = function FileList(_ref) {
295
296
  signInfoMap: signInfoMap,
296
297
  disabled: disabled,
297
298
  download: download,
299
+ applySeal: applySeal,
298
300
  valChange: handleChange,
299
301
  openLoading: openLoading,
300
302
  closeLoading: closeLoading,
@@ -325,6 +327,7 @@ var FileList = function FileList(_ref) {
325
327
  isPC: isPC,
326
328
  disabled: disabled,
327
329
  download: download,
330
+ applySeal: applySeal,
328
331
  valChange: handleChange,
329
332
  openLoading: openLoading,
330
333
  closeLoading: closeLoading,
@@ -20,6 +20,7 @@ export interface FileItemProps {
20
20
  style?: object;
21
21
  signerInfo?: object;
22
22
  openLoading: () => void;
23
+ applySeal: () => void;
23
24
  closeLoading: () => void;
24
25
  valChange: (value: any, fileIndex: any, index: any, subIndex: any) => void;
25
26
  download: (value: any) => void;
@@ -1,3 +1,4 @@
1
+ import _Dialog from "@alifd/next/es/dialog";
1
2
  import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
2
3
  import _extends from "@babel/runtime/helpers/extends";
3
4
  import _Message from "@alifd/next/es/message";
@@ -19,6 +20,7 @@ import SignPage from "./sign";
19
20
  import SealPage from "./seal";
20
21
  import { getMaterialLib, getGuideImg, getUrlById, onlinePreview } from "../../api";
21
22
  import { initFormat, getFileExtension } from "./file.js";
23
+ import { querySeal } from "./sealUtil";
22
24
  import CheckPoint from "./checkPoint";
23
25
  import SignerInfo from "./signerInfo";
24
26
  import "./item.scss";
@@ -48,7 +50,8 @@ var FileItem = function FileItem(_ref) {
48
50
  openLoading = _ref.openLoading,
49
51
  closeLoading = _ref.closeLoading,
50
52
  saveSignerInfo = _ref.saveSignerInfo,
51
- signInfoMap = _ref.signInfoMap;
53
+ signInfoMap = _ref.signInfoMap,
54
+ applySeal = _ref.applySeal;
52
55
  console.log('fileItem', file, maxFileSize);
53
56
  var fileName = file.fileName,
54
57
  fileUrl = file.fileUrl,
@@ -71,7 +74,10 @@ var FileItem = function FileItem(_ref) {
71
74
  _fileConfig$signSelfR = fileConfig.signSelfRole,
72
75
  signSelfRole = _fileConfig$signSelfR === void 0 ? [] : _fileConfig$signSelfR,
73
76
  _fileConfig$signAgent = fileConfig.signAgentRole,
74
- signAgentRole = _fileConfig$signAgent === void 0 ? [] : _fileConfig$signAgent;
77
+ signAgentRole = _fileConfig$signAgent === void 0 ? [] : _fileConfig$signAgent,
78
+ sealKeywords = fileConfig.sealKeywords,
79
+ sealPosition = fileConfig.sealPosition,
80
+ sealContent = fileConfig.sealContent;
75
81
 
76
82
  // 解构默认值只对 undefined 生效,对 null 无效,手动兜底
77
83
  var safeSignatureSelfRole = signatureSelfRole !== null && signatureSelfRole !== void 0 ? signatureSelfRole : [];
@@ -141,6 +147,9 @@ var FileItem = function FileItem(_ref) {
141
147
  var _useState16 = useState(false),
142
148
  showSignerInfo = _useState16[0],
143
149
  setShowSignerInfo = _useState16[1];
150
+ var _useState17 = useState(true),
151
+ showSignPageClose = _useState17[0],
152
+ setShowSignPageClose = _useState17[1];
144
153
  var upload = function upload() {
145
154
  if (disabled) return;
146
155
  var inputEl = document.createElement('input');
@@ -321,20 +330,112 @@ var FileItem = function FileItem(_ref) {
321
330
 
322
331
  // 手写签批
323
332
  var sign = function sign() {
333
+ if (!signatureEnable) {
334
+ closeLoading();
335
+ return;
336
+ }
337
+ ;
324
338
  openLoading();
325
339
  setIsShowSignPage(true);
326
340
  };
327
341
 
328
342
  // 签章
329
- var seal = function seal() {
330
- var type = getFileExtension(fileName);
331
- if (type !== 'pdf') {
332
- _Message.notice('只有pdf文件才能使用电子签章');
333
- return;
334
- }
335
- openLoading();
336
- setIsShowSealPage(true);
337
- };
343
+ var seal = /*#__PURE__*/function () {
344
+ var _ref4 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee3() {
345
+ var type, sealList;
346
+ return _regeneratorRuntime.wrap(function (_context3) {
347
+ while (1) switch (_context3.prev = _context3.next) {
348
+ case 0:
349
+ type = getFileExtension(fileName);
350
+ if (!(type !== 'pdf')) {
351
+ _context3.next = 1;
352
+ break;
353
+ }
354
+ _Message.notice('只有pdf文件才能使用电子签章');
355
+ return _context3.abrupt("return");
356
+ case 1:
357
+ openLoading();
358
+ // 查询当前用户是否有电子签章
359
+ _context3.next = 2;
360
+ return querySeal(userInfo, {
361
+ token: token,
362
+ tokenTY: tokenTY,
363
+ baseUrl: baseUrl,
364
+ env: env,
365
+ isPC: isPC,
366
+ accessToken: accessToken
367
+ });
368
+ case 2:
369
+ sealList = _context3.sent;
370
+ if (!(userInfo.corpType === 'C04')) {
371
+ _context3.next = 3;
372
+ break;
373
+ }
374
+ if (sealList.length) {
375
+ // 有印章 → 对话框提示,可跳过走签批
376
+ _Dialog.confirm({
377
+ title: '提示',
378
+ footerAlign: 'center',
379
+ content: '本份材料可豁免签章流程,完成电子签名即可,是否确认跳过签章?',
380
+ okProps: {
381
+ children: '继续签章'
382
+ },
383
+ cancelProps: {
384
+ children: '跳过签章'
385
+ },
386
+ onOk: function onOk() {
387
+ setIsShowSealPage(true);
388
+ },
389
+ onCancel: function onCancel() {
390
+ sign();
391
+ },
392
+ onClose: function onClose() {
393
+ closeLoading();
394
+ }
395
+ });
396
+ } else {
397
+ // 无印章 → 对话框提示,可申请印章或跳过走签批
398
+ _Dialog.confirm({
399
+ title: '提示',
400
+ content: '经检测,本账户暂未申请企业印章,办理时可选择跳过签章流程完成签名;也可办好印章后再来办理此项业务',
401
+ footerAlign: 'center',
402
+ okProps: {
403
+ children: '申请印章'
404
+ },
405
+ cancelProps: {
406
+ children: '跳过签章'
407
+ },
408
+ onOk: function onOk() {
409
+ applySeal();
410
+ },
411
+ onCancel: function onCancel() {
412
+ sign();
413
+ },
414
+ onClose: function onClose() {
415
+ closeLoading();
416
+ }
417
+ });
418
+ }
419
+ return _context3.abrupt("return");
420
+ case 3:
421
+ if (sealList.length) {
422
+ _context3.next = 4;
423
+ break;
424
+ }
425
+ _Message.error('该单位下暂无印章,请前往"山西政务服务网"或"三晋通"小程序申领印章');
426
+ return _context3.abrupt("return");
427
+ case 4:
428
+ setIsShowSealPage(true);
429
+ case 5:
430
+ case "end":
431
+ return _context3.stop();
432
+ }
433
+ }, _callee3);
434
+ }));
435
+ return function seal() {
436
+ return _ref4.apply(this, arguments);
437
+ };
438
+ }();
338
439
  var signAndSeal = function signAndSeal() {
339
440
  // const notNeedSelfSign = !signatureSelfRole.includes(SELF) && !signatureAgentRole.includes(SELF) && !signSelfRole.includes(SELF) && !signAgentRole.includes(SELF)
340
441
  // // 如果不需要自己签署 只需要别人签署 就直接打开维护签署人信息
@@ -363,6 +464,7 @@ var FileItem = function FileItem(_ref) {
363
464
  // 如果还允许签批 就连住一起做了
364
465
  if (signatureEnable) {
365
466
  setSealedFile(val);
467
+ setShowSignPageClose(false); // 签章完之后就不展示签批页面的关闭按钮了。防止用户误点击退出去
366
468
  sign();
367
469
  } else {
368
470
  valChange(val, fileIndex, index, subIndex);
@@ -406,18 +508,18 @@ var FileItem = function FileItem(_ref) {
406
508
  queryFileLibs();
407
509
  };
408
510
  var showGuide = /*#__PURE__*/function () {
409
- var _ref4 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee3() {
511
+ var _ref5 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee4() {
410
512
  var guideImgRes;
411
- return _regeneratorRuntime.wrap(function (_context3) {
412
- while (1) switch (_context3.prev = _context3.next) {
513
+ return _regeneratorRuntime.wrap(function (_context4) {
514
+ while (1) switch (_context4.prev = _context4.next) {
413
515
  case 0:
414
516
  if (signGuidFileId) {
415
- _context3.next = 1;
517
+ _context4.next = 1;
416
518
  break;
417
519
  }
418
- return _context3.abrupt("return");
520
+ return _context4.abrupt("return");
419
521
  case 1:
420
- _context3.next = 2;
522
+ _context4.next = 2;
421
523
  return getGuideImg({
422
524
  id: signGuidFileId,
423
525
  effectiveTime: 3600000
@@ -430,26 +532,26 @@ var FileItem = function FileItem(_ref) {
430
532
  accessToken: accessToken
431
533
  });
432
534
  case 2:
433
- guideImgRes = _context3.sent;
535
+ guideImgRes = _context4.sent;
434
536
  if (guideImgRes.presignedUrl) {
435
537
  setGuideurl(guideImgRes.presignedUrl);
436
538
  setIsShowGuide(true);
437
539
  }
438
540
  case 3:
439
541
  case "end":
440
- return _context3.stop();
542
+ return _context4.stop();
441
543
  }
442
- }, _callee3);
544
+ }, _callee4);
443
545
  }));
444
546
  return function showGuide() {
445
- return _ref4.apply(this, arguments);
547
+ return _ref5.apply(this, arguments);
446
548
  };
447
549
  }();
448
550
  var selectMaterialOk = /*#__PURE__*/function () {
449
- var _ref5 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee4() {
551
+ var _ref6 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee5() {
450
552
  var selectedMaterial, arr, fileFormat, formatFinal, urlRes, m;
451
- return _regeneratorRuntime.wrap(function (_context4) {
452
- while (1) switch (_context4.prev = _context4.next) {
553
+ return _regeneratorRuntime.wrap(function (_context5) {
554
+ while (1) switch (_context5.prev = _context5.next) {
453
555
  case 0:
454
556
  console.log('val', materialId);
455
557
  console.log('materialLib==', materialLib);
@@ -458,7 +560,7 @@ var FileItem = function FileItem(_ref) {
458
560
  });
459
561
  console.log('selectedMaterial', selectedMaterial);
460
562
  if (!spec) {
461
- _context4.next = 1;
563
+ _context5.next = 1;
462
564
  break;
463
565
  }
464
566
  arr = selectedMaterial.fileName.split('.'); //
@@ -467,24 +569,24 @@ var FileItem = function FileItem(_ref) {
467
569
  formatFinal = initFormat(spec); // 限制的文件类型
468
570
  console.log(formatFinal, '限制的格式最后');
469
571
  if (formatFinal.includes(fileFormat)) {
470
- _context4.next = 1;
572
+ _context5.next = 1;
471
573
  break;
472
574
  }
473
575
  _Message.notice("\u8BE5\u6750\u6599\u4E0D\u652F\u6301\u4E0A\u4F20\u3010" + fileFormat + "\u3011\u683C\u5F0F\u7684\u6587\u4EF6");
474
- return _context4.abrupt("return");
576
+ return _context5.abrupt("return");
475
577
  case 1:
476
578
  if (!(selectedMaterial.type === 1)) {
477
- _context4.next = 2;
579
+ _context5.next = 2;
478
580
  break;
479
581
  }
480
582
  _Message.notice('该文件为旧文件, 请先下载后手动上传');
481
- return _context4.abrupt("return");
583
+ return _context5.abrupt("return");
482
584
  case 2:
483
585
  if (selectedMaterial.innerFileUrl) {
484
- _context4.next = 4;
586
+ _context5.next = 4;
485
587
  break;
486
588
  }
487
- _context4.next = 3;
589
+ _context5.next = 3;
488
590
  return getUrlById({
489
591
  id: selectedMaterial.fileId,
490
592
  effectiveTime: 3600000
@@ -497,7 +599,7 @@ var FileItem = function FileItem(_ref) {
497
599
  accessToken: accessToken
498
600
  });
499
601
  case 3:
500
- urlRes = _context4.sent;
602
+ urlRes = _context5.sent;
501
603
  if (urlRes.presignedUrlList && urlRes.presignedUrlList.length > 0) {
502
604
  selectedMaterial.innerFileUrl = urlRes.presignedUrlList[2];
503
605
  }
@@ -510,12 +612,12 @@ var FileItem = function FileItem(_ref) {
510
612
  setIsShowMaterialLib(false);
511
613
  case 5:
512
614
  case "end":
513
- return _context4.stop();
615
+ return _context5.stop();
514
616
  }
515
- }, _callee4);
617
+ }, _callee5);
516
618
  }));
517
619
  return function selectMaterialOk() {
518
- return _ref5.apply(this, arguments);
620
+ return _ref6.apply(this, arguments);
519
621
  };
520
622
  }();
521
623
  var onDownload = function onDownload() {
@@ -545,58 +647,58 @@ var FileItem = function FileItem(_ref) {
545
647
 
546
648
  // 获取缩略图
547
649
  var extractImageUrls = /*#__PURE__*/function () {
548
- var _ref6 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee5(previewUrl) {
650
+ var _ref7 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee6(previewUrl) {
549
651
  var response, htmlText, parser, doc, imgElements, srcList;
550
- return _regeneratorRuntime.wrap(function (_context5) {
551
- while (1) switch (_context5.prev = _context5.next) {
652
+ return _regeneratorRuntime.wrap(function (_context6) {
653
+ while (1) switch (_context6.prev = _context6.next) {
552
654
  case 0:
553
- _context5.next = 1;
655
+ _context6.next = 1;
554
656
  return fetch(previewUrl);
555
657
  case 1:
556
- response = _context5.sent;
557
- _context5.next = 2;
658
+ response = _context6.sent;
659
+ _context6.next = 2;
558
660
  return response.text();
559
661
  case 2:
560
- htmlText = _context5.sent;
662
+ htmlText = _context6.sent;
561
663
  parser = new DOMParser();
562
664
  doc = parser.parseFromString(htmlText, 'text/html');
563
665
  imgElements = doc.querySelectorAll('img');
564
666
  srcList = Array.from(imgElements).map(function (img) {
565
667
  return img.getAttribute('data-src');
566
668
  });
567
- return _context5.abrupt("return", srcList);
669
+ return _context6.abrupt("return", srcList);
568
670
  case 3:
569
671
  case "end":
570
- return _context5.stop();
672
+ return _context6.stop();
571
673
  }
572
- }, _callee5);
674
+ }, _callee6);
573
675
  }));
574
676
  return function extractImageUrls(_x3) {
575
- return _ref6.apply(this, arguments);
677
+ return _ref7.apply(this, arguments);
576
678
  };
577
679
  }();
578
680
 
579
681
  // 获取预览图片
580
682
  var getViewUrl = /*#__PURE__*/function () {
581
- var _ref7 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee6(id) {
683
+ var _ref8 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee7(id) {
582
684
  var type, urlRes, res, list;
583
- return _regeneratorRuntime.wrap(function (_context6) {
584
- while (1) switch (_context6.prev = _context6.next) {
685
+ return _regeneratorRuntime.wrap(function (_context7) {
686
+ while (1) switch (_context7.prev = _context7.next) {
585
687
  case 0:
586
688
  type = getFileExtension(fileName);
587
689
  if (!['png', 'jpg', 'jpeg'].includes(type)) {
588
- _context6.next = 1;
690
+ _context7.next = 1;
589
691
  break;
590
692
  }
591
- return _context6.abrupt("return", fileUrl);
693
+ return _context7.abrupt("return", fileUrl);
592
694
  case 1:
593
695
  if (!(type !== 'pdf')) {
594
- _context6.next = 2;
696
+ _context7.next = 2;
595
697
  break;
596
698
  }
597
- return _context6.abrupt("return", '');
699
+ return _context7.abrupt("return", '');
598
700
  case 2:
599
- _context6.next = 3;
701
+ _context7.next = 3;
600
702
  return getUrlById({
601
703
  id: id,
602
704
  effectiveTime: 3600000
@@ -609,13 +711,13 @@ var FileItem = function FileItem(_ref) {
609
711
  accessToken: accessToken
610
712
  });
611
713
  case 3:
612
- urlRes = _context6.sent;
714
+ urlRes = _context7.sent;
613
715
  if (!(urlRes.presignedUrlList && urlRes.presignedUrlList.length > 0)) {
614
- _context6.next = 6;
716
+ _context7.next = 6;
615
717
  break;
616
718
  }
617
719
  console.log('urlRes', urlRes);
618
- _context6.next = 4;
720
+ _context7.next = 4;
619
721
  return onlinePreview({
620
722
  url: urlRes.presignedUrlList[2]
621
723
  }, {
@@ -627,21 +729,21 @@ var FileItem = function FileItem(_ref) {
627
729
  accessToken: accessToken
628
730
  });
629
731
  case 4:
630
- res = _context6.sent;
631
- _context6.next = 5;
732
+ res = _context7.sent;
733
+ _context7.next = 5;
632
734
  return extractImageUrls(res.url);
633
735
  case 5:
634
- list = _context6.sent;
736
+ list = _context7.sent;
635
737
  console.log('list---', list);
636
- return _context6.abrupt("return", list[0]);
738
+ return _context7.abrupt("return", list[0]);
637
739
  case 6:
638
740
  case "end":
639
- return _context6.stop();
741
+ return _context7.stop();
640
742
  }
641
- }, _callee6);
743
+ }, _callee7);
642
744
  }));
643
745
  return function getViewUrl(_x4) {
644
- return _ref7.apply(this, arguments);
746
+ return _ref8.apply(this, arguments);
645
747
  };
646
748
  }();
647
749
  useEffect(function () {
@@ -842,7 +944,8 @@ var FileItem = function FileItem(_ref) {
842
944
  handleClose: function handleClose() {
843
945
  return setIsShowSignPage(false);
844
946
  },
845
- closeLoading: closeLoading
947
+ closeLoading: closeLoading,
948
+ showClose: showSignPageClose
846
949
  }), isShowSealPage && /*#__PURE__*/React.createElement(SealPage, {
847
950
  isShowSealPage: isShowSealPage,
848
951
  userInfo: userInfo,
@@ -857,7 +960,12 @@ var FileItem = function FileItem(_ref) {
857
960
  handleClose: function handleClose() {
858
961
  return setIsShowSealPage(false);
859
962
  },
860
- closeLoading: closeLoading
963
+ closeLoading: closeLoading,
964
+ sealConfig: {
965
+ sealKeywords: sealKeywords,
966
+ sealPosition: sealPosition,
967
+ sealContent: sealContent
968
+ }
861
969
  }), isShowPreview && /*#__PURE__*/React.createElement("div", {
862
970
  className: "preview"
863
971
  }, /*#__PURE__*/React.createElement("img", {
@@ -18,6 +18,8 @@ function SealPage(props) {
18
18
  isPC = props.isPC,
19
19
  accessToken = props.accessToken,
20
20
  closeLoading = props.closeLoading,
21
+ _props$sealConfig = props.sealConfig,
22
+ sealConfig = _props$sealConfig === void 0 ? {} : _props$sealConfig,
21
23
  _props$showClose = props.showClose,
22
24
  showClose = _props$showClose === void 0 ? true : _props$showClose;
23
25
  var _useState = useState(''),
@@ -43,7 +45,7 @@ function SealPage(props) {
43
45
  }
44
46
  // 传递配置参数给工具函数
45
47
  _context.next = 1;
46
- return initSealPageMethod(fileObj, userInfo, {
48
+ return initSealPageMethod(fileObj, userInfo, sealConfig, {
47
49
  tokenTY: tokenTY,
48
50
  baseUrl: baseUrl,
49
51
  env: env,
@@ -5,59 +5,54 @@ import _regeneratorRuntime from "@babel/runtime/regenerator";
5
5
  import { getBlob, upload } from "./file.js";
6
6
  import { qrySealApi, getSealUrlApi, getSignOrderIdApi, getPcSealUrlApi } from "../../api.js";
7
7
  // const userInfo = uni.getStorageSync('userInfo')
8
+ var SEAL_TYPE = '法人名章';
9
+ var SEAL_POSITION = '关键字印章';
8
10
 
9
11
  // 对外的方法 获取电子签章的页面地址
10
- export function initSealPageMethod(_x, _x2, _x3) {
12
+ export function initSealPageMethod(_x, _x2, _x3, _x4) {
11
13
  return _initSealPageMethod.apply(this, arguments);
12
14
  }
13
15
 
14
16
  // [第 1 步] 查询当前用户是否有电子签章
15
17
  function _initSealPageMethod() {
16
- _initSealPageMethod = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(fileObj, userInfo, config) {
18
+ _initSealPageMethod = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(fileObj, userInfo, sealConfig, config) {
17
19
  var fileName, sealList, fileUrl, orderId, pageUrl, params;
18
20
  return _regeneratorRuntime.wrap(function (_context) {
19
21
  while (1) switch (_context.prev = _context.next) {
20
22
  case 0:
21
23
  fileName = fileObj.fileName;
22
24
  console.log('fileObj', fileObj, userInfo);
23
- // 【第 1 步】判断当前用户是否有印章
25
+
26
+ // 查询印章列表(getSignOrderId 需要)
24
27
  _context.next = 1;
25
28
  return querySeal(userInfo, config);
26
29
  case 1:
27
30
  sealList = _context.sent;
28
- console.log('sealList---', sealList);
29
- if (sealList.length) {
30
- _context.next = 2;
31
- break;
32
- }
33
- _Message.error('该单位下暂无印章,请前往“山西政务服务网”或“三晋通”小程序申领印章');
34
- return _context.abrupt("return", false);
35
- case 2:
36
- _context.next = 3;
31
+ _context.next = 2;
37
32
  return uploadSealFile(fileObj, config);
38
- case 3:
33
+ case 2:
39
34
  fileUrl = _context.sent;
40
35
  console.log('fileUrl---', fileUrl);
41
36
  if (fileUrl) {
42
- _context.next = 4;
37
+ _context.next = 3;
43
38
  break;
44
39
  }
45
40
  return _context.abrupt("return", false);
41
+ case 3:
42
+ _context.next = 4;
43
+ return getSignOrderId(sealList, fileObj, fileUrl, userInfo, sealConfig, config);
46
44
  case 4:
47
- _context.next = 5;
48
- return getSignOrderId(sealList, fileObj, fileUrl, userInfo, config);
49
- case 5:
50
45
  orderId = _context.sent;
51
46
  console.log('orderId---', orderId);
52
47
  if (orderId) {
53
- _context.next = 6;
48
+ _context.next = 5;
54
49
  break;
55
50
  }
56
51
  return _context.abrupt("return", false);
57
- case 6:
58
- _context.next = 7;
52
+ case 5:
53
+ _context.next = 6;
59
54
  return getMobilePageFun(orderId, config, fileObj, fileUrl);
60
- case 7:
55
+ case 6:
61
56
  pageUrl = _context.sent;
62
57
  // 将 电子签章地址/文件名称 返回
63
58
  params = {
@@ -66,7 +61,7 @@ function _initSealPageMethod() {
66
61
  orderId: orderId
67
62
  };
68
63
  return _context.abrupt("return", params);
69
- case 8:
64
+ case 7:
70
65
  case "end":
71
66
  return _context.stop();
72
67
  }
@@ -74,7 +69,7 @@ function _initSealPageMethod() {
74
69
  }));
75
70
  return _initSealPageMethod.apply(this, arguments);
76
71
  }
77
- function querySeal(userInfo, config) {
72
+ export function querySeal(userInfo, config) {
78
73
  console.log('querySeal', userInfo);
79
74
  // uni.showLoading({ title: '查询印章中' })
80
75
  var params = {
@@ -98,7 +93,7 @@ function querySeal(userInfo, config) {
98
93
  }
99
94
 
100
95
  // [第 2 步] 上传文件
101
- function uploadSealFile(_x4, _x5) {
96
+ function uploadSealFile(_x5, _x6) {
102
97
  return _uploadSealFile.apply(this, arguments);
103
98
  } // [第 3 步] 获取电子印章页面
104
99
  function _uploadSealFile() {
@@ -144,32 +139,51 @@ function _uploadSealFile() {
144
139
  }));
145
140
  return _uploadSealFile.apply(this, arguments);
146
141
  }
147
- function getSignOrderId(sealList, fileObj, esusFileUrl, userInfo, config) {
142
+ function getSignOrderId(sealList, fileObj, esusFileUrl, userInfo, sealConfig, config) {
148
143
  // uni.showLoading({ title: '获取签章页面中' })
149
144
  console.log('sealList', sealList, fileObj, esusFileUrl, userInfo);
150
145
  var fileId = fileObj.fileId,
151
146
  fileName = fileObj.fileName;
152
147
  // 循环签章列表 - 开始
153
148
  var apiSignDtosArr = [];
154
- sealList.forEach(function (sealItem, sealIndex) {
149
+ // 当前用户有法人名章
150
+ var legalSeal = sealList.find(function (item) {
151
+ return item.sealTypeName === SEAL_TYPE;
152
+ });
153
+ // 如果设置的有关键字签章
154
+ if (sealConfig.sealKeywords && sealConfig.sealPosition === SEAL_POSITION && sealConfig.sealContent === SEAL_TYPE && legalSeal) {
155
155
  apiSignDtosArr.push({
156
156
  deviceType: 3,
157
157
  // 签章类型 (默认 3)
158
- signType: 0,
158
+ signType: 3,
159
159
  // 签章方式 (0 - 自由签章 or 定位签章 2 - 关键字签章 3 - 骑缝签章,一次只能有个一个类型,多个请写多组)
160
- sealCode: sealItem.sealCode,
160
+ sealCode: legalSeal.sealCode,
161
161
  // 印章编码
162
- signatories: [
163
- // 定位签章参数
164
- {
165
- pageIndex: sealIndex,
166
- // 签章所在页码
167
- x: 0.00,
168
- // 位置横坐标 支持百分比坐标<1,百分比。>1,pdf 磅,ofd 毫米
169
- y: 0.00 // 位置纵坐标
162
+ keyWordParam: [{
163
+ keyWord: sealConfig.sealKeywords
170
164
  }]
171
165
  });
172
- });
166
+ } else {
167
+ sealList.forEach(function (sealItem, sealIndex) {
168
+ apiSignDtosArr.push({
169
+ deviceType: 3,
170
+ // 签章类型 (默认 3)
171
+ signType: 0,
172
+ // 签章方式 (0 - 自由签章 or 定位签章 2 - 关键字签章 3 - 骑缝签章,一次只能有个一个类型,多个请写多组)
173
+ sealCode: sealItem.sealCode,
174
+ // 印章编码
175
+ signatories: [
176
+ // 定位签章参数
177
+ {
178
+ pageIndex: sealIndex,
179
+ // 签章所在页码
180
+ x: 0.00,
181
+ // 位置横坐标 支持百分比坐标<1,百分比。>1,pdf 磅,ofd 毫米
182
+ y: 0.00 // 位置纵坐标
183
+ }]
184
+ });
185
+ });
186
+ }
173
187
  var params = {
174
188
  deptCode: userInfo.certificateSno,
175
189
  // 单位统一社会信用代码