ydb-components-material 0.1.85 → 0.1.86

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.
@@ -1,7 +1,7 @@
1
1
  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
- import { createbycategory, contractSignUrl, signurl, checkSignState, contractFinish, documentDownload } from "../../api";
4
+ import { createbycategory, contractSignUrl, signurl, checkSignState, contractFinish, documentDownload, fileUploadApi } from "../../api";
5
5
  var categoryId = '3354397552669692408';
6
6
  // 预发
7
7
  var categoryIdRelease = '3291682531601133765'; // 手写签批id
@@ -256,7 +256,7 @@ export function getSignRes(_x6, _x7, _x8, _x9, _x0) {
256
256
  // 轮询 签批状态
257
257
  function _getSignRes() {
258
258
  _getSignRes = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee3(documentIdVal, contractIdVal, name, autoUpload, config) {
259
- var isSignSucc, newFile, uploadedFileObj;
259
+ var isSignSucc, newFile, params, uploadRes;
260
260
  return _regeneratorRuntime.wrap(function (_context3) {
261
261
  while (1) switch (_context3.prev = _context3.next) {
262
262
  case 0:
@@ -265,7 +265,7 @@ function _getSignRes() {
265
265
  case 1:
266
266
  isSignSucc = _context3.sent;
267
267
  if (!isSignSucc) {
268
- _context3.next = 6;
268
+ _context3.next = 8;
269
269
  break;
270
270
  }
271
271
  // 封存
@@ -277,23 +277,38 @@ function _getSignRes() {
277
277
  console.log('newFile', newFile);
278
278
  // 如果需要自动上传
279
279
  if (!autoUpload) {
280
- _context3.next = 4;
280
+ _context3.next = 6;
281
281
  break;
282
282
  }
283
+ params = {
284
+ materiaBase: newFile,
285
+ open: true
286
+ };
287
+ console.log('params', params);
283
288
  _context3.next = 3;
284
- return uploadFilePromise(newFile, config);
289
+ return fileUploadApi(params, config);
285
290
  case 3:
286
- uploadedFileObj = _context3.sent;
287
- console.log('签批完成后的文件地址', uploadedFileObj);
288
- return _context3.abrupt("return", uploadedFileObj);
291
+ uploadRes = _context3.sent;
292
+ // const uploadedFileObj = await uploadFilePromise(newFile, config)
293
+ console.log('签批完成后的文件地址', uploadRes);
294
+ if (!(uploadRes.code === 200)) {
295
+ _context3.next = 4;
296
+ break;
297
+ }
298
+ return _context3.abrupt("return", uploadRes.data);
289
299
  case 4:
290
- return _context3.abrupt("return", newFile);
300
+ return _context3.abrupt("return", false);
291
301
  case 5:
292
302
  _context3.next = 7;
293
303
  break;
294
304
  case 6:
295
- return _context3.abrupt("return", false);
305
+ return _context3.abrupt("return", newFile);
296
306
  case 7:
307
+ _context3.next = 9;
308
+ break;
309
+ case 8:
310
+ return _context3.abrupt("return", false);
311
+ case 9:
297
312
  case "end":
298
313
  return _context3.stop();
299
314
  }
@@ -340,9 +355,13 @@ function handleSignApprovalDown(documentIdVal, name, config) {
340
355
  documentDownload(params, config).then(function (res) {
341
356
  console.log('下载文件:', res);
342
357
  // 返回来是base64格式的
343
- var blob = dataURLtoBlob(res.data); // 转成blob格式进行上传
344
- console.log(blob, '新文件的blob格式');
345
- resolve(blob);
358
+ // const blob = dataURLtoBlob(res.data); // 转成blob格式进行上传
359
+ // console.log(blob, '新文件的blob格式');
360
+ if (res.code === 200) {
361
+ resolve(res.data);
362
+ } else {
363
+ resolve(false);
364
+ }
346
365
  });
347
366
  });
348
367
  }
@@ -258,7 +258,7 @@ function getSignRes(_x6, _x7, _x8, _x9, _x0) {
258
258
  } // 轮询 签批状态
259
259
  function _getSignRes() {
260
260
  _getSignRes = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee3(documentIdVal, contractIdVal, name, autoUpload, config) {
261
- var isSignSucc, newFile, uploadedFileObj;
261
+ var isSignSucc, newFile, params, uploadRes;
262
262
  return _regenerator["default"].wrap(function (_context3) {
263
263
  while (1) switch (_context3.prev = _context3.next) {
264
264
  case 0:
@@ -267,7 +267,7 @@ function _getSignRes() {
267
267
  case 1:
268
268
  isSignSucc = _context3.sent;
269
269
  if (!isSignSucc) {
270
- _context3.next = 6;
270
+ _context3.next = 8;
271
271
  break;
272
272
  }
273
273
  // 封存
@@ -279,23 +279,38 @@ function _getSignRes() {
279
279
  console.log('newFile', newFile);
280
280
  // 如果需要自动上传
281
281
  if (!autoUpload) {
282
- _context3.next = 4;
282
+ _context3.next = 6;
283
283
  break;
284
284
  }
285
+ params = {
286
+ materiaBase: newFile,
287
+ open: true
288
+ };
289
+ console.log('params', params);
285
290
  _context3.next = 3;
286
- return (0, _file.uploadFilePromise)(newFile, config);
291
+ return (0, _api.fileUploadApi)(params, config);
287
292
  case 3:
288
- uploadedFileObj = _context3.sent;
289
- console.log('签批完成后的文件地址', uploadedFileObj);
290
- return _context3.abrupt("return", uploadedFileObj);
293
+ uploadRes = _context3.sent;
294
+ // const uploadedFileObj = await uploadFilePromise(newFile, config)
295
+ console.log('签批完成后的文件地址', uploadRes);
296
+ if (!(uploadRes.code === 200)) {
297
+ _context3.next = 4;
298
+ break;
299
+ }
300
+ return _context3.abrupt("return", uploadRes.data);
291
301
  case 4:
292
- return _context3.abrupt("return", newFile);
302
+ return _context3.abrupt("return", false);
293
303
  case 5:
294
304
  _context3.next = 7;
295
305
  break;
296
306
  case 6:
297
- return _context3.abrupt("return", false);
307
+ return _context3.abrupt("return", newFile);
298
308
  case 7:
309
+ _context3.next = 9;
310
+ break;
311
+ case 8:
312
+ return _context3.abrupt("return", false);
313
+ case 9:
299
314
  case "end":
300
315
  return _context3.stop();
301
316
  }
@@ -342,9 +357,13 @@ function handleSignApprovalDown(documentIdVal, name, config) {
342
357
  (0, _api.documentDownload)(params, config).then(function (res) {
343
358
  console.log('下载文件:', res);
344
359
  // 返回来是base64格式的
345
- var blob = (0, _file.dataURLtoBlob)(res.data); // 转成blob格式进行上传
346
- console.log(blob, '新文件的blob格式');
347
- resolve(blob);
360
+ // const blob = dataURLtoBlob(res.data); // 转成blob格式进行上传
361
+ // console.log(blob, '新文件的blob格式');
362
+ if (res.code === 200) {
363
+ resolve(res.data);
364
+ } else {
365
+ resolve(false);
366
+ }
348
367
  });
349
368
  });
350
369
  }
@@ -90,7 +90,7 @@ function fillRealVersion(meta, packageName, version, basicLibraryVersion) {
90
90
  packageName = 'ydb-components-material';
91
91
  }
92
92
  if (version === void 0) {
93
- version = '0.1.85';
93
+ version = '0.1.86';
94
94
  }
95
95
  if (basicLibraryVersion === void 0) {
96
96
  basicLibraryVersion = {
@@ -95,7 +95,7 @@ function fillRealVersion(meta, packageName, version, basicLibraryVersion) {
95
95
  packageName = 'ydb-components-material';
96
96
  }
97
97
  if (version === void 0) {
98
- version = '0.1.85';
98
+ version = '0.1.86';
99
99
  }
100
100
  if (basicLibraryVersion === void 0) {
101
101
  basicLibraryVersion = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ydb-components-material",
3
- "version": "0.1.85",
3
+ "version": "0.1.86",
4
4
  "description": "ydb-components-material",
5
5
  "main": "lib/index.js",
6
6
  "module": "es/index.js",
@@ -97,10 +97,10 @@
97
97
  },
98
98
  "componentConfig": {
99
99
  "isComponentLibrary": true,
100
- "materialSchema": "https://unpkg.com/ydb-components-material@0.1.85/build/lowcode/assets-prod.json"
100
+ "materialSchema": "https://unpkg.com/ydb-components-material@0.1.86/build/lowcode/assets-prod.json"
101
101
  },
102
102
  "lcMeta": {
103
103
  "type": "component"
104
104
  },
105
- "homepage": "https://unpkg.com/ydb-components-material@0.1.85/build/index.html"
105
+ "homepage": "https://unpkg.com/ydb-components-material@0.1.86/build/index.html"
106
106
  }