修正 index.html 中 favicon 的插入方式,確保其在原始檔案中預設一行,並更新多個組件以使用 window.env 讀取環境變數

This commit is contained in:
koko 2025-08-22 11:16:38 +08:00
parent d0a9aec12a
commit 21d15d39f4
5 changed files with 7 additions and 7 deletions

View File

@ -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 的 <title> 及 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

View File

@ -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</title>
<script src="/env.js"></script>
<script src="https://code.jquery.com/jquery-3.7.1.js"></script>
<script src="https://code.jquery.com/ui/1.13.3/jquery-ui.js"></script>
<!-- <script type="text/javascript" src="/requirejs/config.js"></script> -->

View File

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

View File

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

View File

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