ydb-components-material 0.1.86 → 0.1.88

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 (98) 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.466b4c0a.css → umi.666eb3a7.css} +1 -1
  7. package/build/docs/umi.f5d91602.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/index.js +1 -1
  15. package/build/lowcode/meta.js +1 -1
  16. package/build/lowcode/preview.js +9 -9
  17. package/build/lowcode/render/default/view.css +1 -1
  18. package/build/lowcode/render/default/view.js +55 -2
  19. package/build/lowcode/view.css +1 -1
  20. package/build/lowcode/view.js +55 -2
  21. package/dist/BizComps.css +1 -1
  22. package/dist/BizComps.js +58 -5
  23. package/dist/BizComps.js.map +1 -1
  24. package/es/components/file-item/index.js +165 -70
  25. package/es/components/file-item/index.scss +13 -2
  26. package/es/components/file-list/checkPoint.d.ts +3 -0
  27. package/es/components/file-list/checkPoint.js +157 -0
  28. package/es/components/file-list/checkPoint.scss +120 -0
  29. package/es/components/file-list/file.js +295 -0
  30. package/es/components/file-list/icon/checked.svg +1 -0
  31. package/es/components/file-list/icon/close.svg +1 -0
  32. package/es/components/file-list/icon/del.svg +1 -0
  33. package/es/components/file-list/icon/download.svg +1 -0
  34. package/es/components/file-list/icon/download_pc.svg +1 -0
  35. package/es/components/file-list/icon/file.svg +1 -0
  36. package/es/components/file-list/icon/icon_errorMsg.svg +1 -0
  37. package/es/components/file-list/icon/icon_warning.svg +1 -0
  38. package/es/components/file-list/icon/preview.svg +1 -0
  39. package/es/components/file-list/icon/preview_pc.svg +1 -0
  40. package/es/components/file-list/icon/upload.svg +1 -0
  41. package/es/components/file-list/icon/view.svg +1 -0
  42. package/es/components/file-list/index.d.ts +21 -0
  43. package/es/components/file-list/index.js +222 -0
  44. package/es/components/file-list/index.scss +36 -0
  45. package/es/components/file-list/item.d.ts +27 -0
  46. package/es/components/file-list/item.js +802 -0
  47. package/es/components/file-list/item.scss +412 -0
  48. package/es/components/file-list/seal.d.ts +3 -0
  49. package/es/components/file-list/seal.js +222 -0
  50. package/es/components/file-list/sealUtil.js +252 -0
  51. package/es/components/file-list/sign.d.ts +3 -0
  52. package/es/components/file-list/sign.js +138 -0
  53. package/es/components/file-list/signUtil.js +369 -0
  54. package/es/index.d.ts +2 -0
  55. package/es/index.js +1 -0
  56. package/lib/components/file-item/index.js +165 -70
  57. package/lib/components/file-item/index.scss +13 -2
  58. package/lib/components/file-list/checkPoint.d.ts +3 -0
  59. package/lib/components/file-list/checkPoint.js +162 -0
  60. package/lib/components/file-list/checkPoint.scss +120 -0
  61. package/lib/components/file-list/file.js +306 -0
  62. package/lib/components/file-list/icon/checked.svg +1 -0
  63. package/lib/components/file-list/icon/close.svg +1 -0
  64. package/lib/components/file-list/icon/del.svg +1 -0
  65. package/lib/components/file-list/icon/download.svg +1 -0
  66. package/lib/components/file-list/icon/download_pc.svg +1 -0
  67. package/lib/components/file-list/icon/file.svg +1 -0
  68. package/lib/components/file-list/icon/icon_errorMsg.svg +1 -0
  69. package/lib/components/file-list/icon/icon_warning.svg +1 -0
  70. package/lib/components/file-list/icon/preview.svg +1 -0
  71. package/lib/components/file-list/icon/preview_pc.svg +1 -0
  72. package/lib/components/file-list/icon/upload.svg +1 -0
  73. package/lib/components/file-list/icon/view.svg +1 -0
  74. package/lib/components/file-list/index.d.ts +21 -0
  75. package/lib/components/file-list/index.js +227 -0
  76. package/lib/components/file-list/index.scss +36 -0
  77. package/lib/components/file-list/item.d.ts +27 -0
  78. package/lib/components/file-list/item.js +808 -0
  79. package/lib/components/file-list/item.scss +412 -0
  80. package/lib/components/file-list/seal.d.ts +3 -0
  81. package/lib/components/file-list/seal.js +228 -0
  82. package/lib/components/file-list/sealUtil.js +254 -0
  83. package/lib/components/file-list/sign.d.ts +3 -0
  84. package/lib/components/file-list/sign.js +144 -0
  85. package/lib/components/file-list/signUtil.js +371 -0
  86. package/lib/index.d.ts +2 -0
  87. package/lib/index.js +3 -1
  88. package/lowcode/file-list/meta.ts +231 -0
  89. package/lowcode_es/_setter/IconSelectSetter.js +1 -1
  90. package/lowcode_es/file-list/meta.d.ts +22 -0
  91. package/lowcode_es/file-list/meta.js +213 -0
  92. package/lowcode_es/meta.js +3 -2
  93. package/lowcode_lib/_setter/IconSelectSetter.js +1 -1
  94. package/lowcode_lib/file-list/meta.d.ts +22 -0
  95. package/lowcode_lib/file-list/meta.js +218 -0
  96. package/lowcode_lib/meta.js +14 -13
  97. package/package.json +6 -4
  98. package/build/docs/umi.0968e2ca.js +0 -1
@@ -258,10 +258,12 @@
258
258
  position: absolute;
259
259
  bottom: 0;
260
260
  left: 0;
261
- background-color: #fff;
261
+ background-color: #F5F5F5;
262
262
  border-radius: 16px 16px 0px 0px;
263
263
 
264
264
  .material_lib_title {
265
+ border-radius: 16px 16px 0px 0px;
266
+ background-color: #fff;
265
267
  font-size: 16px;
266
268
  color: #333333;
267
269
  line-height: 54px;
@@ -289,7 +291,7 @@
289
291
  padding: 12px 12px 0 12px;
290
292
  width: 100%;
291
293
  background-color: #F5F5F5;
292
- margin-bottom: 64px;
294
+ // margin-bottom: 14px;
293
295
  max-height: 300px;
294
296
  overflow: auto;
295
297
 
@@ -318,6 +320,15 @@
318
320
  }
319
321
  }
320
322
 
323
+ .more {
324
+ color: #1678FF;
325
+ text-align: center;
326
+ height: 30px;
327
+ line-height: 30px;
328
+ margin-bottom: 70px;
329
+ background-color: #F5F5F5;
330
+ }
331
+
321
332
  .bottom_btn {
322
333
  background-color: #fff;
323
334
  height: 64px;
@@ -0,0 +1,3 @@
1
+ /// <reference types="react" />
2
+ import './checkPoint.scss';
3
+ export default function CheckPoint(props: any): JSX.Element;
@@ -0,0 +1,162 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ exports.__esModule = true;
5
+ exports["default"] = CheckPoint;
6
+ var _message = _interopRequireDefault(require("@alifd/next/lib/message"));
7
+ var _react = require("react");
8
+ var _icons = require("@ant-design/icons");
9
+ require("./checkPoint.scss");
10
+ function CheckPoint(props) {
11
+ var _resultData$at, _resultData$at2;
12
+ var checkPointData = props.checkPointData,
13
+ handleClose = props.handleClose;
14
+ var _useState = (0, _react.useState)(0),
15
+ resIndex = _useState[0],
16
+ setResIndex = _useState[1];
17
+ var _useState2 = (0, _react.useState)(null),
18
+ resIndexData = _useState2[0],
19
+ setResIndexData = _useState2[1];
20
+ var _useState3 = (0, _react.useState)([]),
21
+ resultData = _useState3[0],
22
+ setResultData = _useState3[1];
23
+ var _useState4 = (0, _react.useState)(0),
24
+ pageHeight = _useState4[0],
25
+ setPageHeight = _useState4[1];
26
+ var imgRef = (0, _react.useRef)();
27
+ var initData = function initData() {
28
+ var fileUrl = checkPointData.fileUrl,
29
+ _checkPointData$annot = checkPointData.annotations,
30
+ annotations = _checkPointData$annot === void 0 ? [] : _checkPointData$annot;
31
+ setTimeout(function () {
32
+ var iframe = document.getElementById('file_check_point');
33
+ iframe.src = fileUrl + "#toolbar=0";
34
+ }, 500);
35
+ setResIndexData(annotations[0]);
36
+ // 其中的page可能是乱序的,所以先排序一下
37
+ setResultData(annotations.sort(function (a, b) {
38
+ return a.page - b.page;
39
+ }));
40
+ var clientWidth = document.documentElement.clientWidth;
41
+ var _annotations$ = annotations[0],
42
+ scrollWidth = _annotations$.scrollWidth,
43
+ scrollHeight = _annotations$.scrollHeight;
44
+ var scale = clientWidth / scrollWidth;
45
+ setPageHeight(scrollHeight * scale);
46
+ };
47
+
48
+ // 获取标识的位置和大小 [方法]
49
+ var getTipDotStyle = function getTipDotStyle(item) {
50
+ var width = item.width,
51
+ height = item.height,
52
+ x = item.x,
53
+ y = item.y,
54
+ scrollWidth = item.scrollWidth,
55
+ scrollHeight = item.scrollHeight,
56
+ page = item.page;
57
+ console.log(width, height, x, y);
58
+ var img = imgRef.current;
59
+ console.log(img, 'refs');
60
+ var clientWidth = document.documentElement.clientWidth;
61
+ console.log('clientWidth-----', clientWidth);
62
+
63
+ // 算出一个系数,来动态生成下面的边框样式
64
+ var scale = clientWidth / scrollWidth;
65
+
66
+ // console.log('原始宽高', sourceImgWidth, sourceImgHeight);
67
+ console.log('原始宽高', scrollWidth, scrollHeight);
68
+ console.log('缩放系数', scale, scale);
69
+ return {
70
+ width: width * scale + 'px',
71
+ height: height * scale + 'px',
72
+ left: x * scale + 'px',
73
+ top: (page - 1) * pageHeight + y * scale + 'px'
74
+ };
75
+ };
76
+
77
+ // 上一项(prev),下一项(next) [按钮]
78
+ var handleSwitch = function handleSwitch(state) {
79
+ if (state === 'next' && resIndex === resultData.length - 1) return _message["default"].notice('没有下一项了');
80
+ if (state === 'prev' && resIndex === 0) return _message["default"].notice('没有上一项了');
81
+ if (state === 'next') {
82
+ setResIndex(resIndex + 1);
83
+ setResIndexData(resultData[resIndex + 1]);
84
+ }
85
+ if (state === 'prev') {
86
+ setResIndex(resIndex - 1);
87
+ setResIndexData(resultData[resIndex - 1]);
88
+ }
89
+ };
90
+ var checkOneDot = function checkOneDot(item, index) {
91
+ setResIndex(index);
92
+ setResIndexData(item);
93
+ };
94
+ (0, _react.useEffect)(function () {
95
+ if (checkPointData) {
96
+ initData();
97
+ }
98
+ }, [checkPointData]);
99
+ return /*#__PURE__*/_react.React.createElement("div", null, /*#__PURE__*/_react.React.createElement("div", {
100
+ className: "keyPoint-container"
101
+ }, /*#__PURE__*/_react.React.createElement("div", {
102
+ className: "tipDot-content",
103
+ style: {
104
+ height: ((_resultData$at = resultData.at(-1)) === null || _resultData$at === void 0 ? void 0 : _resultData$at.page) * pageHeight + 'px'
105
+ }
106
+ }, resultData.map(function (item, index) {
107
+ return /*#__PURE__*/_react.React.createElement("div", {
108
+ className: "tip-item " + (index === resIndex ? 'active' : ''),
109
+ key: index,
110
+ onClick: function onClick() {
111
+ return checkOneDot(item, index);
112
+ },
113
+ style: getTipDotStyle(item)
114
+ }, /*#__PURE__*/_react.React.createElement("div", {
115
+ className: "num " + (index === resIndex ? 'active' : '')
116
+ }, index + 1));
117
+ })), resIndexData && /*#__PURE__*/_react.React.createElement("div", {
118
+ className: "result-outter"
119
+ }, /*#__PURE__*/_react.React.createElement("div", {
120
+ className: "result-card"
121
+ }, /*#__PURE__*/_react.React.createElement("div", {
122
+ className: "result-title"
123
+ }, resIndex + 1, "\u3001", resIndexData.text), /*#__PURE__*/_react.React.createElement("div", {
124
+ className: "result-info"
125
+ }, /*#__PURE__*/_react.React.createElement(_icons.CheckCircleFilled, {
126
+ color: "#15bc83",
127
+ size: "20",
128
+ style: {
129
+ color: '#15bc83',
130
+ fontSize: '20px'
131
+ }
132
+ }), /*#__PURE__*/_react.React.createElement("div", {
133
+ className: "result-text"
134
+ }, resIndexData.reviewNotes)))), /*#__PURE__*/_react.React.createElement("div", {
135
+ className: "bottom-btn"
136
+ }, /*#__PURE__*/_react.React.createElement("div", {
137
+ className: "btn"
138
+ }, /*#__PURE__*/_react.React.createElement("div", {
139
+ onClick: handleClose
140
+ }, "\u8FD4\u56DE")), /*#__PURE__*/_react.React.createElement("div", {
141
+ className: "btn"
142
+ }, /*#__PURE__*/_react.React.createElement("div", {
143
+ onClick: function onClick() {
144
+ return handleSwitch('prev');
145
+ }
146
+ }, "\u4E0A\u4E00\u9879")), /*#__PURE__*/_react.React.createElement("div", {
147
+ className: "btn btn-blue"
148
+ }, /*#__PURE__*/_react.React.createElement("div", {
149
+ onClick: function onClick() {
150
+ return handleSwitch('next');
151
+ }
152
+ }, "\u4E0B\u4E00\u9879"))), /*#__PURE__*/_react.React.createElement("iframe", {
153
+ ref: imgRef,
154
+ id: "file_check_point",
155
+ frameBorder: "0",
156
+ height: "100%",
157
+ width: "100%",
158
+ style: {
159
+ height: ((_resultData$at2 = resultData.at(-1)) === null || _resultData$at2 === void 0 ? void 0 : _resultData$at2.page) * pageHeight + 'px'
160
+ }
161
+ })));
162
+ }
@@ -0,0 +1,120 @@
1
+ .keyPoint-container {
2
+ // position: sticky;
3
+ height: 100vh;
4
+ // margin-top: -56px;
5
+ width: 100vw;
6
+ position: fixed;
7
+ z-index: 999;
8
+ left: 0;
9
+ top: 0;
10
+ background: #919191;
11
+ overflow-y: scroll;
12
+ #file_check_point {
13
+ overflow: visible !important;
14
+ overflow-clip-margin: unset !important;
15
+ }
16
+ .tipDot-content{
17
+ // height: 100vh;
18
+ width: 100%;
19
+ position: absolute;
20
+ top: 0;
21
+ left: 0;
22
+ // overflow: scroll;
23
+ .tip-item{
24
+ position: absolute;
25
+ border-radius: 2px;
26
+ border: 1px solid #15BC83;
27
+ background: rgba(21, 188, 131, 0.1);
28
+ &.active {
29
+ background: rgba(247, 98, 93, 0.1);
30
+ border: 1px solid #F7625D;
31
+ }
32
+ .num{
33
+ width: 20px;
34
+ height: 20px;
35
+ border-radius: 50%;
36
+ font-size: 10px;
37
+ display: flex;
38
+ justify-content: center;
39
+ align-items: center;
40
+ color: #ffffff;
41
+ margin-left: -20px;
42
+ background: #15BC83;
43
+ &.active {
44
+ background: #F7625D;
45
+ }
46
+ }
47
+ }
48
+
49
+ }
50
+ .result-outter {
51
+ box-sizing: border-box;
52
+ padding: 0 24px;
53
+ // border: 1px solid red;
54
+ position: fixed;
55
+ width: 100%;
56
+ bottom: 65px;
57
+ left: 0;
58
+ .result-card {
59
+ border-radius: 10px;
60
+ padding: 16px;
61
+ background: #ffffff;
62
+ border: 1px solid #ddd;
63
+ box-shadow: 0px 4px 10px 0px rgba(177, 188, 200, 0.25);
64
+ .result-title {
65
+ color: #333;
66
+ font-size: 14px;
67
+ margin-bottom: 8px;
68
+ }
69
+ .result-info{
70
+ font-size: 14px;
71
+ margin-bottom: 10px;
72
+ display: flex;
73
+ justify-content: flex-start;
74
+ align-items: center;
75
+ gap: 5px;
76
+ // 提示类型: error/judge/pass
77
+ .result-text{
78
+ }
79
+ }
80
+ }
81
+
82
+ }
83
+ .bottom-btn {
84
+ box-sizing: border-box;
85
+ position: fixed;
86
+ bottom: 0;
87
+ left: 0;
88
+ width: 100%;
89
+ background-color: #fff;
90
+ padding: 11px 0;
91
+ display: flex;
92
+ box-shadow: 0px 2px 16px 0px rgba(0, 0, 0, 0.1);
93
+ z-index: 200;
94
+ .btn {
95
+ margin: 0 10px;
96
+ flex: 1;
97
+ color: #323233;
98
+ background-color: #fff;
99
+ border-color: #ebedf0;
100
+ border-width: 1px;
101
+ border-style: solid;
102
+ border-radius: 100px;
103
+ padding: 0 12px;
104
+ font-size: 14px;
105
+ height: 40px;
106
+ position: relative;
107
+ align-items: center;
108
+ justify-content: center;
109
+ display: flex;
110
+ flex-direction: row;
111
+ box-sizing: border-box;
112
+ flex-direction: row;
113
+ }
114
+ .btn-blue {
115
+ color: white;
116
+ border-width: 0px;
117
+ background-image: linear-gradient(rgb(22, 120, 255), rgb(118, 173, 250));
118
+ }
119
+ }
120
+ }
@@ -0,0 +1,306 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ exports.__esModule = true;
5
+ exports.dataURLtoBlob = dataURLtoBlob;
6
+ exports.getBlob = getBlob;
7
+ exports.getFileExtension = getFileExtension;
8
+ exports.pdfToImageUrl = exports.initFormat = void 0;
9
+ exports.upload = upload;
10
+ exports.uploadFilePromise = uploadFilePromise;
11
+ var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
12
+ var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
13
+ var pdfjsLib = _interopRequireWildcard(require("pdfjs-dist/build/pdf"));
14
+ require("pdfjs-dist/build/pdf.worker.entry");
15
+ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, "default": e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
16
+ // import apiConfig from '@/config/api.cofig'
17
+
18
+ // utils/pdfToImage.js
19
+
20
+ // 配置 worker(必须!)
21
+ if (typeof window !== 'undefined') {
22
+ pdfjsLib.GlobalWorkerOptions.workerSrc = require('pdfjs-dist/build/pdf.worker.entry');
23
+ }
24
+
25
+ /**
26
+ * 将 PDF URL 转换为图片 URL
27
+ * @param {string} pdfUrl - PDF 文件的 URL
28
+ * @param {number} [page=1] - 页码,默认第1页
29
+ * @param {number} [scale=0.5] - 缩放比例,默认0.5
30
+ * @param {string} [imageFormat='image/jpeg'] - 图片格式
31
+ * @param {number} [imageQuality=0.8] - 图片质量(0-1)
32
+ * @returns {Promise<string>} 返回图片的 Data URL
33
+ */
34
+ var pdfToImageUrl = exports.pdfToImageUrl = /*#__PURE__*/function () {
35
+ var _ref = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee(pdfUrl, scale) {
36
+ return _regenerator["default"].wrap(function (_context) {
37
+ while (1) switch (_context.prev = _context.next) {
38
+ case 0:
39
+ if (scale === void 0) {
40
+ scale = 0.5;
41
+ }
42
+ console.log('pdfToImageUrl----', pdfUrl);
43
+ pdfjsLib.getDocument(pdfUrl).promise.then(function (pdf) {
44
+ console.log('获取PDF文件成功', pdf);
45
+ // 获取第一页
46
+ return pdf.getPage(1);
47
+ }).then(function (page) {
48
+ console.log('获取PDF页面成功', page);
49
+ // 设置缩略图的缩放比例 (0.5 表示缩小到一半尺寸)
50
+ var viewport = page.getViewport({
51
+ scale: scale
52
+ });
53
+
54
+ // 创建Canvas元素
55
+ var canvas = document.createElement('canvas');
56
+ var context = canvas.getContext('2d');
57
+ canvas.height = viewport.height;
58
+ canvas.width = viewport.width;
59
+
60
+ // 将PDF页面渲染到Canvas上
61
+ var renderContext = {
62
+ canvasContext: context,
63
+ viewport: viewport
64
+ };
65
+ page.render(renderContext).promise.then(function () {
66
+ // 将Canvas转换为图片URL
67
+ var thumbnail = canvas.toDataURL();
68
+ console.log('获取图片成功', thumbnail);
69
+ return thumbnail;
70
+ });
71
+ })["catch"](function (error) {
72
+ console.error('Error generating thumbnail:', error);
73
+ });
74
+ case 1:
75
+ case "end":
76
+ return _context.stop();
77
+ }
78
+ }, _callee);
79
+ }));
80
+ return function pdfToImageUrl(_x, _x2) {
81
+ return _ref.apply(this, arguments);
82
+ };
83
+ }();
84
+
85
+ // 下载文件
86
+ function getBlob(url) {
87
+ return new Promise(function (resolve, reject) {
88
+ var xhr = new XMLHttpRequest();
89
+ xhr.open('GET', url, true);
90
+ xhr.responseType = 'blob';
91
+ xhr.onload = function () {
92
+ if (xhr.status === 200) {
93
+ resolve(xhr.response);
94
+ } else {
95
+ reject("Request failed with status " + xhr.status);
96
+ }
97
+ };
98
+ xhr.onerror = function () {
99
+ reject('Request failed');
100
+ };
101
+ xhr.send();
102
+ });
103
+ }
104
+
105
+ // 上传文件
106
+ function upload(option) {
107
+ var xhr = new XMLHttpRequest(); // 定义上传方式
108
+
109
+ if (option.onProgress && xhr.upload) {
110
+ xhr.upload.onprogress = function progress(e) {
111
+ if (e.total > 0) {
112
+ e.percent = e.loaded / e.total * 100;
113
+ }
114
+ option.onProgress(e); // 上传进度,也是上传成功后回调
115
+ };
116
+ }
117
+ var formData = new FormData();
118
+ formData.append('file', option.file, option.file.name);
119
+ if (option.title) {
120
+ formData.append('title', option.title);
121
+ }
122
+ if (option.fileType) {
123
+ formData.append('fileType', option.fileType);
124
+ }
125
+ xhr.onerror = function error(e) {
126
+ option.onError(e); // 失败返回
127
+ };
128
+ xhr.onload = function onload() {
129
+ if (xhr.status !== 200) {
130
+ return option.onError(JSON.parse(xhr.response));
131
+ }
132
+ option.onSuccess(JSON.parse(xhr.response)); // 成功返回函数
133
+ };
134
+ xhr.open('post', option.action, true);
135
+ if (option.withCredentials && 'withCredentials' in xhr) {
136
+ xhr.withCredentials = true;
137
+ }
138
+ var headers = option.headers || {}; // 定义请求头
139
+ if (headers['X-Requested-With'] !== null) {
140
+ xhr.setRequestHeader('X-Requested-With', 'XMLHttpRequest');
141
+ }
142
+ for (var h in headers) {
143
+ if (headers.hasOwnProperty(h) && headers[h] !== null) {
144
+ xhr.setRequestHeader(h, headers[h]);
145
+ }
146
+ }
147
+ xhr.send(formData);
148
+ return {
149
+ abort: function abort() {
150
+ xhr.abort();
151
+ }
152
+ };
153
+ }
154
+
155
+ // 获取文件名后缀
156
+ function getFileExtension(filename) {
157
+ var match = filename.match(/\.([^.]+)$/);
158
+ return match ? match[1].toLowerCase() : '';
159
+ }
160
+
161
+ // base64转换为流文件
162
+ function dataURLtoBlob(dataUrl) {
163
+ var arr = dataUrl.split(',');
164
+ var mime = arr[0].match(/:(.*?);/)[1];
165
+ var bstr = atob(arr[1]);
166
+ var n = bstr.length;
167
+ var u8arr = new Uint8Array(n);
168
+ while (n--) {
169
+ u8arr[n] = bstr.charCodeAt(n);
170
+ }
171
+ return new Blob([u8arr], {
172
+ type: mime
173
+ });
174
+ }
175
+
176
+ // 上传文件至申报端的服务器 [方法]
177
+ function uploadFilePromise(url, config) {
178
+ console.log('uploadFilePromise', config);
179
+ return new Promise(function (resolve, reject) {
180
+ var formData = new FormData();
181
+ formData.append('file', url);
182
+ formData.append('open', true);
183
+ formData.append('open', 'true');
184
+ fetch(config.baseUrl + "/declaration/material/file/files/api", {
185
+ method: 'POST',
186
+ body: formData,
187
+ headers: {
188
+ Authorization: config.tokenTY
189
+ }
190
+ }).then(function (response) {
191
+ return response.json();
192
+ }).then(function (res) {
193
+ resolve(res);
194
+ // if (res.fileId) {
195
+ // valChange({
196
+ // ...res,
197
+ // name: fileData.name,
198
+ // type: fileData.type
199
+ // })
200
+ // // Message.notice('上传成功')
201
+ // } else {
202
+ // // Message.error('上传失败,请重试')
203
+ // }
204
+ })["catch"](function (err) {
205
+ return err;
206
+ });
207
+ // uni.uploadFile({
208
+ // url: `${baseURL}/declaration/material/file/files/api`,
209
+ // filePath: url,
210
+ // name: 'file',
211
+ // formData: {
212
+ // // #ifdef H5
213
+ // open: true,
214
+ // // #endif
215
+ // // #ifdef MP-WEIXIN
216
+ // open: 'true'
217
+ // // #endif
218
+ // },
219
+ // header: {
220
+ // Authorization: uni.getStorageSync('declarationAppToken')
221
+ // },
222
+ // success: (res) => {
223
+ // if (res.statusCode === 200) {
224
+ // // resolve(JSON.parse(res.data))
225
+ // resolve({
226
+ // status: 'success',
227
+ // message: '上传成功',
228
+ // ...JSON.parse(res.data)
229
+ // });
230
+ // } else {
231
+ // resolve({
232
+ // status: 'failed',
233
+ // message: '上传失败'
234
+ // })
235
+ // }
236
+ // },
237
+ // fail: (err) => {
238
+ // resolve({
239
+ // status: 'failed',
240
+ // message: '上传失败'
241
+ // })
242
+ // }
243
+ // })
244
+ });
245
+ }
246
+
247
+ // 初始化材料格式 [方法]
248
+ var initFormat = exports.initFormat = function initFormat(materialSpec) {
249
+ var materialSpecArr = materialSpec.split(',');
250
+ var arr = [{
251
+ key: '1',
252
+ value: 'doc'
253
+ }, {
254
+ key: '2',
255
+ value: 'docx'
256
+ }, {
257
+ key: '3',
258
+ value: 'pdf'
259
+ }, {
260
+ key: '4',
261
+ value: 'ofd'
262
+ }, {
263
+ key: '5',
264
+ value: 'xlsx'
265
+ }, {
266
+ key: '6',
267
+ value: 'xls'
268
+ }, {
269
+ key: '7',
270
+ value: 'png'
271
+ }, {
272
+ key: '8',
273
+ value: 'jpg'
274
+ }, {
275
+ key: '9',
276
+ value: 'jpeg'
277
+ }, {
278
+ key: '10',
279
+ value: 'gif'
280
+ }, {
281
+ key: '11',
282
+ value: 'bmp'
283
+ }, {
284
+ key: '12',
285
+ value: 'zip'
286
+ }, {
287
+ key: '13',
288
+ value: 'rar'
289
+ }, {
290
+ key: '14',
291
+ value: 'mp3'
292
+ }, {
293
+ key: '15',
294
+ value: 'mp4'
295
+ }, {
296
+ key: '16',
297
+ value: 'xml'
298
+ }];
299
+ var formatArr = [];
300
+ arr.forEach(function (ele) {
301
+ if (materialSpecArr.includes(ele.key)) {
302
+ formatArr.push(ele.value);
303
+ }
304
+ });
305
+ return formatArr;
306
+ };
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" fill="none" version="1.1" width="14" height="14" viewBox="0 0 14 14"><defs><clipPath id="master_svg0_106_93330"><rect x="0" y="0" width="14" height="14" rx="0"/></clipPath></defs><g clip-path="url(#master_svg0_106_93330)"><g><path d="M7.0020943,14.000407C3.672467,14.005688,0.80125445,11.65946,0.13995513,8.3929729C-0.52134383,5.1264863,1.2108389,1.846483,4.2798362,0.55383289C7.8382812,-0.95109636,11.941765,0.71642286,13.445227,4.2783422C14.948689,7.8402619,13.282796,11.947755,9.7243519,13.452684C8.8629837,13.816712,7.9370847,14.003004,7.0020943,14.000407ZM7.0020943,1.1015548C3.7463284,1.1015548,1.1061484,3.744313,1.1061484,7.0032587C1.1061484,10.262204,3.7463281,12.904963,7.0020943,12.904963C10.25786,12.904963,12.89804,10.262204,12.89804,7.0032587C12.89804,3.744313,10.25786,1.1015548,7.0020943,1.1015548Z" fill="#FFFFFF" fill-opacity="1" style="mix-blend-mode:passthrough"/></g><g><path d="M5.8392997015625,9.782016725C5.694968501562499,9.779958725,5.5572960015625,9.720898625,5.4562683015625,9.617700625000001L2.8297682115625,6.988634825C2.6147319265625,6.773055825,2.6148665585625,6.423844625,2.8300691515625,6.208432225C3.0452717515625,5.9930196250000005,3.3941421515625,5.992884625,3.6095104215625,6.208130825L5.8392997015625,8.453790625L10.4767141015625,3.811847495C10.6920643015625,3.596497122,11.0410194015625,3.596582655,11.2562647015625,3.812038165C11.4715099015625,4.027494105,11.4715958015625,4.376790285,11.2564564015625,4.592351375L6.2223310015625,9.617699625C6.1213033015625005,9.720897625,5.9836309015625,9.779958225,5.8392997015625,9.782016725Z" fill="#FFFFFF" fill-opacity="1" style="mix-blend-mode:passthrough"/></g></g></svg>
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" fill="none" version="1.1" width="24" height="24" viewBox="0 0 24 24"><defs><clipPath id="master_svg0_106_93607"><rect x="0" y="0" width="24" height="24" rx="0"/></clipPath></defs><g clip-path="url(#master_svg0_106_93607)"><path d="M10.62774178125,12.00024228125L3.78474200125,5.15724198125C3.40573692325,4.77823618125,3.40573692325,4.16374743125,3.7847423512500002,3.7847423512500002C4.16374779125,3.40573692325,4.77823648125,3.40573692325,5.15724198125,3.78474200125L12.00024228125,10.62774178125L18.843241281250002,3.78474200125C19.222301281249997,3.40605306625,19.83653228125,3.40620327025,20.21540428125,3.78507745125C20.59428028125,4.16395199125,20.59443128125,4.77818178125,20.21574428125,5.15724198125L13.37274168125,12.00024228125L20.21574028125,18.843241281250002C20.59474528125,19.22224728125,20.59474528125,19.83673828125,20.21574028125,20.21574028125C19.83673428125,20.59474528125,19.22224428125,20.59474528125,18.843241281250002,20.21574428125L12.00024228125,13.37274168125L5.15724198125,20.21574428125C4.77818178125,20.59443128125,4.16395163125,20.59428028125,3.78507709125,20.21540428125C3.40620291225,19.83653228125,3.40605306625,19.222301281249997,3.78474200125,18.843241281250002L10.62774178125,12.00024228125Z" fill="#FFFFFF" fill-opacity="1" style="mix-blend-mode:passthrough"/></g></svg>
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" fill="none" version="1.1" width="16" height="16" viewBox="0 0 16 16"><g><g><ellipse cx="8" cy="8" rx="8" ry="8" fill="#333333" fill-opacity="1"/></g><g><path d="M11.7879457,4.21203609C11.5011454,3.929321304,11.040452,3.929321304,10.753614899999999,4.21203609C10.753614899999999,4.21203609,7.9922135,6.9734569,7.9922135,6.9734569C7.9922135,6.9734569,5.2307363,4.21201725,5.2307363,4.21201725C4.94241077,3.94331019,4.49305326,3.951255418,4.21434879,4.22994111C3.935663126,4.50862682,3.927717894,4.95796555,4.19642495,5.2463286C4.19642495,5.2463286,6.9578644999999995,8.0078058,6.9578644999999995,8.0078058C6.9578644999999995,8.0078058,4.19642495,10.7692451,4.19642495,10.7692451C3.927717894,11.0575709,3.935663126,11.5069466,4.21434879,11.7856331C4.49303442,12.0643187,4.9423731,12.0722647,5.2307363,11.8035569C5.2307363,11.8035569,7.9922135,9.042117099999999,7.9922135,9.042117099999999C7.9922135,9.042117099999999,10.753653,11.8035569,10.753653,11.8035569C11.041997,12.0722647,11.4913545,12.0643187,11.7700396,11.7856331C12.0487261,11.5069466,12.0566711,11.0576091,11.787963900000001,10.7692451C11.787963900000001,10.7692451,9.0265245,8.0078058,9.0265245,8.0078058C9.0265245,8.0078058,11.787963900000001,5.2463286,11.787963900000001,5.2463286C12.0706787,4.95950937,12.0706787,4.49883649,11.787963900000001,4.21201725C11.787963900000001,4.21201725,11.7879457,4.21203609,11.7879457,4.21203609Z" fill="#FFFFFF" fill-opacity="1" style="mix-blend-mode:passthrough"/></g></g></svg>
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" fill="none" version="1.1" width="16" height="11.727999687194824" viewBox="0 0 16 11.727999687194824"><g><path d="M16,9.5679989Q16,9.9679985,15.864,10.319999Q15.728001,10.671999,15.488,10.959999Q15.247999,11.247999,14.92,11.431999Q14.592001,11.615999,14.208,11.679999L14.208,11.711999L13.872,11.711999L13.856,11.711999L3.4720001,11.711999Q3.4400001,11.711999,3.4320002,11.719999Q3.4240003,11.728,3.3920002,11.728Q3.3600001,11.728,3.3440001,11.719999Q3.3280001,11.711999,3.296,11.711999L3.2,11.711999L3.2,11.695999Q2.5280001,11.664,1.944,11.391999Q1.3599999,11.119999,0.92799997,10.664Q0.49600008,10.208,0.248,9.6079998Q-8.9406967e-8,9.0079994,0,8.3359995Q8.9406967e-8,7.6639996,0.248,7.0719995Q0.4959999,6.4799995,0.91999996,6.0319996Q1.3440001,5.5839996,1.9119999,5.2959995Q2.4799998,5.0079994,3.1359999,4.96Q3.2479999,3.9199998,3.7119999,3.016Q4.1759996,2.1120002,4.9039998,1.4400001Q5.632,0.76799989,6.5759997,0.38400006Q7.5199995,2.3841858e-7,8.592,0Q9.7279997,0,10.736,0.43199992Q11.744,0.86399984,12.488,1.6159999Q13.231999,2.3680003,13.664,3.3679998Q14.096,4.3679991,14.096,5.5039997Q14.096,6.0159998,14,6.5039997Q13.904,6.9919996,13.728,7.4399996Q13.759999,7.4399996,13.799999,7.4319992Q13.839999,7.4239988,13.871999,7.4239988Q14.319999,7.4239988,14.703999,7.5919991Q15.087998,7.7599993,15.375998,8.0479994Q15.663999,8.3359995,15.831999,8.7279997Q15.999999,9.1199999,16,9.5679989ZM10.736,7.1999989Q10.928,6.8799992,10.848001,6.8319988Q10.768001,6.7839985,10.448001,6.7839985Q10.256001,6.7839985,9.9120007,6.7759981Q9.5680008,6.7679977,9.3920002,6.7679977Q9.1360006,6.7679977,9.0640001,6.5599976Q8.9919996,6.3519974,8.9920006,5.9839973Q8.9920006,5.4719973,8.9840002,5.1599979Q8.9759998,4.8479977,8.9759998,4.4799976Q8.9759998,4.0639982,8.9200001,3.8719981Q8.8640003,3.6799982,8.4639997,3.6799982Q8.1759996,3.6799982,8.0319996,3.6879981Q7.8879995,3.695998,7.6319995,3.695998Q7.1999993,3.695998,7.0959997,3.9439981Q6.9920001,4.1919985,6.9919996,4.4319983L6.9919996,4.9439983Q6.9919996,5.1519985,6.9999995,5.343998Q7.0079994,5.5359983,7.0079994,5.7439985L7.0079994,6.2079983Q7.0079994,6.4639978,6.9439993,6.5999985Q6.8799992,6.7359991,6.6399994,6.7359982Q6.5439992,6.7519979,6.3759995,6.7599983Q6.2079997,6.7679987,6.0319996,6.7759981Q5.8559995,6.7839975,5.6959996,6.7839985L5.4399996,6.7839985Q5.1039996,6.7839985,5.0399995,6.9919987Q4.9759994,7.1999989,5.2479997,7.5199986Q5.5199995,7.855999,5.8319998,8.2479982Q6.1440001,8.6399975,6.448,9.0399981Q6.7519999,9.4399986,7.0320001,9.8159981Q7.3120003,10.191998,7.552,10.463998Q7.9840002,10.943997,8.3839998,10.447998Q8.6239996,10.175998,8.9440002,9.7439985Q9.2640009,9.3119993,9.6000004,8.8399982Q9.9359999,8.3679972,10.240001,7.9279985Q10.544002,7.4879999,10.736,7.1999989Z" fill="#1678FF" fill-opacity="1" style="mix-blend-mode:passthrough"/></g></svg>
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" fill="none" version="1.1" width="14" height="14" viewBox="0 0 14 14"><defs><clipPath id="master_svg0_106_82168"><rect x="0" y="0" width="14" height="14" rx="0"/></clipPath></defs><g clip-path="url(#master_svg0_106_82168)"><g><path d="M13.026563,9.1396484375C12.733489,9.1465744972,12.497551,9.3825128075,12.490624,9.6755861075C12.490624,10.8546484375,11.703125,11.8215239375,10.70125,11.8215239375L3.2987499,11.8215239375C2.296875,11.8127737375,1.509375,10.8546484375,1.509375,9.6755861075C1.5024495,9.3825119775,1.26651073,9.1465736628,0.97343743,9.1396484375C0.68036395,9.1465744972,0.4444256425,9.3825128075,0.4375,9.6755861075C0.4375,11.462774037500001,1.7259375,12.8933982375,3.2987499,12.8933982375L10.70125,12.8933982375C12.274063,12.8933982375,13.5625,11.462774037500001,13.5625,9.6755861075C13.555574,9.3825119775,13.319635,9.1465736628,13.026563,9.1396484375Z" fill="#1678FF" fill-opacity="1" style="mix-blend-mode:passthrough"/></g><g><path d="M6.62372038125,9.3891039375C6.85207508125,9.5784521375,7.182865881250001,9.5784521375,7.411220581249999,9.3891039375L9.44997068125,7.3503537375C9.63593958125,7.1398992375,9.626101981249999,6.8210883375,9.42751268125,6.6224990375C9.228923281250001,6.4239096375,8.91011238125,6.4140730375,8.699657881250001,6.6000414375L7.59059548125,7.7091035375L7.59059548125,1.6278542875C7.57250328125,1.3445480175,7.33744718125,1.1240234375,7.05356358125,1.1240234375C6.76968078125,1.1240234375,6.53462458125,1.3445481175,6.51653288125,1.6278542875L6.51653288125,7.7091035375L5.40747034125,6.6000414375C5.19701534125,6.4140749375,4.87820670125,6.4239130375,4.67961819125,6.6225018375C4.48102968525,6.8210902375,4.47119176025,7.1398983375,4.65715773125,7.3503537375L6.62372038125,9.3891039375Z" fill="#1678FF" fill-opacity="1" style="mix-blend-mode:passthrough"/></g></g></svg>
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" fill="none" version="1.1" width="24" height="24" viewBox="0 0 24 24"><defs><clipPath id="master_svg0_125_16922"><rect x="0" y="0" width="24" height="24" rx="0"/></clipPath><linearGradient x1="0.5" y1="0" x2="0.5" y2="1" id="master_svg1_125_17238"><stop offset="0%" stop-color="#579EFF" stop-opacity="1"/><stop offset="100%" stop-color="#85B8FF" stop-opacity="1"/></linearGradient></defs><g clip-path="url(#master_svg0_125_16922)"><g><path d="M8.7133856e-15,3.00078105C-7.9004963e-8,2.33803946,0.53725815,1.80078125,1.2,1.80078125L9.4087505,1.80078125C9.8887873,1.800799667833,10.322625,2.08689746,10.5117,2.52813119L11.1,3.90078095L22.800001,3.90078095C23.462742,3.90078115,24,4.43803905,24,5.10078075L24,17.70077925C24,18.36352125,23.462742,18.90077925,22.799999,18.90077925L1.2,18.90077925C0.53725827,18.90077925,8.7133856e-15,18.36352125,8.7133856e-15,17.70077925L8.7133856e-15,3.00078105Z" fill="#4288E7" fill-opacity="1" style="mix-blend-mode:passthrough"/></g><g><path d="M3.30009795625,5.8505859375L20.70009765625,5.8505859375Q21.90009865625,5.8505859375,21.90009865625,7.0505862375L21.90009865625,17.850584937500003Q21.90009865625,19.0505849375,20.70009765625,19.0505849375L3.30009755625,19.0505849375Q2.10009765625,19.0505849375,2.10009765625,17.850584937500003L2.10009765625,7.0505855375Q2.10009765625,5.85058557987213,3.30009795625,5.8505859375Z" fill="#FFFFFF" fill-opacity="1" style="mix-blend-mode:passthrough"/></g><g><path d="M1.1999998,7.80078125L22.799999,7.80078125Q24,7.80078125,24,9.00078155L24,21.00078225Q24,22.20078225,22.799999,22.20078225L1.2,22.20078225Q0,22.20078225,0,21.00078225L0,9.00078155Q0,7.80078125,1.1999998,7.80078125Z" fill="url(#master_svg1_125_17238)" fill-opacity="1" style="mix-blend-mode:passthrough"/></g></g></svg>