ydb-components-material 0.1.83 → 0.1.85

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 (43) 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.97a3bada.css → umi.466b4c0a.css} +1 -1
  7. package/build/docs/umi.860fec17.js +1 -0
  8. package/build/docs/~demos/:uuid.html +3 -3
  9. package/build/docs/~demos/colorful-button-demo.html +3 -3
  10. package/build/docs/~demos/colorful-input-demo.html +3 -3
  11. package/build/lowcode/assets-daily.json +11 -11
  12. package/build/lowcode/assets-dev.json +2 -2
  13. package/build/lowcode/assets-prod.json +11 -11
  14. package/build/lowcode/meta.js +1 -1
  15. package/build/lowcode/render/default/view.css +1 -1
  16. package/build/lowcode/render/default/view.js +1 -1
  17. package/build/lowcode/view.css +1 -1
  18. package/build/lowcode/view.js +1 -1
  19. package/dist/BizComps.css +1 -1
  20. package/dist/BizComps.js +3 -3
  21. package/dist/BizComps.js.map +1 -1
  22. package/es/api.js +31 -30
  23. package/es/components/file-item/checkPoint.scss +1 -1
  24. package/es/components/file-item/file.js +5 -4
  25. package/es/components/file-item/index.js +55 -34
  26. package/es/components/file-item/seal.js +36 -6
  27. package/es/components/file-item/sealUtil.js +33 -59
  28. package/es/components/file-item/sign.js +22 -4
  29. package/es/components/file-item/signUtil.js +43 -56
  30. package/lib/api.js +31 -30
  31. package/lib/components/file-item/checkPoint.scss +1 -1
  32. package/lib/components/file-item/file.js +5 -4
  33. package/lib/components/file-item/index.js +54 -33
  34. package/lib/components/file-item/seal.js +36 -6
  35. package/lib/components/file-item/sealUtil.js +33 -59
  36. package/lib/components/file-item/sign.js +22 -4
  37. package/lib/components/file-item/signUtil.js +43 -56
  38. package/lowcode_es/meta.js +1 -1
  39. package/lowcode_lib/meta.js +1 -1
  40. package/package.json +3 -3
  41. package/build/docs/umi.84ae667a.js +0 -1
  42. package/es/components/file-item/Untitled-5.json +0 -290
  43. package/lib/components/file-item/Untitled-5.json +0 -290
@@ -7,7 +7,12 @@ function SignPage(props) {
7
7
  var userInfo = props.userInfo,
8
8
  file = props.file,
9
9
  getRes = props.getRes,
10
- handleClose = props.handleClose;
10
+ handleClose = props.handleClose,
11
+ token = props.token,
12
+ tokenTY = props.tokenTY,
13
+ baseUrl = props.baseUrl,
14
+ env = props.env,
15
+ isPC = props.isPC;
11
16
  var _useState = useState(''),
12
17
  srcUrl = _useState[0],
13
18
  setSrcUrl = _useState[1];
@@ -27,12 +32,19 @@ function SignPage(props) {
27
32
  return _regeneratorRuntime.wrap(function (_context) {
28
33
  while (1) switch (_context.prev = _context.next) {
29
34
  case 0:
30
- fileObj = file; // 有旧的URL说明是重新签章 旧的是原始的空白的 重新签需要签在原始的空白文件
35
+ fileObj = file; // 有旧的 URL 说明是重新签章 旧的是原始的空白的 重新签需要签在原始的空白文件
31
36
  if (file.oldUrl) {
32
37
  fileObj.url = file.oldUrl;
33
38
  }
39
+ // 传递配置参数给工具函数
34
40
  _context.next = 1;
35
- return initSignPageMethod(fileObj, userInfo);
41
+ return initSignPageMethod(fileObj, userInfo, {
42
+ token: token,
43
+ tokenTY: tokenTY,
44
+ baseUrl: baseUrl,
45
+ env: env,
46
+ isPC: isPC
47
+ });
36
48
  case 1:
37
49
  res = _context.sent;
38
50
  documentIdVal = res.documentId, contractIdVal = res.contractId, pageUrl = res.pageUrl, nameVal = res.name;
@@ -58,7 +70,13 @@ function SignPage(props) {
58
70
  while (1) switch (_context2.prev = _context2.next) {
59
71
  case 0:
60
72
  _context2.next = 1;
61
- return getSignRes(documentIdVal, contractIdVal, nameVal, true);
73
+ return getSignRes(documentIdVal, contractIdVal, nameVal, true, {
74
+ token: token,
75
+ tokenTY: tokenTY,
76
+ baseUrl: baseUrl,
77
+ env: env,
78
+ isPC: isPC
79
+ });
62
80
  case 1:
63
81
  newFile = _context2.sent;
64
82
  console.log(newFile, '签署完毕后的');
@@ -9,21 +9,21 @@ var documentId = ''; // 手写签批生成的文件id
9
9
  var contractId = ''; // 合同id
10
10
 
11
11
  // 对外的方法 初始化手写签批的页面
12
- export function initSignPageMethod(_x, _x2) {
12
+ export function initSignPageMethod(_x, _x2, _x3) {
13
13
  return _initSignPageMethod.apply(this, arguments);
14
14
  }
15
15
 
16
- // 【第1步】上传要手写签批的文件
16
+ // 【第 1 步】上传要手写签批的文件
17
17
  function _initSignPageMethod() {
18
- _initSignPageMethod = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(fileObj, userInfo) {
18
+ _initSignPageMethod = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(fileObj, userInfo, config) {
19
19
  var name, docId, contrId, flag, pageUrl, params;
20
20
  return _regeneratorRuntime.wrap(function (_context) {
21
21
  while (1) switch (_context.prev = _context.next) {
22
22
  case 0:
23
23
  console.log('fileObj', fileObj, userInfo);
24
- name = fileObj.name; // 【第1步】上传要手写签批的文件
24
+ name = fileObj.name; // 【第 1 步】上传要手写签批的文件
25
25
  _context.next = 1;
26
- return uploadSignFile(fileObj);
26
+ return uploadSignFile(fileObj, config);
27
27
  case 1:
28
28
  docId = _context.sent;
29
29
  console.log('docId---', docId);
@@ -33,11 +33,11 @@ function _initSignPageMethod() {
33
33
  }
34
34
  return _context.abrupt("return", false);
35
35
  case 2:
36
- documentId = docId; // 保存文档id
36
+ documentId = docId; // 保存文档 id
37
37
 
38
- // 【第2步】创建或者发起电子签批
38
+ // 【第 2 步】创建或者发起电子签批
39
39
  _context.next = 3;
40
- return createbycategoryFun(name, docId);
40
+ return createbycategoryFun(name, docId, config);
41
41
  case 3:
42
42
  contrId = _context.sent;
43
43
  console.log('contrId---', contrId);
@@ -48,16 +48,10 @@ function _initSignPageMethod() {
48
48
  return _context.abrupt("return", false);
49
49
  case 4:
50
50
  contractId = contrId;
51
- // const contractIdList = [contrId];
52
- // uni.setStorageSync('contractIdList',
53
- // [
54
- // ...uni.getStorageSync('contractIdList'), ...contractIdList
55
- // ]
56
- // );
57
51
 
58
- // 【第3步】创建手写签批页面
52
+ // 【第 3 步】创建手写签批页面
59
53
  _context.next = 5;
60
- return getContractSignUrl(contrId, userInfo);
54
+ return getContractSignUrl(contrId, userInfo, config);
61
55
  case 5:
62
56
  flag = _context.sent;
63
57
  if (flag) {
@@ -67,7 +61,7 @@ function _initSignPageMethod() {
67
61
  return _context.abrupt("return", false);
68
62
  case 6:
69
63
  _context.next = 7;
70
- return getSignUrl(userInfo);
64
+ return getSignUrl(userInfo, config);
71
65
  case 7:
72
66
  pageUrl = _context.sent;
73
67
  if (pageUrl) {
@@ -76,7 +70,7 @@ function _initSignPageMethod() {
76
70
  }
77
71
  return _context.abrupt("return", false);
78
72
  case 8:
79
- // 将 文档id/签批文件id/签署地址/文件名称 返回
73
+ // 将 文档 id/签批文件 id/签署地址/文件名称 返回
80
74
  params = {
81
75
  documentId: documentId,
82
76
  contractId: contractId,
@@ -92,16 +86,16 @@ function _initSignPageMethod() {
92
86
  }));
93
87
  return _initSignPageMethod.apply(this, arguments);
94
88
  }
95
- function uploadSignFile(_x3) {
89
+ function uploadSignFile(_x4, _x5) {
96
90
  return _uploadSignFile.apply(this, arguments);
97
- } // 【第2步】创建或者发起电子签批
91
+ } // 【第 2 步】创建或者发起电子签批
98
92
  function _uploadSignFile() {
99
- _uploadSignFile = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2(event) {
93
+ _uploadSignFile = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2(event, config) {
100
94
  var blob, file, signApprovalFileType;
101
95
  return _regeneratorRuntime.wrap(function (_context2) {
102
96
  while (1) switch (_context2.prev = _context2.next) {
103
97
  case 0:
104
- console.log(event, '文件1111', window.env);
98
+ console.log(event, '文件 1111', config);
105
99
  // uni.showLoading({ title: '加载中' })
106
100
  _context2.next = 1;
107
101
  return getBlob(event.url);
@@ -120,9 +114,10 @@ function _uploadSignFile() {
120
114
  filename: event.name,
121
115
  // 文件名称
122
116
  headers: {
123
- Authorization: window.token
117
+ Authorization: config.tokenTY
124
118
  },
125
- action: "\nhttps://zwfwpt.sxzwfw.gov.cn" + (window.env === 'release' ? ':10010' : '') + "/DeclarationAPI/declaration/center/signapproval/api/createbyfile",
119
+ // https://zwfwpt.sxzwfw.gov.cn${window.env === 'release' ? ':10010' : ''}/DeclarationAPI
120
+ action: config.baseUrl + "/declaration/center/signapproval/api/createbyfile",
126
121
  // 上传文件的地址
127
122
  onError: function onError(e) {
128
123
  // uni.$u.toast(e.msg || '手写签批上传文件异常');
@@ -144,18 +139,18 @@ function _uploadSignFile() {
144
139
  }));
145
140
  return _uploadSignFile.apply(this, arguments);
146
141
  }
147
- function createbycategoryFun(fileName, documentIdVal) {
142
+ function createbycategoryFun(fileName, documentIdVal, config) {
148
143
  // uni.showLoading({ title: '加载中' })
149
- console.log('env---', window.env);
144
+ console.log('env---', config.env);
150
145
  var params = {
151
146
  subject: fileName,
152
147
  documents: [documentIdVal],
153
- categoryId: window.env === 'release' ? categoryIdRelease : categoryId,
148
+ categoryId: config.env === 'releaseHLW' ? categoryIdRelease : categoryId,
154
149
  send: true,
155
150
  tenantName: '山西省行政审批服务管理局'
156
151
  };
157
152
  return new Promise(function (resolve) {
158
- createbycategory(params).then(function (res) {
153
+ createbycategory(params, config).then(function (res) {
159
154
  console.log('创建订单成功', res);
160
155
  if (res.code === 200) {
161
156
  resolve(res.data.contractId);
@@ -169,8 +164,8 @@ function createbycategoryFun(fileName, documentIdVal) {
169
164
  });
170
165
  }
171
166
 
172
- // 【第3步】创建手写签批页面
173
- function getContractSignUrl(contractIdVal, userInfo) {
167
+ // 【第 3 步】创建手写签批页面
168
+ function getContractSignUrl(contractIdVal, userInfo, config) {
174
169
  console.log('contractIdVal', contractIdVal, userInfo);
175
170
  // uni.showLoading({ title: '加载中' })
176
171
  var params = {
@@ -187,7 +182,7 @@ function getContractSignUrl(contractIdVal, userInfo) {
187
182
  }]
188
183
  };
189
184
  return new Promise(function (resolve) {
190
- contractSignUrl(params).then(function (res) {
185
+ contractSignUrl(params, config).then(function (res) {
191
186
  if (res.data.code == 0) {
192
187
  resolve(true);
193
188
  } else {
@@ -207,8 +202,8 @@ function getContractSignUrl(contractIdVal, userInfo) {
207
202
  });
208
203
  }
209
204
 
210
- // 【第4步】获取签pi页面
211
- function getSignUrl(userInfo) {
205
+ // 【第 4 步】获取签 pi 页面
206
+ function getSignUrl(userInfo, config) {
212
207
  // uni.showLoading({ title: '加载中' })
213
208
  var params = {
214
209
  contractId: contractId,
@@ -229,14 +224,14 @@ function getSignUrl(userInfo) {
229
224
  canViewDetail: false,
230
225
  // 页面是否显示签署详情按钮
231
226
  canMoreOperation: false,
232
- // 页面是否显示“更多操作”按钮
227
+ // 页面是否显示"更多操作"按钮
233
228
  autoClosePage: true,
234
229
  // 操作完成自动关闭页面
235
230
  language: 'ZH_CN',
236
- deviceType: window.isPC || 'H5' // 取值范围:PC(返回PC页面),H5(返回H5页面);不传值默认为:根据请求的UserAgent自动判断返回的页面类型。
231
+ deviceType: config.isPC || 'H5' // 取值范围:PC(返回 PC 页面),H5(返回 H5 页面);不传值默认为:根据请求的 UserAgent 自动判断返回的页面类型。
237
232
  };
238
233
  return new Promise(function (resolve) {
239
- signurl(params).then(function (res) {
234
+ signurl(params, config).then(function (res) {
240
235
  console.log(res, '页面结果');
241
236
  if (res.data.code == 0) {
242
237
  resolve(res.data.signUrl);
@@ -254,19 +249,19 @@ function getSignUrl(userInfo) {
254
249
  // 下方是打开手写签批页面后 的后续操作
255
250
 
256
251
  // 对外的方法 获取签批后的文件
257
- export function getSignRes(_x4, _x5, _x6, _x7) {
252
+ export function getSignRes(_x6, _x7, _x8, _x9, _x0) {
258
253
  return _getSignRes.apply(this, arguments);
259
254
  }
260
255
 
261
256
  // 轮询 签批状态
262
257
  function _getSignRes() {
263
- _getSignRes = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee3(documentIdVal, contractIdVal, name, autoUpload) {
258
+ _getSignRes = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee3(documentIdVal, contractIdVal, name, autoUpload, config) {
264
259
  var isSignSucc, newFile, uploadedFileObj;
265
260
  return _regeneratorRuntime.wrap(function (_context3) {
266
261
  while (1) switch (_context3.prev = _context3.next) {
267
262
  case 0:
268
263
  _context3.next = 1;
269
- return getCheckSignState(contractIdVal);
264
+ return getCheckSignState(contractIdVal, config);
270
265
  case 1:
271
266
  isSignSucc = _context3.sent;
272
267
  if (!isSignSucc) {
@@ -274,9 +269,9 @@ function _getSignRes() {
274
269
  break;
275
270
  }
276
271
  // 封存
277
- getContractFinish(contractIdVal);
272
+ getContractFinish(contractIdVal, config);
278
273
  _context3.next = 2;
279
- return handleSignApprovalDown(documentIdVal, name);
274
+ return handleSignApprovalDown(documentIdVal, name, config);
280
275
  case 2:
281
276
  newFile = _context3.sent;
282
277
  console.log('newFile', newFile);
@@ -286,7 +281,7 @@ function _getSignRes() {
286
281
  break;
287
282
  }
288
283
  _context3.next = 3;
289
- return uploadFilePromise(newFile);
284
+ return uploadFilePromise(newFile, config);
290
285
  case 3:
291
286
  uploadedFileObj = _context3.sent;
292
287
  console.log('签批完成后的文件地址', uploadedFileObj);
@@ -306,11 +301,11 @@ function _getSignRes() {
306
301
  }));
307
302
  return _getSignRes.apply(this, arguments);
308
303
  }
309
- function getCheckSignState(contractIdVal) {
304
+ function getCheckSignState(contractIdVal, config) {
310
305
  return new Promise(function (resolve) {
311
306
  checkSignState({
312
307
  contractId: contractIdVal
313
- }).then(function (res) {
308
+ }, config).then(function (res) {
314
309
  console.log('轮询结果---', res);
315
310
  // console.log('轮询结果', JSON.parse(res.data));
316
311
  // 签署完成
@@ -329,32 +324,24 @@ function getCheckSignState(contractIdVal) {
329
324
  }
330
325
 
331
326
  // 封存电子签批
332
- function getContractFinish(contractIdVal) {
327
+ function getContractFinish(contractIdVal, config) {
333
328
  contractFinish({
334
329
  contractId: contractIdVal
335
- });
330
+ }, config);
336
331
  }
337
332
 
338
333
  // 下载签署完的文档
339
- function handleSignApprovalDown(documentIdVal, name) {
334
+ function handleSignApprovalDown(documentIdVal, name, config) {
340
335
  var params = {
341
336
  documentId: documentIdVal,
342
337
  type: 'pdf'
343
338
  };
344
339
  return new Promise(function (resolve) {
345
- documentDownload(params).then(function (res) {
340
+ documentDownload(params, config).then(function (res) {
346
341
  console.log('下载文件:', res);
347
342
  // 返回来是base64格式的
348
343
  var blob = dataURLtoBlob(res.data); // 转成blob格式进行上传
349
344
  console.log(blob, '新文件的blob格式');
350
- var fileObj = {
351
- file: [{
352
- url: res.data,
353
- size: blob.size,
354
- isSignApproval: true,
355
- name: name
356
- }]
357
- };
358
345
  resolve(blob);
359
346
  });
360
347
  });
package/lib/api.js CHANGED
@@ -14,19 +14,19 @@ var post = exports.post = /*#__PURE__*/function () {
14
14
  if (noJson === void 0) {
15
15
  noJson = false;
16
16
  }
17
- console.log('window.env111', window.env, window.tokenTY);
17
+ console.log('config', config);
18
18
  // zwfwpt.sxzwfw.gov.cn
19
- if (window.env === 'release' && url.indexOf('zwfwpt.sxzwfw.gov.cn') > -1) {
20
- url = url.replace('zwfwpt.sxzwfw.gov.cn', 'zwfwpt.sxzwfw.gov.cn:10010');
21
- }
19
+ // if (config.env === 'release' && url.indexOf('zwfwpt.sxzwfw.gov.cn') > -1) {
20
+ // url = url.replace('zwfwpt.sxzwfw.gov.cn', 'zwfwpt.sxzwfw.gov.cn:10010')
21
+ // }
22
22
  _context.next = 1;
23
23
  return fetch(url, {
24
24
  method: 'POST',
25
25
  headers: {
26
26
  'Content-Type': config && config['Content-Type'] ? config['Content-Type'] : 'application/json',
27
27
  // 声明发送的数据格式
28
- // zwfwpt.sxzwfw.gov.cn
29
- 'Authorization': url.indexOf('zwfwpt.sxzwfw.gov.cn') > -1 ? window.token : window.tokenTY
28
+ // url.indexOf('zwfwpt.sxzwfw.gov.cn') > -1 ? config.token : config.tokenTY
29
+ 'Authorization': config && config.tokenTY ? config.tokenTY : ''
30
30
  },
31
31
  body: JSON.stringify(data)
32
32
  }).then(function (response) {
@@ -61,7 +61,7 @@ var get = exports.get = /*#__PURE__*/function () {
61
61
  method: 'GET',
62
62
  headers: {
63
63
  'Content-Type': config && config['Content-Type'] ? config['Content-Type'] : 'application/json',
64
- 'Authorization': url.indexOf('zwfwpt.sxzwfw.gov.cn') > -1 ? window.token : window.tokenTY
64
+ 'Authorization': config && config.tokenTY ? config.tokenTY : ''
65
65
  }
66
66
  }).then(function (response) {
67
67
  return response.json();
@@ -83,84 +83,85 @@ var get = exports.get = /*#__PURE__*/function () {
83
83
  return _ref2.apply(this, arguments);
84
84
  };
85
85
  }();
86
+ // https://zwfwpt.sxzwfw.gov.cn/DeclarationAPI
86
87
  var createbycategory = exports.createbycategory = function createbycategory(params, config) {
87
- return post("https://zwfwpt.sxzwfw.gov.cn/DeclarationAPI/declaration/center/signapproval/api/createbycategory", params, config);
88
+ return post(config.baseUrl + "/declaration/center/signapproval/api/createbycategory", params, config);
88
89
  };
89
90
 
90
91
  // 获取电子签批签署页面
91
92
  var contractSignUrl = exports.contractSignUrl = function contractSignUrl(params, config) {
92
- return post("https://zwfwpt.sxzwfw.gov.cn/DeclarationAPI/declaration/center/signapproval/api/contractSignUrl", params, config);
93
+ return post(config.baseUrl + "/declaration/center/signapproval/api/contractSignUrl", params, config);
93
94
  };
94
95
 
95
96
  // 获取电子签批签署页面
96
97
  var signurl = exports.signurl = function signurl(params, config) {
97
- return post("https://zwfwpt.sxzwfw.gov.cn/DeclarationAPI/declaration/center/signapproval/contract/signurl/v3", params, config);
98
+ return post(config.baseUrl + "/declaration/center/signapproval/contract/signurl/v3", params, config);
98
99
  };
99
100
 
100
- // 校验签批状态-轮训
101
+ // 校验签批状态 - 轮训
101
102
  var checkSignState = exports.checkSignState = function checkSignState(params, config) {
102
- return post("https://zwfwpt.sxzwfw.gov.cn/DeclarationAPI/declaration/center/signapproval/api/checkSignState", params, config);
103
+ return post(config.baseUrl + "/declaration/center/signapproval/api/checkSignState", params, config);
103
104
  };
104
105
 
105
106
  // 封存电子签批并完成签署
106
107
  var contractFinish = exports.contractFinish = function contractFinish(params, config) {
107
- return post("https://zwfwpt.sxzwfw.gov.cn/DeclarationAPI/declaration/center/signapproval/api/contract/finish", params, config);
108
+ return post(config.baseUrl + "/declaration/center/signapproval/api/contract/finish", params, config);
108
109
  };
109
110
 
110
111
  // 下载签署文档
111
112
  var documentDownload = exports.documentDownload = function documentDownload(params, config) {
112
- return post("https://zwfwpt.sxzwfw.gov.cn/DeclarationAPI/declaration/center/signapproval/api/documentDownload", params, config);
113
+ return post(config.baseUrl + "/declaration/center/signapproval/api/documentDownload", params, config);
113
114
  };
114
115
  var qrySealApi = exports.qrySealApi = function qrySealApi(params, config) {
115
- return post(window.baseUrl + "/declaration/center/sign/api/qrySeal", params, config);
116
+ return post(config.baseUrl + "/declaration/center/sign/api/qrySeal", params, config);
116
117
  };
117
118
 
118
119
  // 获取电子签章页面
119
120
  var getSignOrderIdApi = exports.getSignOrderIdApi = function getSignOrderIdApi(params, config) {
120
- return post(window.baseUrl + "/declaration/center/sign/api/outSignCreateSiggOrder", params, config);
121
+ return post(config.baseUrl + "/declaration/center/sign/api/outSignCreateSiggOrder", params, config);
121
122
  };
122
123
  // 获取电子签章页面
123
124
  var getSealUrlApi = exports.getSealUrlApi = function getSealUrlApi(params, config) {
124
- return post(window.baseUrl + "/declaration/center/sign/api/signWebByDirectMobile", params, config, true);
125
+ return post(config.baseUrl + "/declaration/center/sign/api/signWebByDirectMobile", params, config, true);
125
126
  };
126
- // 获取电子签章页面pc
127
+ // 获取电子签章页面 pc
127
128
  var getPcSealUrlApi = exports.getPcSealUrlApi = function getPcSealUrlApi(params, config) {
128
- return post(window.baseUrl + "/declaration/center/sign/api/signWebByDirect", params, config);
129
+ return post(config.baseUrl + "/declaration/center/sign/api/signWebByDirect", params, config);
129
130
  };
130
131
 
131
- // 电子签章-下载文件
132
+ // 电子签章 - 下载文件
132
133
  var signFileDownApi = exports.signFileDownApi = function signFileDownApi(params, config) {
133
- return post(window.baseUrl + "/declaration/center/sign/api/fileDownloadBySign", params, config);
134
+ return post(config.baseUrl + "/declaration/center/sign/api/fileDownloadBySign", params, config);
134
135
  };
135
136
 
136
137
  // 电子签章 上传文件
137
138
  var fileUploadApi = exports.fileUploadApi = function fileUploadApi(params, config) {
138
- return post(window.baseUrl + "/declaration/material/base64UploadMaterial", params, config);
139
+ return post(config.baseUrl + "/declaration/material/base64UploadMaterial", params, config);
139
140
  };
140
141
 
141
142
  // 预览
142
143
  var previewApi = exports.previewApi = function previewApi(params, config) {
143
- return post("https://zwfwpt.sxzwfw.gov.cn/DeclarationAPI/declaration/center/sign/api/preview", params, config);
144
+ return post(config.baseUrl + "/declaration/center/sign/api/preview", params, config);
144
145
  };
145
146
  // 材料库
146
147
  var getMaterialLib = exports.getMaterialLib = function getMaterialLib(params, config) {
147
- return post("https://zwfwpt.sxzwfw.gov.cn/DeclarationAPI/declaration/material/queryFileByCardNo", params, config);
148
+ return post(config.baseUrl + "/declaration/material/queryFileByCardNo", params, config);
148
149
  };
149
150
  var getUrlById = exports.getUrlById = function getUrlById(params, config) {
150
- return get("https://zwfwpt.sxzwfw.gov.cn:10009/DeclarationAPI/declaration/material/file/files/api/presigned-url", params, config);
151
+ return get(config.baseUrl + "/declaration/material/file/files/api/presigned-url", params, config);
151
152
  };
152
153
  var onlinePreview = exports.onlinePreview = function onlinePreview(params, config) {
153
- return get("https://zwfwpt.sxzwfw.gov.cn:10009/DeclarationAPI/declaration/material/onlinePreview", params, config);
154
+ return get(config.baseUrl + "/declaration/material/onlinePreview", params, config);
154
155
  };
155
156
  var getMaterialPreview = exports.getMaterialPreview = function getMaterialPreview(params, config) {
156
- return get(window.baseUrl + "/declaration/material/onlinePreview", params, config);
157
+ return get(config.baseUrl + "/declaration/material/onlinePreview", params, config);
157
158
  };
158
159
  var getSignFileApi = exports.getSignFileApi = function getSignFileApi(params, config) {
159
- return post(window.baseUrl + "/declaration/center/sign/api/getSignFileList", params, config);
160
+ return post(config.baseUrl + "/declaration/center/sign/api/getSignFileList", params, config);
160
161
  };
161
162
  var getIcons = exports.getIcons = function getIcons(params, config) {
162
- return post(window.baseUrl + "component/icon/page", params, config);
163
+ return post(config.baseUrl + "component/icon/page", params, config);
163
164
  };
164
165
  var getGuideImg = exports.getGuideImg = function getGuideImg(params, config) {
165
- return get(window.baseUrl + "/declaration/material/file/files/api/presigned-url", params, config);
166
+ return get(config.baseUrl + "/declaration/material/file/files/api/presigned-url", params, config);
166
167
  };
@@ -8,7 +8,7 @@
8
8
  left: 0;
9
9
  top: 0;
10
10
  background: #919191;
11
- // padding-top: 100px;
11
+ overflow-y: scroll;
12
12
  #file_check_point {
13
13
  overflow: visible !important;
14
14
  overflow-clip-margin: unset !important;
@@ -102,17 +102,18 @@ function dataURLtoBlob(dataUrl) {
102
102
  }
103
103
 
104
104
  // 上传文件至申报端的服务器 [方法]
105
- function uploadFilePromise(url, baseUrl, token) {
105
+ function uploadFilePromise(url, config) {
106
+ console.log('uploadFilePromise', config);
106
107
  return new Promise(function (resolve, reject) {
107
108
  var formData = new FormData();
108
109
  formData.append('file', url);
109
110
  formData.append('open', true);
110
111
  formData.append('open', 'true');
111
- fetch(baseUrl + "/declaration/material/file/files/api", {
112
+ fetch(config.baseUrl + "/declaration/material/file/files/api", {
112
113
  method: 'POST',
113
114
  body: formData,
114
- header: {
115
- Authorization: token
115
+ headers: {
116
+ 'Authorization': config.tokenTY
116
117
  }
117
118
  }).then(function (response) {
118
119
  return response.json();
@@ -131,7 +131,7 @@ var FileItem = function FileItem(_ref) {
131
131
  method: 'POST',
132
132
  body: formData,
133
133
  headers: {
134
- 'Authorization': tokenTY
134
+ 'Authorization': tokenTY || ''
135
135
  }
136
136
  }).then(function (response) {
137
137
  return response.json();
@@ -156,6 +156,7 @@ var FileItem = function FileItem(_ref) {
156
156
  // 预览材料
157
157
  var preview = /*#__PURE__*/function () {
158
158
  var _ref2 = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee() {
159
+ var urlRes, res;
159
160
  return _regenerator["default"].wrap(function (_context) {
160
161
  while (1) switch (_context.prev = _context.next) {
161
162
  case 0:
@@ -169,29 +170,40 @@ var FileItem = function FileItem(_ref) {
169
170
  setPreviewIframeUrl(fileUrl);
170
171
  setIsShowPreview(true);
171
172
  // if (!fileId) return;
172
- // const urlRes = await getUrlById({
173
- // id: fileId,
174
- // effectiveTime: 3600000
175
- // })
176
- // if (urlRes.presignedUrlList && urlRes.presignedUrlList.length > 0) {
177
- // // fetch(`${baseUrl}/declaration/material/onlinePreview?url=${urlRes.presignedUrlList[2]}`, {
178
- // // method: 'GET',
179
- // // headers: {
180
- // // 'Authorization': tokenTY
181
- // // }
182
- // // })
183
- // // .then(response => response.json())
184
- // // .then(res => {
185
- // // setPreviewIframeUrl(res.url)
186
- // // setIsShowPreview(true)
187
- // // })
188
- // const res = await onlinePreview({
189
- // url: urlRes.presignedUrlList[2],
190
- // })
191
- // setPreviewIframeUrl(res.url)
192
- // setIsShowPreview(true)
193
- // }
173
+ _context.next = 2;
174
+ return (0, _api.getUrlById)({
175
+ id: fileId,
176
+ effectiveTime: 3600000
177
+ }, {
178
+ token: token,
179
+ tokenTY: tokenTY,
180
+ baseUrl: baseUrl,
181
+ env: env,
182
+ isPC: isPC,
183
+ accessToken: accessToken
184
+ });
194
185
  case 2:
186
+ urlRes = _context.sent;
187
+ if (!(urlRes.presignedUrlList && urlRes.presignedUrlList.length > 0)) {
188
+ _context.next = 4;
189
+ break;
190
+ }
191
+ _context.next = 3;
192
+ return (0, _api.onlinePreview)({
193
+ url: urlRes.presignedUrlList[2]
194
+ }, {
195
+ token: token,
196
+ tokenTY: tokenTY,
197
+ baseUrl: baseUrl,
198
+ env: env,
199
+ isPC: isPC,
200
+ accessToken: accessToken
201
+ });
202
+ case 3:
203
+ res = _context.sent;
204
+ setPreviewIframeUrl(res.url);
205
+ setIsShowPreview(true);
206
+ case 4:
195
207
  case "end":
196
208
  return _context.stop();
197
209
  }
@@ -212,7 +224,7 @@ var FileItem = function FileItem(_ref) {
212
224
  fetch(baseUrl + "/declaration/material/onlinePreview?url=" + url, {
213
225
  method: 'GET',
214
226
  headers: {
215
- 'Authorization': tokenTY
227
+ 'Authorization': tokenTY || ''
216
228
  }
217
229
  }).then(function (response) {
218
230
  return response.json();
@@ -275,7 +287,14 @@ var FileItem = function FileItem(_ref) {
275
287
  pageNum: 1,
276
288
  pageSize: 10
277
289
  };
278
- (0, _api.getMaterialLib)(params).then(function (res) {
290
+ (0, _api.getMaterialLib)(params, {
291
+ token: token,
292
+ tokenTY: tokenTY,
293
+ baseUrl: baseUrl,
294
+ env: env,
295
+ isPC: isPC,
296
+ accessToken: accessToken
297
+ }).then(function (res) {
279
298
  if (res.code === 200) {
280
299
  var records = res.data.records;
281
300
  setMaterialLib(records);
@@ -305,6 +324,13 @@ var FileItem = function FileItem(_ref) {
305
324
  return (0, _api.getGuideImg)({
306
325
  id: guideImg,
307
326
  effectiveTime: 3600000
327
+ }, {
328
+ token: token,
329
+ tokenTY: tokenTY,
330
+ baseUrl: baseUrl,
331
+ env: env,
332
+ isPC: isPC,
333
+ accessToken: accessToken
308
334
  });
309
335
  case 2:
310
336
  guideImgRes = _context2.sent;
@@ -367,14 +393,6 @@ var FileItem = function FileItem(_ref) {
367
393
  }, 0);
368
394
  }
369
395
  }, [userInfo, isShowLib, tokenTY]);
370
- (0, _react.useEffect)(function () {
371
- window.env = env;
372
- window.baseUrl = baseUrl;
373
- window.token = token;
374
- window.tokenTY = tokenTY;
375
- window.isPC = isPC;
376
- window.accessToken = accessToken;
377
- }, [env, baseUrl, token, tokenTY, isPC, accessToken]);
378
396
  return /*#__PURE__*/_react["default"].createElement("div", {
379
397
  className: "file_item",
380
398
  style: style
@@ -563,6 +581,8 @@ var FileItem = function FileItem(_ref) {
563
581
  token: token,
564
582
  tokenTY: tokenTY,
565
583
  baseUrl: baseUrl,
584
+ env: env,
585
+ isPC: isPC,
566
586
  getRes: getRes,
567
587
  handleClose: function handleClose() {
568
588
  return setIsShowSignPage(false);
@@ -581,6 +601,7 @@ var FileItem = function FileItem(_ref) {
581
601
  tokenTY: tokenTY,
582
602
  baseUrl: baseUrl,
583
603
  env: env,
604
+ isPC: isPC,
584
605
  getSealRes: getSealRes,
585
606
  accessToken: accessToken,
586
607
  handleClose: function handleClose() {