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(() => {