diff --git a/src/stores/useBuildingStore.js b/src/stores/useBuildingStore.js index 73df0b3..31f75c2 100644 --- a/src/stores/useBuildingStore.js +++ b/src/stores/useBuildingStore.js @@ -84,8 +84,8 @@ const useBuildingStore = defineStore("buildingInfo", () => { // 獲取2D、3D顯示與否 const fetchDashboard2D3D = async (BuildingId) => { const res = await getDashboard2D3D(BuildingId); - showForgeArea.value = res.data.is3DEnabled || false; - previewImageExt.value = res.data.previewImageExt || ""; + showForgeArea.value = res.data?.is3DEnabled || false; + previewImageExt.value = res.data?.previewImageExt || ""; }; // 清除localStorage建築物 diff --git a/src/views/dashboard/Dashboard.vue b/src/views/dashboard/Dashboard.vue index ea8eea3..3291565 100644 --- a/src/views/dashboard/Dashboard.vue +++ b/src/views/dashboard/Dashboard.vue @@ -41,12 +41,12 @@ watch( ); watch( - () => store.previewImageExt, - (newExt) => { - if (formState.value.building_guid) { - imgBaseUrl.value = newExt - ? `${FILE_BASEURL}/upload/setting/previewImage/${formState.value.building_guid}${newExt}` - : "/build_img.jpg"; + [() => store.previewImageExt, () => formState.value.building_guid], + ([newExt, buildingGuid]) => { + if (newExt && buildingGuid) { + imgBaseUrl.value = `${FILE_BASEURL}/upload/setting/previewImage/${buildingGuid}${newExt}`; + } else { + imgBaseUrl.value = `${FILE_BASEURL}/upload/build_img.jpg`; } }, { immediate: true } diff --git a/src/views/login/Login.vue b/src/views/login/Login.vue index a1ccc59..f5af3fb 100644 --- a/src/views/login/Login.vue +++ b/src/views/login/Login.vue @@ -54,7 +54,7 @@ const doLogin = async () => {