From bb576469eb1e2cb2bf8e1717902702ca28f5ef65 Mon Sep 17 00:00:00 2001 From: zhangwei <1504152376@qq.com> Date: 星期一, 28 七月 2025 17:20:56 +0800 Subject: [PATCH] '-' --- src/utils/auth.ts | 18 ++++++++++++++++++ 1 files changed, 18 insertions(+), 0 deletions(-) diff --git a/src/utils/auth.ts b/src/utils/auth.ts index 37cda2f..bf688e0 100644 --- a/src/utils/auth.ts +++ b/src/utils/auth.ts @@ -123,6 +123,24 @@ obj.username = data.enterpriseName; storageLocal().setItem(userKey, obj); } + +export function setRoleListInfo(data: DataInfo<Date>) { + useUserStoreHook().SET_ROLES_LIST(data); + storageLocal().setItem("rolesList", data); +} + +export function setNowRole(data: DataInfo<Date>) { + const list = storageLocal().getItem<DataInfo<number>>(userKey)?.exRoles ?? []; + if (list.length > 0) { + const obj = list.find(item => { + return item.code == data.code; + }); + data = { ...obj, ...data }; + } + useUserStoreHook().SET_NOW_ROLE(data); + storageLocal().setItem("nowRole", data); +} + export function removeEnterpriseInfo() { storageLocal().removeItem("enterpriseInfo"); } -- Gitblit v1.9.1