ztxkutils 2.10.66-29 → 2.10.66-30
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.
- package/dist/dataModel-914b6226.js +26 -0
- package/dist/dataModel-b3629ef3.js +26 -0
- package/dist/dataModel-f1ef06bc.js +26 -0
- package/dist/dataModel.js +1 -1
- package/dist/i18next.js +17 -17
- package/dist/index.js +3 -3
- package/dist/{request-588c90ec.js → request-1e442d5d.js} +14 -8
- package/dist/{request-87d93572.js → request-40e9ca7b.js} +16 -8
- package/dist/request-80d1ac80.js +2992 -0
- package/dist/{request-dc69f021.js → request-986d7090.js} +19 -68
- package/dist/{request-3c906c2d.js → request-c0970aae.js} +5 -1
- package/dist/request-d1972b41.js +2992 -0
- package/dist/request-f600ad7a.js +2992 -0
- package/dist/request.js +1 -1
- package/dist/{validate-4e0272c6.js → validate-21164759.js} +1 -3
- package/dist/validate-21b58a69.js +260 -0
- package/dist/validate-2de5a28f.js +260 -0
- package/dist/validate-ab47ebe9.js +260 -0
- package/dist/validate.js +1 -1
- package/package.json +1 -1
- /package/dist/{validate-eccfa73c.js → validate-2138d94a.js} +0 -0
@@ -0,0 +1,26 @@
|
|
1
|
+
import instance from './i18next.js';
|
2
|
+
|
3
|
+
/**
|
4
|
+
* @description 数据模型创建
|
5
|
+
*/
|
6
|
+
function createSuccessModel(data, message) {
|
7
|
+
return {
|
8
|
+
data: data,
|
9
|
+
message: message || instance.t('数据请求成功'),
|
10
|
+
success: true,
|
11
|
+
};
|
12
|
+
}
|
13
|
+
function createErrorModel(message) {
|
14
|
+
return {
|
15
|
+
message: message || instance.t('数据请求失败'),
|
16
|
+
success: false,
|
17
|
+
};
|
18
|
+
}
|
19
|
+
|
20
|
+
var dataModel = /*#__PURE__*/Object.freeze({
|
21
|
+
__proto__: null,
|
22
|
+
createSuccessModel: createSuccessModel,
|
23
|
+
createErrorModel: createErrorModel
|
24
|
+
});
|
25
|
+
|
26
|
+
export { createErrorModel as a, createSuccessModel as c, dataModel as d };
|
@@ -0,0 +1,26 @@
|
|
1
|
+
import instance from './i18next.js';
|
2
|
+
|
3
|
+
/**
|
4
|
+
* @description 数据模型创建
|
5
|
+
*/
|
6
|
+
function createSuccessModel(data, message) {
|
7
|
+
return {
|
8
|
+
data: data,
|
9
|
+
message: message || instance.t('数据请求成功'),
|
10
|
+
success: true,
|
11
|
+
};
|
12
|
+
}
|
13
|
+
function createErrorModel(message) {
|
14
|
+
return {
|
15
|
+
message: message || instance.t('数据请求失败'),
|
16
|
+
success: false,
|
17
|
+
};
|
18
|
+
}
|
19
|
+
|
20
|
+
var dataModel = /*#__PURE__*/Object.freeze({
|
21
|
+
__proto__: null,
|
22
|
+
createSuccessModel: createSuccessModel,
|
23
|
+
createErrorModel: createErrorModel
|
24
|
+
});
|
25
|
+
|
26
|
+
export { createErrorModel as a, createSuccessModel as c, dataModel as d };
|
@@ -0,0 +1,26 @@
|
|
1
|
+
import instance from './i18next.js';
|
2
|
+
|
3
|
+
/**
|
4
|
+
* @description 数据模型创建
|
5
|
+
*/
|
6
|
+
function createSuccessModel(data, message) {
|
7
|
+
return {
|
8
|
+
data: data,
|
9
|
+
message: message || instance.t('数据请求成功'),
|
10
|
+
success: true,
|
11
|
+
};
|
12
|
+
}
|
13
|
+
function createErrorModel(message) {
|
14
|
+
return {
|
15
|
+
message: message || instance.t('数据请求失败'),
|
16
|
+
success: false,
|
17
|
+
};
|
18
|
+
}
|
19
|
+
|
20
|
+
var dataModel = /*#__PURE__*/Object.freeze({
|
21
|
+
__proto__: null,
|
22
|
+
createSuccessModel: createSuccessModel,
|
23
|
+
createErrorModel: createErrorModel
|
24
|
+
});
|
25
|
+
|
26
|
+
export { createErrorModel as a, createSuccessModel as c, dataModel as d };
|
package/dist/dataModel.js
CHANGED
@@ -1,2 +1,2 @@
|
|
1
1
|
import './i18next.js';
|
2
|
-
export { a as createErrorModel, c as createSuccessModel } from './dataModel-
|
2
|
+
export { a as createErrorModel, c as createSuccessModel } from './dataModel-f1ef06bc.js';
|
package/dist/i18next.js
CHANGED
@@ -2378,23 +2378,23 @@ instance.loadNamespaces;
|
|
2378
2378
|
instance.loadLanguages;
|
2379
2379
|
|
2380
2380
|
var originalT = instance.t;
|
2381
|
-
|
2382
|
-
|
2383
|
-
Object.
|
2384
|
-
|
2385
|
-
|
2386
|
-
|
2387
|
-
|
2388
|
-
|
2389
|
-
|
2390
|
-
|
2391
|
-
|
2392
|
-
|
2393
|
-
|
2394
|
-
|
2395
|
-
|
2396
|
-
|
2397
|
-
|
2381
|
+
var getSourceKey = function (key, params) {
|
2382
|
+
if (params) {
|
2383
|
+
var keys = Object.keys(params);
|
2384
|
+
if (keys.length) {
|
2385
|
+
return keys.reduce(function (pre, cur) {
|
2386
|
+
return pre.replace("{{" + cur + "}}", params[cur]);
|
2387
|
+
}, key);
|
2388
|
+
}
|
2389
|
+
}
|
2390
|
+
return key;
|
2391
|
+
};
|
2392
|
+
var t = (function () {
|
2393
|
+
var args = [];
|
2394
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
2395
|
+
args[_i] = arguments[_i];
|
2396
|
+
}
|
2397
|
+
return originalT.apply(void 0, args) || getSourceKey(args === null || args === void 0 ? void 0 : args[0], args === null || args === void 0 ? void 0 : args[1]);
|
2398
2398
|
});
|
2399
2399
|
instance.t = t;
|
2400
2400
|
|
package/dist/index.js
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
export { d as authority } from './authority-7a91cb9f.js';
|
2
|
-
export { d as dataModel } from './dataModel-
|
2
|
+
export { d as dataModel } from './dataModel-f1ef06bc.js';
|
3
3
|
export { t as tools } from './tools-390e3466.js';
|
4
|
-
export { v as validate } from './validate-
|
5
|
-
export { r as request } from './request-
|
4
|
+
export { v as validate } from './validate-2138d94a.js';
|
5
|
+
export { r as request } from './request-40e9ca7b.js';
|
6
6
|
export { r as reqUrl } from './reqUrl-ea7ef876.js';
|
7
7
|
import './i18next.js';
|
8
8
|
import './tslib.es6-35653116.js';
|
@@ -1,4 +1,5 @@
|
|
1
1
|
import { a as __rest, _ as __assign } from './tslib.es6-35653116.js';
|
2
|
+
import instance from './i18next.js';
|
2
3
|
import axios from 'axios';
|
3
4
|
import { Modal, message } from 'ztxkui';
|
4
5
|
import { c as commonjsGlobal, a as crypto } from './crypto-c481f616.js';
|
@@ -2452,7 +2453,7 @@ var AxiosCancel = /** @class */ (function () {
|
|
2452
2453
|
// 将token挂载到当前接口的请求头里面
|
2453
2454
|
config.cancelToken = cancelTokenObj.token;
|
2454
2455
|
if (this.pendingRequests.has(key)) {
|
2455
|
-
this.pendingRequests.get(key).cancel('拦截重复请求');
|
2456
|
+
this.pendingRequests.get(key).cancel(instance.t('拦截重复请求'));
|
2456
2457
|
this.pendingRequests.delete(key);
|
2457
2458
|
}
|
2458
2459
|
this.pendingRequests.set(key, {
|
@@ -2512,7 +2513,7 @@ function checkStatus(response, jumpCallback, otherOptions) {
|
|
2512
2513
|
refreshTokenRequst(jumpCallback, InnerAuthorization);
|
2513
2514
|
}
|
2514
2515
|
else {
|
2515
|
-
message.info(
|
2516
|
+
message.info(instance.t('刷新token遭到频繁调用,请联系管理员查看是否接口权限出现问题,可能是{{slot0}}接口出现问题', { slot0: response === null || response === void 0 ? void 0 : response.config.url }), 5);
|
2516
2517
|
requestTokenEndTime = 0;
|
2517
2518
|
}
|
2518
2519
|
}
|
@@ -2560,6 +2561,7 @@ function refreshTokenRequst(jumpCallback, Authorization) {
|
|
2560
2561
|
// 刷新成功 重置token 重置refresh-token
|
2561
2562
|
setToken(data === null || data === void 0 ? void 0 : data.access_token);
|
2562
2563
|
setRefreshToken(data === null || data === void 0 ? void 0 : data.refresh_token);
|
2564
|
+
message.info(instance.t('token已经刷新成功,请重新提交!', {}));
|
2563
2565
|
onAccessTokenFetched();
|
2564
2566
|
isRefreshing = true;
|
2565
2567
|
}
|
@@ -2573,7 +2575,7 @@ function refreshTokenRequst(jumpCallback, Authorization) {
|
|
2573
2575
|
jumpCallback(401);
|
2574
2576
|
}
|
2575
2577
|
else {
|
2576
|
-
message.info(
|
2578
|
+
message.info(instance.t('登录过期!', {}), 3.5, function () {
|
2577
2579
|
isExpiration = false;
|
2578
2580
|
});
|
2579
2581
|
window.location.href = '/login';
|
@@ -2589,7 +2591,7 @@ function refreshTokenRequst(jumpCallback, Authorization) {
|
|
2589
2591
|
jumpCallback(401);
|
2590
2592
|
}
|
2591
2593
|
else {
|
2592
|
-
message.info(
|
2594
|
+
message.info(instance.t('登录过期!', {}), 3.5, function () {
|
2593
2595
|
isExpiration = false;
|
2594
2596
|
});
|
2595
2597
|
window.location.href = '/login';
|
@@ -2665,7 +2667,11 @@ function setInterceptorsResponse(jumpCallback, otherOptions) {
|
|
2665
2667
|
__isTimeoutMessage) {
|
2666
2668
|
isMessage = true;
|
2667
2669
|
Modal.confirm({
|
2668
|
-
title:
|
2670
|
+
title: instance.t('请求超时,请稍后再试,请去列表确认数据是否插入成功,请勿重复提交! 接口地址:{{slot0}} 请求方式:{{slot1}} 请求超时时间:{{slot2}}', {
|
2671
|
+
slot0: (_d = error === null || error === void 0 ? void 0 : error.config) === null || _d === void 0 ? void 0 : _d.url,
|
2672
|
+
slot1: (_e = error === null || error === void 0 ? void 0 : error.config) === null || _e === void 0 ? void 0 : _e.method,
|
2673
|
+
slot2: (_f = error === null || error === void 0 ? void 0 : error.config) === null || _f === void 0 ? void 0 : _f.timeout,
|
2674
|
+
}),
|
2669
2675
|
okCancel: false,
|
2670
2676
|
onOk: function () {
|
2671
2677
|
isMessage = false;
|
@@ -2679,7 +2685,7 @@ function setInterceptorsResponse(jumpCallback, otherOptions) {
|
|
2679
2685
|
if ((errRes === null || errRes === void 0 ? void 0 : errRes.status) === 404) {
|
2680
2686
|
if (!isNotFound) {
|
2681
2687
|
isNotFound = true;
|
2682
|
-
message.info(
|
2688
|
+
message.info(instance.t('接口: {{slot0}} 未找到!', { slot0: errRes.config.url }), 3.5, function () {
|
2683
2689
|
isNotFound = false;
|
2684
2690
|
});
|
2685
2691
|
}
|
@@ -2695,7 +2701,7 @@ function setInterceptorsResponse(jumpCallback, otherOptions) {
|
|
2695
2701
|
jumpCallback(errRes === null || errRes === void 0 ? void 0 : errRes.status);
|
2696
2702
|
}
|
2697
2703
|
else {
|
2698
|
-
message.info(
|
2704
|
+
message.info(instance.t('你的账号已在其他地方登录!', {}), 3.5, function () {
|
2699
2705
|
isOffSite = false;
|
2700
2706
|
});
|
2701
2707
|
window.location.href = '/login';
|
@@ -2713,7 +2719,7 @@ function setInterceptorsResponse(jumpCallback, otherOptions) {
|
|
2713
2719
|
jumpCallback(errRes === null || errRes === void 0 ? void 0 : errRes.status);
|
2714
2720
|
}
|
2715
2721
|
else {
|
2716
|
-
message.info(
|
2722
|
+
message.info(instance.t('登录过期!', {}), 3.5, function () {
|
2717
2723
|
isExpiration = false;
|
2718
2724
|
});
|
2719
2725
|
window.location.href = '/login';
|
@@ -1,4 +1,5 @@
|
|
1
1
|
import { a as __rest, _ as __assign } from './tslib.es6-35653116.js';
|
2
|
+
import instance from './i18next.js';
|
2
3
|
import axios from 'axios';
|
3
4
|
import { Modal, message } from 'ztxkui';
|
4
5
|
import { c as commonjsGlobal, a as crypto } from './crypto-c481f616.js';
|
@@ -2452,7 +2453,7 @@ var AxiosCancel = /** @class */ (function () {
|
|
2452
2453
|
// 将token挂载到当前接口的请求头里面
|
2453
2454
|
config.cancelToken = cancelTokenObj.token;
|
2454
2455
|
if (this.pendingRequests.has(key)) {
|
2455
|
-
this.pendingRequests.get(key).cancel('拦截重复请求');
|
2456
|
+
this.pendingRequests.get(key).cancel(instance.t('拦截重复请求'));
|
2456
2457
|
this.pendingRequests.delete(key);
|
2457
2458
|
}
|
2458
2459
|
this.pendingRequests.set(key, {
|
@@ -2512,7 +2513,7 @@ function checkStatus(response, jumpCallback, otherOptions) {
|
|
2512
2513
|
refreshTokenRequst(jumpCallback, InnerAuthorization);
|
2513
2514
|
}
|
2514
2515
|
else {
|
2515
|
-
message.info(
|
2516
|
+
message.info(instance.t('刷新token遭到频繁调用,请联系管理员查看是否接口权限出现问题,可能是{{slot0}}接口出现问题', { slot0: response === null || response === void 0 ? void 0 : response.config.url }), 5);
|
2516
2517
|
requestTokenEndTime = 0;
|
2517
2518
|
}
|
2518
2519
|
}
|
@@ -2560,6 +2561,7 @@ function refreshTokenRequst(jumpCallback, Authorization) {
|
|
2560
2561
|
// 刷新成功 重置token 重置refresh-token
|
2561
2562
|
setToken(data === null || data === void 0 ? void 0 : data.access_token);
|
2562
2563
|
setRefreshToken(data === null || data === void 0 ? void 0 : data.refresh_token);
|
2564
|
+
message.info(instance.t('token已经刷新成功,请重新提交!', {}));
|
2563
2565
|
onAccessTokenFetched();
|
2564
2566
|
isRefreshing = true;
|
2565
2567
|
}
|
@@ -2573,7 +2575,7 @@ function refreshTokenRequst(jumpCallback, Authorization) {
|
|
2573
2575
|
jumpCallback(401);
|
2574
2576
|
}
|
2575
2577
|
else {
|
2576
|
-
message.info(
|
2578
|
+
message.info(instance.t('登录过期!', {}), 3.5, function () {
|
2577
2579
|
isExpiration = false;
|
2578
2580
|
});
|
2579
2581
|
window.location.href = '/login';
|
@@ -2589,7 +2591,7 @@ function refreshTokenRequst(jumpCallback, Authorization) {
|
|
2589
2591
|
jumpCallback(401);
|
2590
2592
|
}
|
2591
2593
|
else {
|
2592
|
-
message.info(
|
2594
|
+
message.info(instance.t('登录过期!', {}), 3.5, function () {
|
2593
2595
|
isExpiration = false;
|
2594
2596
|
});
|
2595
2597
|
window.location.href = '/login';
|
@@ -2665,7 +2667,11 @@ function setInterceptorsResponse(jumpCallback, otherOptions) {
|
|
2665
2667
|
__isTimeoutMessage) {
|
2666
2668
|
isMessage = true;
|
2667
2669
|
Modal.confirm({
|
2668
|
-
title:
|
2670
|
+
title: instance.t('请求超时,请稍后再试,请去列表确认数据是否插入成功,请勿重复提交! 接口地址:{{slot0}} 请求方式:{{slot1}} 请求超时时间:{{slot2}}', {
|
2671
|
+
slot0: (_d = error === null || error === void 0 ? void 0 : error.config) === null || _d === void 0 ? void 0 : _d.url,
|
2672
|
+
slot1: (_e = error === null || error === void 0 ? void 0 : error.config) === null || _e === void 0 ? void 0 : _e.method,
|
2673
|
+
slot2: (_f = error === null || error === void 0 ? void 0 : error.config) === null || _f === void 0 ? void 0 : _f.timeout,
|
2674
|
+
}),
|
2669
2675
|
okCancel: false,
|
2670
2676
|
onOk: function () {
|
2671
2677
|
isMessage = false;
|
@@ -2679,7 +2685,7 @@ function setInterceptorsResponse(jumpCallback, otherOptions) {
|
|
2679
2685
|
if ((errRes === null || errRes === void 0 ? void 0 : errRes.status) === 404) {
|
2680
2686
|
if (!isNotFound) {
|
2681
2687
|
isNotFound = true;
|
2682
|
-
message.info(
|
2688
|
+
message.info(instance.t('接口: {{slot0}} 未找到!', { slot0: errRes.config.url }), 3.5, function () {
|
2683
2689
|
isNotFound = false;
|
2684
2690
|
});
|
2685
2691
|
}
|
@@ -2695,7 +2701,7 @@ function setInterceptorsResponse(jumpCallback, otherOptions) {
|
|
2695
2701
|
jumpCallback(errRes === null || errRes === void 0 ? void 0 : errRes.status);
|
2696
2702
|
}
|
2697
2703
|
else {
|
2698
|
-
message.info(
|
2704
|
+
message.info(instance.t('你的账号已在其他地方登录!', {}), 3.5, function () {
|
2699
2705
|
isOffSite = false;
|
2700
2706
|
});
|
2701
2707
|
window.location.href = '/login';
|
@@ -2713,7 +2719,7 @@ function setInterceptorsResponse(jumpCallback, otherOptions) {
|
|
2713
2719
|
jumpCallback(errRes === null || errRes === void 0 ? void 0 : errRes.status);
|
2714
2720
|
}
|
2715
2721
|
else {
|
2716
|
-
message.info(
|
2722
|
+
message.info(instance.t('登录过期!', {}), 3.5, function () {
|
2717
2723
|
isExpiration = false;
|
2718
2724
|
});
|
2719
2725
|
window.location.href = '/login';
|
@@ -2793,6 +2799,8 @@ function request(myOptions, jumpCallback, otherOptions) {
|
|
2793
2799
|
'Zmdms-Auth': "bearer " + token,
|
2794
2800
|
'Tenant-Id': '000000',
|
2795
2801
|
Authorization: InnerAuthorization ? InnerAuthorization : Authorization,
|
2802
|
+
// 设置语言包请求头
|
2803
|
+
'Zmdms-Lang': window.localStorage.getItem('languageType') || 'zh_CN',
|
2796
2804
|
},
|
2797
2805
|
};
|
2798
2806
|
if ((_a = options.baseURL) === null || _a === void 0 ? void 0 : _a.endsWith('/')) {
|