ztxkutils 2.10.20 → 2.10.22

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,8 +1,7 @@
1
1
  import { g as getToken } from './authority-e6bde99f.js';
2
- import { d as dangerouslySetXss } from './tools-5541a681.js';
3
- import './tslib.es6-f9459658.js';
2
+ import { d as dangerouslySetXss } from './tools-42d3993e.js';
3
+ import './tslib.es6-35653116.js';
4
4
  import 'dayjs';
5
- import 'number-precision';
6
5
 
7
6
  /**
8
7
  * @author cyx
package/dist/hooks.js CHANGED
@@ -1,11 +1,10 @@
1
- import { _ as __assign, c as __awaiter, d as __generator } from './tslib.es6-f9459658.js';
1
+ import { _ as __assign, b as __awaiter, c as __generator } from './tslib.es6-35653116.js';
2
2
  import { useState, useEffect, useRef, useCallback } from 'react';
3
3
  export { default as useFileIdToBase64 } from './useFileIdToBase64.js';
4
4
  import './fileOperation.js';
5
5
  import './authority-e6bde99f.js';
6
- import './tools-5541a681.js';
6
+ import './tools-42d3993e.js';
7
7
  import 'dayjs';
8
- import 'number-precision';
9
8
 
10
9
  function useTableLinkage(_a) {
11
10
  var records = _a.records, callbackPromise = _a.callbackPromise, dependencies = _a.dependencies, devDependencies = _a.devDependencies;
package/dist/index.js CHANGED
@@ -1,12 +1,11 @@
1
1
  export { c as authority } from './authority-e6bde99f.js';
2
2
  export { d as dataModel } from './dataModel-1fbaff40.js';
3
- export { t as tools } from './tools-5541a681.js';
3
+ export { t as tools } from './tools-42d3993e.js';
4
4
  export { v as validate } from './validate-6e735536.js';
5
- export { r as request } from './request-5ad0262d.js';
5
+ export { r as request } from './request-bf07dd24.js';
6
6
  export { r as reqUrl } from './reqUrl-787dd9e5.js';
7
- import './tslib.es6-f9459658.js';
7
+ import './tslib.es6-35653116.js';
8
8
  import 'dayjs';
9
- import 'number-precision';
10
9
  import 'axios';
11
10
  import 'ztxkui';
12
11
  import './crypto-c481f616.js';
package/dist/print.js CHANGED
@@ -1,4 +1,4 @@
1
- import { a as __spreadArray, _ as __assign, c as __awaiter, d as __generator } from './tslib.es6-f9459658.js';
1
+ import { d as __spreadArray, _ as __assign, b as __awaiter, c as __generator } from './tslib.es6-35653116.js';
2
2
  import { jsPDF } from 'jspdf';
3
3
  import html2canvas from 'html2canvas';
4
4
 
@@ -1,4 +1,4 @@
1
- import { b as __rest, _ as __assign } from './tslib.es6-f9459658.js';
1
+ import { a as __rest, _ as __assign } from './tslib.es6-35653116.js';
2
2
  import axios from 'axios';
3
3
  import { Modal, message } from 'ztxkui';
4
4
  import { c as commonjsGlobal, a as crypto } from './crypto-c481f616.js';
@@ -2563,6 +2563,21 @@ function setInterceptorsResponse(jumpCallback) {
2563
2563
  // catchPromiseObj = [];
2564
2564
  console.error(error);
2565
2565
  var errRes = error === null || error === void 0 ? void 0 : error.response;
2566
+ /** 如果接口出错了,那么清理掉这个错误的接口 */
2567
+ var item = catchPromiseObj.findIndex(function (item) {
2568
+ return isEqual_1({
2569
+ url: item.url,
2570
+ params: item.params,
2571
+ }, {
2572
+ url: error === null || error === void 0 ? void 0 : error.config.url,
2573
+ params: error === null || error === void 0 ? void 0 : error.config.params,
2574
+ });
2575
+ });
2576
+ if (item !== -1) {
2577
+ catchPromiseObj.splice(item, 1);
2578
+ }
2579
+ console.log(error === null || error === void 0 ? void 0 : error.config, catchPromiseObj);
2580
+ /** 如果接口出错了,那么清理掉这个错误的接口 */
2566
2581
  // 超时异常统一处理,超时的异常没有response值,只能通过toString处理
2567
2582
  if (!errRes && error.toString().indexOf(timeoutNum + "ms") !== -1) {
2568
2583
  if (!isMessage) {
@@ -2660,13 +2675,13 @@ function transformObj(obj) {
2660
2675
  return obj;
2661
2676
  }
2662
2677
  function request(myOptions, jumpCallback) {
2663
- var _a, _b, _c, _d, _e, _f, _g, _h;
2678
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
2664
2679
  if (!isFirstSet) {
2665
2680
  // setInterceptorsRequest();
2666
2681
  setInterceptorsResponse(jumpCallback);
2667
2682
  isFirstSet = true;
2668
2683
  }
2669
- var encryptionType = myOptions.encryptionType, isTimeoutMessage = myOptions.isTimeoutMessage, options = __rest(myOptions, ["encryptionType", "isTimeoutMessage"]);
2684
+ var encryptionType = myOptions.encryptionType, isTimeoutMessage = myOptions.isTimeoutMessage, isForceRequest = myOptions.isForceRequest, options = __rest(myOptions, ["encryptionType", "isTimeoutMessage", "isForceRequest"]);
2670
2685
  timeoutNum =
2671
2686
  typeof myOptions.timeout === 'number' ? myOptions.timeout : timeoutNum;
2672
2687
  __isTimeoutMessage = isTimeoutMessage;
@@ -2742,10 +2757,12 @@ function request(myOptions, jumpCallback) {
2742
2757
  };
2743
2758
  }
2744
2759
  }
2745
- // 缓存本次宏任务下的GET请求
2746
- if (((_h = newOptions.method) === null || _h === void 0 ? void 0 : _h.toUpperCase()) === 'GET') {
2760
+ // 缓存本次宏任务下的GET请求,并且不是以/page结尾的列表分页接口
2761
+ // 并且不是强制请求,强制请求需要
2762
+ if (((_h = newOptions.method) === null || _h === void 0 ? void 0 : _h.toUpperCase()) === 'GET' &&
2763
+ !((_j = newOptions.url) === null || _j === void 0 ? void 0 : _j.endsWith('/page'))) {
2747
2764
  // 能不能找到,url与参数都一样得数据
2748
- var item = catchPromiseObj.find(function (item) {
2765
+ var index = catchPromiseObj.findIndex(function (item) {
2749
2766
  return isEqual_1({
2750
2767
  url: item.url,
2751
2768
  params: item.params,
@@ -2754,7 +2771,13 @@ function request(myOptions, jumpCallback) {
2754
2771
  params: newOptions.params,
2755
2772
  });
2756
2773
  });
2757
- if (item) {
2774
+ // 如果是强制请求,并且之前有缓存 那么删除掉之前的缓存
2775
+ if (isForceRequest && index !== -1) {
2776
+ catchPromiseObj.splice(index, 1);
2777
+ index = -1;
2778
+ }
2779
+ if (index !== -1) {
2780
+ var item = catchPromiseObj[index];
2758
2781
  return item === null || item === void 0 ? void 0 : item.promiseObj;
2759
2782
  }
2760
2783
  else {
package/dist/request.d.ts CHANGED
@@ -6,6 +6,7 @@ export interface IOptions extends AxiosRequestConfig {
6
6
  isFormData?: boolean;
7
7
  encryptionType?: 'aes' | 'des' | boolean;
8
8
  isTimeoutMessage?: boolean;
9
+ isForceRequest?: boolean;
9
10
  }
10
11
  export default function request(myOptions: IOptions, jumpCallback?: any): any;
11
12
  export declare function clearCatch(): void;
package/dist/request.js CHANGED
@@ -1,7 +1,7 @@
1
- import './tslib.es6-f9459658.js';
1
+ import './tslib.es6-35653116.js';
2
2
  import 'axios';
3
3
  import 'ztxkui';
4
- export { c as clearCatch, a as default } from './request-5ad0262d.js';
4
+ export { c as clearCatch, a as default } from './request-bf07dd24.js';
5
5
  import './authority-e6bde99f.js';
6
6
  import './crypto-c481f616.js';
7
7
  import 'crypto';