ydb-components-material 0.1.21 → 0.1.22
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/static/close.e2e8764a.svg +1 -0
- package/build/docs/umi.0ec80fbb.js +1 -0
- package/build/docs/{umi.4278bf7b.css → umi.1ef21448.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/index.js +1 -1
- package/build/lowcode/meta.js +1 -1
- package/build/lowcode/preview.js +8 -8
- 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/api.js +20 -7
- package/es/components/file-item/file.js +3 -4
- package/es/components/file-item/icon/close.svg +1 -0
- package/es/components/file-item/index.d.ts +10 -5
- package/es/components/file-item/index.js +106 -51
- package/es/components/file-item/index.scss +39 -2
- package/es/components/file-item/seal.js +68 -10
- package/es/components/file-item/sealUtil.js +127 -31
- package/es/components/file-item/sign.js +20 -16
- package/es/components/file-item/signUtil.js +3 -3
- package/es/components/scene-tree/index.js +1 -0
- package/lib/api.js +21 -8
- package/lib/components/file-item/file.js +3 -4
- package/lib/components/file-item/icon/close.svg +1 -0
- package/lib/components/file-item/index.d.ts +10 -5
- package/lib/components/file-item/index.js +106 -51
- package/lib/components/file-item/index.scss +39 -2
- package/lib/components/file-item/seal.js +68 -10
- package/lib/components/file-item/sealUtil.js +126 -30
- package/lib/components/file-item/sign.js +20 -16
- package/lib/components/file-item/signUtil.js +3 -3
- package/lib/components/scene-tree/index.js +1 -0
- package/lowcode/file-item/meta.ts +63 -15
- package/lowcode_es/file-item/meta.js +60 -15
- package/lowcode_es/meta.js +1 -1
- package/lowcode_lib/file-item/meta.js +60 -15
- package/lowcode_lib/meta.js +1 -1
- package/package.json +3 -3
- package/build/docs/umi.b1d4b795.js +0 -1
package/es/api.js
CHANGED
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
2
2
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
3
3
|
export var post = /*#__PURE__*/function () {
|
|
4
|
-
var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(url, data, config) {
|
|
4
|
+
var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(url, data, config, noJson) {
|
|
5
5
|
var res;
|
|
6
6
|
return _regeneratorRuntime.wrap(function (_context) {
|
|
7
7
|
while (1) switch (_context.prev = _context.next) {
|
|
8
8
|
case 0:
|
|
9
|
+
if (noJson === void 0) {
|
|
10
|
+
noJson = false;
|
|
11
|
+
}
|
|
9
12
|
_context.next = 1;
|
|
10
13
|
return fetch(url, {
|
|
11
14
|
method: 'POST',
|
|
@@ -16,7 +19,8 @@ export var post = /*#__PURE__*/function () {
|
|
|
16
19
|
},
|
|
17
20
|
body: JSON.stringify(data)
|
|
18
21
|
}).then(function (response) {
|
|
19
|
-
|
|
22
|
+
console.log('response', response, response.body);
|
|
23
|
+
return noJson ? response.text() : response.json();
|
|
20
24
|
}).then(function (res) {
|
|
21
25
|
return res;
|
|
22
26
|
})["catch"](function (err) {
|
|
@@ -31,7 +35,7 @@ export var post = /*#__PURE__*/function () {
|
|
|
31
35
|
}
|
|
32
36
|
}, _callee);
|
|
33
37
|
}));
|
|
34
|
-
return function post(_x, _x2, _x3) {
|
|
38
|
+
return function post(_x, _x2, _x3, _x4) {
|
|
35
39
|
return _ref.apply(this, arguments);
|
|
36
40
|
};
|
|
37
41
|
}();
|
|
@@ -63,7 +67,7 @@ export var get = /*#__PURE__*/function () {
|
|
|
63
67
|
}
|
|
64
68
|
}, _callee2);
|
|
65
69
|
}));
|
|
66
|
-
return function get(
|
|
70
|
+
return function get(_x5, _x6, _x7) {
|
|
67
71
|
return _ref2.apply(this, arguments);
|
|
68
72
|
};
|
|
69
73
|
}();
|
|
@@ -96,15 +100,24 @@ export var documentDownload = function documentDownload(params, config) {
|
|
|
96
100
|
return post("https://zwfwpt.sxzwfw.gov.cn/DeclarationAPI/declaration/center/signapproval/api/documentDownload", params, config);
|
|
97
101
|
};
|
|
98
102
|
export var qrySealApi = function qrySealApi(params, config) {
|
|
99
|
-
return post("
|
|
103
|
+
return post(config.baseUrl + "/declaration/center/sign/api/qrySeal", params, config);
|
|
100
104
|
};
|
|
101
105
|
|
|
106
|
+
// 获取电子签章页面
|
|
107
|
+
export var getSignOrderIdApi = function getSignOrderIdApi(params, config) {
|
|
108
|
+
return post(config.baseUrl + "/declaration/center/sign/api/outSignCreateSiggOrder", params, config);
|
|
109
|
+
};
|
|
102
110
|
// 获取电子签章页面
|
|
103
111
|
export var getSealUrlApi = function getSealUrlApi(params, config) {
|
|
104
|
-
return post("
|
|
112
|
+
return post(config.baseUrl + "/declaration/center/sign/api/signWebByDirectMobile", params, config, true);
|
|
105
113
|
};
|
|
106
114
|
|
|
107
115
|
// 电子签章-下载文件
|
|
108
116
|
export var signFileDownApi = function signFileDownApi(params, config) {
|
|
109
|
-
return post("
|
|
117
|
+
return post(config.baseUrl + "declaration/center/sign/api/fileDownloadBySign", params, config);
|
|
118
|
+
};
|
|
119
|
+
|
|
120
|
+
// 预览
|
|
121
|
+
export var previewApi = function previewApi(params, config) {
|
|
122
|
+
return post("https://zwfwpt.sxzwfw.gov.cn/DeclarationAPI/declaration/center/sign/api/preview", params, config);
|
|
110
123
|
};
|
|
@@ -93,18 +93,17 @@ export function dataURLtoBlob(dataUrl) {
|
|
|
93
93
|
}
|
|
94
94
|
|
|
95
95
|
// 上传文件至申报端的服务器 [方法]
|
|
96
|
-
export function uploadFilePromise(url, token) {
|
|
97
|
-
// const { baseURL } = apiConfig
|
|
96
|
+
export function uploadFilePromise(url, baseUrl, token) {
|
|
98
97
|
return new Promise(function (resolve, reject) {
|
|
99
98
|
var formData = new FormData();
|
|
100
99
|
formData.append('file', url);
|
|
101
100
|
formData.append('open', true);
|
|
102
101
|
formData.append('open', 'true');
|
|
103
|
-
fetch(
|
|
102
|
+
fetch(baseUrl + "/declaration/material/file/files/api", {
|
|
104
103
|
method: 'POST',
|
|
105
104
|
body: formData,
|
|
106
105
|
header: {
|
|
107
|
-
|
|
106
|
+
Authorization: token
|
|
108
107
|
}
|
|
109
108
|
}).then(function (response) {
|
|
110
109
|
return response.json();
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" fill="none" version="1.1" width="24" height="24" viewBox="0 0 24 24"><defs><clipPath id="master_svg0_106_93607"><rect x="0" y="0" width="24" height="24" rx="0"/></clipPath></defs><g clip-path="url(#master_svg0_106_93607)"><path d="M10.62774178125,12.00024228125L3.78474200125,5.15724198125C3.40573692325,4.77823618125,3.40573692325,4.16374743125,3.7847423512500002,3.7847423512500002C4.16374779125,3.40573692325,4.77823648125,3.40573692325,5.15724198125,3.78474200125L12.00024228125,10.62774178125L18.843241281250002,3.78474200125C19.222301281249997,3.40605306625,19.83653228125,3.40620327025,20.21540428125,3.78507745125C20.59428028125,4.16395199125,20.59443128125,4.77818178125,20.21574428125,5.15724198125L13.37274168125,12.00024228125L20.21574028125,18.843241281250002C20.59474528125,19.22224728125,20.59474528125,19.83673828125,20.21574028125,20.21574028125C19.83673428125,20.59474528125,19.22224428125,20.59474528125,18.843241281250002,20.21574428125L12.00024228125,13.37274168125L5.15724198125,20.21574428125C4.77818178125,20.59443128125,4.16395163125,20.59428028125,3.78507709125,20.21540428125C3.40620291225,19.83653228125,3.40605306625,19.222301281249997,3.78474200125,18.843241281250002L10.62774178125,12.00024228125Z" fill="#FFFFFF" fill-opacity="1" style="mix-blend-mode:passthrough"/></g></svg>
|
|
@@ -4,24 +4,29 @@ export interface FileItemProps {
|
|
|
4
4
|
/**
|
|
5
5
|
* 标题
|
|
6
6
|
*/
|
|
7
|
-
|
|
7
|
+
fileUrl: string;
|
|
8
8
|
fileName: string;
|
|
9
|
+
fileId: string;
|
|
9
10
|
fileType: string;
|
|
10
11
|
guideImg: string;
|
|
11
12
|
checkImg: string;
|
|
12
|
-
|
|
13
|
-
|
|
13
|
+
signatureEnable: boolean;
|
|
14
|
+
signEnable: boolean;
|
|
14
15
|
token: string;
|
|
15
16
|
accessToken: string;
|
|
16
|
-
|
|
17
|
-
|
|
17
|
+
isSigned: boolean;
|
|
18
|
+
isSealed: boolean;
|
|
18
19
|
materialList: any[];
|
|
19
20
|
maxFileSize: number;
|
|
20
21
|
isInValid: boolean;
|
|
21
22
|
isShowLib: boolean;
|
|
22
23
|
userInfo: any;
|
|
24
|
+
baseUrl: string;
|
|
23
25
|
del: () => void;
|
|
26
|
+
handleSeal: () => void;
|
|
27
|
+
handleSign: () => void;
|
|
24
28
|
valChange: (value: any) => void;
|
|
29
|
+
download: (value: any) => void;
|
|
25
30
|
}
|
|
26
31
|
declare const FileItem: React.FC<FileItemProps>;
|
|
27
32
|
export default FileItem;
|
|
@@ -11,19 +11,20 @@ import fileIcon from "./icon/file.svg";
|
|
|
11
11
|
import warningIcon from "./icon/icon_warning.svg";
|
|
12
12
|
import errorMsgIcon from "./icon/icon_errorMsg.svg";
|
|
13
13
|
import uploadIcon from "./icon/upload.svg";
|
|
14
|
+
import closeIcon from "./icon/close.svg";
|
|
14
15
|
import SignPage from "./sign";
|
|
15
16
|
import SealPage from "./seal";
|
|
16
17
|
import "./index.scss";
|
|
17
18
|
var RadioGroup = _Radio.Group;
|
|
18
|
-
var BASE_URL = 'http://172.16.132.12:5005';
|
|
19
19
|
var FileItem = function FileItem(_ref) {
|
|
20
|
-
var
|
|
20
|
+
var fileUrl = _ref.fileUrl,
|
|
21
21
|
guideImg = _ref.guideImg,
|
|
22
22
|
checkImg = _ref.checkImg,
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
23
|
+
fileId = _ref.fileId,
|
|
24
|
+
signatureEnable = _ref.signatureEnable,
|
|
25
|
+
signEnable = _ref.signEnable,
|
|
26
|
+
isSigned = _ref.isSigned,
|
|
27
|
+
isSealed = _ref.isSealed,
|
|
27
28
|
materialList = _ref.materialList,
|
|
28
29
|
maxFileSize = _ref.maxFileSize,
|
|
29
30
|
isInValid = _ref.isInValid,
|
|
@@ -33,29 +34,34 @@ var FileItem = function FileItem(_ref) {
|
|
|
33
34
|
fileType = _ref.fileType,
|
|
34
35
|
token = _ref.token,
|
|
35
36
|
accessToken = _ref.accessToken,
|
|
37
|
+
baseUrl = _ref.baseUrl,
|
|
36
38
|
valChange = _ref.valChange,
|
|
39
|
+
download = _ref.download,
|
|
37
40
|
del = _ref.del;
|
|
38
41
|
var _useState = useState(false),
|
|
39
42
|
isShowView = _useState[0],
|
|
40
43
|
setIsShowView = _useState[1];
|
|
41
|
-
var _useState2 = useState(
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
var _useState3 = useState(
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
var _useState4 = useState(
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
var _useState5 = useState(),
|
|
51
|
-
|
|
52
|
-
|
|
44
|
+
var _useState2 = useState(''),
|
|
45
|
+
viewImg = _useState2[0],
|
|
46
|
+
setViewImg = _useState2[1];
|
|
47
|
+
var _useState3 = useState(false),
|
|
48
|
+
isShowMaterialLib = _useState3[0],
|
|
49
|
+
setIsShowMaterialLib = _useState3[1];
|
|
50
|
+
var _useState4 = useState(),
|
|
51
|
+
material = _useState4[0],
|
|
52
|
+
setMaterial = _useState4[1];
|
|
53
|
+
var _useState5 = useState(false),
|
|
54
|
+
isShowSignPage = _useState5[0],
|
|
55
|
+
setIsShowSignPage = _useState5[1];
|
|
53
56
|
var _useState6 = useState(false),
|
|
54
|
-
|
|
55
|
-
|
|
57
|
+
isShowSealPage = _useState6[0],
|
|
58
|
+
setIsShowSealPage = _useState6[1];
|
|
56
59
|
var _useState7 = useState(false),
|
|
57
|
-
|
|
58
|
-
|
|
60
|
+
isShowPreview = _useState7[0],
|
|
61
|
+
setIsShowPreview = _useState7[1];
|
|
62
|
+
var _useState8 = useState(''),
|
|
63
|
+
previewIframeUrl = _useState8[0],
|
|
64
|
+
setPreviewIframeUrl = _useState8[1];
|
|
59
65
|
var list = materialList || [{
|
|
60
66
|
name: '图片1',
|
|
61
67
|
value: 1
|
|
@@ -92,7 +98,7 @@ var FileItem = function FileItem(_ref) {
|
|
|
92
98
|
var formData = new FormData();
|
|
93
99
|
formData.append('file', fileData);
|
|
94
100
|
formData.append('open', true);
|
|
95
|
-
fetch(
|
|
101
|
+
fetch(baseUrl + "/declaration/material/file/files/api", {
|
|
96
102
|
method: 'POST',
|
|
97
103
|
body: formData
|
|
98
104
|
}).then(function (response) {
|
|
@@ -100,6 +106,7 @@ var FileItem = function FileItem(_ref) {
|
|
|
100
106
|
}).then(function (res) {
|
|
101
107
|
document.body.removeChild(inputEl);
|
|
102
108
|
if (res.fileId) {
|
|
109
|
+
console.log('--------res', res);
|
|
103
110
|
valChange(_extends({}, res, {
|
|
104
111
|
name: fileData.name,
|
|
105
112
|
type: fileData.type
|
|
@@ -113,17 +120,45 @@ var FileItem = function FileItem(_ref) {
|
|
|
113
120
|
});
|
|
114
121
|
});
|
|
115
122
|
};
|
|
123
|
+
var preview = function preview() {
|
|
124
|
+
if (!fileUrl) return;
|
|
125
|
+
fetch(baseUrl + "/declaration/material/onlinePreview?url=" + fileUrl, {
|
|
126
|
+
method: 'GET'
|
|
127
|
+
}).then(function (response) {
|
|
128
|
+
return response.json();
|
|
129
|
+
}).then(function (res) {
|
|
130
|
+
setPreviewIframeUrl(res.url);
|
|
131
|
+
setIsShowPreview(true);
|
|
132
|
+
});
|
|
133
|
+
};
|
|
134
|
+
var sign = function sign() {
|
|
135
|
+
// handleSign()
|
|
136
|
+
setIsShowSignPage(true);
|
|
137
|
+
};
|
|
138
|
+
var seal = function seal() {
|
|
139
|
+
console.log('fileType', fileType);
|
|
140
|
+
if (fileType !== 'application/pdf') {
|
|
141
|
+
_Message.notice('只有pdf文件才能使用电子签章');
|
|
142
|
+
return;
|
|
143
|
+
}
|
|
144
|
+
// handleSeal()
|
|
145
|
+
setIsShowSealPage(true);
|
|
146
|
+
};
|
|
116
147
|
var getRes = function getRes(val) {
|
|
117
148
|
console.log('val---', val);
|
|
118
149
|
valChange(val);
|
|
119
150
|
};
|
|
151
|
+
var getSealRes = function getSealRes(val) {
|
|
152
|
+
console.log('sealval---', val);
|
|
153
|
+
valChange(val);
|
|
154
|
+
};
|
|
120
155
|
return /*#__PURE__*/React.createElement("div", {
|
|
121
156
|
className: "file_item"
|
|
122
157
|
}, /*#__PURE__*/React.createElement("div", {
|
|
123
158
|
className: "file"
|
|
124
159
|
}, /*#__PURE__*/React.createElement("div", {
|
|
125
160
|
className: "file_img"
|
|
126
|
-
},
|
|
161
|
+
}, fileUrl ? /*#__PURE__*/React.createElement("div", {
|
|
127
162
|
className: "filed"
|
|
128
163
|
}, /*#__PURE__*/React.createElement("img", {
|
|
129
164
|
className: "small_img",
|
|
@@ -146,24 +181,24 @@ var FileItem = function FileItem(_ref) {
|
|
|
146
181
|
className: "upload",
|
|
147
182
|
src: uploadIcon,
|
|
148
183
|
alt: ""
|
|
149
|
-
}), "\u4E0A\u4F20\u6750\u6599"),
|
|
184
|
+
}), "\u4E0A\u4F20\u6750\u6599"), (isSigned || isSealed) && /*#__PURE__*/React.createElement("div", {
|
|
150
185
|
className: "mask"
|
|
151
186
|
}, /*#__PURE__*/React.createElement("div", {
|
|
152
187
|
className: "center"
|
|
153
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
188
|
+
}, isSigned && /*#__PURE__*/React.createElement("div", {
|
|
154
189
|
className: "checked",
|
|
155
190
|
style: {
|
|
156
191
|
marginBottom: '9px'
|
|
157
192
|
}
|
|
158
193
|
}, /*#__PURE__*/React.createElement("img", {
|
|
159
194
|
src: CheckedIcon,
|
|
160
|
-
alt: "
|
|
161
|
-
}), "\u5DF2\u7B7E\
|
|
195
|
+
alt: ""
|
|
196
|
+
}), "\u5DF2\u7B7E\u6279"), isSealed && /*#__PURE__*/React.createElement("div", {
|
|
162
197
|
className: "checked"
|
|
163
198
|
}, /*#__PURE__*/React.createElement("img", {
|
|
164
199
|
src: CheckedIcon,
|
|
165
|
-
alt: "
|
|
166
|
-
}), "\u5DF2\u7B7E\
|
|
200
|
+
alt: ""
|
|
201
|
+
}), "\u5DF2\u7B7E\u7AE0")))), /*#__PURE__*/React.createElement("div", {
|
|
167
202
|
className: "operation"
|
|
168
203
|
}, /*#__PURE__*/React.createElement("div", {
|
|
169
204
|
className: "btn"
|
|
@@ -177,7 +212,7 @@ var FileItem = function FileItem(_ref) {
|
|
|
177
212
|
onClick: function onClick() {
|
|
178
213
|
return showViewImg(checkImg);
|
|
179
214
|
}
|
|
180
|
-
}, "\u5BA1\u67E5\u8981\u70B9")),
|
|
215
|
+
}, "\u5BA1\u67E5\u8981\u70B9")), fileUrl ?
|
|
181
216
|
/*#__PURE__*/
|
|
182
217
|
// 有文件且配置了这俩功能才展示
|
|
183
218
|
React.createElement("div", {
|
|
@@ -185,17 +220,13 @@ var FileItem = function FileItem(_ref) {
|
|
|
185
220
|
style: {
|
|
186
221
|
marginTop: '20px'
|
|
187
222
|
}
|
|
188
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
223
|
+
}, signatureEnable && /*#__PURE__*/React.createElement("div", {
|
|
189
224
|
className: "operation_btn",
|
|
190
|
-
onClick:
|
|
191
|
-
|
|
192
|
-
}
|
|
193
|
-
}, "\u624B\u5199\u5BA1\u6279"), /*#__PURE__*/React.createElement("div", {
|
|
225
|
+
onClick: sign
|
|
226
|
+
}, isSigned ? '重新签批' : '手写审批'), userInfo.acctType === '20' && signEnable && /*#__PURE__*/React.createElement("div", {
|
|
194
227
|
className: "operation_btn",
|
|
195
|
-
onClick:
|
|
196
|
-
|
|
197
|
-
}
|
|
198
|
-
}, "\u7535\u5B50\u7B7E\u7AE0")) :
|
|
228
|
+
onClick: seal
|
|
229
|
+
}, isSealed ? '重新签章' : '电子签章')) :
|
|
199
230
|
// 展示材料库
|
|
200
231
|
isShowLib && /*#__PURE__*/React.createElement("div", {
|
|
201
232
|
className: "operation_btn",
|
|
@@ -208,14 +239,16 @@ var FileItem = function FileItem(_ref) {
|
|
|
208
239
|
}, "\u6750\u6599\u5E93"))), /*#__PURE__*/React.createElement("div", {
|
|
209
240
|
className: "file_item_bottom"
|
|
210
241
|
}, /*#__PURE__*/React.createElement("div", {
|
|
211
|
-
className: "icon_text"
|
|
242
|
+
className: "icon_text",
|
|
243
|
+
onClick: preview
|
|
212
244
|
}, /*#__PURE__*/React.createElement("img", {
|
|
213
245
|
src: previewIcon,
|
|
214
246
|
alt: ""
|
|
215
247
|
}), "\u9884\u89C8"), /*#__PURE__*/React.createElement("div", {
|
|
216
248
|
className: "line"
|
|
217
249
|
}), /*#__PURE__*/React.createElement("div", {
|
|
218
|
-
className: "icon_text"
|
|
250
|
+
className: "icon_text",
|
|
251
|
+
onClick: download
|
|
219
252
|
}, /*#__PURE__*/React.createElement("img", {
|
|
220
253
|
src: downloadIcon,
|
|
221
254
|
alt: ""
|
|
@@ -275,24 +308,46 @@ var FileItem = function FileItem(_ref) {
|
|
|
275
308
|
userInfo: userInfo,
|
|
276
309
|
file: {
|
|
277
310
|
name: fileName,
|
|
278
|
-
url:
|
|
311
|
+
url: fileUrl,
|
|
279
312
|
type: fileType
|
|
280
313
|
},
|
|
281
314
|
token: token,
|
|
282
|
-
|
|
315
|
+
baseUrl: baseUrl,
|
|
316
|
+
getRes: getRes,
|
|
317
|
+
handleClose: function handleClose() {
|
|
318
|
+
return setIsShowSignPage(false);
|
|
319
|
+
}
|
|
283
320
|
}), isShowSealPage && /*#__PURE__*/React.createElement(SealPage, {
|
|
284
321
|
isShowSealPage: isShowSealPage,
|
|
285
322
|
userInfo: userInfo,
|
|
286
323
|
file: {
|
|
287
324
|
name: fileName,
|
|
288
|
-
url:
|
|
289
|
-
type: fileType
|
|
325
|
+
url: fileUrl,
|
|
326
|
+
type: fileType,
|
|
327
|
+
fileId: fileId
|
|
290
328
|
},
|
|
291
|
-
token: token
|
|
292
|
-
|
|
293
|
-
,
|
|
294
|
-
accessToken: accessToken
|
|
295
|
-
|
|
329
|
+
token: token,
|
|
330
|
+
baseUrl: baseUrl,
|
|
331
|
+
getSealRes: getSealRes,
|
|
332
|
+
accessToken: accessToken,
|
|
333
|
+
handleClose: function handleClose() {
|
|
334
|
+
return setIsShowSealPage(false);
|
|
335
|
+
}
|
|
336
|
+
}), isShowPreview && /*#__PURE__*/React.createElement("div", {
|
|
337
|
+
className: "preview"
|
|
338
|
+
}, /*#__PURE__*/React.createElement("img", {
|
|
339
|
+
className: "close",
|
|
340
|
+
src: closeIcon,
|
|
341
|
+
alt: "",
|
|
342
|
+
onClick: function onClick() {
|
|
343
|
+
return setIsShowPreview(false);
|
|
344
|
+
}
|
|
345
|
+
}), /*#__PURE__*/React.createElement("iframe", {
|
|
346
|
+
src: previewIframeUrl,
|
|
347
|
+
frameborder: "0",
|
|
348
|
+
height: "500px",
|
|
349
|
+
width: "100%"
|
|
350
|
+
})));
|
|
296
351
|
};
|
|
297
352
|
FileItem.displayName = 'FileItem';
|
|
298
353
|
export default FileItem;
|
|
@@ -58,7 +58,7 @@
|
|
|
58
58
|
height: 16px;
|
|
59
59
|
top: -6px;
|
|
60
60
|
right: -6px;
|
|
61
|
-
z-index:
|
|
61
|
+
z-index: 3;
|
|
62
62
|
}
|
|
63
63
|
|
|
64
64
|
.error_msg {
|
|
@@ -81,7 +81,7 @@
|
|
|
81
81
|
justify-content: center;
|
|
82
82
|
align-items: center;
|
|
83
83
|
color: #fff;
|
|
84
|
-
z-index:
|
|
84
|
+
z-index: 3;
|
|
85
85
|
|
|
86
86
|
.checked {
|
|
87
87
|
display: flex;
|
|
@@ -296,4 +296,41 @@
|
|
|
296
296
|
}
|
|
297
297
|
}
|
|
298
298
|
}
|
|
299
|
+
|
|
300
|
+
.preview {
|
|
301
|
+
width: 100%;
|
|
302
|
+
height: 100%;
|
|
303
|
+
position: absolute;
|
|
304
|
+
top: 0;
|
|
305
|
+
left: 0;
|
|
306
|
+
background: rgba(0, 0, 0, 0.5);
|
|
307
|
+
display: flex;
|
|
308
|
+
justify-content: center;
|
|
309
|
+
align-items: center;
|
|
310
|
+
|
|
311
|
+
.close {
|
|
312
|
+
position: absolute;
|
|
313
|
+
top: 20px;
|
|
314
|
+
right: 20px;
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
.sealPage {
|
|
319
|
+
position: absolute;
|
|
320
|
+
top: 0;
|
|
321
|
+
left: 0;
|
|
322
|
+
width: 100%;
|
|
323
|
+
height: 100%;
|
|
324
|
+
z-index: 99;
|
|
325
|
+
background: rgba(0, 0, 0, 0.5);
|
|
326
|
+
}
|
|
327
|
+
.sign_page {
|
|
328
|
+
position: absolute;
|
|
329
|
+
top: 0;
|
|
330
|
+
left: 0;
|
|
331
|
+
width: 100%;
|
|
332
|
+
height: 100%;
|
|
333
|
+
z-index: 99;
|
|
334
|
+
background: rgba(0, 0, 0, 0.5);
|
|
335
|
+
}
|
|
299
336
|
}
|
|
@@ -1,14 +1,18 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
1
2
|
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
2
3
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
3
4
|
import React, { useEffect, useState } from 'react';
|
|
4
5
|
import { initSealPageMethod } from "./sealUtil";
|
|
6
|
+
import { signFileDownApi } from "../../api";
|
|
7
|
+
import { uploadFilePromise } from "./file.js";
|
|
5
8
|
function SealPage(props) {
|
|
6
|
-
var
|
|
7
|
-
userInfo = props.userInfo,
|
|
9
|
+
var userInfo = props.userInfo,
|
|
8
10
|
file = props.file,
|
|
9
11
|
token = props.token,
|
|
10
12
|
accessToken = props.accessToken,
|
|
11
|
-
|
|
13
|
+
getSealRes = props.getSealRes,
|
|
14
|
+
baseUrl = props.baseUrl,
|
|
15
|
+
handleClose = props.handleClose;
|
|
12
16
|
var _useState = useState(''),
|
|
13
17
|
srcUrl = _useState[0],
|
|
14
18
|
setSrcUrl = _useState[1];
|
|
@@ -20,10 +24,11 @@ function SealPage(props) {
|
|
|
20
24
|
case 0:
|
|
21
25
|
console.log('file', file, userInfo);
|
|
22
26
|
_context.next = 1;
|
|
23
|
-
return initSealPageMethod(file, userInfo, token, accessToken);
|
|
27
|
+
return initSealPageMethod(file, userInfo, token, accessToken, baseUrl);
|
|
24
28
|
case 1:
|
|
25
29
|
res = _context.sent;
|
|
26
30
|
pageUrl = res.pageUrl;
|
|
31
|
+
console.log('pageUrl', pageUrl);
|
|
27
32
|
setSrcUrl(pageUrl);
|
|
28
33
|
// console.log(res)
|
|
29
34
|
case 2:
|
|
@@ -36,18 +41,71 @@ function SealPage(props) {
|
|
|
36
41
|
return _ref.apply(this, arguments);
|
|
37
42
|
};
|
|
38
43
|
}();
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
44
|
+
|
|
45
|
+
// 将返回的文件重新上传
|
|
46
|
+
var uploadNewFile = /*#__PURE__*/function () {
|
|
47
|
+
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2(fileData) {
|
|
48
|
+
var uploadedFileObj, finalFile;
|
|
49
|
+
return _regeneratorRuntime.wrap(function (_context2) {
|
|
50
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
51
|
+
case 0:
|
|
52
|
+
_context2.next = 1;
|
|
53
|
+
return uploadFilePromise('data:application/pdf;base64,' + fileData, baseUrl, token);
|
|
54
|
+
case 1:
|
|
55
|
+
uploadedFileObj = _context2.sent;
|
|
56
|
+
console.log('重新上传的文件', uploadedFileObj);
|
|
57
|
+
handleClose();
|
|
58
|
+
finalFile = _extends({
|
|
59
|
+
name: file.name,
|
|
60
|
+
url: uploadedFileObj.fileUrlList[0],
|
|
61
|
+
status: 'success',
|
|
62
|
+
message: '上传成功'
|
|
63
|
+
}, uploadedFileObj);
|
|
64
|
+
getSealRes(finalFile);
|
|
65
|
+
case 2:
|
|
66
|
+
case "end":
|
|
67
|
+
return _context2.stop();
|
|
68
|
+
}
|
|
69
|
+
}, _callee2);
|
|
70
|
+
}));
|
|
71
|
+
return function uploadNewFile(_x) {
|
|
72
|
+
return _ref2.apply(this, arguments);
|
|
73
|
+
};
|
|
74
|
+
}();
|
|
75
|
+
|
|
76
|
+
// 下载文件
|
|
77
|
+
var signFileDown = function signFileDown(filePath) {
|
|
78
|
+
signFileDownApi({
|
|
79
|
+
fileUrl: filePath
|
|
80
|
+
}).then(function (res) {
|
|
81
|
+
uploadNewFile(res);
|
|
82
|
+
});
|
|
83
|
+
};
|
|
84
|
+
// 监听子页面数据
|
|
85
|
+
var getMessage = function getMessage(e) {
|
|
86
|
+
console.log('子页面数据', e);
|
|
87
|
+
if (e.data.type === 'signal' && e.data.data && e.data.data.length) {
|
|
88
|
+
console.log(e.data.data[0]); // 文件路径
|
|
89
|
+
var filePath = e.data.data[0];
|
|
90
|
+
signFileDown(filePath);
|
|
42
91
|
}
|
|
43
|
-
}
|
|
92
|
+
};
|
|
93
|
+
useEffect(function () {
|
|
94
|
+
window.addEventListener('message', getMessage);
|
|
95
|
+
return function () {
|
|
96
|
+
window.removeEventListener('message', getMessage);
|
|
97
|
+
};
|
|
98
|
+
}, []);
|
|
99
|
+
useEffect(function () {
|
|
100
|
+
handleRes();
|
|
101
|
+
}, [userInfo, file, token, accessToken, baseUrl]);
|
|
44
102
|
return /*#__PURE__*/React.createElement("div", {
|
|
45
|
-
className: "
|
|
103
|
+
className: "sealPage"
|
|
46
104
|
}, /*#__PURE__*/React.createElement("iframe", {
|
|
47
105
|
src: srcUrl,
|
|
48
106
|
id: "iframe",
|
|
49
107
|
frameborder: "0",
|
|
50
|
-
height: "
|
|
108
|
+
height: "100%",
|
|
51
109
|
width: "100%"
|
|
52
110
|
}));
|
|
53
111
|
}
|