fix list style
This commit is contained in:
+12
-2
@@ -3,6 +3,7 @@ import { permissionCodes } from "@/utils/permission";
|
||||
import { type Page, useUserStore } from "timi-web";
|
||||
|
||||
export const currentStoreIdStorageKey = "gao-customer-h5:current-store-id";
|
||||
export const loginStoreIdStorageKey = "gao-customer-h5:login-store-id";
|
||||
|
||||
type LoginUserWithStore = {
|
||||
storeId?: string;
|
||||
@@ -19,20 +20,29 @@ type LoginUserWithStore = {
|
||||
|
||||
export function getCurrentStoreId(): string {
|
||||
const userStore = useUserStore();
|
||||
const loginStoreId = readLoginStoreId();
|
||||
if (userStore.hasPermissions(permissionCodes.store.read)) {
|
||||
return readStoredCurrentStoreId() || getLoginUserStoreId();
|
||||
return readStoredCurrentStoreId() || loginStoreId || getLoginUserStoreId();
|
||||
}
|
||||
return getLoginUserStoreId();
|
||||
return loginStoreId || getLoginUserStoreId();
|
||||
}
|
||||
|
||||
export function setCurrentStoreId(storeId: string): void {
|
||||
localStorage.setItem(currentStoreIdStorageKey, storeId);
|
||||
}
|
||||
|
||||
export function setLoginStoreId(storeId: string): void {
|
||||
localStorage.setItem(loginStoreIdStorageKey, storeId);
|
||||
}
|
||||
|
||||
export function readStoredCurrentStoreId(): string {
|
||||
return localStorage.getItem(currentStoreIdStorageKey) || "";
|
||||
}
|
||||
|
||||
export function readLoginStoreId(): string {
|
||||
return localStorage.getItem(loginStoreIdStorageKey) || "";
|
||||
}
|
||||
|
||||
export function withCurrentStoreId<T extends { storeId?: string }>(data: T): T {
|
||||
return {
|
||||
...data,
|
||||
|
||||
Reference in New Issue
Block a user