@cqsjjb/jjb-react-admin-component 3.3.1-beta.0 → 3.3.1-beta.1
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/AdaptiveTree/index.js +0 -1
- package/package.json +1 -1
- package/tools/index.js +87 -0
package/AdaptiveTree/index.js
CHANGED
package/package.json
CHANGED
package/tools/index.js
ADDED
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { tools } from '@cqsjjb/jjb-common-lib';
|
|
2
|
+
|
|
3
|
+
const { toObject } = tools;
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* @description 版本1
|
|
7
|
+
* @param v {string}
|
|
8
|
+
* @return {boolean}
|
|
9
|
+
*/
|
|
10
|
+
export function isVersion1(v) {
|
|
11
|
+
return v === 'v1';
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* @description 版本2
|
|
16
|
+
* @param v {string}
|
|
17
|
+
* @return {boolean}
|
|
18
|
+
*/
|
|
19
|
+
export function isVersion2(v) {
|
|
20
|
+
return v === 'v2';
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* @description 读取token
|
|
25
|
+
* @return {string}
|
|
26
|
+
*/
|
|
27
|
+
export function getToken() {
|
|
28
|
+
return window.sessionStorage.getItem('token');
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* @description 读取appKey
|
|
33
|
+
* @return {string}
|
|
34
|
+
*/
|
|
35
|
+
export function getAppKey() {
|
|
36
|
+
return toObject(toObject(toObject(window.process).env).app).appKey;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* @description 读取tenantCode
|
|
41
|
+
* @return {string}
|
|
42
|
+
*/
|
|
43
|
+
export function getTenantCode() {
|
|
44
|
+
return window.sessionStorage.getItem('tenantCode');
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* @description 获取纵横比
|
|
49
|
+
* @param wh {string}
|
|
50
|
+
* @return {number[]}
|
|
51
|
+
*/
|
|
52
|
+
export function getViewAsp(wh) {
|
|
53
|
+
try {
|
|
54
|
+
return wh.split('*').map(v => parseInt(v));
|
|
55
|
+
} catch (e) {
|
|
56
|
+
return [0, 0];
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* @description http
|
|
62
|
+
* @param v {string}
|
|
63
|
+
* @return {boolean}
|
|
64
|
+
*/
|
|
65
|
+
export function isHttpUrl(v) {
|
|
66
|
+
return /^http[s]?:\/\//.test(v);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* @description 获取前缀
|
|
71
|
+
* @return {string}
|
|
72
|
+
*/
|
|
73
|
+
export function getPrefixCls() {
|
|
74
|
+
return window.process?.env?.app?.antd['ant-prefix'] || 'ant';
|
|
75
|
+
}
|
|
76
|
+
export function getAlgorithm() {
|
|
77
|
+
const value = document.documentElement.style.getPropertyValue(
|
|
78
|
+
'--gbs-var-algorithm'
|
|
79
|
+
);
|
|
80
|
+
return (
|
|
81
|
+
value ?
|
|
82
|
+
value === '#FFF' ?
|
|
83
|
+
'default'
|
|
84
|
+
: 'dark'
|
|
85
|
+
: 'default'
|
|
86
|
+
);
|
|
87
|
+
}
|