feat:前端修改(我认为ok)

This commit is contained in:
2026-09-14 20:31:06 +08:00
parent 721cc96419
commit 7b6b2a7382
57 changed files with 9558 additions and 0 deletions
+21
View File
@@ -0,0 +1,21 @@
import { USER_TYPE } from "@/lib/roles";
const TOKEN_KEY = "huaxia_token";
/** 前端只负责展示友好名称,取值契约见 lib/roles.ts。 */
export const roleLabels: Record<string, string> = {
管理员: "管理员",
投顾: "投顾专员",
风控专员: "风控专员",
客户经理: "客户经理",
};
export function getToken() { if (typeof window === "undefined") return null; return localStorage.getItem(TOKEN_KEY); }
export function setToken(token: string) { localStorage.setItem(TOKEN_KEY, token); }
export function clearToken() { localStorage.removeItem(TOKEN_KEY); }
export function getRoleLabel(role?: string | null) { return role ? roleLabels[role] ?? "员工" : "员工"; }
/** 客户进入客户端,所有员工统一进入员工工作台。 */
export function getPostLoginPath(user?: { user_type?: string | null }) {
return user?.user_type === USER_TYPE.CUSTOMER ? "/account" : "/admin/common";
}