ydb-components-material 0.1.21 → 0.1.23

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 (55) 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/static/close.e2e8764a.svg +1 -0
  7. package/build/docs/umi.d170f160.js +1 -0
  8. package/build/docs/{umi.4278bf7b.css → umi.e536bfab.css} +1 -1
  9. package/build/docs/~demos/:uuid.html +3 -3
  10. package/build/docs/~demos/colorful-button-demo.html +3 -3
  11. package/build/docs/~demos/colorful-input-demo.html +3 -3
  12. package/build/lowcode/assets-daily.json +11 -11
  13. package/build/lowcode/assets-dev.json +2 -2
  14. package/build/lowcode/assets-prod.json +11 -11
  15. package/build/lowcode/index.js +1 -1
  16. package/build/lowcode/meta.js +1 -1
  17. package/build/lowcode/preview.js +8 -8
  18. package/build/lowcode/render/default/view.css +1 -1
  19. package/build/lowcode/render/default/view.js +1 -1
  20. package/build/lowcode/view.css +1 -1
  21. package/build/lowcode/view.js +1 -1
  22. package/dist/BizComps.css +1 -1
  23. package/dist/BizComps.js +1 -1
  24. package/dist/BizComps.js.map +1 -1
  25. package/es/api.js +27 -7
  26. package/es/components/file-item/file.js +65 -5
  27. package/es/components/file-item/icon/close.svg +1 -0
  28. package/es/components/file-item/index.d.ts +9 -5
  29. package/es/components/file-item/index.js +320 -63
  30. package/es/components/file-item/index.scss +42 -3
  31. package/es/components/file-item/seal.js +111 -12
  32. package/es/components/file-item/sealUtil.js +129 -32
  33. package/es/components/file-item/sign.js +20 -16
  34. package/es/components/file-item/signUtil.js +3 -3
  35. package/es/components/scene-tree/index.js +1 -0
  36. package/es/utils.js +0 -0
  37. package/lib/api.js +28 -8
  38. package/lib/components/file-item/file.js +66 -5
  39. package/lib/components/file-item/icon/close.svg +1 -0
  40. package/lib/components/file-item/index.d.ts +9 -5
  41. package/lib/components/file-item/index.js +321 -64
  42. package/lib/components/file-item/index.scss +42 -3
  43. package/lib/components/file-item/seal.js +110 -11
  44. package/lib/components/file-item/sealUtil.js +128 -31
  45. package/lib/components/file-item/sign.js +20 -16
  46. package/lib/components/file-item/signUtil.js +3 -3
  47. package/lib/components/scene-tree/index.js +1 -0
  48. package/lib/utils.js +1 -0
  49. package/lowcode/file-item/meta.ts +63 -15
  50. package/lowcode_es/file-item/meta.js +60 -15
  51. package/lowcode_es/meta.js +1 -1
  52. package/lowcode_lib/file-item/meta.js +60 -15
  53. package/lowcode_lib/meta.js +1 -1
  54. package/package.json +3 -3
  55. package/build/docs/umi.b1d4b795.js +0 -1
@@ -1,30 +1,40 @@
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
- import React, { useEffect, useState } from 'react';
4
+ import React, { useEffect, useState, useRef } from 'react';
4
5
  import { initSealPageMethod } from "./sealUtil";
6
+ import { signFileDownApi, getSignFileApi } from "../../api";
7
+ import { uploadFilePromise, dataURLtoBlob } from "./file.js";
5
8
  function SealPage(props) {
6
- var isShowSealPage = props.isShowSealPage,
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
- getRes = props.getRes;
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];
19
+ var _useState2 = useState(''),
20
+ orderId = _useState2[0],
21
+ setOrderId = _useState2[1];
22
+ var timerRef = useRef(null);
15
23
  var handleRes = /*#__PURE__*/function () {
16
24
  var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
17
- var res, pageUrl;
25
+ var res, pageUrl, orderIdVal;
18
26
  return _regeneratorRuntime.wrap(function (_context) {
19
27
  while (1) switch (_context.prev = _context.next) {
20
28
  case 0:
21
29
  console.log('file', file, userInfo);
22
30
  _context.next = 1;
23
- return initSealPageMethod(file, userInfo, token, accessToken);
31
+ return initSealPageMethod(file, userInfo, token, accessToken, baseUrl);
24
32
  case 1:
25
33
  res = _context.sent;
26
- pageUrl = res.pageUrl;
34
+ pageUrl = res.pageUrl, orderIdVal = res.orderId;
35
+ console.log('pageUrl', pageUrl);
27
36
  setSrcUrl(pageUrl);
37
+ setOrderId(orderIdVal);
28
38
  // console.log(res)
29
39
  case 2:
30
40
  case "end":
@@ -36,18 +46,107 @@ function SealPage(props) {
36
46
  return _ref.apply(this, arguments);
37
47
  };
38
48
  }();
49
+
50
+ // 将返回的文件重新上传
51
+ var uploadNewFile = /*#__PURE__*/function () {
52
+ var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2(fileData) {
53
+ var blob, uploadedFileObj, finalFile;
54
+ return _regeneratorRuntime.wrap(function (_context2) {
55
+ while (1) switch (_context2.prev = _context2.next) {
56
+ case 0:
57
+ blob = dataURLtoBlob('data:application/pdf;base64,' + fileData);
58
+ _context2.next = 1;
59
+ return uploadFilePromise(blob, baseUrl, token);
60
+ case 1:
61
+ uploadedFileObj = _context2.sent;
62
+ console.log('重新上传的文件', uploadedFileObj);
63
+ handleClose();
64
+ finalFile = _extends({
65
+ name: file.name,
66
+ url: uploadedFileObj.fileUrl
67
+ }, uploadedFileObj);
68
+ getSealRes(finalFile);
69
+ case 2:
70
+ case "end":
71
+ return _context2.stop();
72
+ }
73
+ }, _callee2);
74
+ }));
75
+ return function uploadNewFile(_x) {
76
+ return _ref2.apply(this, arguments);
77
+ };
78
+ }();
79
+
80
+ // 下载文件
81
+ var signFileDown = function signFileDown(filePath) {
82
+ signFileDownApi({
83
+ fileUrl: filePath
84
+ }, {
85
+ baseUrl: baseUrl,
86
+ token: token
87
+ }).then(function (res) {
88
+ if (res.code === 200) {
89
+ uploadNewFile(res.data);
90
+ }
91
+ });
92
+ };
93
+
94
+ // 电子签章-移动端签批 获取移动端签章结果(文件地址)
95
+ var getSignFileFun = function getSignFileFun() {
96
+ // uni.showLoading({ title: '加载中' })
97
+
98
+ var params = {
99
+ orderId: orderId
100
+ };
101
+ getSignFileApi(params, {
102
+ baseUrl: baseUrl,
103
+ token: token
104
+ }).then(function (res) {
105
+ if (!res) {
106
+ return;
107
+ }
108
+ console.log(res, '签章之后的数据');
109
+ var _res$data = res.data,
110
+ signStatus = _res$data.signStatus,
111
+ signFiles = _res$data.signFiles;
112
+ if (signStatus === 6) {
113
+ // 签署成功
114
+ handleClearInterval();
115
+ if (signFiles && signFiles.length) {
116
+ // 下载该文件
117
+ signFileDown(signFiles[0].filePath);
118
+ }
119
+ }
120
+ // uni.hideLoading()
121
+ })["catch"](function (err) {
122
+ console.log(err);
123
+ });
124
+ };
125
+ var handleClearInterval = function handleClearInterval() {
126
+ clearInterval(timerRef.current);
127
+ timerRef.current = null;
128
+ };
39
129
  useEffect(function () {
40
- if (isShowSealPage) {
41
- handleRes();
130
+ if (orderId) {
131
+ handleClearInterval();
132
+ timerRef.current = setInterval(function () {
133
+ getSignFileFun();
134
+ }, 3000);
42
135
  }
43
- }, [isShowSealPage, userInfo, file, token, accessToken]);
136
+ return function () {
137
+ handleClearInterval();
138
+ };
139
+ }, [orderId]);
140
+ useEffect(function () {
141
+ handleRes();
142
+ }, [userInfo, file, token, accessToken, baseUrl]);
44
143
  return /*#__PURE__*/React.createElement("div", {
45
- className: "seal_page"
144
+ className: "sealPage"
46
145
  }, /*#__PURE__*/React.createElement("iframe", {
47
146
  src: srcUrl,
48
147
  id: "iframe",
49
148
  frameborder: "0",
50
- height: "500px",
149
+ height: "100%",
51
150
  width: "100%"
52
151
  }));
53
152
  }
@@ -3,18 +3,18 @@ import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
3
3
  import _regeneratorRuntime from "@babel/runtime/regenerator";
4
4
  // import apiConfig from '@/config/api.cofig'
5
5
  import { getBlob, upload } from "./file.js";
6
- import { qrySealApi, getSealUrlApi } from "../../api.js";
6
+ import { qrySealApi, getSealUrlApi, getSignOrderIdApi } from "../../api.js";
7
7
  // const userInfo = uni.getStorageSync('userInfo')
8
8
 
9
9
  // 对外的方法 获取电子签章的页面地址
10
- export function initSealPageMethod(_x, _x2, _x3, _x4) {
10
+ export function initSealPageMethod(_x, _x2, _x3, _x4, _x5) {
11
11
  return _initSealPageMethod.apply(this, arguments);
12
12
  }
13
13
 
14
14
  // [第1步] 查询当前用户是否有电子签章
15
15
  function _initSealPageMethod() {
16
- _initSealPageMethod = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(fileObj, userInfo, token, accessToken) {
17
- var name, hasSeal, fileUrl, pageUrl, params;
16
+ _initSealPageMethod = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(fileObj, userInfo, token, accessToken, baseUrl) {
17
+ var name, sealList, fileUrl, orderId, pageUrl, params;
18
18
  return _regeneratorRuntime.wrap(function (_context) {
19
19
  while (1) switch (_context.prev = _context.next) {
20
20
  case 0:
@@ -22,26 +22,21 @@ function _initSealPageMethod() {
22
22
  console.log('fileObj', fileObj, userInfo);
23
23
  // 【第1步】判断当前用户是否有印章
24
24
  _context.next = 1;
25
- return querySeal(userInfo, token);
25
+ return querySeal(userInfo, token, baseUrl);
26
26
  case 1:
27
- hasSeal = _context.sent;
28
- if (hasSeal) {
27
+ sealList = _context.sent;
28
+ if (sealList.length) {
29
29
  _context.next = 2;
30
30
  break;
31
31
  }
32
32
  _Message.error('该单位下暂无印章,请前往“山西政务服务网”或“三晋通”小程序申领印章');
33
- // return uni.showModal({
34
- // title: '提示',
35
- // content: '该单位下暂无印章,请前往“山西政务服务网”或“三晋通”小程序申领印章',
36
- // confirmText: '知道了',
37
- // showCancel: false,
38
- // })
39
33
  return _context.abrupt("return", false);
40
34
  case 2:
41
35
  _context.next = 3;
42
- return uploadSealFile(fileObj, token);
36
+ return uploadSealFile(fileObj, token, baseUrl);
43
37
  case 3:
44
38
  fileUrl = _context.sent;
39
+ console.log('fileUrl---', fileUrl);
45
40
  if (fileUrl) {
46
41
  _context.next = 4;
47
42
  break;
@@ -49,22 +44,28 @@ function _initSealPageMethod() {
49
44
  return _context.abrupt("return", false);
50
45
  case 4:
51
46
  _context.next = 5;
52
- return getSealUrl(fileUrl, name, token, accessToken);
47
+ return getSignOrderId(sealList, fileObj, fileUrl, token, baseUrl, userInfo);
53
48
  case 5:
54
- pageUrl = _context.sent;
55
- if (pageUrl) {
49
+ orderId = _context.sent;
50
+ console.log('orderId---', orderId);
51
+ if (orderId) {
56
52
  _context.next = 6;
57
53
  break;
58
54
  }
59
55
  return _context.abrupt("return", false);
60
56
  case 6:
57
+ _context.next = 7;
58
+ return getMobilePageFun(orderId, accessToken, token, baseUrl);
59
+ case 7:
60
+ pageUrl = _context.sent;
61
61
  // 将 电子签章地址/文件名称 返回
62
62
  params = {
63
63
  pageUrl: pageUrl,
64
- name: name
64
+ name: name,
65
+ orderId: orderId
65
66
  };
66
67
  return _context.abrupt("return", params);
67
- case 7:
68
+ case 8:
68
69
  case "end":
69
70
  return _context.stop();
70
71
  }
@@ -72,7 +73,7 @@ function _initSealPageMethod() {
72
73
  }));
73
74
  return _initSealPageMethod.apply(this, arguments);
74
75
  }
75
- function querySeal(userInfo, token) {
76
+ function querySeal(userInfo, token, baseUrl) {
76
77
  console.log('querySeal', userInfo);
77
78
  // uni.showLoading({ title: '查询印章中' })
78
79
  var params = {
@@ -82,27 +83,28 @@ function querySeal(userInfo, token) {
82
83
  };
83
84
  return new Promise(function (resolve) {
84
85
  qrySealApi(params, {
85
- token: token
86
+ token: token,
87
+ baseUrl: baseUrl
86
88
  }).then(function (res) {
87
89
  if (res.data && res.data.length > 0) {
88
- resolve(true);
90
+ resolve(res.data);
89
91
  } else {
90
- resolve(false);
92
+ resolve([]);
91
93
  }
92
94
  // uni.hideLoading()
93
95
  })["catch"](function (error) {
94
- resolve(false);
96
+ resolve([]);
95
97
  // uni.hideLoading()
96
98
  });
97
99
  });
98
100
  }
99
101
 
100
102
  // [第2步] 上传文件
101
- function uploadSealFile(_x5, _x6) {
103
+ function uploadSealFile(_x6, _x7, _x8) {
102
104
  return _uploadSealFile.apply(this, arguments);
103
105
  } // [第3步] 获取电子印章页面
104
106
  function _uploadSealFile() {
105
- _uploadSealFile = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2(fileObj, token) {
107
+ _uploadSealFile = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2(fileObj, token, baseUrl) {
106
108
  var blob, file;
107
109
  return _regeneratorRuntime.wrap(function (_context2) {
108
110
  while (1) switch (_context2.prev = _context2.next) {
@@ -114,7 +116,6 @@ function _uploadSealFile() {
114
116
  file = new File([blob], fileObj.name, {
115
117
  type: fileObj.type
116
118
  }); // 上传接口
117
- // const { baseURL } = apiConfig;
118
119
  return _context2.abrupt("return", new Promise(function (resolve) {
119
120
  upload({
120
121
  file: file,
@@ -123,7 +124,7 @@ function _uploadSealFile() {
123
124
  headers: {
124
125
  Authorization: token
125
126
  },
126
- action: "https://zwfwpt.sxzwfw.gov.cn/DeclarationAPI/declaration/center/signapproval/api/createbyfile",
127
+ action: baseUrl + "/declaration/center/sign/api/fileUploadApi",
127
128
  // 上传文件的地址
128
129
  onError: function onError(e) {
129
130
  // uni.$u.toast(e.msg || '上传文件异常');
@@ -145,20 +146,116 @@ function _uploadSealFile() {
145
146
  }));
146
147
  return _uploadSealFile.apply(this, arguments);
147
148
  }
148
- function getSealUrl(fileUrl, fileName, token, accessToken) {
149
+ function getSignOrderId(sealList, fileObj, esusFileUrl, token, baseUrl, userInfo) {
149
150
  // uni.showLoading({ title: '获取签章页面中' })
150
- // const accessToken = uni.getStorageSync('access_token');
151
+ console.log('sealList', sealList, fileObj, esusFileUrl, token, baseUrl, userInfo);
152
+ var fileId = fileObj.fileId,
153
+ name = fileObj.name;
154
+ // 循环签章列表 - 开始
155
+ var apiSignDtosArr = [];
156
+ sealList.forEach(function (sealItem, sealIndex) {
157
+ apiSignDtosArr.push({
158
+ deviceType: 3,
159
+ // 签章类型(默认3)
160
+ signType: 0,
161
+ // 签章方式(0 - 自由签章 or 定位签章2 - 关键字签章3 - 骑缝签章,一次只能有个一个类型,多个请写多组)
162
+ sealCode: sealItem.sealCode,
163
+ // 印章编码
164
+ signatories: [
165
+ // 定位签章参数
166
+ {
167
+ pageIndex: sealIndex,
168
+ // 签章所在页码
169
+ x: 0.00,
170
+ // 位置横坐标 支持百分比坐标<1,百分比。>1,pdf磅,ofd 毫米
171
+ y: 0.00 // 位置纵坐标
172
+ }]
173
+ });
174
+ });
175
+ var params = {
176
+ deptCode: userInfo.certificateSno,
177
+ // 单位统一社会信用代码
178
+ outUserId: userInfo.legalCertno,
179
+ // 用户身份证号
180
+ userIdType: '2',
181
+ // 2:身份证
182
+ signFileReqs: [{
183
+ file: esusFileUrl,
184
+ // 签章文件(签章文件base64编码文件数据或者文件地址)
185
+ fileType: '0',
186
+ // 文件格式类型(0文件路径;1文件数据)
187
+ docType: '0',
188
+ // 文件内容类型 (0 PDF;1 OFD)
189
+ fileId: fileId,
190
+ // 业务系统文件id (用于回传文件,不可重复)
191
+ fileName: name,
192
+ // 签章文件名称(文件名称包含文件格式,如a.pdf,b.ofd)
193
+ apiSignDtos: apiSignDtosArr
194
+ // apiSignDtos: [ // 签章信息列表(一次可以多个签章参数。每个参数选一个签章参数)
195
+ // {
196
+ // deviceType: 3, // 签章类型(默认3)
197
+ // sealCode: '14110000000423', // 印章编码
198
+ // signType: 0, // 签章方式(0 - 自由签章 or 定位签章2 - 关键字签章3 - 骑缝签章,一次只能有个一个类型,多个请写多组)
199
+ // signatories: [ // 定位签章参数
200
+ // {
201
+ // pageIndex: 0, // 签章所在页码
202
+ // x: 0.00, // 位置横坐标 支持百分比坐标<1,百分比。>1,pdf磅,ofd 毫米
203
+ // y: 0.00, // 位置纵坐标
204
+ // }
205
+ // ]
206
+ // },
207
+ // {
208
+ // deviceType: 3, // 签章类型(默认3)
209
+ // sealCode: '14110000000392', // 印章编码
210
+ // signType: 0, // 签章方式(0 - 自由签章 or 定位签章2 - 关键字签章3 - 骑缝签章,一次只能有个一个类型,多个请写多组)
211
+ // signatories: [ // 定位签章参数
212
+ // {
213
+ // pageIndex: 0, // 签章所在页码
214
+ // x: 0.00, // 位置横坐标 支持百分比坐标<1,百分比。>1,pdf磅,ofd 毫米
215
+ // y: 0.00, // 位置纵坐标
216
+ // }
217
+ // ]
218
+ // }
219
+ // ]
220
+ }]
221
+ };
222
+ console.log('params---', params);
223
+ return new Promise(function (resolve) {
224
+ console.log('获取签章订单id');
225
+ getSignOrderIdApi(params, {
226
+ token: token,
227
+ baseUrl: baseUrl
228
+ }).then(function (res) {
229
+ if (res) {
230
+ var bigNumber = BigInt(res);
231
+ resolve(bigNumber + '');
232
+ // uni.hideLoading()
233
+ } else {
234
+ resolve(false);
235
+ // uni.hideLoading()
236
+ }
237
+ })["catch"](function () {
238
+ resolve(false);
239
+ // uni.hideLoading()
240
+ });
241
+ });
242
+ }
243
+
244
+ // [第4步-移动端] 获取电子印章页面
245
+ function getMobilePageFun(orderId, accessToken, token, baseUrl) {
246
+ // uni.showLoading({ title: '获取移动端签章页面中' })
151
247
  var params = {
152
248
  accessToken: accessToken,
153
249
  acctType: '20',
154
- docURL: fileUrl,
155
- name: fileName
250
+ orderId: orderId
156
251
  };
157
252
  return new Promise(function (resolve) {
158
253
  getSealUrlApi(params, {
254
+ baseUrl: baseUrl,
159
255
  token: token
160
256
  }).then(function (res) {
161
257
  if (res) {
258
+ console.log(res, '移动端签章页面');
162
259
  resolve(res);
163
260
  // uni.hideLoading()
164
261
  } else {
@@ -8,7 +8,9 @@ function SignPage(props) {
8
8
  userInfo = props.userInfo,
9
9
  file = props.file,
10
10
  token = props.token,
11
- getRes = props.getRes;
11
+ getRes = props.getRes,
12
+ handleClose = props.handleClose,
13
+ baseUrl = props.baseUrl;
12
14
  var _useState = useState(''),
13
15
  srcUrl = _useState[0],
14
16
  setSrcUrl = _useState[1];
@@ -22,7 +24,7 @@ function SignPage(props) {
22
24
  name = _useState4[0],
23
25
  setName = _useState4[1];
24
26
  var timerRef = useRef(null);
25
- var handleRes = /*#__PURE__*/function () {
27
+ var init = /*#__PURE__*/function () {
26
28
  var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
27
29
  var res, documentIdVal, contractIdVal, pageUrl, nameVal;
28
30
  return _regeneratorRuntime.wrap(function (_context) {
@@ -44,12 +46,12 @@ function SignPage(props) {
44
46
  }
45
47
  }, _callee);
46
48
  }));
47
- return function handleRes() {
49
+ return function init() {
48
50
  return _ref.apply(this, arguments);
49
51
  };
50
52
  }();
51
53
  var getSignedFile = /*#__PURE__*/function () {
52
- var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2(documentIdVal, contractIdVal, nameVal, tokenVal) {
54
+ var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2(documentIdVal, contractIdVal, nameVal, tokenVal, baseUrl) {
53
55
  var newFile, finalFile;
54
56
  return _regeneratorRuntime.wrap(function (_context2) {
55
57
  while (1) switch (_context2.prev = _context2.next) {
@@ -57,7 +59,7 @@ function SignPage(props) {
57
59
  console.log('tokenVal----', tokenVal);
58
60
  // const { autoUpload } = this
59
61
  _context2.next = 1;
60
- return getSignRes(documentIdVal, contractIdVal, nameVal, true, tokenVal);
62
+ return getSignRes(documentIdVal, contractIdVal, nameVal, true, tokenVal, baseUrl);
61
63
  case 1:
62
64
  newFile = _context2.sent;
63
65
  console.log(newFile, '签署完毕后的');
@@ -65,11 +67,12 @@ function SignPage(props) {
65
67
  // 关闭轮询定时
66
68
  handleClearInterval();
67
69
  // 关闭弹框
68
- // this.handleClose()
70
+ handleClose();
69
71
  // 将手写签批后的新文件 传给
70
72
  finalFile = _extends({
71
73
  name: nameVal,
72
- url: newFile.fileUrlList[0]
74
+ url: newFile.fileUrlList[0],
75
+ isSigned: true
73
76
  }, newFile);
74
77
  console.log('finalFile---', finalFile);
75
78
  getRes(finalFile);
@@ -80,7 +83,7 @@ function SignPage(props) {
80
83
  }
81
84
  }, _callee2);
82
85
  }));
83
- return function getSignedFile(_x, _x2, _x3, _x4) {
86
+ return function getSignedFile(_x, _x2, _x3, _x4, _x5) {
84
87
  return _ref2.apply(this, arguments);
85
88
  };
86
89
  }();
@@ -89,25 +92,26 @@ function SignPage(props) {
89
92
  timerRef.current = null;
90
93
  };
91
94
  useEffect(function () {
92
- if (isShowSignPage) {
93
- handleRes();
94
- }
95
- }, [isShowSignPage]);
95
+ init();
96
+ }, []);
96
97
  useEffect(function () {
97
- if (srcUrl && documentId && contractId && name && token && !timerRef.current) {
98
+ if (srcUrl && documentId && contractId && name && token && baseUrl && !timerRef.current) {
98
99
  handleClearInterval();
99
100
  timerRef.current = setInterval(function () {
100
- getSignedFile(documentId, contractId, name, token);
101
+ getSignedFile(documentId, contractId, name, token, baseUrl);
101
102
  }, 3000);
102
103
  }
103
- }, [srcUrl, documentId, contractId, name, token]);
104
+ return function () {
105
+ handleClearInterval();
106
+ };
107
+ }, [srcUrl, documentId, contractId, name, token, baseUrl]);
104
108
  return /*#__PURE__*/React.createElement("div", {
105
109
  className: "sign_page"
106
110
  }, /*#__PURE__*/React.createElement("iframe", {
107
111
  src: srcUrl,
108
112
  id: "iframe",
109
113
  frameborder: "0",
110
- height: "500px",
114
+ height: "100%",
111
115
  width: "100%"
112
116
  }));
113
117
  }
@@ -257,13 +257,13 @@ function getSignUrl(userInfo, token) {
257
257
  // 下方是打开手写签批页面后 的后续操作
258
258
 
259
259
  // 对外的方法 获取签批后的文件
260
- export function getSignRes(_x6, _x7, _x8, _x9, _x0) {
260
+ export function getSignRes(_x6, _x7, _x8, _x9, _x0, _x1) {
261
261
  return _getSignRes.apply(this, arguments);
262
262
  }
263
263
 
264
264
  // 轮询 签批状态
265
265
  function _getSignRes() {
266
- _getSignRes = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee3(documentIdVal, contractIdVal, name, autoUpload, token) {
266
+ _getSignRes = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee3(documentIdVal, contractIdVal, name, autoUpload, token, baseUrl) {
267
267
  var isSignSucc, newFile, uploadedFileObj;
268
268
  return _regeneratorRuntime.wrap(function (_context3) {
269
269
  while (1) switch (_context3.prev = _context3.next) {
@@ -289,7 +289,7 @@ function _getSignRes() {
289
289
  break;
290
290
  }
291
291
  _context3.next = 3;
292
- return uploadFilePromise(newFile, token);
292
+ return uploadFilePromise(newFile, baseUrl, token);
293
293
  case 3:
294
294
  uploadedFileObj = _context3.sent;
295
295
  console.log('签批完成后的文件地址', uploadedFileObj);
@@ -173,6 +173,7 @@ var SceneTree = function SceneTree(_ref) {
173
173
  return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(FormItem, {
174
174
  name: "baseUser",
175
175
  label: node.title,
176
+ labelTextAlign: "left",
176
177
  required: true,
177
178
  style: {
178
179
  borderBottom: node.children && node.children.length ? '1px solid #EEEEEE' : '',
package/es/utils.js ADDED
File without changes
package/lib/api.js CHANGED
@@ -2,15 +2,18 @@
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
4
  exports.__esModule = true;
5
- exports.signurl = exports.signFileDownApi = exports.qrySealApi = exports.post = exports.getSealUrlApi = exports.get = exports.documentDownload = exports.createbycategory = exports.contractSignUrl = exports.contractFinish = exports.checkSignState = void 0;
5
+ exports.signurl = exports.signFileDownApi = exports.qrySealApi = exports.previewApi = exports.post = exports.getSignOrderIdApi = exports.getSignFileApi = exports.getSealUrlApi = exports.getMaterialLib = exports.get = exports.documentDownload = exports.createbycategory = exports.contractSignUrl = exports.contractFinish = exports.checkSignState = void 0;
6
6
  var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
7
7
  var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
8
8
  var post = exports.post = /*#__PURE__*/function () {
9
- var _ref = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee(url, data, config) {
9
+ var _ref = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee(url, data, config, noJson) {
10
10
  var res;
11
11
  return _regenerator["default"].wrap(function (_context) {
12
12
  while (1) switch (_context.prev = _context.next) {
13
13
  case 0:
14
+ if (noJson === void 0) {
15
+ noJson = false;
16
+ }
14
17
  _context.next = 1;
15
18
  return fetch(url, {
16
19
  method: 'POST',
@@ -21,7 +24,8 @@ var post = exports.post = /*#__PURE__*/function () {
21
24
  },
22
25
  body: JSON.stringify(data)
23
26
  }).then(function (response) {
24
- return response.json();
27
+ console.log('response', response, response.body);
28
+ return noJson ? response.text() : response.json();
25
29
  }).then(function (res) {
26
30
  return res;
27
31
  })["catch"](function (err) {
@@ -36,7 +40,7 @@ var post = exports.post = /*#__PURE__*/function () {
36
40
  }
37
41
  }, _callee);
38
42
  }));
39
- return function post(_x, _x2, _x3) {
43
+ return function post(_x, _x2, _x3, _x4) {
40
44
  return _ref.apply(this, arguments);
41
45
  };
42
46
  }();
@@ -68,7 +72,7 @@ var get = exports.get = /*#__PURE__*/function () {
68
72
  }
69
73
  }, _callee2);
70
74
  }));
71
- return function get(_x4, _x5, _x6) {
75
+ return function get(_x5, _x6, _x7) {
72
76
  return _ref2.apply(this, arguments);
73
77
  };
74
78
  }();
@@ -101,15 +105,31 @@ var documentDownload = exports.documentDownload = function documentDownload(para
101
105
  return post("https://zwfwpt.sxzwfw.gov.cn/DeclarationAPI/declaration/center/signapproval/api/documentDownload", params, config);
102
106
  };
103
107
  var qrySealApi = exports.qrySealApi = function qrySealApi(params, config) {
104
- return post("https://zwfwpt.sxzwfw.gov.cn/DeclarationAPI/declaration/center/sign/api/qrySeal", params, config);
108
+ return post(config.baseUrl + "/declaration/center/sign/api/qrySeal", params, config);
105
109
  };
106
110
 
111
+ // 获取电子签章页面
112
+ var getSignOrderIdApi = exports.getSignOrderIdApi = function getSignOrderIdApi(params, config) {
113
+ return post(config.baseUrl + "/declaration/center/sign/api/outSignCreateSiggOrder", params, config);
114
+ };
107
115
  // 获取电子签章页面
108
116
  var getSealUrlApi = exports.getSealUrlApi = function getSealUrlApi(params, config) {
109
- return post("https://zwfwpt.sxzwfw.gov.cn/DeclarationAPI/declaration/center/sign/api/signWebByDirect", params, config);
117
+ return post(config.baseUrl + "/declaration/center/sign/api/signWebByDirectMobile", params, config, true);
110
118
  };
111
119
 
112
120
  // 电子签章-下载文件
113
121
  var signFileDownApi = exports.signFileDownApi = function signFileDownApi(params, config) {
114
- return post("https://zwfwpt.sxzwfw.gov.cn/DeclarationAPI/declaration/center/sign/api/fileDownloadBySign", params, config);
122
+ return post(config.baseUrl + "/declaration/center/sign/api/fileDownloadBySign", params, config);
123
+ };
124
+
125
+ // 预览
126
+ var previewApi = exports.previewApi = function previewApi(params, config) {
127
+ return post("https://zwfwpt.sxzwfw.gov.cn/DeclarationAPI/declaration/center/sign/api/preview", params, config);
128
+ };
129
+ // 材料库
130
+ var getMaterialLib = exports.getMaterialLib = function getMaterialLib(params, config) {
131
+ return post("https://zwfwpt.sxzwfw.gov.cn/DeclarationAPI/declaration/material/queryFileByCardNo", params, config);
132
+ };
133
+ var getSignFileApi = exports.getSignFileApi = function getSignFileApi(params, config) {
134
+ return post(config.baseUrl + "/declaration/center/sign/api/getSignFileList", params, config);
115
135
  };