ztxkutils 2.10.39 → 2.10.40

Sign up to get free protection for your applications and to get access to all the features.
package/dist/index.js CHANGED
@@ -2,7 +2,7 @@ export { c as authority } from './authority-e6bde99f.js';
2
2
  export { d as dataModel } from './dataModel-1fbaff40.js';
3
3
  export { t as tools } from './tools-09a4d620.js';
4
4
  export { v as validate } from './validate-a06e1fa0.js';
5
- export { r as request } from './request-8e2b5826.js';
5
+ export { r as request } from './request-ba8abf99.js';
6
6
  export { r as reqUrl } from './reqUrl-787dd9e5.js';
7
7
  import './tslib.es6-35653116.js';
8
8
  import 'dayjs';
@@ -0,0 +1 @@
1
+ declare function openDB(dbName: string, version?: number): Promise<unknown>;
@@ -2487,6 +2487,8 @@ var isFirstSet = false; // 首次初始化
2487
2487
  var OLD_AUTHORIZATION = 'Basic c3dvcmQ6c3dvcmRfc2VjcmV0';
2488
2488
  var NEW_AUTHORIZATION = 'Basic em1kbXM6em1kbXNfc2VjcmV0';
2489
2489
  var Authorization = OLD_AUTHORIZATION;
2490
+ // 用于存储目前状态为pending的请求标识信息 2023-05-15
2491
+ var pendingRequest = [];
2490
2492
  function loginRequest(params, InnerAuthorization) {
2491
2493
  return request({
2492
2494
  method: 'POST',
@@ -2712,9 +2714,18 @@ function setInterceptorsResponse(jumpCallback, otherOptions) {
2712
2714
  function setInterceptorsRequest() {
2713
2715
  // 拦截器,拦截响应头信息
2714
2716
  axios.interceptors.request.use(function (config) {
2717
+ var _a;
2715
2718
  if (config.isCancelRepeat) {
2716
2719
  axiosCancel.pendingRequestCancel(config);
2717
2720
  }
2721
+ // 如果需要清除未完成的请求 2023-05-15
2722
+ if (config.isCancelNoCompleteRequest &&
2723
+ !config.cancelToken &&
2724
+ ((_a = config.method) === null || _a === void 0 ? void 0 : _a.toUpperCase()) !== 'POST') {
2725
+ var cancelTokenObj = axios.CancelToken.source();
2726
+ config.cancelToken = cancelTokenObj.token;
2727
+ pendingRequest.push(cancelTokenObj.cancel);
2728
+ }
2718
2729
  return config;
2719
2730
  });
2720
2731
  }
@@ -2868,6 +2879,13 @@ function request(myOptions, jumpCallback, otherOptions) {
2868
2879
  }
2869
2880
  return axios(newOptions);
2870
2881
  }
2882
+ // 清除未完成的请求 2023-05-15
2883
+ function clearNoCompleteRequest() {
2884
+ pendingRequest.forEach(function (cancel, index) {
2885
+ cancel && cancel();
2886
+ });
2887
+ pendingRequest = [];
2888
+ }
2871
2889
  function clearCatch() {
2872
2890
  catchPromiseObj = [];
2873
2891
  }
@@ -2877,7 +2895,8 @@ var request$1 = /*#__PURE__*/Object.freeze({
2877
2895
  OLD_AUTHORIZATION: OLD_AUTHORIZATION,
2878
2896
  NEW_AUTHORIZATION: NEW_AUTHORIZATION,
2879
2897
  'default': request,
2898
+ clearNoCompleteRequest: clearNoCompleteRequest,
2880
2899
  clearCatch: clearCatch
2881
2900
  });
2882
2901
 
2883
- export { NEW_AUTHORIZATION as N, OLD_AUTHORIZATION as O, request as a, clearCatch as c, request$1 as r };
2902
+ export { NEW_AUTHORIZATION as N, OLD_AUTHORIZATION as O, request as a, clearCatch as b, clearNoCompleteRequest as c, request$1 as r };
package/dist/request.d.ts CHANGED
@@ -12,6 +12,8 @@ export interface IOptions extends AxiosRequestConfig {
12
12
  noCatchUrl?: string[];
13
13
  isCatch?: boolean;
14
14
  isCancelRepeat?: boolean;
15
+ isCancelNoCompleteRequest?: boolean;
15
16
  }
16
17
  export default function request(myOptions: IOptions, jumpCallback?: any, otherOptions?: any): any;
18
+ export declare function clearNoCompleteRequest(): void;
17
19
  export declare function clearCatch(): void;
package/dist/request.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import './tslib.es6-35653116.js';
2
2
  import 'axios';
3
3
  import 'ztxkui';
4
- export { N as NEW_AUTHORIZATION, O as OLD_AUTHORIZATION, c as clearCatch, a as default } from './request-8e2b5826.js';
4
+ export { N as NEW_AUTHORIZATION, O as OLD_AUTHORIZATION, b as clearCatch, c as clearNoCompleteRequest, a as default } from './request-ba8abf99.js';
5
5
  import './authority-e6bde99f.js';
6
6
  import './crypto-c481f616.js';
7
7
  import 'crypto';
@@ -1,34 +1 @@
1
- declare const PV_URL_SET: Set<unknown>;
2
- /**
3
- * routeUrl: string
4
- * systemId: string
5
- * userId: string
6
- * navigator: string // 浏览器信息 userAgent
7
- * platform: string // 系统信息
8
- * memory: string // 内存信息
9
- * eventKey: string // 事件名
10
- * eventValue: string // 事件值
11
- * {
12
- * jsHeapSizeLimit: 上下文内可用堆的最大体积,以字节计算。
13
- * totalJSHeapSize: 已分配的堆体积,以字节计算。
14
- * usedJSHeapSize: 当前 JS 堆活跃段(segment)的体积,以字节计算。
15
- * }
16
- */
17
- declare function getUserOsInfo(userAgent?: string): "Windows 10" | "Windows 8" | "Windows 7" | "Windows Vista" | "Windows XP" | "Windows 2000" | "Mac/iOS" | "UNIX" | "Linux" | "Other";
18
- declare class MyStatistic {
19
- private systemId;
20
- private userId;
21
- private navigator;
22
- private platform;
23
- constructor(systemId: any, userId: any);
24
- private send;
25
- private initPerformance;
26
- private errorHandle;
27
- private unhandledrejectionHandle;
28
- private initError;
29
- removeError(): void;
30
- pv(): void;
31
- event(eventKey: string, eventValue: string): void;
32
- error(error: Error, info?: any): void;
33
- }
34
- declare const statistic: MyStatistic;
1
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ztxkutils",
3
- "version": "2.10.39",
3
+ "version": "2.10.40",
4
4
  "description": "",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",
@@ -49,6 +49,7 @@
49
49
  "dependencies": {
50
50
  "crypto-js": "^4.1.1",
51
51
  "decimal.js-light": "^2.5.1",
52
+ "dexie": "^3.2.3",
52
53
  "js-base64": "^3.6.0",
53
54
  "jwt-decode": "^3.1.2",
54
55
  "screenfull": "^5.1.0",