ztxkutils 2.8.6 → 2.8.7
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/authority-5bc06c1a.js +366 -0
- package/dist/authority.js +1 -1
- package/dist/fileOperation.js +1 -1
- package/dist/hooks/useHistory.d.ts +14 -0
- package/dist/index.js +2 -2
- package/dist/request-09b081d4.js +2750 -0
- package/dist/request.js +2 -2
- package/dist/stompClient.js +1 -1
- package/dist/useHistory.js +94 -0
- package/package.json +4 -2
package/dist/request.js
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
import './tslib.es6-f9459658.js';
|
2
2
|
import 'axios';
|
3
3
|
import 'ztxkui';
|
4
|
-
export { a as default } from './request-
|
5
|
-
import './authority-
|
4
|
+
export { a as default } from './request-09b081d4.js';
|
5
|
+
import './authority-5bc06c1a.js';
|
6
6
|
import './crypto-c481f616.js';
|
7
7
|
import 'crypto';
|
package/dist/stompClient.js
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
import Stomp from 'zt-stompjs';
|
2
2
|
import SockJS from 'zt-sockjs-client';
|
3
|
-
import { g as getToken } from './authority-
|
3
|
+
import { g as getToken } from './authority-5bc06c1a.js';
|
4
4
|
|
5
5
|
var StompClient = /** @class */ (function () {
|
6
6
|
function StompClient(connectWsConfig) {
|
@@ -0,0 +1,94 @@
|
|
1
|
+
import { _ as __assign } from './tslib.es6-f9459658.js';
|
2
|
+
import { useEffect } from 'react';
|
3
|
+
import { useHistory as useHistory$1 } from 'react-router-dom';
|
4
|
+
import { i as isQiankun } from './authority-5bc06c1a.js';
|
5
|
+
|
6
|
+
var ROUTER_FILTER_RULES_KEY = '__symbol__alias__session';
|
7
|
+
var ROUTER_FILTER_RULES_VALUE = 'zQzNDkwNjg2MjYwMjI4MDk3LDEzNDU5Nzg1';
|
8
|
+
var _pushTarget = ['_blank'];
|
9
|
+
/**
|
10
|
+
* @author 陈亚雄
|
11
|
+
* @description 代理路由的push方法,可以用window.open的方式跳转页面
|
12
|
+
*/
|
13
|
+
function useHistory(routeBasename) {
|
14
|
+
var history = useHistory$1();
|
15
|
+
return __assign(__assign({}, history), { push: function (path, state, target) {
|
16
|
+
// 代理react router dom 的push方法
|
17
|
+
if (typeof state === 'string' && _pushTarget.includes(state)) {
|
18
|
+
target = state;
|
19
|
+
}
|
20
|
+
// 如果没有传入target,那么还是使用原生的push方法
|
21
|
+
if (!target) {
|
22
|
+
history.push(path, state);
|
23
|
+
}
|
24
|
+
else {
|
25
|
+
// state 没法处理,请不要传递state,可以拼接再地址栏参数后面
|
26
|
+
if (target === '_blank') {
|
27
|
+
// 新窗口打开的页面 都不需要菜单
|
28
|
+
var _path = path.indexOf('?') === -1
|
29
|
+
? path + "?hideFrame=1"
|
30
|
+
: path.indexOf('hideFrame') === -1
|
31
|
+
? path + "&hideFrame=1"
|
32
|
+
: path;
|
33
|
+
// 是否是全路径
|
34
|
+
_path = _path.startsWith('http')
|
35
|
+
? _path
|
36
|
+
: _path.startsWith('/')
|
37
|
+
? _path
|
38
|
+
: "/" + _path;
|
39
|
+
// 如果在微前端里面,需要添加前缀
|
40
|
+
if (isQiankun()) {
|
41
|
+
_path = _path.startsWith('http')
|
42
|
+
? _path
|
43
|
+
: routeBasename
|
44
|
+
? "" + routeBasename + _path
|
45
|
+
: _path;
|
46
|
+
}
|
47
|
+
window.open(_path);
|
48
|
+
}
|
49
|
+
}
|
50
|
+
} });
|
51
|
+
}
|
52
|
+
/**
|
53
|
+
* @author 陈亚雄
|
54
|
+
* @description 设置浏览器标题信息
|
55
|
+
*/
|
56
|
+
function useDocumentTitle(title) {
|
57
|
+
useEffect(function () {
|
58
|
+
if (title) {
|
59
|
+
document.title = title;
|
60
|
+
}
|
61
|
+
}, [title]);
|
62
|
+
}
|
63
|
+
function setFilterAuth() {
|
64
|
+
// 设置是否需要过滤路由验证
|
65
|
+
setSession(ROUTER_FILTER_RULES_KEY, ROUTER_FILTER_RULES_VALUE);
|
66
|
+
// 设置一些混淆的随意字段
|
67
|
+
setSession('__symbol__aliai__session', '0NzYwMDY2LDE0NjgwMzQ0MzcxNTc5U5Nzg1');
|
68
|
+
setSession('__symbol__alias__sessien', 'zQzNDkwNjg2MjYwMjI4MDk7LDEzNDU5Nzg1');
|
69
|
+
setSession('__symbol__alias__sesseen', 'zQzNDkwNjg2MjYwMjI4MDk5LDEzNDU5Nzg1');
|
70
|
+
setSession('__symbol__alaas__sesseen', 'zQzNDkwNjg2MjYwMjI4MDk4LDEzNDU5Nzg1');
|
71
|
+
}
|
72
|
+
function isFilterAuth() {
|
73
|
+
var authResult = getSession(ROUTER_FILTER_RULES_KEY);
|
74
|
+
console.log('---------', authResult);
|
75
|
+
return authResult === ROUTER_FILTER_RULES_VALUE;
|
76
|
+
}
|
77
|
+
function setSession(name, value) {
|
78
|
+
// if (window.opener && Object.getOwnPropertyNames(window.opener).length > 0) {
|
79
|
+
// window.opener.sessionStorage.setItem(name, value);
|
80
|
+
// } else {
|
81
|
+
// sessionStorage.setItem(name, value);
|
82
|
+
// }
|
83
|
+
sessionStorage.setItem(name, value);
|
84
|
+
}
|
85
|
+
function getSession(name) {
|
86
|
+
if (window.opener && Object.getOwnPropertyNames(window.opener).length > 0) {
|
87
|
+
return window.opener.sessionStorage.getItem(name);
|
88
|
+
}
|
89
|
+
else {
|
90
|
+
return sessionStorage.getItem(name);
|
91
|
+
}
|
92
|
+
}
|
93
|
+
|
94
|
+
export { getSession, isFilterAuth, setFilterAuth, setSession, useDocumentTitle, useHistory };
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "ztxkutils",
|
3
|
-
"version": "2.8.
|
3
|
+
"version": "2.8.7",
|
4
4
|
"description": "",
|
5
5
|
"main": "./dist/index.js",
|
6
6
|
"module": "./dist/index.js",
|
@@ -38,6 +38,7 @@
|
|
38
38
|
"pubsub-js": "^1.9.3",
|
39
39
|
"react": "^17.0.2",
|
40
40
|
"react-dom": "^17.0.1",
|
41
|
+
"react-router-dom": "5.2",
|
41
42
|
"rollup": "^2.47.0",
|
42
43
|
"rollup-plugin-typescript2": "^0.30.0",
|
43
44
|
"ts-loader": "^8.0.18",
|
@@ -63,6 +64,7 @@
|
|
63
64
|
"number-precision": ">=1.5.0",
|
64
65
|
"react": ">=17.0.1",
|
65
66
|
"react-dom": ">=17.0.1",
|
66
|
-
"ztxkui": ">=0.4.1"
|
67
|
+
"ztxkui": ">=0.4.1",
|
68
|
+
"react-router-dom": ">=5.2.0"
|
67
69
|
}
|
68
70
|
}
|