ydb-components-material 0.1.66 → 0.1.67

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 (38) 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.2387c9e8.js +1 -0
  7. package/build/docs/~demos/:uuid.html +3 -3
  8. package/build/docs/~demos/colorful-button-demo.html +3 -3
  9. package/build/docs/~demos/colorful-input-demo.html +3 -3
  10. package/build/lowcode/assets-daily.json +11 -11
  11. package/build/lowcode/assets-dev.json +2 -2
  12. package/build/lowcode/assets-prod.json +11 -11
  13. package/build/lowcode/meta.js +1 -1
  14. package/build/lowcode/render/default/view.js +1 -1
  15. package/build/lowcode/view.js +1 -1
  16. package/dist/BizComps.js +5 -5
  17. package/dist/BizComps.js.map +1 -1
  18. package/es/api.js +16 -11
  19. package/es/components/file-item/index.d.ts +1 -0
  20. package/es/components/file-item/index.js +48 -21
  21. package/es/components/file-item/seal.js +5 -20
  22. package/es/components/file-item/sealUtil.js +20 -38
  23. package/es/components/file-item/sign.js +9 -16
  24. package/es/components/file-item/signUtil.js +28 -41
  25. package/lib/api.js +17 -12
  26. package/lib/components/file-item/index.d.ts +1 -0
  27. package/lib/components/file-item/index.js +47 -20
  28. package/lib/components/file-item/seal.js +5 -20
  29. package/lib/components/file-item/sealUtil.js +20 -38
  30. package/lib/components/file-item/sign.js +9 -16
  31. package/lib/components/file-item/signUtil.js +28 -41
  32. package/lowcode/file-item/meta.ts +15 -0
  33. package/lowcode_es/file-item/meta.js +14 -0
  34. package/lowcode_es/meta.js +1 -1
  35. package/lowcode_lib/file-item/meta.js +14 -0
  36. package/lowcode_lib/meta.js +1 -1
  37. package/package.json +3 -3
  38. package/build/docs/umi.04af327b.js +0 -1
@@ -2,27 +2,26 @@ import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
2
2
  import _regeneratorRuntime from "@babel/runtime/regenerator";
3
3
  import { getBlob, getFileExtension, upload, dataURLtoBlob, uploadFilePromise } from "./file";
4
4
  import { createbycategory, contractSignUrl, signurl, checkSignState, contractFinish, documentDownload } from "../../api";
5
- var baseURL = 'http://172.16.132.12:5005';
6
5
  var categoryId = '3354397552669692408';
7
6
  var documentId = ''; // 手写签批生成的文件id
8
7
  var contractId = ''; // 合同id
9
8
 
10
9
  // 对外的方法 初始化手写签批的页面
11
- export function initSignPageMethod(_x, _x2, _x3, _x4, _x5) {
10
+ export function initSignPageMethod(_x, _x2) {
12
11
  return _initSignPageMethod.apply(this, arguments);
13
12
  }
14
13
 
15
14
  // 【第1步】上传要手写签批的文件
16
15
  function _initSignPageMethod() {
17
- _initSignPageMethod = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(fileObj, userInfo, token, device, tokenTY) {
16
+ _initSignPageMethod = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(fileObj, userInfo) {
18
17
  var name, docId, contrId, flag, pageUrl, params;
19
18
  return _regeneratorRuntime.wrap(function (_context) {
20
19
  while (1) switch (_context.prev = _context.next) {
21
20
  case 0:
22
- console.log('fileObj', fileObj, userInfo, token, tokenTY);
21
+ console.log('fileObj', fileObj, userInfo);
23
22
  name = fileObj.name; // 【第1步】上传要手写签批的文件
24
23
  _context.next = 1;
25
- return uploadSignFile(fileObj, token);
24
+ return uploadSignFile(fileObj);
26
25
  case 1:
27
26
  docId = _context.sent;
28
27
  console.log('docId---', docId);
@@ -36,7 +35,7 @@ function _initSignPageMethod() {
36
35
 
37
36
  // 【第2步】创建或者发起电子签批
38
37
  _context.next = 3;
39
- return createbycategoryFun(name, docId, token);
38
+ return createbycategoryFun(name, docId);
40
39
  case 3:
41
40
  contrId = _context.sent;
42
41
  console.log('contrId---', contrId);
@@ -56,7 +55,7 @@ function _initSignPageMethod() {
56
55
 
57
56
  // 【第3步】创建手写签批页面
58
57
  _context.next = 5;
59
- return getContractSignUrl(contrId, userInfo, token);
58
+ return getContractSignUrl(contrId, userInfo);
60
59
  case 5:
61
60
  flag = _context.sent;
62
61
  if (flag) {
@@ -66,7 +65,7 @@ function _initSignPageMethod() {
66
65
  return _context.abrupt("return", false);
67
66
  case 6:
68
67
  _context.next = 7;
69
- return getSignUrl(userInfo, token, device);
68
+ return getSignUrl(userInfo);
70
69
  case 7:
71
70
  pageUrl = _context.sent;
72
71
  if (pageUrl) {
@@ -91,11 +90,11 @@ function _initSignPageMethod() {
91
90
  }));
92
91
  return _initSignPageMethod.apply(this, arguments);
93
92
  }
94
- function uploadSignFile(_x6, _x7) {
93
+ function uploadSignFile(_x3) {
95
94
  return _uploadSignFile.apply(this, arguments);
96
95
  } // 【第2步】创建或者发起电子签批
97
96
  function _uploadSignFile() {
98
- _uploadSignFile = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2(event, token) {
97
+ _uploadSignFile = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2(event) {
99
98
  var blob, file, signApprovalFileType;
100
99
  return _regeneratorRuntime.wrap(function (_context2) {
101
100
  while (1) switch (_context2.prev = _context2.next) {
@@ -119,9 +118,9 @@ function _uploadSignFile() {
119
118
  filename: event.name,
120
119
  // 文件名称
121
120
  headers: {
122
- Authorization: token
121
+ Authorization: window.token
123
122
  },
124
- action: "\nhttps://zwfwpt.sxzwfw.gov.cn/DeclarationAPI/declaration/center/signapproval/api/createbyfile",
123
+ action: "\nhttps://zwfwpt.sxzwfw.gov.cn" + (window.env === 'release' ? ':10010' : '') + "/DeclarationAPI/declaration/center/signapproval/api/createbyfile",
125
124
  // 上传文件的地址
126
125
  onError: function onError(e) {
127
126
  // uni.$u.toast(e.msg || '手写签批上传文件异常');
@@ -143,7 +142,7 @@ function _uploadSignFile() {
143
142
  }));
144
143
  return _uploadSignFile.apply(this, arguments);
145
144
  }
146
- function createbycategoryFun(fileName, documentIdVal, token) {
145
+ function createbycategoryFun(fileName, documentIdVal) {
147
146
  // uni.showLoading({ title: '加载中' })
148
147
  var params = {
149
148
  subject: fileName,
@@ -153,9 +152,7 @@ function createbycategoryFun(fileName, documentIdVal, token) {
153
152
  tenantName: '山西省行政审批服务管理局'
154
153
  };
155
154
  return new Promise(function (resolve) {
156
- createbycategory(params, {
157
- token: token
158
- }).then(function (res) {
155
+ createbycategory(params).then(function (res) {
159
156
  console.log('创建订单成功', res);
160
157
  if (res.code === 200) {
161
158
  resolve(res.data.contractId);
@@ -170,7 +167,7 @@ function createbycategoryFun(fileName, documentIdVal, token) {
170
167
  }
171
168
 
172
169
  // 【第3步】创建手写签批页面
173
- function getContractSignUrl(contractIdVal, userInfo, token) {
170
+ function getContractSignUrl(contractIdVal, userInfo) {
174
171
  console.log('contractIdVal', contractIdVal, userInfo);
175
172
  // uni.showLoading({ title: '加载中' })
176
173
  var params = {
@@ -187,9 +184,7 @@ function getContractSignUrl(contractIdVal, userInfo, token) {
187
184
  }]
188
185
  };
189
186
  return new Promise(function (resolve) {
190
- contractSignUrl(params, {
191
- token: token
192
- }).then(function (res) {
187
+ contractSignUrl(params).then(function (res) {
193
188
  if (res.data.code == 0) {
194
189
  resolve(true);
195
190
  } else {
@@ -210,7 +205,7 @@ function getContractSignUrl(contractIdVal, userInfo, token) {
210
205
  }
211
206
 
212
207
  // 【第4步】获取签pi页面
213
- function getSignUrl(userInfo, token, device) {
208
+ function getSignUrl(userInfo) {
214
209
  // uni.showLoading({ title: '加载中' })
215
210
  var params = {
216
211
  contractId: contractId,
@@ -235,12 +230,10 @@ function getSignUrl(userInfo, token, device) {
235
230
  autoClosePage: true,
236
231
  // 操作完成自动关闭页面
237
232
  language: 'ZH_CN',
238
- deviceType: device || 'H5' // 取值范围:PC(返回PC页面),H5(返回H5页面);不传值默认为:根据请求的UserAgent自动判断返回的页面类型。
233
+ deviceType: window.isPC || 'H5' // 取值范围:PC(返回PC页面),H5(返回H5页面);不传值默认为:根据请求的UserAgent自动判断返回的页面类型。
239
234
  };
240
235
  return new Promise(function (resolve) {
241
- signurl(params, {
242
- token: token
243
- }).then(function (res) {
236
+ signurl(params).then(function (res) {
244
237
  console.log(res, '页面结果');
245
238
  if (res.data.code == 0) {
246
239
  resolve(res.data.signUrl);
@@ -258,19 +251,19 @@ function getSignUrl(userInfo, token, device) {
258
251
  // 下方是打开手写签批页面后 的后续操作
259
252
 
260
253
  // 对外的方法 获取签批后的文件
261
- export function getSignRes(_x8, _x9, _x0, _x1, _x10, _x11) {
254
+ export function getSignRes(_x4, _x5, _x6, _x7) {
262
255
  return _getSignRes.apply(this, arguments);
263
256
  }
264
257
 
265
258
  // 轮询 签批状态
266
259
  function _getSignRes() {
267
- _getSignRes = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee3(documentIdVal, contractIdVal, name, autoUpload, token, baseUrl) {
260
+ _getSignRes = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee3(documentIdVal, contractIdVal, name, autoUpload) {
268
261
  var isSignSucc, newFile, uploadedFileObj;
269
262
  return _regeneratorRuntime.wrap(function (_context3) {
270
263
  while (1) switch (_context3.prev = _context3.next) {
271
264
  case 0:
272
265
  _context3.next = 1;
273
- return getCheckSignState(contractIdVal, token);
266
+ return getCheckSignState(contractIdVal);
274
267
  case 1:
275
268
  isSignSucc = _context3.sent;
276
269
  if (!isSignSucc) {
@@ -278,9 +271,9 @@ function _getSignRes() {
278
271
  break;
279
272
  }
280
273
  // 封存
281
- getContractFinish(contractIdVal, token);
274
+ getContractFinish(contractIdVal);
282
275
  _context3.next = 2;
283
- return handleSignApprovalDown(documentIdVal, name, token);
276
+ return handleSignApprovalDown(documentIdVal, name);
284
277
  case 2:
285
278
  newFile = _context3.sent;
286
279
  console.log('newFile', newFile);
@@ -290,7 +283,7 @@ function _getSignRes() {
290
283
  break;
291
284
  }
292
285
  _context3.next = 3;
293
- return uploadFilePromise(newFile, baseUrl, token);
286
+ return uploadFilePromise(newFile);
294
287
  case 3:
295
288
  uploadedFileObj = _context3.sent;
296
289
  console.log('签批完成后的文件地址', uploadedFileObj);
@@ -310,12 +303,10 @@ function _getSignRes() {
310
303
  }));
311
304
  return _getSignRes.apply(this, arguments);
312
305
  }
313
- function getCheckSignState(contractIdVal, token) {
306
+ function getCheckSignState(contractIdVal) {
314
307
  return new Promise(function (resolve) {
315
308
  checkSignState({
316
309
  contractId: contractIdVal
317
- }, {
318
- token: token
319
310
  }).then(function (res) {
320
311
  console.log('轮询结果---', res);
321
312
  // console.log('轮询结果', JSON.parse(res.data));
@@ -335,24 +326,20 @@ function getCheckSignState(contractIdVal, token) {
335
326
  }
336
327
 
337
328
  // 封存电子签批
338
- function getContractFinish(contractIdVal, token) {
329
+ function getContractFinish(contractIdVal) {
339
330
  contractFinish({
340
331
  contractId: contractIdVal
341
- }, {
342
- token: token
343
332
  });
344
333
  }
345
334
 
346
335
  // 下载签署完的文档
347
- function handleSignApprovalDown(documentIdVal, name, token) {
336
+ function handleSignApprovalDown(documentIdVal, name) {
348
337
  var params = {
349
338
  documentId: documentIdVal,
350
339
  type: 'pdf'
351
340
  };
352
341
  return new Promise(function (resolve) {
353
- documentDownload(params, {
354
- token: token
355
- }).then(function (res) {
342
+ documentDownload(params).then(function (res) {
356
343
  console.log('下载文件:', res);
357
344
  // 返回来是base64格式的
358
345
  var blob = dataURLtoBlob(res.data); // 转成blob格式进行上传
package/lib/api.js CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
4
  exports.__esModule = true;
5
- exports.signurl = exports.signFileDownApi = exports.qrySealApi = exports.previewApi = exports.post = exports.getSignOrderIdApi = exports.getSignFileApi = exports.getSealUrlApi = exports.getPcSealUrlApi = exports.getMaterialLib = exports.getIcons = exports.get = exports.fileUploadApi = 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.getPcSealUrlApi = exports.getMaterialLib = exports.getIcons = exports.getGuideImg = exports.get = exports.fileUploadApi = 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 () {
@@ -14,7 +14,8 @@ var post = exports.post = /*#__PURE__*/function () {
14
14
  if (noJson === void 0) {
15
15
  noJson = false;
16
16
  }
17
- if (window.env === 'release') {
17
+ console.log('window.env', window.env);
18
+ if (window.env === 'release' && url.indexOf('zwfwpt.sxzwfw.gov.cn') > -1) {
18
19
  url = url.replace('zwfwpt.sxzwfw.gov.cn', 'zwfwpt.sxzwfw.gov.cn:10010');
19
20
  }
20
21
  _context.next = 1;
@@ -23,7 +24,7 @@ var post = exports.post = /*#__PURE__*/function () {
23
24
  headers: {
24
25
  'Content-Type': config && config['Content-Type'] ? config['Content-Type'] : 'application/json',
25
26
  // 声明发送的数据格式
26
- 'Authorization': config.token || undefined
27
+ 'Authorization': url.indexOf('zwfwpt.sxzwfw.gov.cn') > -1 ? window.token : window.tokenTY
27
28
  },
28
29
  body: JSON.stringify(data)
29
30
  }).then(function (response) {
@@ -57,7 +58,8 @@ var get = exports.get = /*#__PURE__*/function () {
57
58
  return fetch(url + "?" + new URLSearchParams(data), {
58
59
  method: 'GET',
59
60
  headers: {
60
- 'Content-Type': config && config['Content-Type'] ? config['Content-Type'] : 'application/json'
61
+ 'Content-Type': config && config['Content-Type'] ? config['Content-Type'] : 'application/json',
62
+ 'Authorization': url.indexOf('zwfwpt.sxzwfw.gov.cn') > -1 ? window.token : window.tokenTY
61
63
  }
62
64
  }).then(function (response) {
63
65
  return response.json();
@@ -108,30 +110,30 @@ var documentDownload = exports.documentDownload = function documentDownload(para
108
110
  return post("https://zwfwpt.sxzwfw.gov.cn/DeclarationAPI/declaration/center/signapproval/api/documentDownload", params, config);
109
111
  };
110
112
  var qrySealApi = exports.qrySealApi = function qrySealApi(params, config) {
111
- return post(config.baseUrl + "/declaration/center/sign/api/qrySeal", params, config);
113
+ return post(window.baseUrl + "/declaration/center/sign/api/qrySeal", params, config);
112
114
  };
113
115
 
114
116
  // 获取电子签章页面
115
117
  var getSignOrderIdApi = exports.getSignOrderIdApi = function getSignOrderIdApi(params, config) {
116
- return post(config.baseUrl + "/declaration/center/sign/api/outSignCreateSiggOrder", params, config);
118
+ return post(window.baseUrl + "/declaration/center/sign/api/outSignCreateSiggOrder", params, config);
117
119
  };
118
120
  // 获取电子签章页面
119
121
  var getSealUrlApi = exports.getSealUrlApi = function getSealUrlApi(params, config) {
120
- return post(config.baseUrl + "/declaration/center/sign/api/signWebByDirectMobile", params, config, true);
122
+ return post(window.baseUrl + "/declaration/center/sign/api/signWebByDirectMobile", params, config, true);
121
123
  };
122
124
  // 获取电子签章页面pc
123
125
  var getPcSealUrlApi = exports.getPcSealUrlApi = function getPcSealUrlApi(params, config) {
124
- return post(config.baseUrl + "/declaration/center/sign/api/signWebByDirect", params, config);
126
+ return post(window.baseUrl + "/declaration/center/sign/api/signWebByDirect", params, config);
125
127
  };
126
128
 
127
129
  // 电子签章-下载文件
128
130
  var signFileDownApi = exports.signFileDownApi = function signFileDownApi(params, config) {
129
- return post(config.baseUrl + "/declaration/center/sign/api/fileDownloadBySign", params, config);
131
+ return post(window.baseUrl + "/declaration/center/sign/api/fileDownloadBySign", params, config);
130
132
  };
131
133
 
132
134
  // 电子签章 上传文件
133
135
  var fileUploadApi = exports.fileUploadApi = function fileUploadApi(params, config) {
134
- return post(config.baseUrl + "/declaration/material/base64UploadMaterial", params, config);
136
+ return post(window.baseUrl + "/declaration/material/base64UploadMaterial", params, config);
135
137
  };
136
138
 
137
139
  // 预览
@@ -143,8 +145,11 @@ var getMaterialLib = exports.getMaterialLib = function getMaterialLib(params, co
143
145
  return post("https://zwfwpt.sxzwfw.gov.cn/DeclarationAPI/declaration/material/queryFileByCardNo", params, config);
144
146
  };
145
147
  var getSignFileApi = exports.getSignFileApi = function getSignFileApi(params, config) {
146
- return post(config.baseUrl + "/declaration/center/sign/api/getSignFileList", params, config);
148
+ return post(window.baseUrl + "/declaration/center/sign/api/getSignFileList", params, config);
147
149
  };
148
150
  var getIcons = exports.getIcons = function getIcons(params, config) {
149
- return post(config.baseUrl + "component/icon/page", params, config);
151
+ return post(window.baseUrl + "component/icon/page", params, config);
152
+ };
153
+ var getGuideImg = exports.getGuideImg = function getGuideImg(params, config) {
154
+ return get(window.baseUrl + "/declaration/material/file/files/api/presigned-url", params, config);
150
155
  };
@@ -22,6 +22,7 @@ export interface FileItemProps {
22
22
  isShowLib: boolean;
23
23
  userInfo: object;
24
24
  baseUrl: string;
25
+ env: string;
25
26
  isPC?: boolean;
26
27
  disabled?: boolean;
27
28
  checkPoint?: object;
@@ -3,7 +3,9 @@
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
4
  exports.__esModule = true;
5
5
  exports["default"] = void 0;
6
+ var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
6
7
  var _icon = _interopRequireDefault(require("@alifd/next/lib/icon"));
8
+ var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
7
9
  var _extends3 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
8
10
  var _message = _interopRequireDefault(require("@alifd/next/lib/message"));
9
11
  var _radio = _interopRequireDefault(require("@alifd/next/lib/radio"));
@@ -46,6 +48,7 @@ var FileItem = function FileItem(_ref) {
46
48
  tokenTY = _ref.tokenTY,
47
49
  accessToken = _ref.accessToken,
48
50
  baseUrl = _ref.baseUrl,
51
+ env = _ref.env,
49
52
  isPC = _ref.isPC,
50
53
  disabled = _ref.disabled,
51
54
  checkPoint = _ref.checkPoint,
@@ -286,26 +289,41 @@ var FileItem = function FileItem(_ref) {
286
289
  // this.loadStatus = 'nomore'
287
290
  });
288
291
  };
289
- var showGuide = function showGuide() {
290
- if (!guideImg) return;
291
- if (guideurl) {
292
- setIsShowGuide(true);
293
- return;
294
- }
295
- fetch(baseUrl + "/declaration/material/file/files/api/presigned-url?id=" + guideImg + "&effectiveTime=3600000", {
296
- method: 'GET',
297
- headers: {
298
- 'Authorization': tokenTY
299
- }
300
- }).then(function (response) {
301
- return response.json();
302
- }).then(function (res) {
303
- if (res.presignedUrl) {
304
- setGuideurl(res.presignedUrl);
305
- setIsShowGuide(true);
306
- }
307
- });
308
- };
292
+ var showGuide = /*#__PURE__*/function () {
293
+ var _ref2 = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee() {
294
+ var guideImgRes;
295
+ return _regenerator["default"].wrap(function (_context) {
296
+ while (1) switch (_context.prev = _context.next) {
297
+ case 0:
298
+ if (guideImg) {
299
+ _context.next = 1;
300
+ break;
301
+ }
302
+ return _context.abrupt("return");
303
+ case 1:
304
+ _context.next = 2;
305
+ return (0, _api.getGuideImg)({
306
+ id: guideImg,
307
+ effectiveTime: 3600000
308
+ }, {
309
+ tokenTY: tokenTY
310
+ });
311
+ case 2:
312
+ guideImgRes = _context.sent;
313
+ if (guideImgRes.presignedUrl) {
314
+ setGuideurl(guideImgRes.presignedUrl);
315
+ setIsShowGuide(true);
316
+ }
317
+ case 3:
318
+ case "end":
319
+ return _context.stop();
320
+ }
321
+ }, _callee);
322
+ }));
323
+ return function showGuide() {
324
+ return _ref2.apply(this, arguments);
325
+ };
326
+ }();
309
327
  var selectMaterialOk = function selectMaterialOk() {
310
328
  console.log('val', materialId);
311
329
  console.log('materialLib==', materialLib);
@@ -349,6 +367,14 @@ var FileItem = function FileItem(_ref) {
349
367
  queryFileLibs();
350
368
  }
351
369
  }, [userInfo, isShowLib]);
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]);
352
378
  return /*#__PURE__*/_react["default"].createElement("div", {
353
379
  className: "file_item"
354
380
  }, /*#__PURE__*/_react["default"].createElement("div", {
@@ -551,6 +577,7 @@ var FileItem = function FileItem(_ref) {
551
577
  token: token,
552
578
  tokenTY: tokenTY,
553
579
  baseUrl: baseUrl,
580
+ env: env,
554
581
  getSealRes: getSealRes,
555
582
  accessToken: accessToken,
556
583
  handleClose: function handleClose() {
@@ -15,14 +15,8 @@ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r
15
15
  function SealPage(props) {
16
16
  var userInfo = props.userInfo,
17
17
  file = props.file,
18
- token = props.token,
19
- tokenTY = props.tokenTY,
20
- accessToken = props.accessToken,
21
18
  getSealRes = props.getSealRes,
22
- baseUrl = props.baseUrl,
23
- handleClose = props.handleClose,
24
- _props$isPC = props.isPC,
25
- isPC = _props$isPC === void 0 ? false : _props$isPC;
19
+ handleClose = props.handleClose;
26
20
  var _useState = (0, _react.useState)(''),
27
21
  srcUrl = _useState[0],
28
22
  setSrcUrl = _useState[1];
@@ -43,7 +37,7 @@ function SealPage(props) {
43
37
  fileObj.url = file.oldUrl;
44
38
  }
45
39
  _context.next = 1;
46
- return (0, _sealUtil.initSealPageMethod)(file, userInfo, token, accessToken, baseUrl, tokenTY, isPC);
40
+ return (0, _sealUtil.initSealPageMethod)(file, userInfo);
47
41
  case 1:
48
42
  res = _context.sent;
49
43
  if (res) {
@@ -83,10 +77,7 @@ function SealPage(props) {
83
77
  };
84
78
  console.log('params', params);
85
79
  _context2.next = 1;
86
- return (0, _api.fileUploadApi)(params, {
87
- baseUrl: baseUrl,
88
- tokenTY: tokenTY
89
- });
80
+ return (0, _api.fileUploadApi)(params);
90
81
  case 1:
91
82
  uploadRes = _context2.sent;
92
83
  console.log('重新上传的文件', uploadRes);
@@ -115,9 +106,6 @@ function SealPage(props) {
115
106
  var signFileDown = function signFileDown(filePath) {
116
107
  (0, _api.signFileDownApi)({
117
108
  fileUrl: filePath
118
- }, {
119
- baseUrl: baseUrl,
120
- tokenTY: tokenTY
121
109
  }).then(function (res) {
122
110
  if (res.code === 200) {
123
111
  uploadNewFile(res.data);
@@ -132,10 +120,7 @@ function SealPage(props) {
132
120
  var params = {
133
121
  orderId: orderId
134
122
  };
135
- (0, _api.getSignFileApi)(params, {
136
- baseUrl: baseUrl,
137
- tokenTY: tokenTY
138
- }).then(function (res) {
123
+ (0, _api.getSignFileApi)(params).then(function (res) {
139
124
  if (!res) {
140
125
  return;
141
126
  }
@@ -196,7 +181,7 @@ function SealPage(props) {
196
181
  }, []);
197
182
  (0, _react.useEffect)(function () {
198
183
  handleRes();
199
- }, [userInfo, file, token, accessToken, baseUrl]);
184
+ }, [userInfo, file]);
200
185
  return /*#__PURE__*/_react["default"].createElement("div", {
201
186
  className: "sealPage",
202
187
  ref: elementRef
@@ -11,23 +11,20 @@ var _api = require("../../api.js");
11
11
  // import apiConfig from '@/config/api.cofig'
12
12
  // const userInfo = uni.getStorageSync('userInfo')
13
13
  // 对外的方法 获取电子签章的页面地址
14
- function initSealPageMethod(_x, _x2, _x3, _x4, _x5, _x6, _x7) {
14
+ function initSealPageMethod(_x, _x2) {
15
15
  return _initSealPageMethod.apply(this, arguments);
16
16
  } // [第1步] 查询当前用户是否有电子签章
17
17
  function _initSealPageMethod() {
18
- _initSealPageMethod = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee(fileObj, userInfo, token, accessToken, baseUrl, tokenTY, isPC) {
18
+ _initSealPageMethod = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee(fileObj, userInfo) {
19
19
  var name, sealList, fileUrl, orderId, pageUrl, params;
20
20
  return _regenerator["default"].wrap(function (_context) {
21
21
  while (1) switch (_context.prev = _context.next) {
22
22
  case 0:
23
- if (isPC === void 0) {
24
- isPC = false;
25
- }
26
23
  name = fileObj.name;
27
24
  console.log('fileObj', fileObj, userInfo);
28
25
  // 【第1步】判断当前用户是否有印章
29
26
  _context.next = 1;
30
- return querySeal(userInfo, tokenTY, baseUrl);
27
+ return querySeal(userInfo);
31
28
  case 1:
32
29
  sealList = _context.sent;
33
30
  console.log('sealList---', sealList);
@@ -39,7 +36,7 @@ function _initSealPageMethod() {
39
36
  return _context.abrupt("return", false);
40
37
  case 2:
41
38
  _context.next = 3;
42
- return uploadSealFile(fileObj, tokenTY, baseUrl);
39
+ return uploadSealFile(fileObj);
43
40
  case 3:
44
41
  fileUrl = _context.sent;
45
42
  console.log('fileUrl---', fileUrl);
@@ -50,7 +47,7 @@ function _initSealPageMethod() {
50
47
  return _context.abrupt("return", false);
51
48
  case 4:
52
49
  _context.next = 5;
53
- return getSignOrderId(sealList, fileObj, fileUrl, tokenTY, baseUrl, userInfo);
50
+ return getSignOrderId(sealList, fileObj, fileUrl, userInfo);
54
51
  case 5:
55
52
  orderId = _context.sent;
56
53
  console.log('orderId---', orderId);
@@ -61,7 +58,7 @@ function _initSealPageMethod() {
61
58
  return _context.abrupt("return", false);
62
59
  case 6:
63
60
  _context.next = 7;
64
- return getMobilePageFun(orderId, accessToken, tokenTY, baseUrl, isPC);
61
+ return getMobilePageFun(orderId);
65
62
  case 7:
66
63
  pageUrl = _context.sent;
67
64
  // 将 电子签章地址/文件名称 返回
@@ -79,7 +76,7 @@ function _initSealPageMethod() {
79
76
  }));
80
77
  return _initSealPageMethod.apply(this, arguments);
81
78
  }
82
- function querySeal(userInfo, token, baseUrl) {
79
+ function querySeal(userInfo) {
83
80
  console.log('querySeal', userInfo);
84
81
  // uni.showLoading({ title: '查询印章中' })
85
82
  var params = {
@@ -88,10 +85,7 @@ function querySeal(userInfo, token, baseUrl) {
88
85
  userIdType: '2'
89
86
  };
90
87
  return new Promise(function (resolve) {
91
- (0, _api.qrySealApi)(params, {
92
- token: token,
93
- baseUrl: baseUrl
94
- }).then(function (res) {
88
+ (0, _api.qrySealApi)(params).then(function (res) {
95
89
  if (res.data && res.data.length > 0) {
96
90
  resolve(res.data);
97
91
  } else {
@@ -106,11 +100,11 @@ function querySeal(userInfo, token, baseUrl) {
106
100
  }
107
101
 
108
102
  // [第2步] 上传文件
109
- function uploadSealFile(_x8, _x9, _x0) {
103
+ function uploadSealFile(_x3) {
110
104
  return _uploadSealFile.apply(this, arguments);
111
105
  } // [第3步] 获取电子印章页面
112
106
  function _uploadSealFile() {
113
- _uploadSealFile = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee2(fileObj, token, baseUrl) {
107
+ _uploadSealFile = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee2(fileObj) {
114
108
  var blob, file;
115
109
  return _regenerator["default"].wrap(function (_context2) {
116
110
  while (1) switch (_context2.prev = _context2.next) {
@@ -128,9 +122,9 @@ function _uploadSealFile() {
128
122
  filename: fileObj.name,
129
123
  // 文件名称
130
124
  headers: {
131
- Authorization: token
125
+ Authorization: window.tokenTY
132
126
  },
133
- action: baseUrl + "/declaration/center/sign/api/fileUploadApi",
127
+ action: window.baseUrl + "/declaration/center/sign/api/fileUploadApi",
134
128
  // 上传文件的地址
135
129
  onError: function onError(e) {
136
130
  // uni.$u.toast(e.msg || '上传文件异常');
@@ -152,9 +146,9 @@ function _uploadSealFile() {
152
146
  }));
153
147
  return _uploadSealFile.apply(this, arguments);
154
148
  }
155
- function getSignOrderId(sealList, fileObj, esusFileUrl, token, baseUrl, userInfo) {
149
+ function getSignOrderId(sealList, fileObj, esusFileUrl, userInfo) {
156
150
  // uni.showLoading({ title: '获取签章页面中' })
157
- console.log('sealList', sealList, fileObj, esusFileUrl, token, baseUrl, userInfo);
151
+ console.log('sealList', sealList, fileObj, esusFileUrl, userInfo);
158
152
  var fileId = fileObj.fileId,
159
153
  name = fileObj.name;
160
154
  // 循环签章列表 - 开始
@@ -228,10 +222,7 @@ function getSignOrderId(sealList, fileObj, esusFileUrl, token, baseUrl, userInfo
228
222
  console.log('params---', params);
229
223
  return new Promise(function (resolve) {
230
224
  console.log('获取签章订单id');
231
- (0, _api.getSignOrderIdApi)(params, {
232
- token: token,
233
- baseUrl: baseUrl
234
- }).then(function (res) {
225
+ (0, _api.getSignOrderIdApi)(params).then(function (res) {
235
226
  if (res) {
236
227
  var bigNumber = BigInt(res);
237
228
  resolve(bigNumber + '');
@@ -248,22 +239,16 @@ function getSignOrderId(sealList, fileObj, esusFileUrl, token, baseUrl, userInfo
248
239
  }
249
240
 
250
241
  // [第4步-移动端] 获取电子印章页面
251
- function getMobilePageFun(orderId, accessToken, token, baseUrl, isPC) {
252
- if (isPC === void 0) {
253
- isPC = false;
254
- }
242
+ function getMobilePageFun(orderId) {
255
243
  // uni.showLoading({ title: '获取移动端签章页面中' })
256
244
  var params = {
257
- accessToken: accessToken,
245
+ accessToken: window.accessToken,
258
246
  acctType: '20',
259
247
  orderId: orderId
260
248
  };
261
249
  return new Promise(function (resolve) {
262
- if (isPC) {
263
- (0, _api.getPcSealUrlApi)(params, {
264
- baseUrl: baseUrl,
265
- token: token
266
- }).then(function (res) {
250
+ if (window.isPC) {
251
+ (0, _api.getPcSealUrlApi)(params).then(function (res) {
267
252
  console.log('签章页面pc----', res);
268
253
  if (res.code === 200) {
269
254
  resolve(res.data);
@@ -277,10 +262,7 @@ function getMobilePageFun(orderId, accessToken, token, baseUrl, isPC) {
277
262
  // uni.hideLoading()
278
263
  });
279
264
  } else {
280
- (0, _api.getSealUrlApi)(params, {
281
- baseUrl: baseUrl,
282
- token: token
283
- }).then(function (res) {
265
+ (0, _api.getSealUrlApi)(params).then(function (res) {
284
266
  if (res) {
285
267
  console.log(res, '移动端签章页面');
286
268
  resolve(res);