init: 初始系统模板

This commit is contained in:
TsMask
2023-09-05 14:38:23 +08:00
parent a5bc16ae4f
commit 1075c8ae4f
130 changed files with 22531 additions and 1 deletions

View File

@@ -0,0 +1,40 @@
/**会话级缓存设置 */
export function sessionSet(key: string, value: string) {
if (!sessionStorage || key == null || value == null) {
return;
}
sessionStorage.setItem(key, value);
}
/**会话级缓存获取 */
export function sessionGet(key: string) {
if (!sessionStorage || key == null) {
return null;
}
return sessionStorage.getItem(key);
}
/**会话级缓存移除 */
export function sessionRemove(key: string) {
if (!sessionStorage || key == null) {
return null;
}
return sessionStorage.removeItem(key);
}
/**会话级缓存设置JSON */
export function sessionSetJSON(key: string, jsonValue: object) {
if (key == null || jsonValue == null) {
return null;
}
sessionSet(key, JSON.stringify(jsonValue));
}
/**会话级缓存获取JSON */
export function sessionGetJSON(key: string) {
const value = sessionGet(key);
if (value == null) {
return null;
}
return JSON.parse(value);
}