ydb-components-material 0.1.17 → 0.1.19

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 (47) 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.5df7f485.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/preview.js +7 -7
  15. package/build/lowcode/render/default/view.js +1 -1
  16. package/build/lowcode/view.js +1 -1
  17. package/dist/BizComps.js +1 -1
  18. package/dist/BizComps.js.map +1 -1
  19. package/es/api.js +110 -0
  20. package/es/components/file-item/file.js +164 -0
  21. package/es/components/file-item/index.d.ts +5 -0
  22. package/es/components/file-item/index.js +55 -6
  23. package/es/components/file-item/seal.d.ts +3 -0
  24. package/es/components/file-item/seal.js +54 -0
  25. package/es/components/file-item/sealUtil.js +173 -0
  26. package/es/components/file-item/sign.d.ts +3 -0
  27. package/es/components/file-item/sign.js +114 -0
  28. package/es/components/file-item/signUtil.js +370 -0
  29. package/es/components/scene-tree/index.js +14 -13
  30. package/lib/api.js +115 -0
  31. package/lib/components/file-item/file.js +172 -0
  32. package/lib/components/file-item/index.d.ts +5 -0
  33. package/lib/components/file-item/index.js +55 -6
  34. package/lib/components/file-item/seal.d.ts +3 -0
  35. package/lib/components/file-item/seal.js +60 -0
  36. package/lib/components/file-item/sealUtil.js +175 -0
  37. package/lib/components/file-item/sign.d.ts +3 -0
  38. package/lib/components/file-item/sign.js +120 -0
  39. package/lib/components/file-item/signUtil.js +372 -0
  40. package/lib/components/scene-tree/index.js +13 -12
  41. package/lowcode/file-item/meta.ts +83 -0
  42. package/lowcode_es/file-item/meta.js +78 -0
  43. package/lowcode_es/meta.js +1 -1
  44. package/lowcode_lib/file-item/meta.js +78 -0
  45. package/lowcode_lib/meta.js +1 -1
  46. package/package.json +3 -3
  47. package/build/docs/umi.f9d788c8.js +0 -1
package/es/api.js ADDED
@@ -0,0 +1,110 @@
1
+ import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
2
+ import _regeneratorRuntime from "@babel/runtime/regenerator";
3
+ export var post = /*#__PURE__*/function () {
4
+ var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(url, data, config) {
5
+ var res;
6
+ return _regeneratorRuntime.wrap(function (_context) {
7
+ while (1) switch (_context.prev = _context.next) {
8
+ case 0:
9
+ _context.next = 1;
10
+ return fetch(url, {
11
+ method: 'POST',
12
+ headers: {
13
+ 'Content-Type': config && config['Content-Type'] ? config['Content-Type'] : 'application/json',
14
+ // 声明发送的数据格式
15
+ 'Authorization': config.token || undefined
16
+ },
17
+ body: JSON.stringify(data)
18
+ }).then(function (response) {
19
+ return response.json();
20
+ }).then(function (res) {
21
+ return res;
22
+ })["catch"](function (err) {
23
+ return err;
24
+ });
25
+ case 1:
26
+ res = _context.sent;
27
+ return _context.abrupt("return", res);
28
+ case 2:
29
+ case "end":
30
+ return _context.stop();
31
+ }
32
+ }, _callee);
33
+ }));
34
+ return function post(_x, _x2, _x3) {
35
+ return _ref.apply(this, arguments);
36
+ };
37
+ }();
38
+ export var get = /*#__PURE__*/function () {
39
+ var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2(url, data, config) {
40
+ var res;
41
+ return _regeneratorRuntime.wrap(function (_context2) {
42
+ while (1) switch (_context2.prev = _context2.next) {
43
+ case 0:
44
+ _context2.next = 1;
45
+ return fetch(url + "?" + new URLSearchParams(data), {
46
+ method: 'GET',
47
+ headers: {
48
+ 'Content-Type': config && config['Content-Type'] ? config['Content-Type'] : 'application/json'
49
+ }
50
+ }).then(function (response) {
51
+ return response.json();
52
+ }).then(function (res) {
53
+ return res;
54
+ })["catch"](function (err) {
55
+ return err;
56
+ });
57
+ case 1:
58
+ res = _context2.sent;
59
+ return _context2.abrupt("return", res);
60
+ case 2:
61
+ case "end":
62
+ return _context2.stop();
63
+ }
64
+ }, _callee2);
65
+ }));
66
+ return function get(_x4, _x5, _x6) {
67
+ return _ref2.apply(this, arguments);
68
+ };
69
+ }();
70
+ export var createbycategory = function createbycategory(params, config) {
71
+ return post("https://zwfwpt.sxzwfw.gov.cn/DeclarationAPI/declaration/center/signapproval/api/createbycategory", params, config);
72
+ };
73
+
74
+ // 获取电子签批签署页面
75
+ export var contractSignUrl = function contractSignUrl(params, config) {
76
+ return post("https://zwfwpt.sxzwfw.gov.cn/DeclarationAPI/declaration/center/signapproval/api/contractSignUrl", params, config);
77
+ };
78
+
79
+ // 获取电子签批签署页面
80
+ export var signurl = function signurl(params, config) {
81
+ return post("https://zwfwpt.sxzwfw.gov.cn/DeclarationAPI/declaration/center/signapproval/contract/signurl/v3", params, config);
82
+ };
83
+
84
+ // 校验签批状态-轮训
85
+ export var checkSignState = function checkSignState(params, config) {
86
+ return post("https://zwfwpt.sxzwfw.gov.cn/DeclarationAPI/declaration/center/signapproval/api/checkSignState", params, config);
87
+ };
88
+
89
+ // 封存电子签批并完成签署
90
+ export var contractFinish = function contractFinish(params, config) {
91
+ return post("https://zwfwpt.sxzwfw.gov.cn/DeclarationAPI/declaration/center/signapproval/api/contract/finish", params, config);
92
+ };
93
+
94
+ // 下载签署文档
95
+ export var documentDownload = function documentDownload(params, config) {
96
+ return post("https://zwfwpt.sxzwfw.gov.cn/DeclarationAPI/declaration/center/signapproval/api/documentDownload", params, config);
97
+ };
98
+ export var qrySealApi = function qrySealApi(params, config) {
99
+ return post("https://zwfwpt.sxzwfw.gov.cn/DeclarationAPI/declaration/center/sign/api/qrySeal", params, config);
100
+ };
101
+
102
+ // 获取电子签章页面
103
+ export var getSealUrlApi = function getSealUrlApi(params, config) {
104
+ return post("https://zwfwpt.sxzwfw.gov.cn/DeclarationAPI/declaration/center/sign/api/signWebByDirect", params, config);
105
+ };
106
+
107
+ // 电子签章-下载文件
108
+ export var signFileDownApi = function signFileDownApi(params, config) {
109
+ return post("https://zwfwpt.sxzwfw.gov.cn/DeclarationAPI/declaration/center/sign/api/fileDownloadBySign", params, config);
110
+ };
@@ -0,0 +1,164 @@
1
+ // import apiConfig from '@/config/api.cofig'
2
+ var baseURL = 'http://172.16.132.12:5005';
3
+ // 下载文件
4
+ export function getBlob(url) {
5
+ return new Promise(function (resolve, reject) {
6
+ var xhr = new XMLHttpRequest();
7
+ xhr.open('GET', url, true);
8
+ xhr.responseType = 'blob';
9
+ xhr.onload = function () {
10
+ if (xhr.status === 200) {
11
+ resolve(xhr.response);
12
+ } else {
13
+ reject("Request failed with status " + xhr.status);
14
+ }
15
+ };
16
+ xhr.onerror = function () {
17
+ reject('Request failed');
18
+ };
19
+ xhr.send();
20
+ });
21
+ }
22
+
23
+ // 上传文件
24
+ export function upload(option) {
25
+ var xhr = new XMLHttpRequest(); // 定义上传方式
26
+
27
+ if (option.onProgress && xhr.upload) {
28
+ xhr.upload.onprogress = function progress(e) {
29
+ if (e.total > 0) {
30
+ e.percent = e.loaded / e.total * 100;
31
+ }
32
+ option.onProgress(e); // 上传进度,也是上传成功后回调
33
+ };
34
+ }
35
+ var formData = new FormData();
36
+ formData.append('file', option.file, option.file.name);
37
+ if (option.title) {
38
+ formData.append('title', option.title);
39
+ }
40
+ if (option.fileType) {
41
+ formData.append('fileType', option.fileType);
42
+ }
43
+ xhr.onerror = function error(e) {
44
+ option.onError(e); // 失败返回
45
+ };
46
+ xhr.onload = function onload() {
47
+ if (xhr.status !== 200) {
48
+ return option.onError(JSON.parse(xhr.response));
49
+ }
50
+ option.onSuccess(JSON.parse(xhr.response)); // 成功返回函数
51
+ };
52
+ xhr.open('post', option.action, true);
53
+ if (option.withCredentials && 'withCredentials' in xhr) {
54
+ xhr.withCredentials = true;
55
+ }
56
+ var headers = option.headers || {}; // 定义请求头
57
+ if (headers['X-Requested-With'] !== null) {
58
+ xhr.setRequestHeader('X-Requested-With', 'XMLHttpRequest');
59
+ }
60
+ for (var h in headers) {
61
+ if (headers.hasOwnProperty(h) && headers[h] !== null) {
62
+ xhr.setRequestHeader(h, headers[h]);
63
+ }
64
+ }
65
+ xhr.send(formData);
66
+ return {
67
+ abort: function abort() {
68
+ xhr.abort();
69
+ }
70
+ };
71
+ }
72
+ ;
73
+
74
+ // 获取文件名后缀
75
+ export function getFileExtension(filename) {
76
+ var match = filename.match(/\.([^.]+)$/);
77
+ return match ? match[1].toLowerCase() : '';
78
+ }
79
+
80
+ // base64转换为流文件
81
+ export function dataURLtoBlob(dataUrl) {
82
+ var arr = dataUrl.split(',');
83
+ var mime = arr[0].match(/:(.*?);/)[1];
84
+ var bstr = atob(arr[1]);
85
+ var n = bstr.length;
86
+ var u8arr = new Uint8Array(n);
87
+ while (n--) {
88
+ u8arr[n] = bstr.charCodeAt(n);
89
+ }
90
+ return new Blob([u8arr], {
91
+ type: mime
92
+ });
93
+ }
94
+
95
+ // 上传文件至申报端的服务器 [方法]
96
+ export function uploadFilePromise(url, token) {
97
+ // const { baseURL } = apiConfig
98
+ return new Promise(function (resolve, reject) {
99
+ var formData = new FormData();
100
+ formData.append('file', url);
101
+ formData.append('open', true);
102
+ formData.append('open', 'true');
103
+ fetch('http://172.16.132.12:5005/declaration/material/file/files/api', {
104
+ method: 'POST',
105
+ body: formData,
106
+ header: {
107
+ // Authorization: 'rjvntrnggysagvpqhi7qfasqpd2hz736qap5vkikjgni3h3g4a5gcsawoooosvb2523mo5ifltk22vdki2u5q6vd2ceefhy5sk6e2kofxadn354ridcbcypgqgcljs27bhdnviiza7hdnbnwlh6e4yxe45kapm7y3wb6qqod5wysmjirbl6iwtaz3tzve7rdxq6blrfdqygjsfi5iosrwmpiumocr52tufnpcan2hdzydamjvbso2hmbrp32aymb2cahlcv2liswbhpwiqvf72anhnyycoyr3lwfp4xufasn7cbb2sxq'
108
+ }
109
+ }).then(function (response) {
110
+ return response.json();
111
+ }).then(function (res) {
112
+ resolve(res);
113
+ // if (res.fileId) {
114
+ // valChange({
115
+ // ...res,
116
+ // name: fileData.name,
117
+ // type: fileData.type
118
+ // })
119
+ // // Message.notice('上传成功')
120
+ // } else {
121
+ // // Message.error('上传失败,请重试')
122
+ // }
123
+ })["catch"](function (err) {
124
+ return err;
125
+ });
126
+ // uni.uploadFile({
127
+ // url: `${baseURL}/declaration/material/file/files/api`,
128
+ // filePath: url,
129
+ // name: 'file',
130
+ // formData: {
131
+ // // #ifdef H5
132
+ // open: true,
133
+ // // #endif
134
+ // // #ifdef MP-WEIXIN
135
+ // open: 'true'
136
+ // // #endif
137
+ // },
138
+ // header: {
139
+ // Authorization: uni.getStorageSync('declarationAppToken')
140
+ // },
141
+ // success: (res) => {
142
+ // if (res.statusCode === 200) {
143
+ // // resolve(JSON.parse(res.data))
144
+ // resolve({
145
+ // status: 'success',
146
+ // message: '上传成功',
147
+ // ...JSON.parse(res.data)
148
+ // });
149
+ // } else {
150
+ // resolve({
151
+ // status: 'failed',
152
+ // message: '上传失败'
153
+ // })
154
+ // }
155
+ // },
156
+ // fail: (err) => {
157
+ // resolve({
158
+ // status: 'failed',
159
+ // message: '上传失败'
160
+ // })
161
+ // }
162
+ // })
163
+ });
164
+ }
@@ -5,16 +5,21 @@ export interface FileItemProps {
5
5
  * 标题
6
6
  */
7
7
  file: string;
8
+ fileName: string;
9
+ fileType: string;
8
10
  guideImg: string;
9
11
  checkImg: string;
10
12
  approvalUrl: string;
11
13
  signatureUrl: string;
14
+ token: string;
15
+ accessToken: string;
12
16
  isApproval: boolean;
13
17
  isSignature: boolean;
14
18
  materialList: any[];
15
19
  maxFileSize: number;
16
20
  isInValid: boolean;
17
21
  isShowLib: boolean;
22
+ userInfo: any;
18
23
  del: () => void;
19
24
  valChange: (value: any) => void;
20
25
  }
@@ -1,4 +1,5 @@
1
1
  import _Icon from "@alifd/next/es/icon";
2
+ import _extends from "@babel/runtime/helpers/extends";
2
3
  import _Message from "@alifd/next/es/message";
3
4
  import _Radio from "@alifd/next/es/radio";
4
5
  import React, { useState } from 'react';
@@ -10,6 +11,8 @@ import fileIcon from "./icon/file.svg";
10
11
  import warningIcon from "./icon/icon_warning.svg";
11
12
  import errorMsgIcon from "./icon/icon_errorMsg.svg";
12
13
  import uploadIcon from "./icon/upload.svg";
14
+ import SignPage from "./sign";
15
+ import SealPage from "./seal";
13
16
  import "./index.scss";
14
17
  var RadioGroup = _Radio.Group;
15
18
  var BASE_URL = 'http://172.16.132.12:5005';
@@ -25,6 +28,11 @@ var FileItem = function FileItem(_ref) {
25
28
  maxFileSize = _ref.maxFileSize,
26
29
  isInValid = _ref.isInValid,
27
30
  isShowLib = _ref.isShowLib,
31
+ userInfo = _ref.userInfo,
32
+ fileName = _ref.fileName,
33
+ fileType = _ref.fileType,
34
+ token = _ref.token,
35
+ accessToken = _ref.accessToken,
28
36
  valChange = _ref.valChange,
29
37
  del = _ref.del;
30
38
  var _useState = useState(false),
@@ -42,6 +50,12 @@ var FileItem = function FileItem(_ref) {
42
50
  var _useState5 = useState(),
43
51
  material = _useState5[0],
44
52
  setMaterial = _useState5[1];
53
+ var _useState6 = useState(false),
54
+ isShowSignPage = _useState6[0],
55
+ setIsShowSignPage = _useState6[1];
56
+ var _useState7 = useState(false),
57
+ isShowSealPage = _useState7[0],
58
+ setIsShowSealPage = _useState7[1];
45
59
  var list = materialList || [{
46
60
  name: '图片1',
47
61
  value: 1
@@ -86,7 +100,10 @@ var FileItem = function FileItem(_ref) {
86
100
  }).then(function (res) {
87
101
  document.body.removeChild(inputEl);
88
102
  if (res.fileId) {
89
- valChange(res);
103
+ valChange(_extends({}, res, {
104
+ name: fileData.name,
105
+ type: fileData.type
106
+ }));
90
107
  _Message.notice('上传成功');
91
108
  } else {
92
109
  _Message.error('上传失败,请重试');
@@ -96,6 +113,10 @@ var FileItem = function FileItem(_ref) {
96
113
  });
97
114
  });
98
115
  };
116
+ var getRes = function getRes(val) {
117
+ console.log('val---', val);
118
+ valChange(val);
119
+ };
99
120
  return /*#__PURE__*/React.createElement("div", {
100
121
  className: "file_item"
101
122
  }, /*#__PURE__*/React.createElement("div", {
@@ -164,10 +185,16 @@ var FileItem = function FileItem(_ref) {
164
185
  style: {
165
186
  marginTop: '20px'
166
187
  }
167
- }, approvalUrl && /*#__PURE__*/React.createElement("div", {
168
- className: "operation_btn"
169
- }, "\u624B\u5199\u5BA1\u6279"), signatureUrl && /*#__PURE__*/React.createElement("div", {
170
- className: "operation_btn"
188
+ }, /*#__PURE__*/React.createElement("div", {
189
+ className: "operation_btn",
190
+ onClick: function onClick() {
191
+ return setIsShowSignPage(true);
192
+ }
193
+ }, "\u624B\u5199\u5BA1\u6279"), /*#__PURE__*/React.createElement("div", {
194
+ className: "operation_btn",
195
+ onClick: function onClick() {
196
+ return setIsShowSealPage(true);
197
+ }
171
198
  }, "\u7535\u5B50\u7B7E\u7AE0")) :
172
199
  // 展示材料库
173
200
  isShowLib && /*#__PURE__*/React.createElement("div", {
@@ -243,7 +270,29 @@ var FileItem = function FileItem(_ref) {
243
270
  }
244
271
  }, "\u53D6\u6D88"), /*#__PURE__*/React.createElement("div", {
245
272
  className: "btn ok"
246
- }, "\u786E\u5B9A")))));
273
+ }, "\u786E\u5B9A")))), isShowSignPage && /*#__PURE__*/React.createElement(SignPage, {
274
+ isShowSignPage: isShowSignPage,
275
+ userInfo: userInfo,
276
+ file: {
277
+ name: fileName,
278
+ url: file,
279
+ type: fileType
280
+ },
281
+ token: token,
282
+ getRes: getRes
283
+ }), isShowSealPage && /*#__PURE__*/React.createElement(SealPage, {
284
+ isShowSealPage: isShowSealPage,
285
+ userInfo: userInfo,
286
+ file: {
287
+ name: fileName,
288
+ url: file,
289
+ type: fileType
290
+ },
291
+ token: token
292
+ // getRes={getRes}
293
+ ,
294
+ accessToken: accessToken
295
+ }));
247
296
  };
248
297
  FileItem.displayName = 'FileItem';
249
298
  export default FileItem;
@@ -0,0 +1,3 @@
1
+ /// <reference types="react" />
2
+ declare function SealPage(props: any): JSX.Element;
3
+ export default SealPage;
@@ -0,0 +1,54 @@
1
+ import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
2
+ import _regeneratorRuntime from "@babel/runtime/regenerator";
3
+ import React, { useEffect, useState } from 'react';
4
+ import { initSealPageMethod } from "./sealUtil";
5
+ function SealPage(props) {
6
+ var isShowSealPage = props.isShowSealPage,
7
+ userInfo = props.userInfo,
8
+ file = props.file,
9
+ token = props.token,
10
+ accessToken = props.accessToken,
11
+ getRes = props.getRes;
12
+ var _useState = useState(''),
13
+ srcUrl = _useState[0],
14
+ setSrcUrl = _useState[1];
15
+ var handleRes = /*#__PURE__*/function () {
16
+ var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
17
+ var res, pageUrl;
18
+ return _regeneratorRuntime.wrap(function (_context) {
19
+ while (1) switch (_context.prev = _context.next) {
20
+ case 0:
21
+ console.log('file', file, userInfo);
22
+ _context.next = 1;
23
+ return initSealPageMethod(file, userInfo, token, accessToken);
24
+ case 1:
25
+ res = _context.sent;
26
+ pageUrl = res.pageUrl;
27
+ setSrcUrl(pageUrl);
28
+ // console.log(res)
29
+ case 2:
30
+ case "end":
31
+ return _context.stop();
32
+ }
33
+ }, _callee);
34
+ }));
35
+ return function handleRes() {
36
+ return _ref.apply(this, arguments);
37
+ };
38
+ }();
39
+ useEffect(function () {
40
+ if (isShowSealPage) {
41
+ handleRes();
42
+ }
43
+ }, [isShowSealPage, userInfo, file, token, accessToken]);
44
+ return /*#__PURE__*/React.createElement("div", {
45
+ className: "seal_page"
46
+ }, /*#__PURE__*/React.createElement("iframe", {
47
+ src: srcUrl,
48
+ id: "iframe",
49
+ frameborder: "0",
50
+ height: "500px",
51
+ width: "100%"
52
+ }));
53
+ }
54
+ export default SealPage;
@@ -0,0 +1,173 @@
1
+ import _Message from "@alifd/next/es/message";
2
+ import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
3
+ import _regeneratorRuntime from "@babel/runtime/regenerator";
4
+ // import apiConfig from '@/config/api.cofig'
5
+ import { getBlob, upload } from "./file.js";
6
+ import { qrySealApi, getSealUrlApi } from "../../api.js";
7
+ // const userInfo = uni.getStorageSync('userInfo')
8
+
9
+ // 对外的方法 获取电子签章的页面地址
10
+ export function initSealPageMethod(_x, _x2, _x3, _x4) {
11
+ return _initSealPageMethod.apply(this, arguments);
12
+ }
13
+
14
+ // [第1步] 查询当前用户是否有电子签章
15
+ function _initSealPageMethod() {
16
+ _initSealPageMethod = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(fileObj, userInfo, token, accessToken) {
17
+ var name, hasSeal, fileUrl, pageUrl, params;
18
+ return _regeneratorRuntime.wrap(function (_context) {
19
+ while (1) switch (_context.prev = _context.next) {
20
+ case 0:
21
+ name = fileObj.name;
22
+ console.log('fileObj', fileObj, userInfo);
23
+ // 【第1步】判断当前用户是否有印章
24
+ _context.next = 1;
25
+ return querySeal(userInfo, token);
26
+ case 1:
27
+ hasSeal = _context.sent;
28
+ if (hasSeal) {
29
+ _context.next = 2;
30
+ break;
31
+ }
32
+ _Message.error('该单位下暂无印章,请前往“山西政务服务网”或“三晋通”小程序申领印章');
33
+ // return uni.showModal({
34
+ // title: '提示',
35
+ // content: '该单位下暂无印章,请前往“山西政务服务网”或“三晋通”小程序申领印章',
36
+ // confirmText: '知道了',
37
+ // showCancel: false,
38
+ // })
39
+ return _context.abrupt("return", false);
40
+ case 2:
41
+ _context.next = 3;
42
+ return uploadSealFile(fileObj, token);
43
+ case 3:
44
+ fileUrl = _context.sent;
45
+ if (fileUrl) {
46
+ _context.next = 4;
47
+ break;
48
+ }
49
+ return _context.abrupt("return", false);
50
+ case 4:
51
+ _context.next = 5;
52
+ return getSealUrl(fileUrl, name, token, accessToken);
53
+ case 5:
54
+ pageUrl = _context.sent;
55
+ if (pageUrl) {
56
+ _context.next = 6;
57
+ break;
58
+ }
59
+ return _context.abrupt("return", false);
60
+ case 6:
61
+ // 将 电子签章地址/文件名称 返回
62
+ params = {
63
+ pageUrl: pageUrl,
64
+ name: name
65
+ };
66
+ return _context.abrupt("return", params);
67
+ case 7:
68
+ case "end":
69
+ return _context.stop();
70
+ }
71
+ }, _callee);
72
+ }));
73
+ return _initSealPageMethod.apply(this, arguments);
74
+ }
75
+ function querySeal(userInfo, token) {
76
+ console.log('querySeal', userInfo);
77
+ // uni.showLoading({ title: '查询印章中' })
78
+ var params = {
79
+ deptCode: userInfo.certificateSno,
80
+ outUserId: userInfo.legalCertno,
81
+ userIdType: '2'
82
+ };
83
+ return new Promise(function (resolve) {
84
+ qrySealApi(params, {
85
+ token: token
86
+ }).then(function (res) {
87
+ if (res.data && res.data.length > 0) {
88
+ resolve(true);
89
+ } else {
90
+ resolve(false);
91
+ }
92
+ // uni.hideLoading()
93
+ })["catch"](function (error) {
94
+ resolve(false);
95
+ // uni.hideLoading()
96
+ });
97
+ });
98
+ }
99
+
100
+ // [第2步] 上传文件
101
+ function uploadSealFile(_x5, _x6) {
102
+ return _uploadSealFile.apply(this, arguments);
103
+ } // [第3步] 获取电子印章页面
104
+ function _uploadSealFile() {
105
+ _uploadSealFile = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2(fileObj, token) {
106
+ var blob, file;
107
+ return _regeneratorRuntime.wrap(function (_context2) {
108
+ while (1) switch (_context2.prev = _context2.next) {
109
+ case 0:
110
+ _context2.next = 1;
111
+ return getBlob(fileObj.url);
112
+ case 1:
113
+ blob = _context2.sent;
114
+ file = new File([blob], fileObj.name, {
115
+ type: fileObj.type
116
+ }); // 上传接口
117
+ // const { baseURL } = apiConfig;
118
+ return _context2.abrupt("return", new Promise(function (resolve) {
119
+ upload({
120
+ file: file,
121
+ filename: fileObj.name,
122
+ // 文件名称
123
+ headers: {
124
+ Authorization: token
125
+ },
126
+ action: "https://zwfwpt.sxzwfw.gov.cn/DeclarationAPI/declaration/center/signapproval/api/createbyfile",
127
+ // 上传文件的地址
128
+ onError: function onError(e) {
129
+ // uni.$u.toast(e.msg || '上传文件异常');
130
+ // uni.hideLoading();
131
+ _Message.error('上传文件异常');
132
+ },
133
+ onSuccess: function onSuccess(e) {
134
+ // uni.hideLoading();
135
+ console.log('success', e);
136
+ resolve(e.data);
137
+ }
138
+ });
139
+ }));
140
+ case 2:
141
+ case "end":
142
+ return _context2.stop();
143
+ }
144
+ }, _callee2);
145
+ }));
146
+ return _uploadSealFile.apply(this, arguments);
147
+ }
148
+ function getSealUrl(fileUrl, fileName, token, accessToken) {
149
+ // uni.showLoading({ title: '获取签章页面中' })
150
+ // const accessToken = uni.getStorageSync('access_token');
151
+ var params = {
152
+ accessToken: accessToken,
153
+ acctType: '20',
154
+ docURL: fileUrl,
155
+ name: fileName
156
+ };
157
+ return new Promise(function (resolve) {
158
+ getSealUrlApi(params, {
159
+ token: token
160
+ }).then(function (res) {
161
+ if (res) {
162
+ resolve(res);
163
+ // uni.hideLoading()
164
+ } else {
165
+ resolve(false);
166
+ // uni.hideLoading()
167
+ }
168
+ })["catch"](function () {
169
+ resolve(false);
170
+ // uni.hideLoading()
171
+ });
172
+ });
173
+ }
@@ -0,0 +1,3 @@
1
+ /// <reference types="react" />
2
+ declare function SignPage(props: any): JSX.Element;
3
+ export default SignPage;