ydb-components-material 0.1.138 → 0.1.140
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.eb9ae16b.js +1 -0
- 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/index.js +8 -8
- package/build/lowcode/3.js +2 -2
- package/build/lowcode/4.js +1 -1
- package/build/lowcode/5.js +1 -1
- 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/index.js +1 -1
- package/build/lowcode/meta.js +3 -3
- package/build/lowcode/preview.js +11 -10
- package/build/lowcode/render/default/1.js +1 -1
- package/build/lowcode/render/default/view.js +14 -14
- package/build/lowcode/view.js +17 -17
- package/dist/1.js +2 -2
- package/dist/1.js.map +1 -1
- package/dist/2.js +1 -1
- package/dist/3.js +1 -1
- package/dist/BizComps.js +13 -13
- package/dist/BizComps.js.map +1 -1
- package/es/components/file-list/index.js +32 -14
- package/es/components/file-list/item.d.ts +1 -0
- package/es/components/file-list/item.js +195 -116
- package/es/components/file-list/sign.js +8 -87
- package/es/components/file-list/signUtil.js +20 -4
- package/lib/components/file-list/index.js +31 -12
- package/lib/components/file-list/item.d.ts +1 -0
- package/lib/components/file-list/item.js +194 -115
- package/lib/components/file-list/sign.js +6 -85
- package/lib/components/file-list/signUtil.js +20 -4
- package/lowcode_es/meta.js +1 -1
- package/lowcode_lib/meta.js +1 -1
- package/package.json +3 -3
- package/build/docs/umi.b1f50a93.js +0 -1
|
@@ -1,14 +1,13 @@
|
|
|
1
|
-
import _extends from "@babel/runtime/helpers/extends";
|
|
2
1
|
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
3
2
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
4
|
-
import React, { useEffect
|
|
5
|
-
import { initSignPageMethod
|
|
3
|
+
import React, { useEffect } from 'react';
|
|
4
|
+
import { initSignPageMethod } from "./signUtil";
|
|
6
5
|
import closeIcon from "./icon/close.svg";
|
|
7
6
|
function SignPage(props) {
|
|
8
7
|
var userInfo = props.userInfo,
|
|
9
8
|
file = props.file,
|
|
10
|
-
getRes = props.getRes,
|
|
11
9
|
handleClose = props.handleClose,
|
|
10
|
+
fileList = props.fileList,
|
|
12
11
|
token = props.token,
|
|
13
12
|
tokenTY = props.tokenTY,
|
|
14
13
|
baseUrl = props.baseUrl,
|
|
@@ -17,22 +16,9 @@ function SignPage(props) {
|
|
|
17
16
|
closeLoading = props.closeLoading,
|
|
18
17
|
_props$showClose = props.showClose,
|
|
19
18
|
showClose = _props$showClose === void 0 ? true : _props$showClose;
|
|
20
|
-
var _useState = useState(''),
|
|
21
|
-
srcUrl = _useState[0],
|
|
22
|
-
setSrcUrl = _useState[1];
|
|
23
|
-
var _useState2 = useState(''),
|
|
24
|
-
documentId = _useState2[0],
|
|
25
|
-
setDocumentId = _useState2[1];
|
|
26
|
-
var _useState3 = useState(''),
|
|
27
|
-
contractId = _useState3[0],
|
|
28
|
-
setContractId = _useState3[1];
|
|
29
|
-
var _useState4 = useState(''),
|
|
30
|
-
name = _useState4[0],
|
|
31
|
-
setName = _useState4[1];
|
|
32
|
-
var timerRef = useRef(null);
|
|
33
19
|
var init = /*#__PURE__*/function () {
|
|
34
20
|
var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
35
|
-
var fileObj, res,
|
|
21
|
+
var fileObj, res, pageUrl;
|
|
36
22
|
return _regeneratorRuntime.wrap(function (_context) {
|
|
37
23
|
while (1) switch (_context.prev = _context.next) {
|
|
38
24
|
case 0:
|
|
@@ -49,16 +35,14 @@ function SignPage(props) {
|
|
|
49
35
|
tokenTY: tokenTY,
|
|
50
36
|
baseUrl: baseUrl,
|
|
51
37
|
env: env,
|
|
52
|
-
isPC: isPC
|
|
38
|
+
isPC: isPC,
|
|
39
|
+
fileList: fileList
|
|
53
40
|
});
|
|
54
41
|
case 1:
|
|
55
42
|
res = _context.sent;
|
|
56
|
-
|
|
43
|
+
pageUrl = res.pageUrl;
|
|
57
44
|
closeLoading();
|
|
58
|
-
|
|
59
|
-
setDocumentId(documentIdVal);
|
|
60
|
-
setContractId(contractIdVal);
|
|
61
|
-
setName(nameVal);
|
|
45
|
+
window.location.href = pageUrl;
|
|
62
46
|
console.log(res);
|
|
63
47
|
case 2:
|
|
64
48
|
case "end":
|
|
@@ -70,66 +54,9 @@ function SignPage(props) {
|
|
|
70
54
|
return _ref.apply(this, arguments);
|
|
71
55
|
};
|
|
72
56
|
}();
|
|
73
|
-
var getSignedFile = /*#__PURE__*/function () {
|
|
74
|
-
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2(documentIdVal, contractIdVal, nameVal) {
|
|
75
|
-
var newFile, finalFile;
|
|
76
|
-
return _regeneratorRuntime.wrap(function (_context2) {
|
|
77
|
-
while (1) switch (_context2.prev = _context2.next) {
|
|
78
|
-
case 0:
|
|
79
|
-
_context2.next = 1;
|
|
80
|
-
return getSignRes(documentIdVal, contractIdVal, nameVal, true, {
|
|
81
|
-
token: token,
|
|
82
|
-
tokenTY: tokenTY,
|
|
83
|
-
baseUrl: baseUrl,
|
|
84
|
-
env: env,
|
|
85
|
-
isPC: isPC
|
|
86
|
-
});
|
|
87
|
-
case 1:
|
|
88
|
-
newFile = _context2.sent;
|
|
89
|
-
console.log(newFile, '签署完毕后的');
|
|
90
|
-
if (newFile) {
|
|
91
|
-
// 关闭轮询定时
|
|
92
|
-
handleClearInterval();
|
|
93
|
-
// 关闭弹框
|
|
94
|
-
handleClose();
|
|
95
|
-
// 将手写签批后的新文件 传给
|
|
96
|
-
finalFile = _extends({}, file, {
|
|
97
|
-
fileId: newFile.fileId,
|
|
98
|
-
fileName: nameVal,
|
|
99
|
-
fileUrl: newFile.fileUrlList[2],
|
|
100
|
-
isSigned: true
|
|
101
|
-
});
|
|
102
|
-
console.log('finalFile---', finalFile);
|
|
103
|
-
getRes(finalFile);
|
|
104
|
-
}
|
|
105
|
-
case 2:
|
|
106
|
-
case "end":
|
|
107
|
-
return _context2.stop();
|
|
108
|
-
}
|
|
109
|
-
}, _callee2);
|
|
110
|
-
}));
|
|
111
|
-
return function getSignedFile(_x, _x2, _x3) {
|
|
112
|
-
return _ref2.apply(this, arguments);
|
|
113
|
-
};
|
|
114
|
-
}();
|
|
115
|
-
var handleClearInterval = function handleClearInterval() {
|
|
116
|
-
clearInterval(timerRef.current);
|
|
117
|
-
timerRef.current = null;
|
|
118
|
-
};
|
|
119
57
|
useEffect(function () {
|
|
120
58
|
init();
|
|
121
59
|
}, []);
|
|
122
|
-
useEffect(function () {
|
|
123
|
-
if (srcUrl && documentId && contractId && name && !timerRef.current) {
|
|
124
|
-
handleClearInterval();
|
|
125
|
-
timerRef.current = setInterval(function () {
|
|
126
|
-
getSignedFile(documentId, contractId, name);
|
|
127
|
-
}, 3000);
|
|
128
|
-
}
|
|
129
|
-
return function () {
|
|
130
|
-
handleClearInterval();
|
|
131
|
-
};
|
|
132
|
-
}, [srcUrl, documentId, contractId, name]);
|
|
133
60
|
return /*#__PURE__*/React.createElement("div", {
|
|
134
61
|
className: "sign_page"
|
|
135
62
|
}, showClose && /*#__PURE__*/React.createElement("img", {
|
|
@@ -137,12 +64,6 @@ function SignPage(props) {
|
|
|
137
64
|
src: closeIcon,
|
|
138
65
|
alt: "",
|
|
139
66
|
onClick: handleClose
|
|
140
|
-
}), /*#__PURE__*/React.createElement("iframe", {
|
|
141
|
-
src: srcUrl,
|
|
142
|
-
id: "iframe",
|
|
143
|
-
frameborder: "0",
|
|
144
|
-
height: "100%",
|
|
145
|
-
width: "100%"
|
|
146
67
|
}));
|
|
147
68
|
}
|
|
148
69
|
export default SignPage;
|
|
@@ -18,12 +18,12 @@ export function initSignPageMethod(_x, _x2, _x3) {
|
|
|
18
18
|
// 【第 1 步】上传要手写签批的文件
|
|
19
19
|
function _initSignPageMethod() {
|
|
20
20
|
_initSignPageMethod = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(fileObj, userInfo, config) {
|
|
21
|
-
var fileName, docId, contrId, flag, pageUrl, params;
|
|
21
|
+
var fileName, fileId, originalUrl, fileUrl, docId, contrId, flag, pageUrl, params;
|
|
22
22
|
return _regeneratorRuntime.wrap(function (_context) {
|
|
23
23
|
while (1) switch (_context.prev = _context.next) {
|
|
24
24
|
case 0:
|
|
25
25
|
console.log('fileObj', fileObj, userInfo);
|
|
26
|
-
fileName = fileObj.fileName; // 【第 1 步】上传要手写签批的文件
|
|
26
|
+
fileName = fileObj.fileName, fileId = fileObj.fileId, originalUrl = fileObj.originalUrl, fileUrl = fileObj.fileUrl; // 【第 1 步】上传要手写签批的文件
|
|
27
27
|
_context.next = 1;
|
|
28
28
|
return uploadSignFile(fileObj, config);
|
|
29
29
|
case 1:
|
|
@@ -63,7 +63,7 @@ function _initSignPageMethod() {
|
|
|
63
63
|
return _context.abrupt("return", false);
|
|
64
64
|
case 6:
|
|
65
65
|
_context.next = 7;
|
|
66
|
-
return getSignUrl(userInfo, config);
|
|
66
|
+
return getSignUrl(userInfo, config, fileName, fileId, originalUrl || fileUrl);
|
|
67
67
|
case 7:
|
|
68
68
|
pageUrl = _context.sent;
|
|
69
69
|
if (pageUrl) {
|
|
@@ -212,8 +212,20 @@ function getContractSignUrl(contractIdVal, userInfo, config) {
|
|
|
212
212
|
});
|
|
213
213
|
}
|
|
214
214
|
|
|
215
|
+
// 拼接回调页面的参数
|
|
216
|
+
function getCallbackPageUrl(fileName, tokenTY, fileId, fileUrl) {
|
|
217
|
+
sessionStorage.setItem(tokenTY, JSON.stringify({
|
|
218
|
+
contractId: contractId,
|
|
219
|
+
documentId: documentId,
|
|
220
|
+
fileName: fileName,
|
|
221
|
+
fileId: fileId,
|
|
222
|
+
fileUrl: fileUrl
|
|
223
|
+
}));
|
|
224
|
+
return window.location.href;
|
|
225
|
+
}
|
|
226
|
+
|
|
215
227
|
// 【第 4 步】获取签 pi 页面
|
|
216
|
-
function getSignUrl(userInfo, config) {
|
|
228
|
+
function getSignUrl(userInfo, config, fileName, fileId, fileUrl) {
|
|
217
229
|
// uni.showLoading({ title: '加载中' })
|
|
218
230
|
var params = {
|
|
219
231
|
contractId: contractId,
|
|
@@ -238,12 +250,16 @@ function getSignUrl(userInfo, config) {
|
|
|
238
250
|
autoClosePage: true,
|
|
239
251
|
// 操作完成自动关闭页面
|
|
240
252
|
language: 'ZH_CN',
|
|
253
|
+
callbackPage: getCallbackPageUrl(fileName, config.tokenTY, fileId, fileUrl),
|
|
241
254
|
deviceType: config.isPC || 'H5' // 取值范围:PC(返回 PC 页面),H5(返回 H5 页面);不传值默认为:根据请求的 UserAgent 自动判断返回的页面类型。
|
|
242
255
|
};
|
|
243
256
|
return new Promise(function (resolve) {
|
|
244
257
|
signurl(params, config).then(function (res) {
|
|
245
258
|
console.log(res, '页面结果');
|
|
246
259
|
if (res.data.code == 0) {
|
|
260
|
+
if (config.fileList) {
|
|
261
|
+
localStorage.setItem(config.tokenTY, JSON.stringify(config.fileList));
|
|
262
|
+
}
|
|
247
263
|
resolve(res.data.signUrl);
|
|
248
264
|
} else {
|
|
249
265
|
resolve(false);
|
|
@@ -55,17 +55,31 @@ var FileList = function FileList(_ref) {
|
|
|
55
55
|
saveSignerInfo = _ref.saveSignerInfo,
|
|
56
56
|
applySeal = _ref.applySeal,
|
|
57
57
|
signInfoMap = _ref.signInfoMap;
|
|
58
|
-
var _useState = (0, _react.useState)(
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
58
|
+
var _useState = (0, _react.useState)(fileList),
|
|
59
|
+
fileArray = _useState[0],
|
|
60
|
+
setFileArray = _useState[1];
|
|
61
|
+
(0, _react.useEffect)(function () {
|
|
62
|
+
var stored = localStorage.getItem(tokenTY);
|
|
63
|
+
console.log('fileList-stored', stored);
|
|
64
|
+
if (stored) {
|
|
65
|
+
try {
|
|
66
|
+
setFileArray(JSON.parse(stored));
|
|
67
|
+
} catch (e) {}
|
|
68
|
+
} else {
|
|
69
|
+
setFileArray(fileList);
|
|
70
|
+
}
|
|
71
|
+
}, [fileList]);
|
|
72
|
+
var _useState2 = (0, _react.useState)(false),
|
|
73
|
+
showMerge = _useState2[0],
|
|
74
|
+
setShowMerge = _useState2[1];
|
|
75
|
+
var _useState3 = (0, _react.useState)({
|
|
62
76
|
materialName: '',
|
|
63
77
|
fileList: [],
|
|
64
78
|
index: 0,
|
|
65
79
|
subIndex: 0
|
|
66
80
|
}),
|
|
67
|
-
curMerge =
|
|
68
|
-
setCurMerge =
|
|
81
|
+
curMerge = _useState3[0],
|
|
82
|
+
setCurMerge = _useState3[1];
|
|
69
83
|
var convertNumbersToChinese = function convertNumbersToChinese(str) {
|
|
70
84
|
// 定义基础映射关系
|
|
71
85
|
var digitMap = {
|
|
@@ -103,13 +117,13 @@ var FileList = function FileList(_ref) {
|
|
|
103
117
|
|
|
104
118
|
// 拼接材料的提示文案 - 二级材料
|
|
105
119
|
var getTipTextForSubMaterial = function getTipTextForSubMaterial(item, index, subIndex) {
|
|
106
|
-
var subMaterials =
|
|
120
|
+
var subMaterials = fileArray[index].subMaterials;
|
|
107
121
|
console.log('getTipTextForSubMaterial', item, index, subIndex);
|
|
108
122
|
console.log('subMaterials', subMaterials);
|
|
109
123
|
var materialSize = item.materialSize,
|
|
110
124
|
materialSpec = item.materialSpec,
|
|
111
125
|
materialType = item.materialType;
|
|
112
|
-
var groupId =
|
|
126
|
+
var groupId = fileArray[index].subMaterials[subIndex].groupId;
|
|
113
127
|
if (!materialSpec) return '';
|
|
114
128
|
var formatText = materialSpec.split(',').map(function (i) {
|
|
115
129
|
return MATERIAL_FORMAT[i];
|
|
@@ -151,7 +165,7 @@ var FileList = function FileList(_ref) {
|
|
|
151
165
|
var handleChange = function handleChange(value, fileIndex, index, subIndex) {
|
|
152
166
|
console.log('handleChange', value, fileIndex, index, subIndex);
|
|
153
167
|
// 先找到一级目录
|
|
154
|
-
var oneLevelItem =
|
|
168
|
+
var oneLevelItem = fileArray[index];
|
|
155
169
|
// 如果subIndex有值。再去找一下二级目录
|
|
156
170
|
if (subIndex !== undefined) {
|
|
157
171
|
// value为空,说明删除了
|
|
@@ -197,8 +211,9 @@ var FileList = function FileList(_ref) {
|
|
|
197
211
|
}
|
|
198
212
|
}
|
|
199
213
|
}
|
|
200
|
-
console.log('fileList--------res',
|
|
201
|
-
valChange(
|
|
214
|
+
console.log('fileList--------res', fileArray);
|
|
215
|
+
valChange(fileArray);
|
|
216
|
+
setFileArray([].concat(fileArray));
|
|
202
217
|
};
|
|
203
218
|
|
|
204
219
|
// 如果 文件列表中都是图片,且数量大于1 判断需要合并
|
|
@@ -229,7 +244,7 @@ var FileList = function FileList(_ref) {
|
|
|
229
244
|
style: (0, _extends2["default"])({}, style, {
|
|
230
245
|
width: '100%'
|
|
231
246
|
})
|
|
232
|
-
},
|
|
247
|
+
}, fileArray.map(function (item, index) {
|
|
233
248
|
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
234
249
|
className: "file_level_one"
|
|
235
250
|
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
@@ -283,11 +298,13 @@ var FileList = function FileList(_ref) {
|
|
|
283
298
|
className: "tip"
|
|
284
299
|
}, getTipTextForSubMaterial(item, index, subIndex)), child.fileList.map(function (file, i) {
|
|
285
300
|
return /*#__PURE__*/_react["default"].createElement(_item["default"], {
|
|
301
|
+
key: file.fileId || i,
|
|
286
302
|
index: index,
|
|
287
303
|
subIndex: subIndex,
|
|
288
304
|
fileIndex: i,
|
|
289
305
|
file: file,
|
|
290
306
|
fileConfig: child,
|
|
307
|
+
fileList: fileArray,
|
|
291
308
|
maxFileSize: item.materialSize,
|
|
292
309
|
spec: item.materialSpec,
|
|
293
310
|
userInfo: userInfo,
|
|
@@ -315,12 +332,14 @@ var FileList = function FileList(_ref) {
|
|
|
315
332
|
className: "tip"
|
|
316
333
|
}, getTipText(item)), item.fileList.map(function (file, i) {
|
|
317
334
|
return /*#__PURE__*/_react["default"].createElement(_item["default"], {
|
|
335
|
+
key: file.fileId || i,
|
|
318
336
|
index: index,
|
|
319
337
|
fileIndex: i,
|
|
320
338
|
signerInfo: signerInfo || {},
|
|
321
339
|
signInfoMap: signInfoMap,
|
|
322
340
|
file: file,
|
|
323
341
|
fileConfig: item,
|
|
342
|
+
fileList: fileArray,
|
|
324
343
|
maxFileSize: item.materialSize,
|
|
325
344
|
spec: item.materialSpec,
|
|
326
345
|
userInfo: userInfo,
|