ydb-components-material 0.1.199 → 0.1.201
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/build/docs/404.html +3 -3
- package/build/docs/_demos/:uuid +3 -3
- package/build/docs/colorful-button.html +3 -3
- package/build/docs/colorful-input.html +3 -3
- package/build/docs/index.html +3 -3
- package/build/docs/{umi.e60c247e.js → umi.4aa6a455.js} +1 -1
- package/build/docs/{umi.4ee02fde.css → umi.c6775933.css} +1 -1
- package/build/docs/~demos/:uuid.html +3 -3
- package/build/docs/~demos/colorful-button-demo.html +3 -3
- package/build/docs/~demos/colorful-input-demo.html +3 -3
- package/build/lowcode/assets-daily.json +11 -11
- package/build/lowcode/assets-dev.json +2 -2
- package/build/lowcode/assets-prod.json +11 -11
- package/build/lowcode/meta.js +1 -1
- package/build/lowcode/render/default/view.css +1 -1
- package/build/lowcode/render/default/view.js +1 -1
- package/build/lowcode/view.css +1 -1
- package/build/lowcode/view.js +1 -1
- package/dist/BizComps.css +1 -1
- package/dist/BizComps.js +1 -1
- package/dist/BizComps.js.map +1 -1
- package/es/components/file-list/index.js +17 -13
- package/es/components/file-list/item.js +184 -116
- package/es/components/file-list/merge.scss +1 -1
- package/lib/components/file-list/index.js +17 -13
- package/lib/components/file-list/item.js +185 -117
- package/lib/components/file-list/merge.scss +1 -1
- package/lowcode_es/meta.js +1 -1
- package/lowcode_lib/meta.js +1 -1
- package/package.json +3 -3
|
@@ -200,6 +200,18 @@ var FileList = function FileList(_ref) {
|
|
|
200
200
|
handleChange(value, 0, curMerge.index, curMerge.subIndex);
|
|
201
201
|
setShowMerge(false);
|
|
202
202
|
};
|
|
203
|
+
|
|
204
|
+
// 删除之后调用:只要没到 10 个上限,就保证末尾是一个空槽(渲染成「上传材料」按钮)。
|
|
205
|
+
// 末尾已经是空槽或列表为空(空列表也要补一个)时按需处理,已达上限则不动。
|
|
206
|
+
var ensureEmptySlot = function ensureEmptySlot(list) {
|
|
207
|
+
if (list.length >= 10) return list;
|
|
208
|
+
var last = list[list.length - 1];
|
|
209
|
+
if (last && !last.fileId) return list;
|
|
210
|
+
list.push({
|
|
211
|
+
fileId: ''
|
|
212
|
+
});
|
|
213
|
+
return list;
|
|
214
|
+
};
|
|
203
215
|
var handleChange = function handleChange(value, fileIndex, index, subIndex) {
|
|
204
216
|
console.log('handleChange', value, fileIndex, index, subIndex);
|
|
205
217
|
// 先找到一级目录
|
|
@@ -210,14 +222,9 @@ var FileList = function FileList(_ref) {
|
|
|
210
222
|
if (!value) {
|
|
211
223
|
oneLevelItem.subMaterials[subIndex].isSmart = false;
|
|
212
224
|
oneLevelItem.subMaterials[subIndex].isShareFile = false;
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
fileId: ''
|
|
217
|
-
}];
|
|
218
|
-
} else {
|
|
219
|
-
oneLevelItem.subMaterials[subIndex].fileList.splice(fileIndex, 1);
|
|
220
|
-
}
|
|
225
|
+
oneLevelItem.subMaterials[subIndex].fileList.splice(fileIndex, 1);
|
|
226
|
+
// 删完保证末尾还有「上传材料」按钮
|
|
227
|
+
ensureEmptySlot(oneLevelItem.subMaterials[subIndex].fileList);
|
|
221
228
|
} else {
|
|
222
229
|
// 如果当前这个位置的fileId是空的。说明这次修改是新增
|
|
223
230
|
var isAdd = !oneLevelItem.subMaterials[subIndex].fileList[fileIndex].fileId;
|
|
@@ -233,11 +240,8 @@ var FileList = function FileList(_ref) {
|
|
|
233
240
|
oneLevelItem.isSmart = false;
|
|
234
241
|
oneLevelItem.isShareFile = false;
|
|
235
242
|
oneLevelItem.fileList.splice(fileIndex, 1);
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
fileId: ''
|
|
239
|
-
});
|
|
240
|
-
}
|
|
243
|
+
// 删完保证末尾还有「上传材料」按钮
|
|
244
|
+
ensureEmptySlot(oneLevelItem.fileList);
|
|
241
245
|
} else {
|
|
242
246
|
// 如果当前这个位置的fileId是空的。说明这次修改是新增
|
|
243
247
|
var _isAdd = !oneLevelItem.fileList[fileIndex].fileId;
|
|
@@ -669,55 +669,128 @@ var FileItem = function FileItem(_ref) {
|
|
|
669
669
|
}
|
|
670
670
|
}
|
|
671
671
|
};
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
var
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
672
|
+
|
|
673
|
+
// 请求材料库数据。reset 为 true 时从第一页重新拉取(每次点击「材料库」都拿最新的),
|
|
674
|
+
// 否则按当前页码追加(加载更多)。返回本次拿到的记录,请求失败返回 null——
|
|
675
|
+
// 调用方要靠这个区分「真的没有数据」和「没请求成功」,后者不该提示暂无数据。
|
|
676
|
+
var queryFileLibs = /*#__PURE__*/function () {
|
|
677
|
+
var _ref6 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee5(reset) {
|
|
678
|
+
var certNo, certificateSno, acctType, currentPage, params, res, records, _t;
|
|
679
|
+
return _regeneratorRuntime.wrap(function (_context5) {
|
|
680
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
681
|
+
case 0:
|
|
682
|
+
if (reset === void 0) {
|
|
683
|
+
reset = false;
|
|
684
|
+
}
|
|
685
|
+
if (userInfo) {
|
|
686
|
+
_context5.next = 1;
|
|
687
|
+
break;
|
|
688
|
+
}
|
|
689
|
+
return _context5.abrupt("return", null);
|
|
690
|
+
case 1:
|
|
691
|
+
console.log('queryFileLibs', userInfo);
|
|
692
|
+
certNo = userInfo.certNo, certificateSno = userInfo.certificateSno, acctType = userInfo.acctType;
|
|
693
|
+
currentPage = reset ? 1 : pageNum;
|
|
694
|
+
params = {
|
|
695
|
+
cardno: acctType === '10' ? certNo : certificateSno,
|
|
696
|
+
// 个人传身份证号、法人传社会统一信用代码
|
|
697
|
+
// cardno: '140110199504131013', // 个人传身份证号、法人传社会统一信用代码
|
|
698
|
+
type: acctType === '10' ? '11' : '21',
|
|
699
|
+
pageNum: currentPage,
|
|
700
|
+
pageSize: 10
|
|
701
|
+
};
|
|
702
|
+
_context5.prev = 2;
|
|
703
|
+
_context5.next = 3;
|
|
704
|
+
return getMaterialLib(params, {
|
|
705
|
+
token: token,
|
|
706
|
+
tokenTY: tokenTY,
|
|
707
|
+
baseUrl: baseUrl,
|
|
708
|
+
env: env,
|
|
709
|
+
isPC: isPC,
|
|
710
|
+
accessToken: accessToken
|
|
711
|
+
});
|
|
712
|
+
case 3:
|
|
713
|
+
res = _context5.sent;
|
|
714
|
+
if (!(res.code !== 200)) {
|
|
715
|
+
_context5.next = 4;
|
|
716
|
+
break;
|
|
717
|
+
}
|
|
718
|
+
return _context5.abrupt("return", null);
|
|
719
|
+
case 4:
|
|
720
|
+
records = res.data.records || [];
|
|
721
|
+
setMaterialLib(function (list) {
|
|
722
|
+
return reset ? records : list.concat(records);
|
|
723
|
+
});
|
|
724
|
+
setMaterialLibTotal(+res.data.total);
|
|
725
|
+
setPageNum(currentPage + 1);
|
|
726
|
+
return _context5.abrupt("return", records);
|
|
727
|
+
case 5:
|
|
728
|
+
_context5.prev = 5;
|
|
729
|
+
_t = _context5["catch"](2);
|
|
730
|
+
console.error(_t);
|
|
731
|
+
return _context5.abrupt("return", null);
|
|
732
|
+
case 6:
|
|
733
|
+
case "end":
|
|
734
|
+
return _context5.stop();
|
|
735
|
+
}
|
|
736
|
+
}, _callee5, null, [[2, 5]]);
|
|
737
|
+
}));
|
|
738
|
+
return function queryFileLibs(_x6) {
|
|
739
|
+
return _ref6.apply(this, arguments);
|
|
684
740
|
};
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
741
|
+
}();
|
|
742
|
+
|
|
743
|
+
// 点击「材料库」:先拉数据,空则提示,不打开弹窗
|
|
744
|
+
var openMaterialLib = /*#__PURE__*/function () {
|
|
745
|
+
var _ref7 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee6() {
|
|
746
|
+
var records;
|
|
747
|
+
return _regeneratorRuntime.wrap(function (_context6) {
|
|
748
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
749
|
+
case 0:
|
|
750
|
+
_context6.next = 1;
|
|
751
|
+
return queryFileLibs(true);
|
|
752
|
+
case 1:
|
|
753
|
+
records = _context6.sent;
|
|
754
|
+
if (records) {
|
|
755
|
+
_context6.next = 2;
|
|
756
|
+
break;
|
|
757
|
+
}
|
|
758
|
+
return _context6.abrupt("return");
|
|
759
|
+
case 2:
|
|
760
|
+
if (records.length) {
|
|
761
|
+
_context6.next = 3;
|
|
762
|
+
break;
|
|
763
|
+
}
|
|
764
|
+
_Message.notice('暂无数据');
|
|
765
|
+
return _context6.abrupt("return");
|
|
766
|
+
case 3:
|
|
767
|
+
setIsShowMaterialLib(true);
|
|
768
|
+
case 4:
|
|
769
|
+
case "end":
|
|
770
|
+
return _context6.stop();
|
|
771
|
+
}
|
|
772
|
+
}, _callee6);
|
|
773
|
+
}));
|
|
774
|
+
return function openMaterialLib() {
|
|
775
|
+
return _ref7.apply(this, arguments);
|
|
776
|
+
};
|
|
777
|
+
}();
|
|
705
778
|
var loadMore = function loadMore() {
|
|
706
779
|
queryFileLibs();
|
|
707
780
|
};
|
|
708
781
|
var showGuide = /*#__PURE__*/function () {
|
|
709
|
-
var
|
|
782
|
+
var _ref8 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee7() {
|
|
710
783
|
var guideImgRes;
|
|
711
|
-
return _regeneratorRuntime.wrap(function (
|
|
712
|
-
while (1) switch (
|
|
784
|
+
return _regeneratorRuntime.wrap(function (_context7) {
|
|
785
|
+
while (1) switch (_context7.prev = _context7.next) {
|
|
713
786
|
case 0:
|
|
714
787
|
if (signGuidFileId) {
|
|
715
|
-
|
|
788
|
+
_context7.next = 1;
|
|
716
789
|
break;
|
|
717
790
|
}
|
|
718
|
-
return
|
|
791
|
+
return _context7.abrupt("return");
|
|
719
792
|
case 1:
|
|
720
|
-
|
|
793
|
+
_context7.next = 2;
|
|
721
794
|
return getGuideImg({
|
|
722
795
|
id: signGuidFileId,
|
|
723
796
|
effectiveTime: 3600000
|
|
@@ -730,7 +803,7 @@ var FileItem = function FileItem(_ref) {
|
|
|
730
803
|
accessToken: accessToken
|
|
731
804
|
});
|
|
732
805
|
case 2:
|
|
733
|
-
guideImgRes =
|
|
806
|
+
guideImgRes = _context7.sent;
|
|
734
807
|
if (guideImgRes.presignedUrlList.length && guideImgRes.presignedUrlList[2]) {
|
|
735
808
|
captureComponentTop();
|
|
736
809
|
setGuideurl(guideImgRes.presignedUrlList[2]);
|
|
@@ -738,19 +811,19 @@ var FileItem = function FileItem(_ref) {
|
|
|
738
811
|
}
|
|
739
812
|
case 3:
|
|
740
813
|
case "end":
|
|
741
|
-
return
|
|
814
|
+
return _context7.stop();
|
|
742
815
|
}
|
|
743
|
-
},
|
|
816
|
+
}, _callee7);
|
|
744
817
|
}));
|
|
745
818
|
return function showGuide() {
|
|
746
|
-
return
|
|
819
|
+
return _ref8.apply(this, arguments);
|
|
747
820
|
};
|
|
748
821
|
}();
|
|
749
822
|
var selectMaterialOk = /*#__PURE__*/function () {
|
|
750
|
-
var
|
|
823
|
+
var _ref9 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee8() {
|
|
751
824
|
var selectedMaterial, arr, fileFormat, formatFinal, urlRes, m;
|
|
752
|
-
return _regeneratorRuntime.wrap(function (
|
|
753
|
-
while (1) switch (
|
|
825
|
+
return _regeneratorRuntime.wrap(function (_context8) {
|
|
826
|
+
while (1) switch (_context8.prev = _context8.next) {
|
|
754
827
|
case 0:
|
|
755
828
|
console.log('val', materialId);
|
|
756
829
|
console.log('materialLib==', materialLib);
|
|
@@ -758,8 +831,15 @@ var FileItem = function FileItem(_ref) {
|
|
|
758
831
|
return item.fileId === materialId;
|
|
759
832
|
});
|
|
760
833
|
console.log('selectedMaterial', selectedMaterial);
|
|
834
|
+
if (selectedMaterial) {
|
|
835
|
+
_context8.next = 1;
|
|
836
|
+
break;
|
|
837
|
+
}
|
|
838
|
+
_Message.notice('请选择材料');
|
|
839
|
+
return _context8.abrupt("return");
|
|
840
|
+
case 1:
|
|
761
841
|
if (!spec) {
|
|
762
|
-
|
|
842
|
+
_context8.next = 2;
|
|
763
843
|
break;
|
|
764
844
|
}
|
|
765
845
|
arr = selectedMaterial.fileName.split('.'); //
|
|
@@ -768,24 +848,24 @@ var FileItem = function FileItem(_ref) {
|
|
|
768
848
|
formatFinal = initFormat(spec); // 限制的文件类型
|
|
769
849
|
console.log(formatFinal, '限制的格式最后');
|
|
770
850
|
if (formatFinal.includes(fileFormat)) {
|
|
771
|
-
|
|
851
|
+
_context8.next = 2;
|
|
772
852
|
break;
|
|
773
853
|
}
|
|
774
854
|
_Message.notice("\u8BE5\u6750\u6599\u4E0D\u652F\u6301\u4E0A\u4F20\u3010" + fileFormat + "\u3011\u683C\u5F0F\u7684\u6587\u4EF6");
|
|
775
|
-
return
|
|
776
|
-
case
|
|
855
|
+
return _context8.abrupt("return");
|
|
856
|
+
case 2:
|
|
777
857
|
if (!(selectedMaterial.type === 1)) {
|
|
778
|
-
|
|
858
|
+
_context8.next = 3;
|
|
779
859
|
break;
|
|
780
860
|
}
|
|
781
861
|
_Message.notice('该文件为旧文件, 请先下载后手动上传');
|
|
782
|
-
return
|
|
783
|
-
case
|
|
862
|
+
return _context8.abrupt("return");
|
|
863
|
+
case 3:
|
|
784
864
|
if (selectedMaterial.innerFileUrl) {
|
|
785
|
-
|
|
865
|
+
_context8.next = 5;
|
|
786
866
|
break;
|
|
787
867
|
}
|
|
788
|
-
|
|
868
|
+
_context8.next = 4;
|
|
789
869
|
return getUrlById({
|
|
790
870
|
id: selectedMaterial.fileId,
|
|
791
871
|
effectiveTime: 3600000
|
|
@@ -797,26 +877,26 @@ var FileItem = function FileItem(_ref) {
|
|
|
797
877
|
isPC: isPC,
|
|
798
878
|
accessToken: accessToken
|
|
799
879
|
});
|
|
800
|
-
case
|
|
801
|
-
urlRes =
|
|
880
|
+
case 4:
|
|
881
|
+
urlRes = _context8.sent;
|
|
802
882
|
if (urlRes.presignedUrlList && urlRes.presignedUrlList.length > 0) {
|
|
803
883
|
selectedMaterial.innerFileUrl = urlRes.presignedUrlList[2];
|
|
804
884
|
}
|
|
805
|
-
case
|
|
885
|
+
case 5:
|
|
806
886
|
m = _extends({}, selectedMaterial, {
|
|
807
887
|
fileUrl: selectedMaterial.innerFileUrl
|
|
808
888
|
});
|
|
809
889
|
console.log('m', m);
|
|
810
890
|
valChange(m, fileIndex, index, subIndex);
|
|
811
891
|
setIsShowMaterialLib(false);
|
|
812
|
-
case
|
|
892
|
+
case 6:
|
|
813
893
|
case "end":
|
|
814
|
-
return
|
|
894
|
+
return _context8.stop();
|
|
815
895
|
}
|
|
816
|
-
},
|
|
896
|
+
}, _callee8);
|
|
817
897
|
}));
|
|
818
898
|
return function selectMaterialOk() {
|
|
819
|
-
return
|
|
899
|
+
return _ref9.apply(this, arguments);
|
|
820
900
|
};
|
|
821
901
|
}();
|
|
822
902
|
var onDownload = function onDownload() {
|
|
@@ -828,95 +908,85 @@ var FileItem = function FileItem(_ref) {
|
|
|
828
908
|
});
|
|
829
909
|
};
|
|
830
910
|
var handleDel = /*#__PURE__*/function () {
|
|
831
|
-
var
|
|
832
|
-
return _regeneratorRuntime.wrap(function (
|
|
833
|
-
while (1) switch (
|
|
911
|
+
var _ref0 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee9() {
|
|
912
|
+
return _regeneratorRuntime.wrap(function (_context9) {
|
|
913
|
+
while (1) switch (_context9.prev = _context9.next) {
|
|
834
914
|
case 0:
|
|
835
915
|
if (!disabled) {
|
|
836
|
-
|
|
916
|
+
_context9.next = 1;
|
|
837
917
|
break;
|
|
838
918
|
}
|
|
839
|
-
return
|
|
919
|
+
return _context9.abrupt("return");
|
|
840
920
|
case 1:
|
|
841
921
|
// invalidHandle()
|
|
842
922
|
valChange(undefined, fileIndex, index, subIndex);
|
|
843
923
|
case 2:
|
|
844
924
|
case "end":
|
|
845
|
-
return
|
|
925
|
+
return _context9.stop();
|
|
846
926
|
}
|
|
847
|
-
},
|
|
927
|
+
}, _callee9);
|
|
848
928
|
}));
|
|
849
929
|
return function handleDel() {
|
|
850
|
-
return
|
|
930
|
+
return _ref0.apply(this, arguments);
|
|
851
931
|
};
|
|
852
932
|
}();
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
if (userInfo && tokenTY) {
|
|
856
|
-
console.log('userInfo', tokenTY, userInfo);
|
|
857
|
-
timer = setTimeout(function () {
|
|
858
|
-
queryFileLibs();
|
|
859
|
-
}, 0);
|
|
860
|
-
}
|
|
861
|
-
return function () {
|
|
862
|
-
timer && clearTimeout(timer);
|
|
863
|
-
};
|
|
864
|
-
}, [userInfo, tokenTY]);
|
|
933
|
+
|
|
934
|
+
// 材料库数据改为点击「材料库」时按需拉取(见 openMaterialLib),不再挂载即预取
|
|
865
935
|
|
|
866
936
|
// 获取缩略图
|
|
867
937
|
var extractImageUrls = /*#__PURE__*/function () {
|
|
868
|
-
var
|
|
938
|
+
var _ref1 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee0(previewUrl) {
|
|
869
939
|
var response, htmlText, parser, doc, imgElements, srcList;
|
|
870
|
-
return _regeneratorRuntime.wrap(function (
|
|
871
|
-
while (1) switch (
|
|
940
|
+
return _regeneratorRuntime.wrap(function (_context0) {
|
|
941
|
+
while (1) switch (_context0.prev = _context0.next) {
|
|
872
942
|
case 0:
|
|
873
|
-
|
|
943
|
+
_context0.next = 1;
|
|
874
944
|
return fetch(previewUrl);
|
|
875
945
|
case 1:
|
|
876
|
-
response =
|
|
877
|
-
|
|
946
|
+
response = _context0.sent;
|
|
947
|
+
_context0.next = 2;
|
|
878
948
|
return response.text();
|
|
879
949
|
case 2:
|
|
880
|
-
htmlText =
|
|
950
|
+
htmlText = _context0.sent;
|
|
881
951
|
parser = new DOMParser();
|
|
882
952
|
doc = parser.parseFromString(htmlText, 'text/html');
|
|
883
953
|
imgElements = doc.querySelectorAll('img');
|
|
884
954
|
srcList = Array.from(imgElements).map(function (img) {
|
|
885
955
|
return img.getAttribute('data-src');
|
|
886
956
|
});
|
|
887
|
-
return
|
|
957
|
+
return _context0.abrupt("return", srcList);
|
|
888
958
|
case 3:
|
|
889
959
|
case "end":
|
|
890
|
-
return
|
|
960
|
+
return _context0.stop();
|
|
891
961
|
}
|
|
892
|
-
},
|
|
962
|
+
}, _callee0);
|
|
893
963
|
}));
|
|
894
|
-
return function extractImageUrls(
|
|
895
|
-
return
|
|
964
|
+
return function extractImageUrls(_x7) {
|
|
965
|
+
return _ref1.apply(this, arguments);
|
|
896
966
|
};
|
|
897
967
|
}();
|
|
898
968
|
|
|
899
969
|
// 获取预览图片
|
|
900
970
|
var getViewUrl = /*#__PURE__*/function () {
|
|
901
|
-
var
|
|
971
|
+
var _ref10 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee1(id) {
|
|
902
972
|
var type, urlRes, res, list;
|
|
903
|
-
return _regeneratorRuntime.wrap(function (
|
|
904
|
-
while (1) switch (
|
|
973
|
+
return _regeneratorRuntime.wrap(function (_context1) {
|
|
974
|
+
while (1) switch (_context1.prev = _context1.next) {
|
|
905
975
|
case 0:
|
|
906
976
|
type = getFileExtension(fileName);
|
|
907
977
|
if (!['png', 'jpg', 'jpeg'].includes(type)) {
|
|
908
|
-
|
|
978
|
+
_context1.next = 1;
|
|
909
979
|
break;
|
|
910
980
|
}
|
|
911
|
-
return
|
|
981
|
+
return _context1.abrupt("return", fileUrl);
|
|
912
982
|
case 1:
|
|
913
983
|
if (!(type !== 'pdf')) {
|
|
914
|
-
|
|
984
|
+
_context1.next = 2;
|
|
915
985
|
break;
|
|
916
986
|
}
|
|
917
|
-
return
|
|
987
|
+
return _context1.abrupt("return", '');
|
|
918
988
|
case 2:
|
|
919
|
-
|
|
989
|
+
_context1.next = 3;
|
|
920
990
|
return getUrlById({
|
|
921
991
|
id: id,
|
|
922
992
|
effectiveTime: 3600000
|
|
@@ -929,13 +999,13 @@ var FileItem = function FileItem(_ref) {
|
|
|
929
999
|
accessToken: accessToken
|
|
930
1000
|
});
|
|
931
1001
|
case 3:
|
|
932
|
-
urlRes =
|
|
1002
|
+
urlRes = _context1.sent;
|
|
933
1003
|
if (!(urlRes.presignedUrlList && urlRes.presignedUrlList.length > 0)) {
|
|
934
|
-
|
|
1004
|
+
_context1.next = 6;
|
|
935
1005
|
break;
|
|
936
1006
|
}
|
|
937
1007
|
console.log('urlRes', urlRes);
|
|
938
|
-
|
|
1008
|
+
_context1.next = 4;
|
|
939
1009
|
return onlinePreview({
|
|
940
1010
|
url: urlRes.presignedUrlList[2]
|
|
941
1011
|
}, {
|
|
@@ -947,21 +1017,21 @@ var FileItem = function FileItem(_ref) {
|
|
|
947
1017
|
accessToken: accessToken
|
|
948
1018
|
});
|
|
949
1019
|
case 4:
|
|
950
|
-
res =
|
|
951
|
-
|
|
1020
|
+
res = _context1.sent;
|
|
1021
|
+
_context1.next = 5;
|
|
952
1022
|
return extractImageUrls(res.url);
|
|
953
1023
|
case 5:
|
|
954
|
-
list =
|
|
1024
|
+
list = _context1.sent;
|
|
955
1025
|
console.log('list---111111', list);
|
|
956
|
-
return
|
|
1026
|
+
return _context1.abrupt("return", list[0]);
|
|
957
1027
|
case 6:
|
|
958
1028
|
case "end":
|
|
959
|
-
return
|
|
1029
|
+
return _context1.stop();
|
|
960
1030
|
}
|
|
961
|
-
},
|
|
1031
|
+
}, _callee1);
|
|
962
1032
|
}));
|
|
963
|
-
return function getViewUrl(
|
|
964
|
-
return
|
|
1033
|
+
return function getViewUrl(_x8) {
|
|
1034
|
+
return _ref10.apply(this, arguments);
|
|
965
1035
|
};
|
|
966
1036
|
}();
|
|
967
1037
|
useEffect(function () {
|
|
@@ -1140,11 +1210,9 @@ var FileItem = function FileItem(_ref) {
|
|
|
1140
1210
|
return isSealed ? reSignBtnText : signBtnText;
|
|
1141
1211
|
}())) :
|
|
1142
1212
|
// 展示材料库
|
|
1143
|
-
!isShareFile && !isSmart && !disabled &&
|
|
1213
|
+
!isShareFile && !isSmart && !disabled && /*#__PURE__*/React.createElement("div", {
|
|
1144
1214
|
className: "operation_btn",
|
|
1145
|
-
onClick:
|
|
1146
|
-
return setIsShowMaterialLib(true);
|
|
1147
|
-
}
|
|
1215
|
+
onClick: openMaterialLib
|
|
1148
1216
|
}, "\u6750\u6599\u5E93"))), !isPC && /*#__PURE__*/React.createElement("div", {
|
|
1149
1217
|
className: "file_item_bottom",
|
|
1150
1218
|
style: {
|
|
@@ -206,6 +206,18 @@ var FileList = function FileList(_ref) {
|
|
|
206
206
|
handleChange(value, 0, curMerge.index, curMerge.subIndex);
|
|
207
207
|
setShowMerge(false);
|
|
208
208
|
};
|
|
209
|
+
|
|
210
|
+
// 删除之后调用:只要没到 10 个上限,就保证末尾是一个空槽(渲染成「上传材料」按钮)。
|
|
211
|
+
// 末尾已经是空槽或列表为空(空列表也要补一个)时按需处理,已达上限则不动。
|
|
212
|
+
var ensureEmptySlot = function ensureEmptySlot(list) {
|
|
213
|
+
if (list.length >= 10) return list;
|
|
214
|
+
var last = list[list.length - 1];
|
|
215
|
+
if (last && !last.fileId) return list;
|
|
216
|
+
list.push({
|
|
217
|
+
fileId: ''
|
|
218
|
+
});
|
|
219
|
+
return list;
|
|
220
|
+
};
|
|
209
221
|
var handleChange = function handleChange(value, fileIndex, index, subIndex) {
|
|
210
222
|
console.log('handleChange', value, fileIndex, index, subIndex);
|
|
211
223
|
// 先找到一级目录
|
|
@@ -216,14 +228,9 @@ var FileList = function FileList(_ref) {
|
|
|
216
228
|
if (!value) {
|
|
217
229
|
oneLevelItem.subMaterials[subIndex].isSmart = false;
|
|
218
230
|
oneLevelItem.subMaterials[subIndex].isShareFile = false;
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
fileId: ''
|
|
223
|
-
}];
|
|
224
|
-
} else {
|
|
225
|
-
oneLevelItem.subMaterials[subIndex].fileList.splice(fileIndex, 1);
|
|
226
|
-
}
|
|
231
|
+
oneLevelItem.subMaterials[subIndex].fileList.splice(fileIndex, 1);
|
|
232
|
+
// 删完保证末尾还有「上传材料」按钮
|
|
233
|
+
ensureEmptySlot(oneLevelItem.subMaterials[subIndex].fileList);
|
|
227
234
|
} else {
|
|
228
235
|
// 如果当前这个位置的fileId是空的。说明这次修改是新增
|
|
229
236
|
var isAdd = !oneLevelItem.subMaterials[subIndex].fileList[fileIndex].fileId;
|
|
@@ -239,11 +246,8 @@ var FileList = function FileList(_ref) {
|
|
|
239
246
|
oneLevelItem.isSmart = false;
|
|
240
247
|
oneLevelItem.isShareFile = false;
|
|
241
248
|
oneLevelItem.fileList.splice(fileIndex, 1);
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
fileId: ''
|
|
245
|
-
});
|
|
246
|
-
}
|
|
249
|
+
// 删完保证末尾还有「上传材料」按钮
|
|
250
|
+
ensureEmptySlot(oneLevelItem.fileList);
|
|
247
251
|
} else {
|
|
248
252
|
// 如果当前这个位置的fileId是空的。说明这次修改是新增
|
|
249
253
|
var _isAdd = !oneLevelItem.fileList[fileIndex].fileId;
|