From 5d027dd085532f8ff73c00d38ed826ca10d36279 Mon Sep 17 00:00:00 2001 From: ko1234 Date: Wed, 20 Aug 2025 13:26:18 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8B=95=E6=85=8B=E8=A8=AD=E5=AE=9A=E7=B6=B2?= =?UTF-8?q?=E9=A0=81=E6=A8=99=E9=A1=8C=E3=80=81favicon=20=E5=92=8C=20logo?= =?UTF-8?q?=EF=BC=8C=E4=B8=A6=E6=9B=B4=E6=96=B0=E9=A0=90=E8=A8=AD=E5=9C=96?= =?UTF-8?q?=E7=89=87=E8=B7=AF=E5=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Dockerfile | 3 +++ docker-entrypoint.sh | 2 +- index.html | 17 +++++++++++++++-- src/components/navbar/Navbar.vue | 6 +++--- src/views/dashboard/Dashboard.vue | 2 +- src/views/login/Login.vue | 8 ++++---- src/views/system/System.vue | 2 +- 7 files changed, 28 insertions(+), 12 deletions(-) diff --git a/Dockerfile b/Dockerfile index 6ffd4b1..d42c142 100644 --- a/Dockerfile +++ b/Dockerfile @@ -33,6 +33,9 @@ COPY --from=builder /app/dist /usr/share/nginx/html # 暴露 Nginx 預設的 80 端口 EXPOSE 80 +# 2025-08-20 +LABEL changelog="2025-08-20: 動態設定網頁標題與 favicon與logo與預設build_img,標題由 VITE_APP_TITLE 環境變數控制,favicon、logo、build_img.jpg 由 VITE_FILE_API_BASEURL 動態插入,docker-entrypoint.sh 寫入 env.js 供前端讀取。" + # Nginx 已經預設啟動,所以不需要 CMD 指令 COPY docker-entrypoint.sh /docker-entrypoint.sh RUN chmod +x /docker-entrypoint.sh diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh index 2bbda52..aef6486 100644 --- a/docker-entrypoint.sh +++ b/docker-entrypoint.sh @@ -1,3 +1,3 @@ #!/bin/sh -echo "window.env = { VITE_API_BASEURL: '${VITE_API_BASEURL}', VITE_FILE_API_BASEURL: '${VITE_FILE_API_BASEURL}', VITE_MQTT_BASEURL: '${VITE_MQTT_BASEURL}' };" > /usr/share/nginx/html/env.js +echo "window.env = { VITE_API_BASEURL: '${VITE_API_BASEURL}', VITE_FILE_API_BASEURL: '${VITE_FILE_API_BASEURL}', VITE_MQTT_BASEURL: '${VITE_MQTT_BASEURL}', VITE_APP_TITLE: '${VITE_APP_TITLE}' };" > /usr/share/nginx/html/env.js exec "$@" \ No newline at end of file diff --git a/index.html b/index.html index 81a2361..7c89834 100644 --- a/index.html +++ b/index.html @@ -3,13 +3,27 @@ - + Cvilux EMS + + @@ -17,7 +31,6 @@ type="text/javascript" src="/module/js/com/tridium/js/ext/require/require.min.js?" > --> -
diff --git a/src/components/navbar/Navbar.vue b/src/components/navbar/Navbar.vue index 19b6e6d..0c910e1 100644 --- a/src/components/navbar/Navbar.vue +++ b/src/components/navbar/Navbar.vue @@ -11,6 +11,7 @@ import AlarmDrawer from "@/components/alarm/AlarmDrawer.vue"; import NavbarLang from "./NavbarLang.vue"; import { twMerge } from "tailwind-merge"; +const FILE_BASEURL = window.env?.VITE_FILE_API_BASEURL; const user = ref(""); const menuShow = ref(true); const router = useRouter(); @@ -28,7 +29,7 @@ const toggleMenu = () => { menuShow.value = !menuShow.value; }; -const src = import.meta.env.MODE === "production" ? "./logo.svg" : Logo; +const src = `${FILE_BASEURL}/upload/logo.png`; const logout = () => { document.cookie = "JWT-Authorization=; Max-Age=0"; @@ -69,8 +70,7 @@ const logout = () => { to="/dashboard" class="rounded-lg pl-4 text-2xl font-bold text-white flex items-center" > - logo - CviLux Group + logo diff --git a/src/views/dashboard/Dashboard.vue b/src/views/dashboard/Dashboard.vue index ea8eea3..ccc44e5 100644 --- a/src/views/dashboard/Dashboard.vue +++ b/src/views/dashboard/Dashboard.vue @@ -46,7 +46,7 @@ watch( if (formState.value.building_guid) { imgBaseUrl.value = newExt ? `${FILE_BASEURL}/upload/setting/previewImage/${formState.value.building_guid}${newExt}` - : "/build_img.jpg"; + : `${FILE_BASEURL}/upload/build_img.jpg`; } }, { immediate: true } diff --git a/src/views/login/Login.vue b/src/views/login/Login.vue index a1ccc59..dac6f3e 100644 --- a/src/views/login/Login.vue +++ b/src/views/login/Login.vue @@ -1,13 +1,14 @@