| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146 |
- <template>
- <a-config-provider :theme="themeConfig">
- <router-view />
- </a-config-provider>
- </template>
- <script setup lang="ts">
- import { computed, onMounted } from 'vue'
- import { theme } from 'ant-design-vue'
- import { useThemeStore } from '@/stores/theme'
- import { useAuthStore } from '@/stores/auth'
- import { useWebSocketStore } from '@/stores/websocket'
- const themeStore = useThemeStore()
- const authStore = useAuthStore()
- const wsStore = useWebSocketStore()
- const themeConfig = computed(() => ({
- algorithm: themeStore.theme === 'dark' ? theme.darkAlgorithm : theme.defaultAlgorithm,
- token: {
- colorPrimary: '#1890ff',
- borderRadius: 6,
- colorBgContainer: themeStore.themeColors.cardBackground,
- colorBgElevated: themeStore.themeColors.cardBackground,
- colorBgLayout: themeStore.themeColors.surface,
- colorBorder: themeStore.themeColors.border,
- colorBorderSecondary: themeStore.themeColors.border,
- colorText: themeStore.themeColors.text,
- colorTextSecondary: themeStore.themeColors.textSecondary,
- }
- }))
- onMounted(async () => {
- themeStore.applyThemeToDom()
- await authStore.checkAuthStatus()
- if (authStore.isAuthenticated) {
- wsStore.initConnection()
- }
- })
- </script>
- <style>
- * {
- margin: 0;
- padding: 0;
- box-sizing: border-box;
- }
- body {
- font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
- -webkit-font-smoothing: antialiased;
- -moz-osx-font-smoothing: grayscale;
- background: var(--theme-background);
- color: var(--theme-text);
- transition: background-color 0.3s ease, color 0.3s ease;
- }
- :root {
- --theme-background: #ffffff;
- --theme-surface: #f0f2f5;
- --theme-primary: #1890ff;
- --theme-secondary: #52c41a;
- --theme-accent: #722ed1;
- --theme-text: rgba(0, 0, 0, 0.88);
- --theme-text-secondary: rgba(0, 0, 0, 0.45);
- --theme-border: #f0f0f0;
- --theme-shadow: rgba(0, 0, 0, 0.06);
- --theme-card-background: #ffffff;
- --theme-header-background: #ffffff;
- --theme-sidebar-background: #ffffff;
- --theme-success: #52c41a;
- --theme-warning: #faad14;
- --theme-error: #ff4d4f;
- --theme-info: #1890ff;
- }
- .dark-theme {
- --theme-background: #141414;
- --theme-surface: #1a1a1a;
- --theme-primary: #177ddc;
- --theme-secondary: #49aa19;
- --theme-accent: #531dab;
- --theme-text: rgba(255, 255, 255, 0.88);
- --theme-text-secondary: rgba(255, 255, 255, 0.45);
- --theme-border: #303030;
- --theme-shadow: rgba(0, 0, 0, 0.3);
- --theme-card-background: #1f1f1f;
- --theme-header-background: #1f1f1f;
- --theme-sidebar-background: #141414;
- --theme-success: #49aa19;
- --theme-warning: #d89614;
- --theme-error: #d32029;
- --theme-info: #177ddc;
- }
- #app {
- min-height: 100vh;
- }
- .ant-layout-sider {
- transition: width 0.2s cubic-bezier(0.645, 0.045, 0.355, 1), min-width 0.2s cubic-bezier(0.645, 0.045, 0.355, 1), max-width 0.2s cubic-bezier(0.645, 0.045, 0.355, 1) !important;
- }
- .ant-layout-sider .ant-layout-sider-children {
- transition: none !important;
- }
- .ant-card {
- border-radius: 8px !important;
- box-shadow: 0 1px 2px 0 var(--theme-shadow) !important;
- }
- .ant-menu-inline {
- border-inline-end: none !important;
- }
- .ant-drawer .ant-drawer-body {
- padding: 0 !important;
- }
- ::-webkit-scrollbar {
- width: 6px;
- height: 6px;
- }
- ::-webkit-scrollbar-track {
- background: transparent;
- }
- ::-webkit-scrollbar-thumb {
- background: rgba(0, 0, 0, 0.15);
- border-radius: 3px;
- }
- ::-webkit-scrollbar-thumb:hover {
- background: rgba(0, 0, 0, 0.25);
- }
- .dark-theme ::-webkit-scrollbar-thumb {
- background: rgba(255, 255, 255, 0.15);
- }
- .dark-theme ::-webkit-scrollbar-thumb:hover {
- background: rgba(255, 255, 255, 0.25);
- }
- </style>
|