feat: 重构锁屏功能

This commit is contained in:
TsMask
2024-06-12 14:35:07 +08:00
parent c9eb0240d8
commit 375f236e32
16 changed files with 452 additions and 509 deletions

View File

@@ -1,7 +1,7 @@
import Cookies from 'js-cookie';
import { TOKEN_COOKIE } from '@/constants/token-constants';
import { localRemove, localSet } from '@/utils/cache-local-utils';
import { CACHE_LOCAL_LOCK } from '@/constants/cache-keys-constants';
import { CACHE_LOCAL_LOCK_PASSWD, CACHE_LOCAL_MASK } from '@/constants/cache-keys-constants';
/**获取cookis中Token字符串 */
export function getToken(): string {
@@ -11,11 +11,12 @@ export function getToken(): string {
/**设置cookis中Token字符串 */
export function setToken(token: string): void {
Cookies.set(TOKEN_COOKIE, token);
localSet(CACHE_LOCAL_LOCK, 'none');
localSet(CACHE_LOCAL_MASK, 'none');
}
/**移除cookis中Token字符串,localStorage中锁屏字符串 */
export function removeToken(): void {
Cookies.remove(TOKEN_COOKIE);
localRemove(CACHE_LOCAL_LOCK);
localRemove(CACHE_LOCAL_MASK);
localRemove(CACHE_LOCAL_LOCK_PASSWD);
}