app.ts 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. import { useCache } from '@/hooks/web/useCache'
  2. const { wsCache } = useCache()
  3. export type LayoutType = 'classic' | 'topLeft' | 'top' | 'cutMenu'
  4. export type ThemeTypes = {
  5. elColorPrimary?: string
  6. leftMenuBorderColor?: string
  7. leftMenuBgColor?: string
  8. leftMenuBgLightColor?: string
  9. leftMenuBgActiveColor?: string
  10. leftMenuCollapseBgActiveColor?: string
  11. leftMenuTextColor?: string
  12. leftMenuTextActiveColor?: string
  13. logoTitleTextColor?: string
  14. logoBorderColor?: string
  15. topHeaderBgColor?: string
  16. topHeaderTextColor?: string
  17. topHeaderHoverColor?: string
  18. topToolBorderColor?: string
  19. }
  20. export interface AppState {
  21. breadcrumb: boolean
  22. breadcrumbIcon: boolean
  23. collapse: boolean
  24. uniqueOpened: boolean
  25. hamburger: boolean
  26. screenfull: boolean
  27. size: boolean
  28. locale: boolean
  29. tagsView: boolean
  30. tagsViewIcon: boolean
  31. logo: boolean
  32. fixedHeader: boolean
  33. greyMode: boolean
  34. pageLoading: boolean
  35. layout: LayoutType
  36. title: string
  37. userInfo: string
  38. isDark: boolean
  39. currentSize: ElememtPlusSize
  40. sizeMap: ElememtPlusSize[]
  41. mobile: boolean
  42. footer: boolean
  43. theme: ThemeTypes
  44. }
  45. export const appModules: AppState = {
  46. userInfo: 'userInfo', // 登录信息存储字段-建议每个项目换一个字段,避免与其他项目冲突
  47. sizeMap: ['default', 'large', 'small'],
  48. mobile: false, // 是否是移动端
  49. title: import.meta.env.VITE_APP_TITLE, // 标题
  50. pageLoading: false, // 路由跳转loading
  51. breadcrumb: true, // 面包屑
  52. breadcrumbIcon: false, // 面包屑图标
  53. collapse: false, // 折叠菜单
  54. uniqueOpened: true, // 是否只保持一个子菜单的展开
  55. hamburger: true, // 折叠图标
  56. screenfull: true, // 全屏图标
  57. size: true, // 尺寸图标
  58. locale: true, // 多语言图标
  59. tagsView: true, // 标签页
  60. tagsViewIcon: false, // 是否显示标签图标
  61. logo: true, // logo
  62. fixedHeader: true, // 固定toolheader
  63. footer: true, // 显示页脚
  64. greyMode: false, // 是否开始灰色模式,用于特殊悼念日
  65. layout: wsCache.get('layout') || 'topLeft', // layout布局
  66. isDark: wsCache.get('isDark') || false, // 是否是暗黑模式
  67. currentSize: wsCache.get('default') || 'default', // 组件尺寸
  68. theme: wsCache.get('theme') || {
  69. // 主题色
  70. elColorPrimary: '#409eff',
  71. // 左侧菜单边框颜色
  72. leftMenuBorderColor: 'inherit',
  73. // 左侧菜单背景颜色
  74. leftMenuBgColor: '#001529',
  75. // 左侧菜单浅色背景颜色
  76. leftMenuBgLightColor: '#0f2438',
  77. // 左侧菜单选中背景颜色
  78. leftMenuBgActiveColor: 'var(--el-color-primary)',
  79. // 左侧菜单收起选中背景颜色
  80. leftMenuCollapseBgActiveColor: 'var(--el-color-primary)',
  81. // 左侧菜单字体颜色
  82. leftMenuTextColor: '#bfcbd9',
  83. // 左侧菜单选中字体颜色
  84. leftMenuTextActiveColor: '#fff',
  85. // logo字体颜色
  86. logoTitleTextColor: '#fff',
  87. // logo边框颜色
  88. logoBorderColor: 'inherit',
  89. // 头部背景颜色
  90. topHeaderBgColor: '#fff',
  91. // 头部字体颜色
  92. topHeaderTextColor: 'inherit',
  93. // 头部悬停颜色
  94. topHeaderHoverColor: '#f6f6f6',
  95. // 头部边框颜色
  96. topToolBorderColor: '#eee'
  97. }
  98. }