ydb-components-material 0.1.144 → 0.1.146

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.
@@ -200,6 +200,7 @@ var FileItem = function FileItem(_ref) {
200
200
  var _useState18 = useState(0),
201
201
  signKey = _useState18[0],
202
202
  setSignKey = _useState18[1];
203
+ var timerRef = useRef(null);
203
204
  var originalUrlRef = useRef('');
204
205
  var getSignedFile = /*#__PURE__*/function () {
205
206
  var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(documentIdVal, contractIdVal, nameVal) {
@@ -218,12 +219,13 @@ var FileItem = function FileItem(_ref) {
218
219
  });
219
220
  case 1:
220
221
  newFile = _context.sent;
221
- sessionStorage.removeItem(tokenTY);
222
- localStorage.removeItem(tokenTY);
223
222
  if (!newFile) {
224
223
  _context.next = 2;
225
224
  break;
226
225
  }
226
+ clearInterval(timerRef.current);
227
+ timerRef.current = null;
228
+ localStorage.removeItem(fileId);
227
229
  closeLoading();
228
230
  getRes(_extends({}, file, {
229
231
  fileId: newFile.fileId,
@@ -901,7 +903,7 @@ var FileItem = function FileItem(_ref) {
901
903
  }, [fileId]);
902
904
  useEffect(function () {
903
905
  try {
904
- var stored = sessionStorage.getItem(tokenTY);
906
+ var stored = localStorage.getItem(fileId);
905
907
  if (stored) {
906
908
  console.log('stored---', stored);
907
909
  var _JSON$parse = JSON.parse(stored),
@@ -911,19 +913,22 @@ var FileItem = function FileItem(_ref) {
911
913
  storedFileId = _JSON$parse.fileId,
912
914
  originalUrl = _JSON$parse.fileUrl;
913
915
  console.log('docId', docId, contrId, nameVal);
914
- if (storedFileId !== fileId) return;
916
+ localStorage.removeItem(storedFileId);
915
917
  originalUrlRef.current = originalUrl || '';
916
918
  if (docId && contrId && nameVal) {
917
919
  openLoading();
918
- getSignedFile(docId, contrId, nameVal).then(function (success) {
919
- if (!success) {
920
- closeLoading();
921
- _Message.error('签署失败,请重新签署');
922
- }
923
- });
920
+ timerRef.current = setInterval(function () {
921
+ getSignedFile(docId, contrId, nameVal);
922
+ }, 3000);
924
923
  }
925
924
  }
926
925
  } catch (e) {}
926
+ return function () {
927
+ if (timerRef.current) {
928
+ clearInterval(timerRef.current);
929
+ timerRef.current = null;
930
+ }
931
+ };
927
932
  }, []);
928
933
  return /*#__PURE__*/React.createElement("div", {
929
934
  className: "file_item",
@@ -213,8 +213,8 @@ function getContractSignUrl(contractIdVal, userInfo, config) {
213
213
  }
214
214
 
215
215
  // 保存签批信息
216
- function setSignInfo(fileName, tokenTY, fileId, fileUrl) {
217
- sessionStorage.setItem(tokenTY, JSON.stringify({
216
+ function setSignInfo(fileName, fileId, fileUrl) {
217
+ localStorage.setItem(fileId, JSON.stringify({
218
218
  contractId: contractId,
219
219
  documentId: documentId,
220
220
  fileName: fileName,
@@ -257,7 +257,7 @@ function getSignUrl(userInfo, config, fileName, fileId, fileUrl) {
257
257
  console.log(res, '页面结果');
258
258
  if (res.data.code == 0) {
259
259
  if (config.fileList) {
260
- setSignInfo(fileName, config.tokenTY, fileId, fileUrl);
260
+ setSignInfo(fileName, fileId, fileUrl);
261
261
  localStorage.setItem(config.tokenTY, JSON.stringify(config.fileList));
262
262
  }
263
263
  resolve(res.data.signUrl);
@@ -206,6 +206,7 @@ var FileItem = function FileItem(_ref) {
206
206
  var _useState18 = (0, _react.useState)(0),
207
207
  signKey = _useState18[0],
208
208
  setSignKey = _useState18[1];
209
+ var timerRef = (0, _react.useRef)(null);
209
210
  var originalUrlRef = (0, _react.useRef)('');
210
211
  var getSignedFile = /*#__PURE__*/function () {
211
212
  var _ref2 = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee(documentIdVal, contractIdVal, nameVal) {
@@ -224,12 +225,13 @@ var FileItem = function FileItem(_ref) {
224
225
  });
225
226
  case 1:
226
227
  newFile = _context.sent;
227
- sessionStorage.removeItem(tokenTY);
228
- localStorage.removeItem(tokenTY);
229
228
  if (!newFile) {
230
229
  _context.next = 2;
231
230
  break;
232
231
  }
232
+ clearInterval(timerRef.current);
233
+ timerRef.current = null;
234
+ localStorage.removeItem(fileId);
233
235
  closeLoading();
234
236
  getRes((0, _extends3["default"])({}, file, {
235
237
  fileId: newFile.fileId,
@@ -907,7 +909,7 @@ var FileItem = function FileItem(_ref) {
907
909
  }, [fileId]);
908
910
  (0, _react.useEffect)(function () {
909
911
  try {
910
- var stored = sessionStorage.getItem(tokenTY);
912
+ var stored = localStorage.getItem(fileId);
911
913
  if (stored) {
912
914
  console.log('stored---', stored);
913
915
  var _JSON$parse = JSON.parse(stored),
@@ -917,19 +919,22 @@ var FileItem = function FileItem(_ref) {
917
919
  storedFileId = _JSON$parse.fileId,
918
920
  originalUrl = _JSON$parse.fileUrl;
919
921
  console.log('docId', docId, contrId, nameVal);
920
- if (storedFileId !== fileId) return;
922
+ localStorage.removeItem(storedFileId);
921
923
  originalUrlRef.current = originalUrl || '';
922
924
  if (docId && contrId && nameVal) {
923
925
  openLoading();
924
- getSignedFile(docId, contrId, nameVal).then(function (success) {
925
- if (!success) {
926
- closeLoading();
927
- _message["default"].error('签署失败,请重新签署');
928
- }
929
- });
926
+ timerRef.current = setInterval(function () {
927
+ getSignedFile(docId, contrId, nameVal);
928
+ }, 3000);
930
929
  }
931
930
  }
932
931
  } catch (e) {}
932
+ return function () {
933
+ if (timerRef.current) {
934
+ clearInterval(timerRef.current);
935
+ timerRef.current = null;
936
+ }
937
+ };
933
938
  }, []);
934
939
  return /*#__PURE__*/_react["default"].createElement("div", {
935
940
  className: "file_item",
@@ -217,8 +217,8 @@ function getContractSignUrl(contractIdVal, userInfo, config) {
217
217
  }
218
218
 
219
219
  // 保存签批信息
220
- function setSignInfo(fileName, tokenTY, fileId, fileUrl) {
221
- sessionStorage.setItem(tokenTY, JSON.stringify({
220
+ function setSignInfo(fileName, fileId, fileUrl) {
221
+ localStorage.setItem(fileId, JSON.stringify({
222
222
  contractId: contractId,
223
223
  documentId: documentId,
224
224
  fileName: fileName,
@@ -261,7 +261,7 @@ function getSignUrl(userInfo, config, fileName, fileId, fileUrl) {
261
261
  console.log(res, '页面结果');
262
262
  if (res.data.code == 0) {
263
263
  if (config.fileList) {
264
- setSignInfo(fileName, config.tokenTY, fileId, fileUrl);
264
+ setSignInfo(fileName, fileId, fileUrl);
265
265
  localStorage.setItem(config.tokenTY, JSON.stringify(config.fileList));
266
266
  }
267
267
  resolve(res.data.signUrl);
@@ -98,7 +98,7 @@ function fillRealVersion(meta, packageName, version, basicLibraryVersion) {
98
98
  packageName = 'ydb-components-material';
99
99
  }
100
100
  if (version === void 0) {
101
- version = '0.1.144';
101
+ version = '0.1.146';
102
102
  }
103
103
  if (basicLibraryVersion === void 0) {
104
104
  basicLibraryVersion = {
@@ -103,7 +103,7 @@ function fillRealVersion(meta, packageName, version, basicLibraryVersion) {
103
103
  packageName = 'ydb-components-material';
104
104
  }
105
105
  if (version === void 0) {
106
- version = '0.1.144';
106
+ version = '0.1.146';
107
107
  }
108
108
  if (basicLibraryVersion === void 0) {
109
109
  basicLibraryVersion = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ydb-components-material",
3
- "version": "0.1.144",
3
+ "version": "0.1.146",
4
4
  "description": "ydb-components-material",
5
5
  "main": "lib/index.js",
6
6
  "module": "es/index.js",
@@ -102,10 +102,10 @@
102
102
  },
103
103
  "componentConfig": {
104
104
  "isComponentLibrary": true,
105
- "materialSchema": "https://unpkg.com/ydb-components-material@0.1.144/build/lowcode/assets-prod.json"
105
+ "materialSchema": "https://unpkg.com/ydb-components-material@0.1.146/build/lowcode/assets-prod.json"
106
106
  },
107
107
  "lcMeta": {
108
108
  "type": "component"
109
109
  },
110
- "homepage": "https://unpkg.com/ydb-components-material@0.1.144/build/index.html"
110
+ "homepage": "https://unpkg.com/ydb-components-material@0.1.146/build/index.html"
111
111
  }