mirror of
https://github.com/soybeanjs/soybean-admin.git
synced 2025-11-14 04:33:41 +08:00
chore(projects): correct the word spell
This commit is contained in:
@@ -77,9 +77,9 @@ const darkColorMap = [
|
||||
* @param darkThemeMixColor - 暗黑主题的混合颜色,默认 #141414
|
||||
*/
|
||||
export function getColorPalettes(color: AnyColor, darkTheme = false, darkThemeMixColor = '#141414'): string[] {
|
||||
const indexs: ColorIndex[] = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
|
||||
const indexes: ColorIndex[] = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
|
||||
|
||||
const patterns = indexs.map(index => getColorPalette(color, index));
|
||||
const patterns = indexes.map(index => getColorPalette(color, index));
|
||||
|
||||
if (darkTheme) {
|
||||
const darkPatterns = darkColorMap.map(({ index, opacity }) => {
|
||||
|
||||
@@ -6,7 +6,7 @@ const CryptoSecret = '__CryptoJS_Secret__';
|
||||
* 加密数据
|
||||
* @param data - 数据
|
||||
*/
|
||||
export function encrypto(data: any) {
|
||||
export function encrypt(data: any) {
|
||||
const newData = JSON.stringify(data);
|
||||
return CryptoJS.AES.encrypt(newData, CryptoSecret).toString();
|
||||
}
|
||||
@@ -15,7 +15,7 @@ export function encrypto(data: any) {
|
||||
* 解密数据
|
||||
* @param cipherText - 密文
|
||||
*/
|
||||
export function decrypto(cipherText: string) {
|
||||
export function decrypt(cipherText: string) {
|
||||
const bytes = CryptoJS.AES.decrypt(cipherText, CryptoSecret);
|
||||
const originalText = bytes.toString(CryptoJS.enc.Utf8);
|
||||
if (originalText) {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { decrypto, encrypto } from '../crypto';
|
||||
import { decrypt, encrypt } from '../crypto';
|
||||
interface StorageData<T> {
|
||||
value: T;
|
||||
expire: number | null;
|
||||
@@ -13,7 +13,7 @@ function createLocalStorage<T extends StorageInterface.Local = StorageInterface.
|
||||
value,
|
||||
expire: expire !== null ? new Date().getTime() + expire * 1000 : null
|
||||
};
|
||||
const json = encrypto(storageData);
|
||||
const json = encrypt(storageData);
|
||||
window.localStorage.setItem(key as string, json);
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ function createLocalStorage<T extends StorageInterface.Local = StorageInterface.
|
||||
if (json) {
|
||||
let storageData: StorageData<T[K]> | null = null;
|
||||
try {
|
||||
storageData = decrypto(json);
|
||||
storageData = decrypt(json);
|
||||
} catch {
|
||||
// 防止解析失败
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { decrypto, encrypto } from '../crypto';
|
||||
import { decrypt, encrypt } from '../crypto';
|
||||
|
||||
function createSessionStorage<T extends StorageInterface.Session = StorageInterface.Session>() {
|
||||
function set<K extends keyof T>(key: K, value: T[K]) {
|
||||
const json = encrypto(value);
|
||||
const json = encrypt(value);
|
||||
sessionStorage.setItem(key as string, json);
|
||||
}
|
||||
function get<K extends keyof T>(key: K) {
|
||||
@@ -10,7 +10,7 @@ function createSessionStorage<T extends StorageInterface.Session = StorageInterf
|
||||
let data: T[K] | null = null;
|
||||
if (json) {
|
||||
try {
|
||||
data = decrypto(json);
|
||||
data = decrypt(json);
|
||||
} catch {
|
||||
// 防止解析失败
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user