mirror of
https://gitee.com/hhyykk/ipms-sjy.git
synced 2025-07-06 23:25:06 +08:00
feat: add cache key
This commit is contained in:
@ -45,7 +45,7 @@ export const getUsername = () => {
|
||||
}
|
||||
|
||||
export const setUsername = (username: string) => {
|
||||
wsCache.set(UsernameKey, username)
|
||||
wsCache.set(UsernameKey, username, { exp: 30 * 24 * 60 * 60 })
|
||||
}
|
||||
|
||||
export const removeUsername = () => {
|
||||
@ -58,7 +58,7 @@ export const getPassword = () => {
|
||||
}
|
||||
|
||||
export const setPassword = (password: string) => {
|
||||
wsCache.set(PasswordKey, encrypt(password))
|
||||
wsCache.set(PasswordKey, encrypt(password), { exp: 30 * 24 * 60 * 60 })
|
||||
}
|
||||
|
||||
export const removePassword = () => {
|
||||
@ -66,11 +66,11 @@ export const removePassword = () => {
|
||||
}
|
||||
|
||||
export const getRememberMe = () => {
|
||||
return wsCache.get(RememberMeKey) === 'true'
|
||||
return wsCache.get(RememberMeKey) === true
|
||||
}
|
||||
|
||||
export const setRememberMe = (rememberMe: string) => {
|
||||
wsCache.set(RememberMeKey, rememberMe)
|
||||
export const setRememberMe = (rememberMe: boolean) => {
|
||||
wsCache.set(RememberMeKey, rememberMe, { exp: 30 * 24 * 60 * 60 })
|
||||
}
|
||||
|
||||
export const removeRememberMe = () => {
|
||||
@ -87,7 +87,7 @@ export const getTenantName = () => {
|
||||
}
|
||||
|
||||
export const setTenantName = (username: string) => {
|
||||
wsCache.set(TenantNameKey, username)
|
||||
wsCache.set(TenantNameKey, username, { exp: 30 * 24 * 60 * 60 })
|
||||
}
|
||||
|
||||
export const removeTenantName = () => {
|
||||
|
@ -18,7 +18,7 @@ export const getParentLayout = () => {
|
||||
}
|
||||
|
||||
// 按照路由中meta下的rank等级升序来排序路由
|
||||
export function ascending(arr: any[]) {
|
||||
export const ascending = (arr: any[]) => {
|
||||
arr.forEach((v) => {
|
||||
if (v?.meta?.rank === null) v.meta.rank = undefined
|
||||
if (v?.meta?.rank === 0) {
|
||||
@ -109,7 +109,7 @@ export const generateRoute = (routes: AppCustomRouteRecordRaw[]): AppRouteRecord
|
||||
data.children = generateRoute(route.children)
|
||||
}
|
||||
}
|
||||
res.push(data)
|
||||
res.push(data as AppRouteRecordRaw)
|
||||
}
|
||||
return res
|
||||
}
|
||||
@ -203,7 +203,7 @@ const addToChildren = (
|
||||
}
|
||||
}
|
||||
}
|
||||
function toCamelCase(str: string, upperCaseFirst: boolean) {
|
||||
const toCamelCase = (str: string, upperCaseFirst: boolean) => {
|
||||
str = (str || '').toLowerCase().replace(/-(.)/g, function (group1: string) {
|
||||
return group1.toUpperCase()
|
||||
})
|
||||
|
Reference in New Issue
Block a user