From 28e189e38f87a80fb6b8e4a4281f2165b068b9f7 Mon Sep 17 00:00:00 2001 From: zhonghua Date: Fri, 27 Mar 2026 17:36:20 +0800 Subject: [PATCH] =?UTF-8?q?feat(=E5=89=8D=E7=AB=AF):=20=E7=99=BB=E5=BD=95?= =?UTF-8?q?=E9=A1=B5=E4=B8=8E=E5=90=84=E7=AB=AF=E5=B8=83=E5=B1=80=E5=B1=95?= =?UTF-8?q?=E7=A4=BA=E7=89=88=E6=9C=AC=E5=8F=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 统一从 package.json 注入 __APP_VERSION__,并在登录页、管理端、学校端、教师端和家长端菜单底部展示一致版本信息,提升发布可识别性。 Made-with: Cursor --- .../src/views/admin/LayoutView.vue | 20 ++- .../src/views/auth/LoginView.vue | 11 ++ .../src/views/parent/LayoutView.vue | 129 ++++++++++++------ .../src/views/school/LayoutView.vue | 20 ++- .../src/views/teacher/LayoutView.vue | 20 ++- .../src/vite-env.d.ts | 2 + .../vite.config.ts | 5 + 7 files changed, 160 insertions(+), 47 deletions(-) diff --git a/lesingle-edu-reading-platform-frontend/src/views/admin/LayoutView.vue b/lesingle-edu-reading-platform-frontend/src/views/admin/LayoutView.vue index 8350ef7..a6f63ab 100644 --- a/lesingle-edu-reading-platform-frontend/src/views/admin/LayoutView.vue +++ b/lesingle-edu-reading-platform-frontend/src/views/admin/LayoutView.vue @@ -62,6 +62,9 @@ +
+ v{{ appVersion }} +
@@ -133,6 +136,7 @@ import { useUserStore } from '@/stores/user'; const router = useRouter(); const route = useRoute(); const userStore = useUserStore(); +const appVersion = __APP_VERSION__; const collapsed = ref(false); const selectedKeys = ref(['dashboard']); @@ -222,6 +226,8 @@ $bg-dark: #111827; background: white !important; box-shadow: 2px 0 8px rgba(0, 0, 0, 0.04); border-right: 1px solid $border-color; + display: flex; + flex-direction: column; .logo { height: 72px; @@ -314,7 +320,8 @@ $bg-dark: #111827; } .sider-menu-wrapper { - height: calc(100vh - 72px); + flex: 1; + min-height: 0; overflow: auto; // 自定义侧边栏滚动条样式 @@ -332,6 +339,17 @@ $bg-dark: #111827; } } +.sider-version { + padding: 10px 12px 14px; + border-top: 1px solid $border-color; + font-size: 12px; + color: #9CA3AF; + text-align: center; + line-height: 1.2; + background: #fff; + flex-shrink: 0; +} + .admin-header { background: white; padding: 0 24px; diff --git a/lesingle-edu-reading-platform-frontend/src/views/auth/LoginView.vue b/lesingle-edu-reading-platform-frontend/src/views/auth/LoginView.vue index baa9b3e..8843713 100644 --- a/lesingle-edu-reading-platform-frontend/src/views/auth/LoginView.vue +++ b/lesingle-edu-reading-platform-frontend/src/views/auth/LoginView.vue @@ -66,6 +66,7 @@ @@ -83,6 +84,7 @@ import { import { useUserStore } from '@/stores/user'; const userStore = useUserStore(); +const appVersion = __APP_VERSION__; // 是否启用默认账号填充(开发/测试环境启用,生产环境禁用) const enableDefaultAccount = import.meta.env.VITE_ENABLE_DEFAULT_ACCOUNT === 'true'; @@ -413,5 +415,14 @@ $bg-cream: #FEFEFE; margin-top: 24px; font-size: 12px; color: $text-light; + display: flex; + flex-direction: column; + align-items: center; + gap: 4px; +} + +.app-version { + font-size: 11px; + letter-spacing: 0.3px; } diff --git a/lesingle-edu-reading-platform-frontend/src/views/parent/LayoutView.vue b/lesingle-edu-reading-platform-frontend/src/views/parent/LayoutView.vue index 88855b4..8a6babc 100644 --- a/lesingle-edu-reading-platform-frontend/src/views/parent/LayoutView.vue +++ b/lesingle-edu-reading-platform-frontend/src/views/parent/LayoutView.vue @@ -46,6 +46,9 @@ +
+ v{{ appVersion }} +
@@ -60,47 +63,50 @@ - - - - 首页 - - - - 我的孩子 - - - - 阅读记录 - - - - 阅读任务 - - - - 成长档案 - - - - 个人信息 - - +
+ + + + 首页 + + + + 我的孩子 + + + + 阅读记录 + + + + 阅读任务 + + + + 成长档案 + + + + 个人信息 + + +
+
+ v{{ appVersion }} +
@@ -225,6 +228,7 @@ import { useUserStore } from '@/stores/user'; const router = useRouter(); const route = useRoute(); const userStore = useUserStore(); +const appVersion = __APP_VERSION__; const collapsed = ref(false); const selectedKeys = ref(['dashboard']); @@ -329,6 +333,8 @@ $bg-light: #FAFAFA; background: white !important; box-shadow: 2px 0 8px rgba(0, 0, 0, 0.06); border-right: 1px solid $border-color; + display: flex; + flex-direction: column; .logo { height: 80px; @@ -457,7 +463,8 @@ $bg-light: #FAFAFA; } .sider-menu-wrapper { - height: calc(100vh - 80px); + flex: 1; + min-height: 0; overflow: auto; // 自定义侧边栏滚动条样式 @@ -475,6 +482,17 @@ $bg-light: #FAFAFA; } } +.sider-version { + padding: 10px 12px 14px; + border-top: 1px solid $border-color; + font-size: 12px; + color: #9CA3AF; + text-align: center; + line-height: 1.2; + background: #fff; + flex-shrink: 0; +} + .school-header { background: white; padding: 0 24px; diff --git a/lesingle-edu-reading-platform-frontend/src/views/teacher/LayoutView.vue b/lesingle-edu-reading-platform-frontend/src/views/teacher/LayoutView.vue index 6c7eb1d..6972c4a 100644 --- a/lesingle-edu-reading-platform-frontend/src/views/teacher/LayoutView.vue +++ b/lesingle-edu-reading-platform-frontend/src/views/teacher/LayoutView.vue @@ -69,6 +69,9 @@ +
+ v{{ appVersion }} +
@@ -140,6 +143,7 @@ import { useUserStore } from '@/stores/user'; const router = useRouter(); const route = useRoute(); const userStore = useUserStore(); +const appVersion = __APP_VERSION__; const collapsed = ref(false); const selectedKeys = ref(['dashboard']); @@ -225,6 +229,8 @@ $bg-light: #FAFAFA; background: white !important; box-shadow: 2px 0 8px rgba(0, 0, 0, 0.06); border-right: 1px solid $border-color; + display: flex; + flex-direction: column; .logo { height: 80px; @@ -316,7 +322,8 @@ $bg-light: #FAFAFA; } .sider-menu-wrapper { - height: calc(100vh - 80px); + flex: 1; + min-height: 0; overflow: auto; // 自定义侧边栏滚动条样式 @@ -334,6 +341,17 @@ $bg-light: #FAFAFA; } } +.sider-version { + padding: 10px 12px 14px; + border-top: 1px solid $border-color; + font-size: 12px; + color: #9CA3AF; + text-align: center; + line-height: 1.2; + background: #fff; + flex-shrink: 0; +} + .teacher-header { background: white; padding: 0 24px; diff --git a/lesingle-edu-reading-platform-frontend/src/vite-env.d.ts b/lesingle-edu-reading-platform-frontend/src/vite-env.d.ts index 614ceda..089b04a 100644 --- a/lesingle-edu-reading-platform-frontend/src/vite-env.d.ts +++ b/lesingle-edu-reading-platform-frontend/src/vite-env.d.ts @@ -9,3 +9,5 @@ interface ImportMetaEnv { interface ImportMeta { readonly env: ImportMetaEnv } + +declare const __APP_VERSION__: string diff --git a/lesingle-edu-reading-platform-frontend/vite.config.ts b/lesingle-edu-reading-platform-frontend/vite.config.ts index 569e01a..0f5272e 100644 --- a/lesingle-edu-reading-platform-frontend/vite.config.ts +++ b/lesingle-edu-reading-platform-frontend/vite.config.ts @@ -7,13 +7,18 @@ import { AntDesignVueResolver } from 'unplugin-vue-components/resolvers'; import viteCompression from 'vite-plugin-compression'; import fileRouter from 'unplugin-vue-router/vite'; import UnoCSS from 'unocss/vite'; +import packageJson from './package.json'; export default defineConfig(({ mode }) => { const env = loadEnv(mode, process.cwd(), ''); const port = parseInt(env.VITE_APP_PORT) || 5173; const backendPort = env.VITE_BACKEND_PORT || '8480'; + const appVersion = packageJson.version; return { + define: { + __APP_VERSION__: JSON.stringify(appVersion), + }, plugins: [ vue(), UnoCSS(),