zhangwencui
2026-10-28 7b0c52c4bfcd2c2bbcbb1cccdcfbe9f79027224b
src/stores/theme.ts
@@ -1,6 +1,7 @@
import { computed, readonly, ref } from "vue";
import { APP_COMPANY } from "../config/company";
export type ThemeKey = "blue" | "green" | "purple";
export type ThemeKey = "blue" | "electric" | "green" | "aurora" | "purple";
export interface AppTheme {
  key: ThemeKey;
@@ -15,7 +16,7 @@
  cardBackground: string;
}
export const THEME_STORAGE_KEY = "mom_app_theme";
export const THEME_STORAGE_KEY = `mom_app_theme_${APP_COMPANY.key}`;
export const appThemes: AppTheme[] = [
  {
@@ -43,6 +44,30 @@
    cardBackground: "#ffffff",
  },
  {
    key: "electric",
    name: "电力深蓝",
    description: "冷峻清晰,突出电力运行状态",
    primary: "#0879e8",
    primaryDark: "#0756ac",
    primaryLight: "#47a9ff",
    primarySoft: "#e9f5ff",
    primaryBorder: "#b7ddff",
    pageBackground: "#f2f7fb",
    cardBackground: "#ffffff",
  },
  {
    key: "aurora",
    name: "智能极光",
    description: "紫青渐变,体现智能科技感",
    primary: "#7257df",
    primaryDark: "#5640b7",
    primaryLight: "#9a84f3",
    primarySoft: "#f2efff",
    primaryBorder: "#d9d0ff",
    pageBackground: "#f7f5fc",
    cardBackground: "#ffffff",
  },
  {
    key: "purple",
    name: "科技紫",
    description: "层次鲜明,适合数据场景",
@@ -56,7 +81,12 @@
  },
];
const defaultTheme = appThemes[0];
const companyDefaultThemeKey: ThemeKey = APP_COMPANY.key === "changhui"
  ? "electric"
  : APP_COMPANY.key === "kangyi"
    ? "aurora"
    : "blue";
const defaultTheme = appThemes.find(item => item.key === companyDefaultThemeKey) || appThemes[0];
const currentTheme = ref<AppTheme>(defaultTheme);
function findTheme(key?: string) {