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 @@