修正預覽2D圖片時的錯誤 | 登入UI修改

This commit is contained in:
koko 2025-08-21 14:07:36 +08:00
parent 5ba844e307
commit 8243900f96
4 changed files with 17 additions and 18 deletions

View File

@ -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建築物

View File

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

View File

@ -54,7 +54,7 @@ const doLogin = async () => {
<template>
<div
class="absolute top-10 left-1/2 -translate-x-1/2 z-20 border-4 rounded-3xl p-5 bg-white bg-opacity-60"
class="absolute top-10 left-1/2 -translate-x-1/2 z-20 border-2 border-slate-200/40 shadow-lg shadow-slate-100/20 rounded-3xl p-5 bg-gradient-to-br from-slate-600 to-slate-800 bg-opacity-60"
>
<div class="flex flex-col items-start w-96">
<div
@ -65,7 +65,7 @@ const doLogin = async () => {
</div>
<div class="w-full flex flex-col items-end my-2">
<div class="w-full flex justify-between">
<label class="mr-2 text-2xl text-black" for="account">{{
<label class="mr-2 text-2xl text-slate-200" for="account">{{
$t("account")
}}</label>
<input
@ -81,7 +81,7 @@ const doLogin = async () => {
</div>
<div class="w-full flex flex-col items-end my-2">
<div class="w-full flex justify-between relative">
<label class="mr-2 text-2xl text-black" for="password">{{
<label class="mr-2 text-2xl text-slate-200" for="password">{{
$t("password")
}}</label>
<input

View File

@ -138,14 +138,13 @@ watch(
}
);
watch(
() => buildingStore.previewImageExt,
(newValue) => {
if (buildingStore.selectedBuilding && buildingStore.selectedBuilding.building_guid) {
imgBaseUrl.value = buildingStore.previewImageExt
? `${FILE_BASEURL}/upload/setting/previewImage/${buildingStore.selectedBuilding.building_guid}${newValue}`
: "/build_img.jpg";
[() => buildingStore.previewImageExt, () => buildingStore.selectedBuilding?.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 }