fix: close business flow regressions

This commit is contained in:
david
2026-07-31 11:33:28 +08:00
parent 42a2322c8e
commit a47e9025d0
18 changed files with 403 additions and 30 deletions

View File

@@ -1,12 +1,12 @@
/** 气站后台 HTTP 客户端,使用独立 API 前缀和 JWT 存储键。 */
const apiBaseURL = import.meta.env.VITE_API_BASE_URL || 'http://localhost:12426/heqi/gas/v1';
import { getToken } from '@/utils/auth';
export const tokenStorageKey = 'gas_admin_token';
const apiBaseURL = import.meta.env.VITE_API_BASE_URL || 'http://localhost:12426/heqi/gas/v1';
export type PageResult<T> = { total: number; list: T[] };
export async function request<T>(path: string, init?: RequestInit): Promise<T> {
const token = localStorage.getItem(tokenStorageKey);
const token = getToken();
let response: Response;
try {
response = await fetch(`${apiBaseURL}${path}`, {

View File

@@ -37,7 +37,10 @@ export default function setupPermissionGuard(router: Router) {
);
}
}
if (exist && permissionsAllow) {
const menuCode = to.meta.menuCode;
const grantedByMenuCode =
typeof menuCode === 'string' && userStore.menuCodes.includes(menuCode);
if ((exist || grantedByMenuCode) && permissionsAllow) {
next();
} else next(NOT_FOUND);
} else if (permissionsAllow) {

View File

@@ -1,4 +1,4 @@
const TOKEN_KEY = 'token';
const TOKEN_KEY = 'gas_admin_token';
const isLogin = () => {
return !!localStorage.getItem(TOKEN_KEY);