sirius-common-utils 1.0.0
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/index.js +35 -0
- package/dist/utils/AppUtils.js +139 -0
- package/dist/utils/AxiosUtils.js +555 -0
- package/dist/utils/CfgUtils.js +25 -0
- package/dist/utils/DateUtils.js +193 -0
- package/dist/utils/DomUtils.js +50 -0
- package/dist/utils/ExplorerTypeUtils.js +48 -0
- package/dist/utils/FormUtils.js +128 -0
- package/dist/utils/JsonUtils.js +23 -0
- package/dist/utils/LoginUserUtils.js +169 -0
- package/dist/utils/NumberUtils.js +57 -0
- package/dist/utils/SignatureUtils.js +160 -0
- package/dist/utils/StringUtils.js +20 -0
- package/package.json +37 -0
- package/src/packages/index.js +29 -0
- package/src/packages/utils/AppUtils.js +155 -0
- package/src/packages/utils/AxiosUtils.js +433 -0
- package/src/packages/utils/CfgUtils.js +15 -0
- package/src/packages/utils/DateUtils.js +223 -0
- package/src/packages/utils/DomUtils.js +48 -0
- package/src/packages/utils/ExplorerTypeUtils.js +60 -0
- package/src/packages/utils/FormUtils.js +92 -0
- package/src/packages/utils/JsonUtils.js +21 -0
- package/src/packages/utils/LoginUserUtils.js +105 -0
- package/src/packages/utils/NumberUtils.js +60 -0
- package/src/packages/utils/SignatureUtils.js +132 -0
- package/src/packages/utils/StringUtils.js +17 -0
package/dist/index.js
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports["default"] = void 0;
|
|
7
|
+
var _AppUtils = _interopRequireDefault(require("./utils/AppUtils"));
|
|
8
|
+
var _AxiosUtils = _interopRequireDefault(require("./utils/AxiosUtils"));
|
|
9
|
+
var _CfgUtils = _interopRequireDefault(require("./utils/CfgUtils"));
|
|
10
|
+
var _DateUtils = _interopRequireDefault(require("./utils/DateUtils"));
|
|
11
|
+
var _DomUtils = _interopRequireDefault(require("./utils/DomUtils"));
|
|
12
|
+
var _ExplorerTypeUtils = _interopRequireDefault(require("./utils/ExplorerTypeUtils"));
|
|
13
|
+
var _FormUtils = _interopRequireDefault(require("./utils/FormUtils"));
|
|
14
|
+
var _JsonUtils = _interopRequireDefault(require("./utils/JsonUtils"));
|
|
15
|
+
var _LoginUserUtils = _interopRequireDefault(require("./utils/LoginUserUtils"));
|
|
16
|
+
var _NumberUtils = _interopRequireDefault(require("./utils/NumberUtils"));
|
|
17
|
+
var _SignatureUtils = _interopRequireDefault(require("./utils/SignatureUtils"));
|
|
18
|
+
var _StringUtils = _interopRequireDefault(require("./utils/StringUtils"));
|
|
19
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
20
|
+
var SiriusCommonUtils = {
|
|
21
|
+
AppUtils: _AppUtils["default"],
|
|
22
|
+
AxiosUtils: _AxiosUtils["default"],
|
|
23
|
+
CfgUtils: _CfgUtils["default"],
|
|
24
|
+
DateUtils: _DateUtils["default"],
|
|
25
|
+
DomUtils: _DomUtils["default"],
|
|
26
|
+
ExplorerTypeUtils: _ExplorerTypeUtils["default"],
|
|
27
|
+
FormUtils: _FormUtils["default"],
|
|
28
|
+
JsonUtils: _JsonUtils["default"],
|
|
29
|
+
LoginUserUtils: _LoginUserUtils["default"],
|
|
30
|
+
NumberUtils: _NumberUtils["default"],
|
|
31
|
+
SignatureUtils: _SignatureUtils["default"],
|
|
32
|
+
StringUtils: _StringUtils["default"]
|
|
33
|
+
};
|
|
34
|
+
var _default = SiriusCommonUtils;
|
|
35
|
+
exports["default"] = _default;
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports["default"] = void 0;
|
|
7
|
+
var _lodash = _interopRequireDefault(require("lodash"));
|
|
8
|
+
var _jsBase = require("js-base64");
|
|
9
|
+
var _CfgUtils = _interopRequireDefault(require("./CfgUtils"));
|
|
10
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
11
|
+
//appVersion
|
|
12
|
+
function setAppVersion(version) {
|
|
13
|
+
setLocalStorageStringItem("APP_VERSION", version);
|
|
14
|
+
}
|
|
15
|
+
function getAppVersion() {
|
|
16
|
+
return getLocalStorageStringItem("APP_VERSION");
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
//app build version
|
|
20
|
+
function setBuildVersion(version) {
|
|
21
|
+
setLocalStorageStringItem("BUILD_VERSION", version);
|
|
22
|
+
}
|
|
23
|
+
function getBuildVersion() {
|
|
24
|
+
return getLocalStorageStringItem("BUILD_VERSION");
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
//app cache version
|
|
28
|
+
function setAppCacheVersion(version) {
|
|
29
|
+
setLocalStorageStringItem("APP_CACHE_VERSION", version);
|
|
30
|
+
}
|
|
31
|
+
function getAppCacheVersion() {
|
|
32
|
+
return getLocalStorageStringItem("APP_CACHE_VERSION");
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* 检查LocalStorage中是否存在该键
|
|
37
|
+
*/
|
|
38
|
+
function isLocalStorageItemExisted(key) {
|
|
39
|
+
var realKey = _CfgUtils["default"].appInfo.appName + '_' + key;
|
|
40
|
+
var obj = localStorage.getItem(realKey);
|
|
41
|
+
return obj != null;
|
|
42
|
+
}
|
|
43
|
+
function removeLocalStorageItem(key, obj) {
|
|
44
|
+
var realKey = _CfgUtils["default"].appInfo.appName + '_' + key;
|
|
45
|
+
localStorage.removeItem(realKey);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* String类型的数据存储
|
|
50
|
+
*/
|
|
51
|
+
function setLocalStorageStringItem(key, obj) {
|
|
52
|
+
var realKey = _CfgUtils["default"].appInfo.appName + '_' + key;
|
|
53
|
+
var realValue = obj;
|
|
54
|
+
localStorage.setItem(realKey, realValue);
|
|
55
|
+
}
|
|
56
|
+
function getLocalStorageStringItem(key) {
|
|
57
|
+
var realKey = _CfgUtils["default"].appInfo.appName + '_' + key;
|
|
58
|
+
var obj = localStorage.getItem(realKey);
|
|
59
|
+
return obj;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Object类型的数据存储
|
|
64
|
+
*/
|
|
65
|
+
|
|
66
|
+
function setLocalStorageObjItem(key, obj) {
|
|
67
|
+
var realKey = _CfgUtils["default"].appInfo.appName + '_' + key;
|
|
68
|
+
var realValue = _jsBase.Base64.encode(JSON.stringify(obj));
|
|
69
|
+
localStorage.setItem(realKey, realValue);
|
|
70
|
+
}
|
|
71
|
+
function getLocalStorageObjItem(key) {
|
|
72
|
+
var realKey = _CfgUtils["default"].appInfo.appName + '_' + key;
|
|
73
|
+
var obj = null;
|
|
74
|
+
try {
|
|
75
|
+
var jsonVal = localStorage.getItem(realKey);
|
|
76
|
+
obj = JSON.parse(_jsBase.Base64.decode(jsonVal));
|
|
77
|
+
} catch (e) {}
|
|
78
|
+
return obj;
|
|
79
|
+
}
|
|
80
|
+
function atomSetLocalStorageObjItem(key, obj) {
|
|
81
|
+
setLocalStorageObjItem(key, obj);
|
|
82
|
+
}
|
|
83
|
+
function atomGetLocalStorageObjItem(key) {
|
|
84
|
+
var result = getLocalStorageObjItem(key);
|
|
85
|
+
setLocalStorageObjItem(key, null);
|
|
86
|
+
return result;
|
|
87
|
+
}
|
|
88
|
+
function pushLocalStorageStringItem(key, obj) {
|
|
89
|
+
setLocalStorageStringItem(key, obj);
|
|
90
|
+
}
|
|
91
|
+
function popLocalStorageStringItem(key) {
|
|
92
|
+
var result = getLocalStorageStringItem(key);
|
|
93
|
+
removeLocalStorageItem(key);
|
|
94
|
+
return result;
|
|
95
|
+
}
|
|
96
|
+
function atomSetSessionStorageObjItem(key, obj) {
|
|
97
|
+
setSessionStorageObjItem(key, obj);
|
|
98
|
+
}
|
|
99
|
+
function atomGetSessionStorageObjItem(key) {
|
|
100
|
+
var result = getSessionStorageObjItem(key);
|
|
101
|
+
setSessionStorageObjItem(key, null);
|
|
102
|
+
return result;
|
|
103
|
+
}
|
|
104
|
+
function setSessionStorageObjItem(key, obj) {
|
|
105
|
+
var realKey = _CfgUtils["default"].appInfo.appName + '_' + key;
|
|
106
|
+
var realValue = _jsBase.Base64.encode(JSON.stringify(obj));
|
|
107
|
+
sessionStorage.setItem(realKey, realValue);
|
|
108
|
+
}
|
|
109
|
+
function getSessionStorageObjItem(key) {
|
|
110
|
+
var realKey = _CfgUtils["default"].appInfo.appName + '_' + key;
|
|
111
|
+
var obj = null;
|
|
112
|
+
try {
|
|
113
|
+
var jsonVal = sessionStorage.getItem(realKey);
|
|
114
|
+
obj = JSON.parse(_jsBase.Base64.decode(jsonVal));
|
|
115
|
+
} catch (e) {}
|
|
116
|
+
return obj;
|
|
117
|
+
}
|
|
118
|
+
var _default = {
|
|
119
|
+
setAppVersion: setAppVersion,
|
|
120
|
+
getAppVersion: getAppVersion,
|
|
121
|
+
setBuildVersion: setBuildVersion,
|
|
122
|
+
getBuildVersion: getBuildVersion,
|
|
123
|
+
setAppCacheVersion: setAppCacheVersion,
|
|
124
|
+
getAppCacheVersion: getAppCacheVersion,
|
|
125
|
+
atomSetLocalStorageObjItem: atomSetLocalStorageObjItem,
|
|
126
|
+
atomGetLocalStorageObjItem: atomGetLocalStorageObjItem,
|
|
127
|
+
pushLocalStorageStringItem: pushLocalStorageStringItem,
|
|
128
|
+
popLocalStorageStringItem: popLocalStorageStringItem,
|
|
129
|
+
isLocalStorageItemExisted: isLocalStorageItemExisted,
|
|
130
|
+
setLocalStorageObjItem: setLocalStorageObjItem,
|
|
131
|
+
getLocalStorageObjItem: getLocalStorageObjItem,
|
|
132
|
+
setLocalStorageStringItem: setLocalStorageStringItem,
|
|
133
|
+
getLocalStorageStringItem: getLocalStorageStringItem,
|
|
134
|
+
atomSetSessionStorageObjItem: atomSetSessionStorageObjItem,
|
|
135
|
+
atomGetSessionStorageObjItem: atomGetSessionStorageObjItem,
|
|
136
|
+
setSessionStorageObjItem: setSessionStorageObjItem,
|
|
137
|
+
getSessionStorageObjItem: getSessionStorageObjItem
|
|
138
|
+
};
|
|
139
|
+
exports["default"] = _default;
|