From 21d15d39f45b7d78e7134e3969c2ae4a51b44095 Mon Sep 17 00:00:00 2001 From: ko1234 Date: Fri, 22 Aug 2025 11:16:38 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=20index.html=20=E4=B8=AD=20f?= =?UTF-8?q?avicon=20=E7=9A=84=E6=8F=92=E5=85=A5=E6=96=B9=E5=BC=8F=EF=BC=8C?= =?UTF-8?q?=E7=A2=BA=E4=BF=9D=E5=85=B6=E5=9C=A8=E5=8E=9F=E5=A7=8B=E6=AA=94?= =?UTF-8?q?=E6=A1=88=E4=B8=AD=E9=A0=90=E8=A8=AD=E4=B8=80=E8=A1=8C=EF=BC=8C?= =?UTF-8?q?=E4=B8=A6=E6=9B=B4=E6=96=B0=E5=A4=9A=E5=80=8B=E7=B5=84=E4=BB=B6?= =?UTF-8?q?=E4=BB=A5=E4=BD=BF=E7=94=A8=20window.env=20=E8=AE=80=E5=8F=96?= =?UTF-8?q?=E7=92=B0=E5=A2=83=E8=AE=8A=E6=95=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Dockerfile | 4 ++-- index.html | 4 ++-- src/views/dashboard/Dashboard.vue | 2 +- src/views/setting/components/ViewModeSetting.vue | 2 +- src/views/system/System.vue | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Dockerfile b/Dockerfile index d99ad28..03b5cf3 100644 --- a/Dockerfile +++ b/Dockerfile @@ -33,8 +33,8 @@ COPY --from=builder /app/dist /usr/share/nginx/html # 暴露 Nginx 預設的 80 端口 EXPOSE 80 -# 2025-08-21 -LABEL changelog="2025-08-21: index.html 的 及 favicon 由 docker-entrypoint.sh 啟動時根據環境變數直接替換,社群爬蟲可正確抓取,env.js 仍供前端 JS 讀取其他動態參數。" +# 2025-08-22 +LABEL changelog="2025-08-22: 修正 index.html favicon 插入方式,確保原始檔案預設 <link rel='icon' ...>,docker-entrypoint.sh 可正確替換;並更新多個組件以使用 window.env 讀取環境變數,提升部署彈性。" # Nginx 已經預設啟動,所以不需要 CMD 指令 COPY docker-entrypoint.sh /docker-entrypoint.sh diff --git a/index.html b/index.html index 8d8345c..1953fce 100644 --- a/index.html +++ b/index.html @@ -3,7 +3,7 @@ <html lang="en" data-theme="dracula"> <head> <meta charset="UTF-8" /> - <!-- favicon 由 JS 動態插入 --> + <link rel="icon" href="/favicon.ico" /> <link rel="stylesheet" href="https://developer.api.autodesk.com/modelderivative/v2/viewers/7.*/style.css" @@ -11,7 +11,7 @@ <meta name="viewport" content="width=device-width, initial-scale=1.0" /> <title>Cvilux EMS - + diff --git a/src/views/dashboard/Dashboard.vue b/src/views/dashboard/Dashboard.vue index 3291565..807520a 100644 --- a/src/views/dashboard/Dashboard.vue +++ b/src/views/dashboard/Dashboard.vue @@ -17,7 +17,7 @@ const store = useBuildingStore(); const { items, changeActiveBtn, setItems, selectedBtn } = useActiveBtn(); let intervalId = null; const energyCostData = ref({}); -const FILE_BASEURL = import.meta.env.VITE_FILE_API_BASEURL; +const FILE_BASEURL = window.env?.VITE_FILE_API_BASEURL; const imgBaseUrl = ref(""); const formState = ref({ building_guid: null, diff --git a/src/views/setting/components/ViewModeSetting.vue b/src/views/setting/components/ViewModeSetting.vue index c3e40b9..cf3d754 100644 --- a/src/views/setting/components/ViewModeSetting.vue +++ b/src/views/setting/components/ViewModeSetting.vue @@ -8,7 +8,7 @@ import { tr } from "date-fns/locale"; const { openToast, cancelToastOpen } = inject("app_toast"); const buildingStore = useBuildingStore(); const { t } = useI18n(); -const FILE_BASEURL = import.meta.env.VITE_FILE_API_BASEURL; +const FILE_BASEURL = window.env?.VITE_FILE_API_BASEURL; const form = ref(null); const formState = ref({ diff --git a/src/views/system/System.vue b/src/views/system/System.vue index f8441ff..06f44c8 100644 --- a/src/views/system/System.vue +++ b/src/views/system/System.vue @@ -16,7 +16,7 @@ import SystemFloor from "./SystemFloor.vue"; import { twMerge } from "tailwind-merge"; import dayjs from "dayjs"; -const FILE_BASEURL = import.meta.env.VITE_FILE_API_BASEURL; +const FILE_BASEURL = window.env?.VITE_FILE_API_BASEURL; const buildingStore = useBuildingStore(); const statusList = computed(() => {