antd-management-fast-framework 1.12.39 → 1.12.42
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/es/utils/Authorized.js +5 -3
- package/es/utils/appConfiguration.d.ts +70 -0
- package/es/utils/appConfiguration.js +403 -0
- package/es/utils/authority.js +4 -2
- package/es/utils/cacheAssist.js +12 -8
- package/es/utils/core.d.ts +11 -0
- package/es/utils/core.js +39 -0
- package/es/utils/defaultSettingsSpecial.d.ts +58 -29
- package/es/utils/defaultSettingsSpecial.js +30 -303
- package/es/utils/developAssist.d.ts +41 -0
- package/es/utils/developAssist.js +224 -0
- package/es/utils/globalStorageAssist.js +16 -14
- package/es/utils/localStorageAssist.d.ts +47 -0
- package/es/utils/localStorageAssist.js +114 -0
- package/es/utils/mediaDefault.d.ts +1 -1
- package/es/utils/mediaDefault.js +2 -2
- package/es/utils/sessionStorageAssist.d.ts +47 -0
- package/es/utils/sessionStorageAssist.js +114 -0
- package/es/utils/tools.d.ts +8 -142
- package/es/utils/tools.js +51 -422
- package/es/utils/typeCheck.d.ts +20 -0
- package/es/utils/typeCheck.js +53 -0
- package/es/utils/typeConvert.d.ts +7 -0
- package/es/utils/typeConvert.js +16 -0
- package/package.json +3 -3
|
@@ -0,0 +1,224 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.empty = empty;
|
|
7
|
+
exports.getNearestLocalhostNotifyCache = getNearestLocalhostNotifyCache;
|
|
8
|
+
exports.recordDebug = recordDebug;
|
|
9
|
+
exports.recordError = recordError;
|
|
10
|
+
exports.recordInfo = recordInfo;
|
|
11
|
+
exports.recordLog = recordLog;
|
|
12
|
+
exports.recordObject = recordObject;
|
|
13
|
+
exports.recordText = recordText;
|
|
14
|
+
exports.recordWarn = recordWarn;
|
|
15
|
+
exports.removeNearestLocalhostNotifyCache = removeNearestLocalhostNotifyCache;
|
|
16
|
+
exports.setNearestLocalhostNotifyCache = setNearestLocalhostNotifyCache;
|
|
17
|
+
|
|
18
|
+
var _appConfiguration = require("./appConfiguration");
|
|
19
|
+
|
|
20
|
+
var _constants = require("./constants");
|
|
21
|
+
|
|
22
|
+
var _core = require("./core");
|
|
23
|
+
|
|
24
|
+
var _localStorageAssist = require("./localStorageAssist");
|
|
25
|
+
|
|
26
|
+
var _typeCheck = require("./typeCheck");
|
|
27
|
+
|
|
28
|
+
var storageKeyCollection = {
|
|
29
|
+
nearestLocalhostNotify: 'nearestLocalhostNotify'
|
|
30
|
+
};
|
|
31
|
+
/**
|
|
32
|
+
* 记录日志
|
|
33
|
+
*
|
|
34
|
+
* @export
|
|
35
|
+
* @param {*} str
|
|
36
|
+
* @returns
|
|
37
|
+
*/
|
|
38
|
+
|
|
39
|
+
function recordLog(record, showMode) {
|
|
40
|
+
var level = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : _constants.logLevel.debug;
|
|
41
|
+
var showModeModified = (showMode || null) == null || (0, _core.stringIsNullOrWhiteSpace)(showMode) ? _constants.logShowMode.unknown : showMode;
|
|
42
|
+
|
|
43
|
+
if (!inCollection([_constants.logShowMode.unknown, _constants.logShowMode.text, _constants.logShowMode.object], showModeModified)) {
|
|
44
|
+
throw new Error("\u65E0\u6548\u7684\u65E5\u5FD7\u663E\u793A\u6A21\u5F0F:".concat(showModeModified));
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
if (showModeModified === _constants.logShowMode.unknown) {
|
|
48
|
+
if ((0, _typeCheck.isString)(record)) {
|
|
49
|
+
showModeModified = _constants.logShowMode.text;
|
|
50
|
+
} else {
|
|
51
|
+
showModeModified = _constants.logShowMode.object;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
if ((0, _appConfiguration.logShowInConsole)() && level === _constants.logLevel.debug) {
|
|
56
|
+
if (showModeModified === _constants.logShowMode.text) {
|
|
57
|
+
var data = {
|
|
58
|
+
record: record,
|
|
59
|
+
level: level
|
|
60
|
+
};
|
|
61
|
+
console.log('%c%s', 'color:#00768f;', JSON.stringify(data));
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
if (showModeModified === _constants.logShowMode.object) {
|
|
65
|
+
console.log({
|
|
66
|
+
record: record,
|
|
67
|
+
level: level
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
if ((0, _appConfiguration.logShowInConsole)() && level === _constants.logLevel.warn) {
|
|
73
|
+
if (showModeModified === _constants.logShowMode.text) {
|
|
74
|
+
var _data = {
|
|
75
|
+
record: record,
|
|
76
|
+
level: level
|
|
77
|
+
};
|
|
78
|
+
console.log('%c%s', 'color:#ff4f49;', JSON.stringify(_data));
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
if (showModeModified === _constants.logShowMode.object) {
|
|
82
|
+
console.log({
|
|
83
|
+
record: record,
|
|
84
|
+
level: level
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
if ((0, _appConfiguration.logShowInConsole)() && level === _constants.logLevel.info) {
|
|
90
|
+
if (showModeModified === _constants.logShowMode.text) {
|
|
91
|
+
var _data2 = {
|
|
92
|
+
record: record,
|
|
93
|
+
level: level
|
|
94
|
+
};
|
|
95
|
+
console.log('%c%s', 'color:#89ca78;', JSON.stringify(_data2));
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
if (showModeModified === _constants.logShowMode.object) {
|
|
99
|
+
console.log({
|
|
100
|
+
record: record,
|
|
101
|
+
level: level
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
if (level === _constants.logLevel.error) {
|
|
107
|
+
if (showModeModified === _constants.logShowMode.text) {
|
|
108
|
+
var _data3 = {
|
|
109
|
+
record: record,
|
|
110
|
+
level: level
|
|
111
|
+
};
|
|
112
|
+
console.error(JSON.stringify(_data3));
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
if (showModeModified === _constants.logShowMode.object) {
|
|
116
|
+
console.error({
|
|
117
|
+
record: record,
|
|
118
|
+
level: level
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
function recordWarn(record) {
|
|
125
|
+
if ((0, _typeCheck.isString)(record)) {
|
|
126
|
+
recordText(record, _constants.logLevel.warn);
|
|
127
|
+
} else {
|
|
128
|
+
recordObject(record, _constants.logLevel.warn);
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
function recordInfo(record) {
|
|
133
|
+
if ((0, _typeCheck.isString)(record)) {
|
|
134
|
+
recordText(record, _constants.logLevel.info);
|
|
135
|
+
} else {
|
|
136
|
+
recordObject(record, _constants.logLevel.info);
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
function recordDebug(record) {
|
|
141
|
+
if ((0, _typeCheck.isString)(record)) {
|
|
142
|
+
recordText(record, _constants.logLevel.debug);
|
|
143
|
+
} else {
|
|
144
|
+
recordObject(record, _constants.logLevel.debug);
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* 记录错误信息
|
|
149
|
+
*/
|
|
150
|
+
|
|
151
|
+
|
|
152
|
+
function recordError(record) {
|
|
153
|
+
if ((0, _typeCheck.isString)(record)) {
|
|
154
|
+
recordText(record, _constants.logLevel.error);
|
|
155
|
+
} else {
|
|
156
|
+
recordObject(record, _constants.logLevel.error);
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* 记录日志
|
|
161
|
+
*
|
|
162
|
+
* @export
|
|
163
|
+
* @param {*} str
|
|
164
|
+
* @returns
|
|
165
|
+
*/
|
|
166
|
+
|
|
167
|
+
|
|
168
|
+
function recordText(record) {
|
|
169
|
+
var level = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _constants.logLevel.debug;
|
|
170
|
+
recordLog(record, _constants.logShowMode.text, level);
|
|
171
|
+
}
|
|
172
|
+
/**
|
|
173
|
+
* 记录日志
|
|
174
|
+
*
|
|
175
|
+
* @export
|
|
176
|
+
* @param {*} str
|
|
177
|
+
* @returns
|
|
178
|
+
*/
|
|
179
|
+
|
|
180
|
+
|
|
181
|
+
function recordObject(record) {
|
|
182
|
+
var level = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _constants.logLevel.debug;
|
|
183
|
+
recordLog(record, _constants.logShowMode.object, level);
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
function getNearestLocalhostNotifyCache() {
|
|
187
|
+
var key = storageKeyCollection.nearestLocalhostNotify;
|
|
188
|
+
var d = (0, _localStorageAssist.getJsonFromLocalStorage)(key);
|
|
189
|
+
|
|
190
|
+
if ((d || null) == null) {
|
|
191
|
+
return null;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
if ((d.nearestTime || null) == null) {
|
|
195
|
+
return null;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
return d || null;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
function setNearestLocalhostNotifyCache() {
|
|
202
|
+
var key = storageKeyCollection.nearestLocalhostNotify;
|
|
203
|
+
var now = parseInt(new Date().getTime() / 1000, 10);
|
|
204
|
+
var d = {
|
|
205
|
+
nearestTime: now
|
|
206
|
+
};
|
|
207
|
+
return (0, _localStorageAssist.saveJsonToLocalStorage)(key, d);
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
function removeNearestLocalhostNotifyCache() {
|
|
211
|
+
var key = storageKeyCollection.nearestLocalhostNotify;
|
|
212
|
+
(0, _localStorageAssist.removeLocalStorage)(key);
|
|
213
|
+
}
|
|
214
|
+
/**
|
|
215
|
+
* 占位函数
|
|
216
|
+
*
|
|
217
|
+
* @export
|
|
218
|
+
* @returns
|
|
219
|
+
*/
|
|
220
|
+
|
|
221
|
+
|
|
222
|
+
function empty() {
|
|
223
|
+
return {};
|
|
224
|
+
}
|
|
@@ -23,7 +23,9 @@ var _cacheAssist = require("./cacheAssist");
|
|
|
23
23
|
|
|
24
24
|
var _constants = require("./constants");
|
|
25
25
|
|
|
26
|
-
var
|
|
26
|
+
var _core = require("./core");
|
|
27
|
+
|
|
28
|
+
var _localStorageAssist = require("./localStorageAssist");
|
|
27
29
|
|
|
28
30
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
29
31
|
|
|
@@ -41,7 +43,7 @@ exports.storageKeyCollection = storageKeyCollection;
|
|
|
41
43
|
|
|
42
44
|
function getNearestLocalhostNotifyCache() {
|
|
43
45
|
var key = storageKeyCollection.nearestLocalhostNotify;
|
|
44
|
-
var d = (0,
|
|
46
|
+
var d = (0, _localStorageAssist.getJsonFromLocalStorage)(key);
|
|
45
47
|
|
|
46
48
|
if ((d || null) == null) {
|
|
47
49
|
return null;
|
|
@@ -60,12 +62,12 @@ function setNearestLocalhostNotifyCache() {
|
|
|
60
62
|
var d = {
|
|
61
63
|
nearestTime: now
|
|
62
64
|
};
|
|
63
|
-
return (0,
|
|
65
|
+
return (0, _localStorageAssist.saveJsonToLocalStorage)(key, d);
|
|
64
66
|
}
|
|
65
67
|
|
|
66
68
|
function removeNearestLocalhostNotifyCache() {
|
|
67
69
|
var key = storageKeyCollection.nearestLocalhostNotify;
|
|
68
|
-
(0,
|
|
70
|
+
(0, _localStorageAssist.removeLocalStorage)(key);
|
|
69
71
|
}
|
|
70
72
|
|
|
71
73
|
function getAccessWayCollectionCache() {
|
|
@@ -80,12 +82,12 @@ function getAccessWayCollectionCache() {
|
|
|
80
82
|
key: key
|
|
81
83
|
});
|
|
82
84
|
|
|
83
|
-
if ((0,
|
|
85
|
+
if ((0, _core.isArray)(result)) {
|
|
84
86
|
return result;
|
|
85
87
|
}
|
|
86
88
|
}
|
|
87
89
|
|
|
88
|
-
var d = (0,
|
|
90
|
+
var d = (0, _localStorageAssist.getJsonFromLocalStorage)(key);
|
|
89
91
|
|
|
90
92
|
if ((d || null) == null) {
|
|
91
93
|
return _objectSpread({}, _constants.accessWaySpecialCollection || {});
|
|
@@ -101,7 +103,7 @@ function getAccessWayCollectionCache() {
|
|
|
101
103
|
|
|
102
104
|
function setAccessWayCollectionCache(o) {
|
|
103
105
|
var key = storageKeyCollection.accessWayCollection;
|
|
104
|
-
(0,
|
|
106
|
+
(0, _localStorageAssist.saveJsonToLocalStorage)(key, o || {});
|
|
105
107
|
}
|
|
106
108
|
/**
|
|
107
109
|
* 获取useParamsData缓存
|
|
@@ -113,7 +115,7 @@ function setAccessWayCollectionCache(o) {
|
|
|
113
115
|
|
|
114
116
|
|
|
115
117
|
function getParamsDataCache(key) {
|
|
116
|
-
var d = (0,
|
|
118
|
+
var d = (0, _localStorageAssist.getJsonFromLocalStorage)(key);
|
|
117
119
|
|
|
118
120
|
if ((d || null) == null) {
|
|
119
121
|
removeParamsDataCache(key);
|
|
@@ -149,7 +151,7 @@ function setParamsDataCache(key, o) {
|
|
|
149
151
|
useParamsData: o || null,
|
|
150
152
|
dataVersion: now
|
|
151
153
|
};
|
|
152
|
-
return (0,
|
|
154
|
+
return (0, _localStorageAssist.saveJsonToLocalStorage)(key, d);
|
|
153
155
|
}
|
|
154
156
|
/**
|
|
155
157
|
* 移除信息
|
|
@@ -161,7 +163,7 @@ function setParamsDataCache(key, o) {
|
|
|
161
163
|
|
|
162
164
|
|
|
163
165
|
function removeParamsDataCache(key) {
|
|
164
|
-
(0,
|
|
166
|
+
(0, _localStorageAssist.removeLocalStorage)(key);
|
|
165
167
|
}
|
|
166
168
|
/**
|
|
167
169
|
* 获取Token键名
|
|
@@ -186,7 +188,7 @@ function getTokenKeyName() {
|
|
|
186
188
|
|
|
187
189
|
function getToken() {
|
|
188
190
|
var key = storageKeyCollection.token;
|
|
189
|
-
return (0,
|
|
191
|
+
return (0, _localStorageAssist.getStringFromLocalStorage)(key);
|
|
190
192
|
}
|
|
191
193
|
/**
|
|
192
194
|
* Set Token
|
|
@@ -199,7 +201,7 @@ function getToken() {
|
|
|
199
201
|
|
|
200
202
|
function setToken(v) {
|
|
201
203
|
var key = storageKeyCollection.token;
|
|
202
|
-
return (0,
|
|
204
|
+
return (0, _localStorageAssist.saveStringToLocalStorage)(key, v);
|
|
203
205
|
}
|
|
204
206
|
/**
|
|
205
207
|
* 移除Token
|
|
@@ -212,7 +214,7 @@ function setToken(v) {
|
|
|
212
214
|
|
|
213
215
|
function removeToken() {
|
|
214
216
|
var key = storageKeyCollection.token;
|
|
215
|
-
return (0,
|
|
217
|
+
return (0, _localStorageAssist.removeLocalStorage)(key);
|
|
216
218
|
}
|
|
217
219
|
|
|
218
220
|
function getTokenObject() {
|
|
@@ -228,5 +230,5 @@ function getTokenObject() {
|
|
|
228
230
|
|
|
229
231
|
|
|
230
232
|
function clearCustomData() {
|
|
231
|
-
(0,
|
|
233
|
+
(0, _localStorageAssist.clearLocalStorage)();
|
|
232
234
|
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 获取LocalStorage数据
|
|
3
|
+
* @export
|
|
4
|
+
* @param {*} key
|
|
5
|
+
* @param {*} value
|
|
6
|
+
*/
|
|
7
|
+
export function getStringFromLocalStorage(key: any): any;
|
|
8
|
+
/**
|
|
9
|
+
* 获取LocalStorage数据
|
|
10
|
+
* @export
|
|
11
|
+
* @param {*} key
|
|
12
|
+
* @param {*} value
|
|
13
|
+
*/
|
|
14
|
+
export function getJsonFromLocalStorage(key: any): any;
|
|
15
|
+
/**
|
|
16
|
+
* 存储本地数据
|
|
17
|
+
* @export
|
|
18
|
+
* @param {*} key
|
|
19
|
+
* @param {*} value
|
|
20
|
+
*/
|
|
21
|
+
export function saveStringToLocalStorage(key: any, value: any): void;
|
|
22
|
+
/**
|
|
23
|
+
* 存储本地数据
|
|
24
|
+
* @export
|
|
25
|
+
* @param {*} key
|
|
26
|
+
* @param {*} value
|
|
27
|
+
*/
|
|
28
|
+
export function saveJsonToLocalStorage(key: any, json: any): void;
|
|
29
|
+
/**
|
|
30
|
+
* 移除LocalStorage数据
|
|
31
|
+
* @export
|
|
32
|
+
* @param {*} key
|
|
33
|
+
*/
|
|
34
|
+
export function removeLocalStorage(key: any): void;
|
|
35
|
+
/**
|
|
36
|
+
* 清空LocalStorage数据
|
|
37
|
+
* @export
|
|
38
|
+
* @param {*} key
|
|
39
|
+
*/
|
|
40
|
+
export function clearLocalStorage(): void;
|
|
41
|
+
/**
|
|
42
|
+
* 占位函数
|
|
43
|
+
*
|
|
44
|
+
* @export
|
|
45
|
+
* @returns
|
|
46
|
+
*/
|
|
47
|
+
export function empty(): {};
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.clearLocalStorage = clearLocalStorage;
|
|
7
|
+
exports.empty = empty;
|
|
8
|
+
exports.getJsonFromLocalStorage = getJsonFromLocalStorage;
|
|
9
|
+
exports.getStringFromLocalStorage = getStringFromLocalStorage;
|
|
10
|
+
exports.removeLocalStorage = removeLocalStorage;
|
|
11
|
+
exports.saveJsonToLocalStorage = saveJsonToLocalStorage;
|
|
12
|
+
exports.saveStringToLocalStorage = saveStringToLocalStorage;
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* 获取LocalStorage数据
|
|
16
|
+
* @export
|
|
17
|
+
* @param {*} key
|
|
18
|
+
* @param {*} value
|
|
19
|
+
*/
|
|
20
|
+
function getStringFromLocalStorage(key) {
|
|
21
|
+
var storage = window.localStorage;
|
|
22
|
+
var value = storage.getItem(key);
|
|
23
|
+
|
|
24
|
+
if (process.env.NODE_ENV === 'development') {
|
|
25
|
+
return value;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
var decode = decodeBase64(value);
|
|
29
|
+
var v = encodeBase64(decode);
|
|
30
|
+
|
|
31
|
+
if (value !== v) {
|
|
32
|
+
return null;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
return decode;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* 获取LocalStorage数据
|
|
39
|
+
* @export
|
|
40
|
+
* @param {*} key
|
|
41
|
+
* @param {*} value
|
|
42
|
+
*/
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
function getJsonFromLocalStorage(key) {
|
|
46
|
+
var jsonString = getStringFromLocalStorage(key);
|
|
47
|
+
|
|
48
|
+
if (jsonString) {
|
|
49
|
+
return JSON.parse(jsonString || '{}');
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
return null;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* 存储本地数据
|
|
56
|
+
* @export
|
|
57
|
+
* @param {*} key
|
|
58
|
+
* @param {*} value
|
|
59
|
+
*/
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
function saveStringToLocalStorage(key, value) {
|
|
63
|
+
var storage = window.localStorage;
|
|
64
|
+
|
|
65
|
+
if (process.env.NODE_ENV === 'development') {
|
|
66
|
+
storage.setItem(key, value);
|
|
67
|
+
} else {
|
|
68
|
+
storage.setItem(key, encodeBase64(value));
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* 存储本地数据
|
|
73
|
+
* @export
|
|
74
|
+
* @param {*} key
|
|
75
|
+
* @param {*} value
|
|
76
|
+
*/
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
function saveJsonToLocalStorage(key, json) {
|
|
80
|
+
saveStringToLocalStorage(key, JSON.stringify(json || {}));
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* 移除LocalStorage数据
|
|
84
|
+
* @export
|
|
85
|
+
* @param {*} key
|
|
86
|
+
*/
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
function removeLocalStorage(key) {
|
|
90
|
+
var storage = window.localStorage;
|
|
91
|
+
storage.removeItem(key);
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* 清空LocalStorage数据
|
|
95
|
+
* @export
|
|
96
|
+
* @param {*} key
|
|
97
|
+
*/
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
function clearLocalStorage() {
|
|
101
|
+
var storage = window.localStorage;
|
|
102
|
+
storage.clear();
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* 占位函数
|
|
106
|
+
*
|
|
107
|
+
* @export
|
|
108
|
+
* @returns
|
|
109
|
+
*/
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
function empty() {
|
|
113
|
+
return {};
|
|
114
|
+
}
|
package/es/utils/mediaDefault.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.
|
|
6
|
+
exports.empty = empty;
|
|
7
7
|
exports.emptyLogo = void 0;
|
|
8
8
|
|
|
9
9
|
/**
|
|
@@ -19,6 +19,6 @@ var emptyLogo = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqa
|
|
|
19
19
|
|
|
20
20
|
exports.emptyLogo = emptyLogo;
|
|
21
21
|
|
|
22
|
-
function
|
|
22
|
+
function empty() {
|
|
23
23
|
return {};
|
|
24
24
|
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 获取SessionStorage数据
|
|
3
|
+
* @export
|
|
4
|
+
* @param {*} key
|
|
5
|
+
* @param {*} value
|
|
6
|
+
*/
|
|
7
|
+
export function getStringFromSessionStorage(key: any): any;
|
|
8
|
+
/**
|
|
9
|
+
* 获取SessionStorage数据
|
|
10
|
+
* @export
|
|
11
|
+
* @param {*} key
|
|
12
|
+
* @param {*} value
|
|
13
|
+
*/
|
|
14
|
+
export function getJsonFromSessionStorage(key: any): any;
|
|
15
|
+
/**
|
|
16
|
+
* 存储SessionStorage数据
|
|
17
|
+
* @export
|
|
18
|
+
* @param {*} key
|
|
19
|
+
* @param {*} value
|
|
20
|
+
*/
|
|
21
|
+
export function saveStringToSessionStorage(key: any, value: any): void;
|
|
22
|
+
/**
|
|
23
|
+
* 存储SessionStorage数据
|
|
24
|
+
* @export
|
|
25
|
+
* @param {*} key
|
|
26
|
+
* @param {*} value
|
|
27
|
+
*/
|
|
28
|
+
export function saveJsonToSessionStorage(key: any, json: any): void;
|
|
29
|
+
/**
|
|
30
|
+
* 移除SessionStorage数据
|
|
31
|
+
* @export
|
|
32
|
+
* @param {*} key
|
|
33
|
+
*/
|
|
34
|
+
export function removeSessionStorage(key: any): void;
|
|
35
|
+
/**
|
|
36
|
+
* 清空SessionStorage数据
|
|
37
|
+
* @export
|
|
38
|
+
* @param {*} key
|
|
39
|
+
*/
|
|
40
|
+
export function clearSessionStorage(): void;
|
|
41
|
+
/**
|
|
42
|
+
* 占位函数
|
|
43
|
+
*
|
|
44
|
+
* @export
|
|
45
|
+
* @returns
|
|
46
|
+
*/
|
|
47
|
+
export function empty(): {};
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.clearSessionStorage = clearSessionStorage;
|
|
7
|
+
exports.empty = empty;
|
|
8
|
+
exports.getJsonFromSessionStorage = getJsonFromSessionStorage;
|
|
9
|
+
exports.getStringFromSessionStorage = getStringFromSessionStorage;
|
|
10
|
+
exports.removeSessionStorage = removeSessionStorage;
|
|
11
|
+
exports.saveJsonToSessionStorage = saveJsonToSessionStorage;
|
|
12
|
+
exports.saveStringToSessionStorage = saveStringToSessionStorage;
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* 获取SessionStorage数据
|
|
16
|
+
* @export
|
|
17
|
+
* @param {*} key
|
|
18
|
+
* @param {*} value
|
|
19
|
+
*/
|
|
20
|
+
function getStringFromSessionStorage(key) {
|
|
21
|
+
var storage = window.sessionStorage;
|
|
22
|
+
var value = storage.getItem(key);
|
|
23
|
+
|
|
24
|
+
if (process.env.NODE_ENV === 'development') {
|
|
25
|
+
return value;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
var decode = decodeBase64(value);
|
|
29
|
+
var v = encodeBase64(decode);
|
|
30
|
+
|
|
31
|
+
if (value !== v) {
|
|
32
|
+
return null;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
return decode;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* 获取SessionStorage数据
|
|
39
|
+
* @export
|
|
40
|
+
* @param {*} key
|
|
41
|
+
* @param {*} value
|
|
42
|
+
*/
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
function getJsonFromSessionStorage(key) {
|
|
46
|
+
var jsonString = getStringFromSessionStorage(key);
|
|
47
|
+
|
|
48
|
+
if (jsonString) {
|
|
49
|
+
return JSON.parse(jsonString || '{}');
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
return null;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* 存储SessionStorage数据
|
|
56
|
+
* @export
|
|
57
|
+
* @param {*} key
|
|
58
|
+
* @param {*} value
|
|
59
|
+
*/
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
function saveStringToSessionStorage(key, value) {
|
|
63
|
+
var storage = window.sessionStorage;
|
|
64
|
+
|
|
65
|
+
if (process.env.NODE_ENV === 'development') {
|
|
66
|
+
storage.setItem(key, value);
|
|
67
|
+
} else {
|
|
68
|
+
storage.setItem(key, encodeBase64(value));
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* 存储SessionStorage数据
|
|
73
|
+
* @export
|
|
74
|
+
* @param {*} key
|
|
75
|
+
* @param {*} value
|
|
76
|
+
*/
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
function saveJsonToSessionStorage(key, json) {
|
|
80
|
+
saveStringToSessionStorage(key, JSON.stringify(json || {}));
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* 移除SessionStorage数据
|
|
84
|
+
* @export
|
|
85
|
+
* @param {*} key
|
|
86
|
+
*/
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
function removeSessionStorage(key) {
|
|
90
|
+
var storage = window.sessionStorage;
|
|
91
|
+
storage.removeItem(key);
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* 清空SessionStorage数据
|
|
95
|
+
* @export
|
|
96
|
+
* @param {*} key
|
|
97
|
+
*/
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
function clearSessionStorage() {
|
|
101
|
+
var storage = window.sessionStorage;
|
|
102
|
+
storage.clear();
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* 占位函数
|
|
106
|
+
*
|
|
107
|
+
* @export
|
|
108
|
+
* @returns
|
|
109
|
+
*/
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
function empty() {
|
|
113
|
+
return {};
|
|
114
|
+
}
|