From 2903f194c949c5ed0791cce534adbf06c842e112 Mon Sep 17 00:00:00 2001 From: gitee-bot Date: Fri, 15 May 2026 16:02:32 +0000 Subject: [PATCH 1/5] feat: implement responsive design for global UI to adapt to browser sizes - Remove Vite template constraints from style.css (max-width, text-align) - Add responsive base styles with box-sizing and viewport units - Add collapsible sidebar in MainLayout with toggle trigger icons - Implement breakpoint-based auto-collapse for sidebar at lg breakpoint - Add responsive media queries for header elements (1200px, 992px, 768px, 576px) - Hide non-essential elements on smaller screens (version, 2FA, check-in) - Adjust padding, margins, and font sizes for different screen sizes - Use CSS classes instead of inline styles for better responsive control --- src/layouts/MainLayout.vue | 176 +++++++++++++++++++++++++++++++++++-- src/style.css | 74 +++++----------- 2 files changed, 191 insertions(+), 59 deletions(-) diff --git a/src/layouts/MainLayout.vue b/src/layouts/MainLayout.vue index 97979cb..dbfde5a 100644 --- a/src/layouts/MainLayout.vue +++ b/src/layouts/MainLayout.vue @@ -2,17 +2,27 @@
+ + {{ $t("message.systemName") }}
- + {{ $t("message.serverVersion") }}: {{ serverVersion || "-" }} @@ -47,7 +57,7 @@ {{ username }} @@ -68,14 +78,14 @@ {{ $t("message.twoFactor") }} {{ $t("message.logout") }} 简体中文 @@ -99,7 +109,16 @@
- + themeContext?.isDarkMode?.value === true); @@ -1856,6 +1876,14 @@ const handleOpenChange = (keys) => { openKeys.value = keys; }; +const toggleSider = () => { + siderCollapsed.value = !siderCollapsed.value; +}; + +const handleBreakpoint = (broken) => { + siderCollapsed.value = broken; +}; + watch( () => route.path, async (newPath) => { @@ -2003,4 +2031,136 @@ watch( color: var(--app-text-secondary); text-align: center; } + +.sider-trigger { + font-size: 18px; + line-height: 64px; + cursor: pointer; + transition: color 0.3s; + color: var(--app-text-color); + margin-right: 10px; +} + +.sider-trigger:hover { + color: var(--app-primary-color, #1890ff); +} + +.main-layout-logo { + height: 40px; + margin-right: 10px; +} + +.version-button { + white-space: nowrap; +} + +.username-button, +.twofactor-button, +.logout-button, +.signin-button { + margin-right: 10px; +} + +.language-select { + min-width: 120px; +} + +@media (max-width: 1200px) { + .version-button { + display: none; + } +} + +@media (max-width: 992px) { + .main-layout-brand-text { + display: none; + } + + .twofactor-button { + display: none; + } +} + +@media (max-width: 768px) { + .main-layout-header { + padding: 0 12px; + flex-wrap: wrap; + } + + .main-layout-actions { + gap: 4px; + } + + .username-button { + margin-right: 4px; + } + + .logout-button { + margin-right: 4px; + } + + .signin-button { + margin-right: 4px; + } + + .main-layout-content { + padding: 12px; + min-height: 400px; + } + + .language-select { + min-width: 100px; + } +} + +@media (max-width: 576px) { + .main-layout-header { + padding: 0 8px; + } + + .main-layout-brand { + gap: 6px; + } + + .sider-trigger { + margin-right: 6px; + } + + .main-layout-logo { + height: 32px; + margin-right: 6px; + } + + .main-layout-actions { + flex-wrap: wrap; + justify-content: flex-end; + } + + .employee-check-in-button { + display: none; + } + + .employee-check-in-day-count { + display: none; + } + + .favorite-route-button { + margin-right: 4px; + } + + .language-select { + min-width: 90px; + font-size: 12px; + } + + .main-layout-content { + padding: 8px; + } + + .main-layout-sider { + position: fixed !important; + z-index: 1000; + height: 100vh; + } +} diff --git a/src/style.css b/src/style.css index bb131d6..11d0c3d 100644 --- a/src/style.css +++ b/src/style.css @@ -3,77 +3,49 @@ line-height: 1.5; font-weight: 400; - color-scheme: light dark; - color: rgba(255, 255, 255, 0.87); - background-color: #242424; - font-synthesis: none; text-rendering: optimizeLegibility; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; } -a { - font-weight: 500; - color: #646cff; - text-decoration: inherit; +* { + box-sizing: border-box; } -a:hover { - color: #535bf2; + +html, body { + width: 100%; + height: 100%; + margin: 0; + padding: 0; } body { - margin: 0; - display: flex; - place-items: center; min-width: 320px; min-height: 100vh; + overflow-x: hidden; } -h1 { - font-size: 3.2em; - line-height: 1.1; +#app { + width: 100%; + min-height: 100vh; + margin: 0; + padding: 0; } -button { - border-radius: 8px; - border: 1px solid transparent; - padding: 0.6em 1.2em; - font-size: 1em; +a { font-weight: 500; - font-family: inherit; - background-color: #1a1a1a; - cursor: pointer; - transition: border-color 0.25s; -} -button:hover { - border-color: #646cff; -} -button:focus, -button:focus-visible { - outline: 4px auto -webkit-focus-ring-color; -} - -.card { - padding: 2em; + text-decoration: inherit; } -#app { - max-width: 1280px; - margin: 0 auto; - padding: 2rem; - text-align: center; +@media (max-width: 768px) { + body { + font-size: 14px; + } } -@media (prefers-color-scheme: light) { - :root { - color: #213547; - background-color: #ffffff; - } - a:hover { - color: #747bff; - } - button { - background-color: #f9f9f9; +@media (max-width: 576px) { + body { + font-size: 13px; } } -- Gitee From 50877cefc6de080b0e42f91dd31302ba1b872514 Mon Sep 17 00:00:00 2001 From: ck_yeun9 Date: Sat, 16 May 2026 14:24:01 +0800 Subject: [PATCH 2/5] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E9=98=BB=E6=96=AD?= =?UTF-8?q?=E9=A1=B9=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components.d.ts | 2 ++ src/utils/icons.js | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/components.d.ts b/components.d.ts index 5c08725..408f2db 100644 --- a/components.d.ts +++ b/components.d.ts @@ -93,6 +93,8 @@ declare module 'vue' { LinkOutlined: typeof import('@ant-design/icons-vue')['LinkOutlined'] ListFilter: typeof import('./src/components/common/ListFilter.vue')['default'] LoadingOutlined: typeof import('@ant-design/icons-vue')['LoadingOutlined'] + MenuFoldOutlined: typeof import('@ant-design/icons-vue')['MenuFoldOutlined'] + MenuUnfoldOutlined: typeof import('@ant-design/icons-vue')['MenuUnfoldOutlined'] MoneyCollectOutlined: typeof import('@ant-design/icons-vue')['MoneyCollectOutlined'] MoonOutlined: typeof import('@ant-design/icons-vue')['MoonOutlined'] PlusOutlined: typeof import('@ant-design/icons-vue')['PlusOutlined'] diff --git a/src/utils/icons.js b/src/utils/icons.js index 1f74a4a..d36b571 100644 --- a/src/utils/icons.js +++ b/src/utils/icons.js @@ -58,6 +58,8 @@ import { StarOutlined, StarFilled, CheckCircleOutlined, + MenuUnfoldOutlined, + MenuFoldOutlined, } from "@ant-design/icons-vue"; export function registerAntdIcons(app) { @@ -119,4 +121,6 @@ export function registerAntdIcons(app) { app.component("StarOutlined", StarOutlined); app.component("StarFilled", StarFilled); app.component("CheckCircleOutlined", CheckCircleOutlined); + app.component("MenuUnfoldOutlined", MenuUnfoldOutlined); + app.component("MenuFoldOutlined", MenuFoldOutlined); } -- Gitee From cb236da6755d1c5b3b450daa5e3c755e99ca715a Mon Sep 17 00:00:00 2001 From: ck_yeun9 Date: Sat, 16 May 2026 14:33:36 +0800 Subject: [PATCH 3/5] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E9=98=BB=E6=96=AD?= =?UTF-8?q?=E9=A1=B9=E3=80=82by=20Gemini?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/layouts/MainLayout.vue | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/src/layouts/MainLayout.vue b/src/layouts/MainLayout.vue index dbfde5a..6c9c6d9 100644 --- a/src/layouts/MainLayout.vue +++ b/src/layouts/MainLayout.vue @@ -134,6 +134,14 @@ + + +
+ @@ -313,7 +321,7 @@ import { watch, nextTick, } from "vue"; -import { useStorage } from "@vueuse/core"; +import { useStorage, useMediaQuery } from "@vueuse/core"; import { useRoute, useRouter } from "vue-router"; import { formatDateTime, @@ -396,6 +404,7 @@ import { THEME_CONTEXT_KEY, THEME_MODES } from "@/utils/theme"; const serverVersion = ref(""); const siderCollapsed = ref(false); +const isMobile = useMediaQuery('(max-width: 576px)'); const themeContext = inject(THEME_CONTEXT_KEY, null); const isDarkMode = computed(() => themeContext?.isDarkMode?.value === true); @@ -1881,7 +1890,9 @@ const toggleSider = () => { }; const handleBreakpoint = (broken) => { - siderCollapsed.value = broken; + if (broken) { + siderCollapsed.value = true; + } }; watch( @@ -2163,4 +2174,14 @@ watch( height: 100vh; } } + +.sider-mask { + position: fixed; + top: 0; + left: 0; + right: 0; + bottom: 0; + background-color: rgba(0, 0, 0, 0.45); + z-index: 999; +} -- Gitee From ae5d4d3ad32757acfcf9edebe15db885ab0bcd92 Mon Sep 17 00:00:00 2001 From: ck_yeun9 Date: Sat, 16 May 2026 14:49:00 +0800 Subject: [PATCH 4/5] =?UTF-8?q?=E4=BC=98=E5=8C=96=E4=BE=A7=E8=BE=B9?= =?UTF-8?q?=E6=A0=8F=E5=B1=95=E5=BC=80=E9=80=BB=E8=BE=91=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/layouts/MainLayout.vue | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/src/layouts/MainLayout.vue b/src/layouts/MainLayout.vue index 6c9c6d9..efa5306 100644 --- a/src/layouts/MainLayout.vue +++ b/src/layouts/MainLayout.vue @@ -1,5 +1,5 @@